gfx/layers/composite/ThebesLayerComposite.h

Thu, 22 Jan 2015 13:21:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 22 Jan 2015 13:21:57 +0100
branch
TOR_BUG_9701
changeset 15
b8a032363ba2
permissions
-rw-r--r--

Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6

     1 /* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
     2 /* This Source Code Form is subject to the terms of the Mozilla Public
     3  * License, v. 2.0. If a copy of the MPL was not distributed with this
     4  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     6 #ifndef GFX_ThebesLayerComposite_H
     7 #define GFX_ThebesLayerComposite_H
     9 #include "Layers.h"                     // for Layer (ptr only), etc
    10 #include "gfxRect.h"                    // for gfxRect
    11 #include "mozilla/Attributes.h"         // for MOZ_OVERRIDE
    12 #include "mozilla/RefPtr.h"             // for RefPtr
    13 #include "mozilla/layers/LayerManagerComposite.h"  // for LayerComposite, etc
    14 #include "mozilla/layers/LayersTypes.h"  // for LayerRenderState, etc
    15 #include "nsDebug.h"                    // for NS_RUNTIMEABORT
    16 #include "nsRegion.h"                   // for nsIntRegion
    17 #include "nscore.h"                     // for nsACString
    19 struct nsIntPoint;
    20 struct nsIntRect;
    23 namespace mozilla {
    24 namespace layers {
    26 /**
    27  * Thebes layers use ContentHosts for their compsositable host.
    28  * By using different ContentHosts, ThebesLayerComposite support tiled and
    29  * non-tiled Thebes layers and single or double buffering.
    30  */
    32 class CompositableHost;
    33 class ContentHost;
    34 class TiledLayerComposer;
    36 class ThebesLayerComposite : public ThebesLayer,
    37                              public LayerComposite
    38 {
    39 public:
    40   ThebesLayerComposite(LayerManagerComposite *aManager);
    41   virtual ~ThebesLayerComposite();
    43   virtual void Disconnect() MOZ_OVERRIDE;
    45   virtual LayerRenderState GetRenderState() MOZ_OVERRIDE;
    47   CompositableHost* GetCompositableHost() MOZ_OVERRIDE;
    49   virtual void Destroy() MOZ_OVERRIDE;
    51   virtual Layer* GetLayer() MOZ_OVERRIDE;
    53   virtual TiledLayerComposer* GetTiledLayerComposer() MOZ_OVERRIDE;
    55   virtual void RenderLayer(const nsIntRect& aClipRect) MOZ_OVERRIDE;
    57   virtual void CleanupResources() MOZ_OVERRIDE;
    59   virtual bool SetCompositableHost(CompositableHost* aHost) MOZ_OVERRIDE;
    61   virtual LayerComposite* AsLayerComposite() MOZ_OVERRIDE { return this; }
    63   void EnsureTiled() { mRequiresTiledProperties = true; }
    65   virtual void InvalidateRegion(const nsIntRegion& aRegion)
    66   {
    67     NS_RUNTIMEABORT("ThebesLayerComposites can't fill invalidated regions");
    68   }
    70   void SetValidRegion(const nsIntRegion& aRegion)
    71   {
    72     MOZ_LAYERS_LOG_IF_SHADOWABLE(this, ("Layer::Mutated(%p) ValidRegion", this));
    73     mValidRegion = aRegion;
    74     Mutated();
    75   }
    77   MOZ_LAYER_DECL_NAME("ThebesLayerComposite", TYPE_THEBES)
    79 protected:
    81   virtual nsACString& PrintInfo(nsACString& aTo, const char* aPrefix) MOZ_OVERRIDE;
    83 private:
    84   CSSToScreenScale GetEffectiveResolution();
    86   RefPtr<ContentHost> mBuffer;
    87   bool mRequiresTiledProperties;
    88 };
    90 } /* layers */
    91 } /* mozilla */
    92 #endif /* GFX_ThebesLayerComposite_H */

mercurial