|
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 MOZILLA_GFX_IMAGEHOST_H |
|
7 #define MOZILLA_GFX_IMAGEHOST_H |
|
8 |
|
9 #include <stdio.h> // for FILE |
|
10 #include "CompositableHost.h" // for CompositableHost |
|
11 #include "mozilla/Attributes.h" // for MOZ_OVERRIDE |
|
12 #include "mozilla/RefPtr.h" // for RefPtr |
|
13 #include "mozilla/gfx/Point.h" // for Point |
|
14 #include "mozilla/gfx/Rect.h" // for Rect |
|
15 #include "mozilla/gfx/Types.h" // for Filter |
|
16 #include "mozilla/layers/CompositorTypes.h" // for TextureInfo, etc |
|
17 #include "mozilla/layers/LayersSurfaces.h" // for SurfaceDescriptor |
|
18 #include "mozilla/layers/LayersTypes.h" // for LayerRenderState, etc |
|
19 #include "mozilla/layers/TextureHost.h" // for TextureHost, etc |
|
20 #include "mozilla/mozalloc.h" // for operator delete |
|
21 #include "nsCOMPtr.h" // for already_AddRefed |
|
22 #include "nsRect.h" // for nsIntRect |
|
23 #include "nscore.h" // for nsACString |
|
24 |
|
25 class nsIntRegion; |
|
26 |
|
27 namespace mozilla { |
|
28 namespace gfx { |
|
29 class Matrix4x4; |
|
30 } |
|
31 namespace layers { |
|
32 |
|
33 class Compositor; |
|
34 class ISurfaceAllocator; |
|
35 struct EffectChain; |
|
36 |
|
37 /** |
|
38 * ImageHost. Works with ImageClientSingle and ImageClientBuffered |
|
39 */ |
|
40 class ImageHost : public CompositableHost |
|
41 { |
|
42 public: |
|
43 ImageHost(const TextureInfo& aTextureInfo); |
|
44 ~ImageHost(); |
|
45 |
|
46 virtual CompositableType GetType() { return mTextureInfo.mCompositableType; } |
|
47 |
|
48 virtual void Composite(EffectChain& aEffectChain, |
|
49 float aOpacity, |
|
50 const gfx::Matrix4x4& aTransform, |
|
51 const gfx::Filter& aFilter, |
|
52 const gfx::Rect& aClipRect, |
|
53 const nsIntRegion* aVisibleRegion = nullptr, |
|
54 TiledLayerProperties* aLayerProperties = nullptr) MOZ_OVERRIDE; |
|
55 |
|
56 virtual void UseTextureHost(TextureHost* aTexture) MOZ_OVERRIDE; |
|
57 |
|
58 virtual void RemoveTextureHost(TextureHost* aTexture) MOZ_OVERRIDE; |
|
59 |
|
60 virtual TextureHost* GetAsTextureHost() MOZ_OVERRIDE; |
|
61 |
|
62 virtual void SetCompositor(Compositor* aCompositor) MOZ_OVERRIDE; |
|
63 |
|
64 virtual void SetPictureRect(const nsIntRect& aPictureRect) MOZ_OVERRIDE |
|
65 { |
|
66 mPictureRect = aPictureRect; |
|
67 mHasPictureRect = true; |
|
68 } |
|
69 |
|
70 virtual LayerRenderState GetRenderState() MOZ_OVERRIDE; |
|
71 |
|
72 virtual void PrintInfo(nsACString& aTo, const char* aPrefix); |
|
73 |
|
74 #ifdef MOZ_DUMP_PAINTING |
|
75 virtual void Dump(FILE* aFile = nullptr, |
|
76 const char* aPrefix = "", |
|
77 bool aDumpHtml = false) MOZ_OVERRIDE; |
|
78 |
|
79 virtual TemporaryRef<gfx::DataSourceSurface> GetAsSurface() MOZ_OVERRIDE; |
|
80 #endif |
|
81 |
|
82 protected: |
|
83 |
|
84 RefPtr<TextureHost> mFrontBuffer; |
|
85 nsIntRect mPictureRect; |
|
86 bool mHasPictureRect; |
|
87 }; |
|
88 |
|
89 } |
|
90 } |
|
91 |
|
92 #endif |