/src/mozilla-central/gfx/layers/mlgpu/ContainerLayerMLGPU.h
Line | Count | Source (jump to first uncovered line) |
1 | | /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ |
2 | | /* vim: set ts=8 sts=2 et sw=2 tw=80: */ |
3 | | /* This Source Code Form is subject to the terms of the Mozilla Public |
4 | | * License, v. 2.0. If a copy of the MPL was not distributed with this |
5 | | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
6 | | |
7 | | #ifndef mozilla_gfx_layers_mlgpu_ContainerLayerMLGPU_h |
8 | | #define mozilla_gfx_layers_mlgpu_ContainerLayerMLGPU_h |
9 | | |
10 | | #include "LayerMLGPU.h" |
11 | | #include "MLGDeviceTypes.h" |
12 | | |
13 | | namespace mozilla { |
14 | | namespace layers { |
15 | | |
16 | | class MLGDevice; |
17 | | class RenderViewMLGPU; |
18 | | |
19 | | class ContainerLayerMLGPU final : public ContainerLayer |
20 | | , public LayerMLGPU |
21 | | { |
22 | | public: |
23 | | explicit ContainerLayerMLGPU(LayerManagerMLGPU* aManager); |
24 | | ~ContainerLayerMLGPU() override; |
25 | | |
26 | | MOZ_LAYER_DECL_NAME("ContainerLayerMLGPU", TYPE_CONTAINER) |
27 | | |
28 | 0 | HostLayer* AsHostLayer() override { return this; } |
29 | 0 | ContainerLayerMLGPU* AsContainerLayerMLGPU() override { return this; } |
30 | 0 | Layer* GetLayer() override { return this; } |
31 | | |
32 | 0 | void ComputeEffectiveTransforms(const gfx::Matrix4x4& aTransformToSurface) override { |
33 | 0 | DefaultComputeEffectiveTransforms(aTransformToSurface); |
34 | 0 | } |
35 | | void SetInvalidCompositeRect(const gfx::IntRect* aRect) override; |
36 | | void ClearCachedResources() override; |
37 | | |
38 | | const LayerIntRegion& GetShadowVisibleRegion() override; |
39 | | |
40 | | RefPtr<MLGRenderTarget> UpdateRenderTarget( |
41 | | MLGDevice* aDevice, |
42 | | MLGRenderTargetFlags aFlags); |
43 | | |
44 | 0 | MLGRenderTarget* GetRenderTarget() const { |
45 | 0 | return mRenderTarget; |
46 | 0 | } |
47 | 0 | gfx::IntPoint GetTargetOffset() const { |
48 | 0 | return mTargetOffset; |
49 | 0 | } |
50 | 0 | gfx::IntSize GetTargetSize() const { |
51 | 0 | return mTargetSize; |
52 | 0 | } |
53 | 0 | const gfx::IntRect& GetInvalidRect() const { |
54 | 0 | return mInvalidRect; |
55 | 0 | } |
56 | 0 | void ClearInvalidRect() { |
57 | 0 | mInvalidRect.SetEmpty(); |
58 | 0 | } |
59 | | bool IsContentOpaque() override; |
60 | 0 | bool NeedsSurfaceCopy() const { |
61 | 0 | return mSurfaceCopyNeeded; |
62 | 0 | } |
63 | | |
64 | 0 | RenderViewMLGPU* GetRenderView() const { |
65 | 0 | return mView; |
66 | 0 | } |
67 | 0 | void SetRenderView(RenderViewMLGPU* aView) { |
68 | 0 | MOZ_ASSERT(!mView); |
69 | 0 | mView = aView; |
70 | 0 | } |
71 | | |
72 | | void ComputeIntermediateSurfaceBounds(); |
73 | | |
74 | | protected: |
75 | | bool OnPrepareToRender(FrameBuilder* aBuilder) override; |
76 | | void OnLayerManagerChange(LayerManagerMLGPU* aManager) override; |
77 | | |
78 | | private: |
79 | | static Maybe<gfx::IntRect> FindVisibleBounds(Layer* aLayer, const Maybe<RenderTargetIntRect>& aClip); |
80 | | |
81 | | RefPtr<MLGRenderTarget> mRenderTarget; |
82 | | |
83 | | // We cache these since occlusion culling can change the visible region. |
84 | | gfx::IntPoint mTargetOffset; |
85 | | gfx::IntSize mTargetSize; |
86 | | |
87 | | // The region of the container that needs to be recomposited if visible. We |
88 | | // store this as a rectangle instead of an nsIntRegion for efficiency. This |
89 | | // is in layer coordinates. |
90 | | gfx::IntRect mInvalidRect; |
91 | | bool mInvalidateEntireSurface; |
92 | | bool mSurfaceCopyNeeded; |
93 | | |
94 | | // This is only valid for intermediate surfaces while an instance of |
95 | | // FrameBuilder is live. |
96 | | RenderViewMLGPU* mView; |
97 | | }; |
98 | | |
99 | | } // namespace layers |
100 | | } // namespace mozilla |
101 | | |
102 | | #endif // mozilla_gfx_layers_mlgpu_ContainerLayerMLGPU_h |