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_ImageLayerComposite_H
7 : #define GFX_ImageLayerComposite_H
8 :
9 : #include "GLTextureImage.h" // for TextureImage
10 : #include "ImageLayers.h" // for ImageLayer
11 : #include "mozilla/Attributes.h" // for override
12 : #include "mozilla/gfx/Rect.h"
13 : #include "mozilla/RefPtr.h" // for RefPtr
14 : #include "mozilla/layers/LayerManagerComposite.h" // for LayerComposite, etc
15 : #include "mozilla/layers/LayersTypes.h" // for LayerRenderState, etc
16 : #include "nsISupportsImpl.h" // for TextureImage::AddRef, etc
17 : #include "nscore.h" // for nsACString
18 : #include "CompositableHost.h" // for CompositableHost
19 :
20 : namespace mozilla {
21 : namespace layers {
22 :
23 : class ImageHost;
24 : class Layer;
25 :
26 : class ImageLayerComposite : public ImageLayer,
27 : public LayerComposite
28 : {
29 : typedef gl::TextureImage TextureImage;
30 :
31 : public:
32 : explicit ImageLayerComposite(LayerManagerComposite* aManager);
33 :
34 : protected:
35 : virtual ~ImageLayerComposite();
36 :
37 : public:
38 : virtual void Disconnect() override;
39 :
40 : virtual bool SetCompositableHost(CompositableHost* aHost) override;
41 :
42 : virtual Layer* GetLayer() override;
43 :
44 : virtual void SetLayerManager(HostLayerManager* aManager) override;
45 :
46 : virtual void RenderLayer(const gfx::IntRect& aClipRect,
47 : const Maybe<gfx::Polygon>& aGeometry) override;
48 :
49 : virtual void ComputeEffectiveTransforms(const mozilla::gfx::Matrix4x4& aTransformToSurface) override;
50 :
51 : virtual void CleanupResources() override;
52 :
53 : CompositableHost* GetCompositableHost() override;
54 :
55 : virtual void GenEffectChain(EffectChain& aEffect) override;
56 :
57 0 : virtual HostLayer* AsHostLayer() override { return this; }
58 :
59 0 : virtual const char* Name() const override { return "ImageLayerComposite"; }
60 :
61 : virtual bool IsOpaque() override;
62 :
63 : virtual nsIntRegion GetFullyRenderedRegion() override;
64 :
65 : protected:
66 : virtual void PrintInfo(std::stringstream& aStream, const char* aPrefix) override;
67 :
68 : private:
69 : gfx::SamplingFilter GetSamplingFilter();
70 :
71 : private:
72 : RefPtr<ImageHost> mImageHost;
73 : };
74 :
75 : } // namespace layers
76 : } // namespace mozilla
77 :
78 : #endif /* GFX_ImageLayerComposite_H */
|