Line data Source code
1 : /* -*- Mode: C++; tab-width: 2; 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_WEBRENDERCONTAINERLAYER_H
7 : #define GFX_WEBRENDERCONTAINERLAYER_H
8 :
9 : #include "gfxPrefs.h"
10 : #include "Layers.h"
11 : #include "mozilla/layers/WebRenderLayer.h"
12 : #include "mozilla/layers/WebRenderLayerManager.h"
13 :
14 : namespace mozilla {
15 : namespace layers {
16 :
17 : class WebRenderContainerLayer : public WebRenderLayer,
18 : public ContainerLayer
19 : {
20 : public:
21 0 : explicit WebRenderContainerLayer(WebRenderLayerManager* aManager)
22 0 : : ContainerLayer(aManager, static_cast<WebRenderLayer*>(this))
23 : {
24 0 : MOZ_COUNT_CTOR(WebRenderContainerLayer);
25 0 : }
26 :
27 : protected:
28 0 : virtual ~WebRenderContainerLayer()
29 0 : {
30 :
31 0 : if (gfxPrefs::WebRenderOMTAEnabled() &&
32 0 : !GetAnimations().IsEmpty()) {
33 0 : mManager->AsWebRenderLayerManager()->
34 0 : AddCompositorAnimationsIdForDiscard(GetCompositorAnimationsId());
35 : }
36 :
37 0 : ContainerLayer::RemoveAllChildren();
38 0 : MOZ_COUNT_DTOR(WebRenderContainerLayer);
39 0 : }
40 :
41 : void UpdateTransformDataForAnimation();
42 :
43 : public:
44 0 : Layer* GetLayer() override { return this; }
45 : void RenderLayer(wr::DisplayListBuilder& aBuilder,
46 : const StackingContextHelper& aSc) override;
47 :
48 : void ClearAnimations() override;
49 0 : virtual void ComputeEffectiveTransforms(const gfx::Matrix4x4& aTransformToSurface) override
50 : {
51 0 : DefaultComputeEffectiveTransforms(aTransformToSurface);
52 0 : }
53 : };
54 :
55 : class WebRenderRefLayer : public WebRenderLayer,
56 : public RefLayer {
57 : public:
58 0 : explicit WebRenderRefLayer(WebRenderLayerManager* aManager) :
59 0 : RefLayer(aManager, static_cast<WebRenderLayer*>(this))
60 : {
61 0 : MOZ_COUNT_CTOR(WebRenderRefLayer);
62 0 : }
63 :
64 : protected:
65 0 : virtual ~WebRenderRefLayer()
66 0 : {
67 0 : MOZ_COUNT_DTOR(WebRenderRefLayer);
68 0 : }
69 :
70 : public:
71 0 : Layer* GetLayer() override { return this; }
72 : void RenderLayer(wr::DisplayListBuilder& aBuilder,
73 : const StackingContextHelper& aSc) override;
74 :
75 0 : virtual void ComputeEffectiveTransforms(const gfx::Matrix4x4& aTransformToSurface) override
76 : {
77 0 : DefaultComputeEffectiveTransforms(aTransformToSurface);
78 0 : }
79 : };
80 :
81 : } // namespace layers
82 : } // namespace mozilla
83 :
84 : #endif // GFX_WEBRENDERCONTAINERLAYER_H
|