|
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_ContainerLayerComposite_H |
|
7 #define GFX_ContainerLayerComposite_H |
|
8 |
|
9 #include "Layers.h" // for Layer (ptr only), etc |
|
10 #include "mozilla/Attributes.h" // for MOZ_OVERRIDE |
|
11 #include "mozilla/layers/LayerManagerComposite.h" |
|
12 |
|
13 struct nsIntPoint; |
|
14 struct nsIntRect; |
|
15 |
|
16 namespace mozilla { |
|
17 namespace layers { |
|
18 |
|
19 class CompositableHost; |
|
20 |
|
21 class ContainerLayerComposite : public ContainerLayer, |
|
22 public LayerComposite |
|
23 { |
|
24 template<class ContainerT> |
|
25 friend void ContainerRender(ContainerT* aContainer, |
|
26 LayerManagerComposite* aManager, |
|
27 const nsIntRect& aClipRect); |
|
28 public: |
|
29 ContainerLayerComposite(LayerManagerComposite *aManager); |
|
30 |
|
31 ~ContainerLayerComposite(); |
|
32 |
|
33 // LayerComposite Implementation |
|
34 virtual Layer* GetLayer() MOZ_OVERRIDE { return this; } |
|
35 |
|
36 virtual void Destroy() MOZ_OVERRIDE; |
|
37 |
|
38 LayerComposite* GetFirstChildComposite(); |
|
39 |
|
40 virtual void RenderLayer(const nsIntRect& aClipRect) MOZ_OVERRIDE; |
|
41 |
|
42 virtual void ComputeEffectiveTransforms(const gfx::Matrix4x4& aTransformToSurface) MOZ_OVERRIDE |
|
43 { |
|
44 DefaultComputeEffectiveTransforms(aTransformToSurface); |
|
45 } |
|
46 |
|
47 virtual void CleanupResources() MOZ_OVERRIDE; |
|
48 |
|
49 virtual LayerComposite* AsLayerComposite() MOZ_OVERRIDE { return this; } |
|
50 |
|
51 // container layers don't use a compositable |
|
52 CompositableHost* GetCompositableHost() MOZ_OVERRIDE { return nullptr; } |
|
53 |
|
54 virtual const char* Name() const MOZ_OVERRIDE { return "ContainerLayerComposite"; } |
|
55 }; |
|
56 |
|
57 class RefLayerComposite : public RefLayer, |
|
58 public LayerComposite |
|
59 { |
|
60 template<class ContainerT> |
|
61 friend void ContainerRender(ContainerT* aContainer, |
|
62 LayerManagerComposite* aManager, |
|
63 const nsIntRect& aClipRect); |
|
64 public: |
|
65 RefLayerComposite(LayerManagerComposite *aManager); |
|
66 ~RefLayerComposite(); |
|
67 |
|
68 /** LayerOGL implementation */ |
|
69 Layer* GetLayer() MOZ_OVERRIDE { return this; } |
|
70 |
|
71 void Destroy() MOZ_OVERRIDE; |
|
72 |
|
73 LayerComposite* GetFirstChildComposite(); |
|
74 |
|
75 virtual void RenderLayer(const nsIntRect& aClipRect) MOZ_OVERRIDE; |
|
76 |
|
77 virtual void ComputeEffectiveTransforms(const gfx::Matrix4x4& aTransformToSurface) MOZ_OVERRIDE |
|
78 { |
|
79 DefaultComputeEffectiveTransforms(aTransformToSurface); |
|
80 } |
|
81 |
|
82 virtual void CleanupResources() MOZ_OVERRIDE; |
|
83 |
|
84 virtual LayerComposite* AsLayerComposite() MOZ_OVERRIDE { return this; } |
|
85 |
|
86 // ref layers don't use a compositable |
|
87 CompositableHost* GetCompositableHost() MOZ_OVERRIDE { return nullptr; } |
|
88 |
|
89 virtual const char* Name() const MOZ_OVERRIDE { return "RefLayerComposite"; } |
|
90 }; |
|
91 |
|
92 } /* layers */ |
|
93 } /* mozilla */ |
|
94 |
|
95 #endif /* GFX_ContainerLayerComposite_H */ |