gfx/layers/composite/ThebesLayerComposite.h

branch
TOR_BUG_3246
changeset 7
129ffea94266
equal deleted inserted replaced
-1:000000000000 0:5d11457ba1df
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/. */
5
6 #ifndef GFX_ThebesLayerComposite_H
7 #define GFX_ThebesLayerComposite_H
8
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
18
19 struct nsIntPoint;
20 struct nsIntRect;
21
22
23 namespace mozilla {
24 namespace layers {
25
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 */
31
32 class CompositableHost;
33 class ContentHost;
34 class TiledLayerComposer;
35
36 class ThebesLayerComposite : public ThebesLayer,
37 public LayerComposite
38 {
39 public:
40 ThebesLayerComposite(LayerManagerComposite *aManager);
41 virtual ~ThebesLayerComposite();
42
43 virtual void Disconnect() MOZ_OVERRIDE;
44
45 virtual LayerRenderState GetRenderState() MOZ_OVERRIDE;
46
47 CompositableHost* GetCompositableHost() MOZ_OVERRIDE;
48
49 virtual void Destroy() MOZ_OVERRIDE;
50
51 virtual Layer* GetLayer() MOZ_OVERRIDE;
52
53 virtual TiledLayerComposer* GetTiledLayerComposer() MOZ_OVERRIDE;
54
55 virtual void RenderLayer(const nsIntRect& aClipRect) MOZ_OVERRIDE;
56
57 virtual void CleanupResources() MOZ_OVERRIDE;
58
59 virtual bool SetCompositableHost(CompositableHost* aHost) MOZ_OVERRIDE;
60
61 virtual LayerComposite* AsLayerComposite() MOZ_OVERRIDE { return this; }
62
63 void EnsureTiled() { mRequiresTiledProperties = true; }
64
65 virtual void InvalidateRegion(const nsIntRegion& aRegion)
66 {
67 NS_RUNTIMEABORT("ThebesLayerComposites can't fill invalidated regions");
68 }
69
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 }
76
77 MOZ_LAYER_DECL_NAME("ThebesLayerComposite", TYPE_THEBES)
78
79 protected:
80
81 virtual nsACString& PrintInfo(nsACString& aTo, const char* aPrefix) MOZ_OVERRIDE;
82
83 private:
84 CSSToScreenScale GetEffectiveResolution();
85
86 RefPtr<ContentHost> mBuffer;
87 bool mRequiresTiledProperties;
88 };
89
90 } /* layers */
91 } /* mozilla */
92 #endif /* GFX_ThebesLayerComposite_H */

mercurial