Line data Source code
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_PaintedLayerComposite_H
7 : #define GFX_PaintedLayerComposite_H
8 :
9 : #include "Layers.h" // for Layer (ptr only), etc
10 : #include "mozilla/gfx/Rect.h"
11 : #include "mozilla/Attributes.h" // for 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 :
20 : namespace mozilla {
21 : namespace layers {
22 :
23 : /**
24 : * PaintedLayers use ContentHosts for their compsositable host.
25 : * By using different ContentHosts, PaintedLayerComposite support tiled and
26 : * non-tiled PaintedLayers and single or double buffering.
27 : */
28 :
29 : class CompositableHost;
30 : class ContentHost;
31 :
32 : class PaintedLayerComposite : public PaintedLayer,
33 : public LayerComposite
34 : {
35 : public:
36 : explicit PaintedLayerComposite(LayerManagerComposite *aManager);
37 :
38 : protected:
39 : virtual ~PaintedLayerComposite();
40 :
41 : public:
42 : virtual void Disconnect() override;
43 :
44 : CompositableHost* GetCompositableHost() override;
45 :
46 : virtual void Destroy() override;
47 :
48 : virtual Layer* GetLayer() override;
49 :
50 : virtual void SetLayerManager(HostLayerManager* aManager) override;
51 :
52 : virtual void RenderLayer(const gfx::IntRect& aClipRect,
53 : const Maybe<gfx::Polygon>& aGeometry) override;
54 :
55 : virtual void CleanupResources() override;
56 :
57 : virtual void GenEffectChain(EffectChain& aEffect) override;
58 :
59 : virtual bool SetCompositableHost(CompositableHost* aHost) override;
60 :
61 2024 : virtual HostLayer* AsHostLayer() override { return this; }
62 :
63 0 : virtual void InvalidateRegion(const nsIntRegion& aRegion) override
64 : {
65 0 : MOZ_CRASH("PaintedLayerComposites can't fill invalidated regions");
66 : }
67 :
68 : const virtual gfx::TiledIntRegion& GetInvalidRegion() override;
69 :
70 251 : MOZ_LAYER_DECL_NAME("PaintedLayerComposite", TYPE_PAINTED)
71 :
72 : protected:
73 :
74 : virtual void PrintInfo(std::stringstream& aStream, const char* aPrefix) override;
75 :
76 : private:
77 56 : gfx::SamplingFilter GetSamplingFilter() { return gfx::SamplingFilter::LINEAR; }
78 :
79 : private:
80 : RefPtr<ContentHost> mBuffer;
81 : };
82 :
83 : } // namespace layers
84 : } // namespace mozilla
85 :
86 : #endif /* GFX_PaintedLayerComposite_H */
|