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_WEBRENDERPAINTEDLAYER_H
7 : #define GFX_WEBRENDERPAINTEDLAYER_H
8 :
9 : #include "Layers.h"
10 : #include "mozilla/layers/ContentClient.h"
11 : #include "mozilla/layers/WebRenderBridgeChild.h"
12 : #include "mozilla/layers/WebRenderLayer.h"
13 : #include "mozilla/layers/WebRenderLayerManager.h"
14 : #include "mozilla/webrender/WebRenderTypes.h"
15 :
16 : namespace mozilla {
17 : namespace layers {
18 :
19 : class WebRenderPaintedLayer : public WebRenderLayer,
20 : public PaintedLayer {
21 : public:
22 : typedef RotatedContentBuffer::PaintState PaintState;
23 : typedef RotatedContentBuffer::ContentType ContentType;
24 :
25 0 : explicit WebRenderPaintedLayer(WebRenderLayerManager* aLayerManager)
26 0 : : PaintedLayer(aLayerManager, static_cast<WebRenderLayer*>(this), LayerManager::NONE)
27 : {
28 0 : MOZ_COUNT_CTOR(WebRenderPaintedLayer);
29 0 : }
30 :
31 : protected:
32 0 : virtual ~WebRenderPaintedLayer()
33 0 : {
34 0 : MOZ_COUNT_DTOR(WebRenderPaintedLayer);
35 0 : if (mExternalImageId.isSome()) {
36 0 : WrBridge()->DeallocExternalImageId(mExternalImageId.ref());
37 : }
38 0 : }
39 :
40 : wr::MaybeExternalImageId mExternalImageId;
41 :
42 : public:
43 0 : virtual void InvalidateRegion(const nsIntRegion& aRegion) override
44 : {
45 0 : mInvalidRegion.Add(aRegion);
46 0 : UpdateValidRegionAfterInvalidRegionChanged();
47 0 : }
48 :
49 0 : Layer* GetLayer() override { return this; }
50 : void RenderLayer(wr::DisplayListBuilder& aBuilder,
51 : const StackingContextHelper& aSc) override;
52 : RefPtr<ImageContainer> mImageContainer;
53 : RefPtr<ImageClient> mImageClient;
54 :
55 : private:
56 : bool SetupExternalImages();
57 : bool UpdateImageClient();
58 : void CreateWebRenderDisplayList(wr::DisplayListBuilder& aBuilder,
59 : const StackingContextHelper& aSc);
60 : };
61 :
62 : } // namespace layers
63 : } // namespace mozilla
64 :
65 : #endif // GFX_WEBRENDERPAINTEDLAYER_H
|