annotate tests/4e1a3919e741.diff @ 29:826155711744

wip
author Jeff Hammel <jhammel@mozilla.com>
date Sat, 05 Oct 2013 15:50:02 -0700
parents a0ff003319ec
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
12
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
1
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
2 # HG changeset patch
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
3 # User Nicholas Cameron <ncameron@mozilla.com>
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
4 # Date 1380242239 -43200
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
5 # Node ID 4e1a3919e741eb8e3a4f520535671df9711b5b9b
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
6 # Parent a11f8859f7d84ed1a7ab3596c9242074a8a4dc35
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
7 Bug 882113. Azurification of compositor classes. r=mattwoodrow
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
8
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
9 diff --git a/gfx/gl/GLContext.cpp b/gfx/gl/GLContext.cpp
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
10 --- a/gfx/gl/GLContext.cpp
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
11 +++ b/gfx/gl/GLContext.cpp
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
12 @@ -2080,16 +2080,33 @@ GetActualReadFormats(GLContext* gl, GLen
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
13 void
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
14 GLContext::ReadScreenIntoImageSurface(gfxImageSurface* dest)
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
15 {
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
16 ScopedBindFramebuffer autoFB(this, 0);
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
17
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
18 ReadPixelsIntoImageSurface(dest);
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
19 }
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
20
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
21 +TemporaryRef<SourceSurface>
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
22 +GLContext::ReadPixelsToSourceSurface(const gfx::IntSize &aSize)
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
23 +{
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
24 + // XXX we should do this properly one day without using the gfxImageSurface
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
25 + RefPtr<DataSourceSurface> dataSourceSurface =
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
26 + Factory::CreateDataSourceSurface(aSize, gfx::FORMAT_B8G8R8A8);
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
27 + nsRefPtr<gfxImageSurface> surf =
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
28 + new gfxImageSurface(dataSourceSurface->GetData(),
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
29 + gfxIntSize(aSize.width, aSize.height),
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
30 + dataSourceSurface->Stride(),
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
31 + gfxImageFormatARGB32);
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
32 + ReadPixelsIntoImageSurface(surf);
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
33 + dataSourceSurface->MarkDirty();
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
34 +
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
35 + return dataSourceSurface;
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
36 +}
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
37 +
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
38 void
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
39 GLContext::ReadPixelsIntoImageSurface(gfxImageSurface* dest)
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
40 {
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
41 MakeCurrent();
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
42 MOZ_ASSERT(dest->GetSize() != gfxIntSize(0, 0));
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
43
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
44 /* gfxImageFormatARGB32:
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
45 * RGBA+UByte: be[RGBA], le[ABGR]
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
46 diff --git a/gfx/gl/GLContext.h b/gfx/gl/GLContext.h
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
47 --- a/gfx/gl/GLContext.h
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
48 +++ b/gfx/gl/GLContext.h
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
49 @@ -47,16 +47,17 @@ class nsIThread;
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
50
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
51 namespace android {
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
52 class GraphicBuffer;
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
53 }
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
54
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
55 namespace mozilla {
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
56 namespace gfx {
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
57 class SharedSurface;
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
58 + class SourceSurface;
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
59 class DataSourceSurface;
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
60 struct SurfaceCaps;
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
61 }
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
62
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
63 namespace gl {
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
64 class GLContext;
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
65 class GLLibraryEGL;
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
66 class GLScreenBuffer;
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
67 @@ -2696,16 +2697,18 @@ public:
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
68 * ReadScreenIntoImageSurface call dest->Flush/MarkDirty.
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
69 */
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
70 void ReadPixelsIntoImageSurface(gfxImageSurface* dest);
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
71
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
72 // Similar to ReadPixelsIntoImageSurface, but pulls from the screen
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
73 // instead of the currently bound framebuffer.
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
74 void ReadScreenIntoImageSurface(gfxImageSurface* dest);
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
75
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
76 + TemporaryRef<gfx::SourceSurface> ReadPixelsToSourceSurface(const gfx::IntSize &aSize);
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
77 +
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
78 /**
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
79 * Copy a rectangle from one TextureImage into another. The
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
80 * source and destination are given in integer coordinates, and
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
81 * will be converted to texture coordinates.
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
82 *
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
83 * For the source texture, the wrap modes DO apply -- it's valid
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
84 * to use REPEAT or PAD and expect appropriate behaviour if the source
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
85 * rectangle extends beyond its bounds.
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
86 diff --git a/gfx/layers/Compositor.h b/gfx/layers/Compositor.h
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
87 --- a/gfx/layers/Compositor.h
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
88 +++ b/gfx/layers/Compositor.h
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
89 @@ -2,17 +2,16 @@
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
90 * This Source Code Form is subject to the terms of the Mozilla Public
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
91 * License, v. 2.0. If a copy of the MPL was not distributed with this
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
92 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
93
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
94 #ifndef MOZILLA_GFX_COMPOSITOR_H
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
95 #define MOZILLA_GFX_COMPOSITOR_H
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
96
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
97 #include "Units.h" // for ScreenPoint
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
98 -#include "gfxPoint.h" // for gfxIntSize
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
99 #include "mozilla/Assertions.h" // for MOZ_ASSERT, etc
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
100 #include "mozilla/RefPtr.h" // for TemporaryRef, RefCounted
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
101 #include "mozilla/gfx/Point.h" // for IntSize, Point
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
102 #include "mozilla/gfx/Rect.h" // for Rect, IntRect
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
103 #include "mozilla/gfx/Types.h" // for Float
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
104 #include "mozilla/layers/CompositorTypes.h" // for DiagnosticTypes, etc
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
105 #include "mozilla/layers/LayersTypes.h" // for LayersBackend
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
106 #include "nsTraceRefcnt.h" // for MOZ_COUNT_CTOR, etc
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
107 @@ -97,24 +96,24 @@
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
108 * under gfx/layers/. To add a new backend, implement at least the following
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
109 * interfaces:
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
110 * - Compositor (ex. CompositorOGL)
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
111 * - TextureHost (ex. SharedTextureHostOGL)
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
112 * Depending on the type of data that needs to be serialized, you may need to
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
113 * add specific TextureClient implementations.
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
114 */
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
115
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
116 -class gfxContext;
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
117 class nsIWidget;
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
118 struct gfxMatrix;
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
119 struct nsIntSize;
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
120
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
121 namespace mozilla {
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
122 namespace gfx {
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
123 class Matrix4x4;
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
124 +class DrawTarget;
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
125 }
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
126
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
127 namespace layers {
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
128
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
129 struct Effect;
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
130 struct EffectChain;
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
131 class Image;
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
132 class ISurfaceAllocator;
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
133 @@ -205,27 +204,27 @@ public:
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
134 * across process or thread boundaries that are compatible with this
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
135 * compositor.
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
136 */
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
137 virtual TextureFactoryIdentifier GetTextureFactoryIdentifier() = 0;
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
138
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
139 /**
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
140 * Properties of the compositor.
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
141 */
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
142 - virtual bool CanUseCanvasLayerForSize(const gfxIntSize& aSize) = 0;
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
143 + virtual bool CanUseCanvasLayerForSize(const gfx::IntSize& aSize) = 0;
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
144 virtual int32_t GetMaxTextureSize() const = 0;
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
145
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
146 /**
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
147 * Set the target for rendering. Results will have been written to aTarget by
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
148 * the time that EndFrame returns.
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
149 *
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
150 * If this method is not used, or we pass in nullptr, we target the compositor's
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
151 * usual swap chain and render to the screen.
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
152 */
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
153 - virtual void SetTargetContext(gfxContext* aTarget) = 0;
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
154 + virtual void SetTargetContext(gfx::DrawTarget* aTarget) = 0;
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
155
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
156 typedef uint32_t MakeCurrentFlags;
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
157 static const MakeCurrentFlags ForceMakeCurrent = 0x1;
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
158 /**
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
159 * Make this compositor's rendering context the current context for the
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
160 * underlying graphics API. This may be a global operation, depending on the
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
161 * API. Our context will remain the current one until someone else changes it.
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
162 *
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
163 diff --git a/gfx/layers/Layers.cpp b/gfx/layers/Layers.cpp
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
164 --- a/gfx/layers/Layers.cpp
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
165 +++ b/gfx/layers/Layers.cpp
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
166 @@ -1166,19 +1166,20 @@ void WriteSnapshotToDumpFile(Layer* aLay
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
167 WriteSnapshotToDumpFile_internal(aLayer, aSurf);
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
168 }
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
169
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
170 void WriteSnapshotToDumpFile(LayerManager* aManager, gfxASurface* aSurf)
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
171 {
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
172 WriteSnapshotToDumpFile_internal(aManager, aSurf);
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
173 }
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
174
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
175 -void WriteSnapshotToDumpFile(Compositor* aCompositor, gfxASurface* aSurf)
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
176 +void WriteSnapshotToDumpFile(Compositor* aCompositor, DrawTarget* aTarget)
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
177 {
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
178 - WriteSnapshotToDumpFile_internal(aCompositor, aSurf);
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
179 + nsRefPtr<gfxASurface> surf = gfxPlatform::GetPlatform()->GetThebesSurfaceForDrawTarget(aTarget);
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
180 + WriteSnapshotToDumpFile_internal(aCompositor, surf);
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
181 }
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
182 #endif
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
183
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
184 void
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
185 Layer::Dump(FILE* aFile, const char* aPrefix, bool aDumpHtml)
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
186 {
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
187 if (aDumpHtml) {
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
188 fprintf(aFile, "<li><a id=\"%p\" ", this);
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
189 diff --git a/gfx/layers/Layers.h b/gfx/layers/Layers.h
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
190 --- a/gfx/layers/Layers.h
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
191 +++ b/gfx/layers/Layers.h
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
192 @@ -1955,15 +1955,15 @@ protected:
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
193 Layer* mTempReferent;
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
194 // 0 is a special value that means "no ID".
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
195 uint64_t mId;
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
196 };
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
197
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
198 #ifdef MOZ_DUMP_PAINTING
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
199 void WriteSnapshotToDumpFile(Layer* aLayer, gfxASurface* aSurf);
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
200 void WriteSnapshotToDumpFile(LayerManager* aManager, gfxASurface* aSurf);
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
201 -void WriteSnapshotToDumpFile(Compositor* aCompositor, gfxASurface* aSurf);
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
202 +void WriteSnapshotToDumpFile(Compositor* aCompositor, gfx::DrawTarget* aTarget);
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
203 #endif
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
204
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
205 }
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
206 }
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
207
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
208 #endif /* GFX_LAYERS_H */
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
209 diff --git a/gfx/layers/basic/BasicCompositor.cpp b/gfx/layers/basic/BasicCompositor.cpp
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
210 --- a/gfx/layers/basic/BasicCompositor.cpp
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
211 +++ b/gfx/layers/basic/BasicCompositor.cpp
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
212 @@ -464,30 +464,27 @@ BasicCompositor::BeginFrame(const gfx::R
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
213 }
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
214 }
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
215
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
216 void
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
217 BasicCompositor::EndFrame()
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
218 {
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
219 mRenderTarget->mDrawTarget->PopClip();
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
220
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
221 + RefPtr<SourceSurface> source = mRenderTarget->mDrawTarget->Snapshot();
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
222 if (mCopyTarget) {
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
223 - nsRefPtr<gfxASurface> thebes = gfxPlatform::GetPlatform()->GetThebesSurfaceForDrawTarget(mRenderTarget->mDrawTarget);
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
224 - gfxContextAutoSaveRestore restore(mCopyTarget);
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
225 - mCopyTarget->SetOperator(gfxContext::OPERATOR_SOURCE);
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
226 - mCopyTarget->SetSource(thebes);
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
227 - mCopyTarget->Paint();
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
228 - mCopyTarget = nullptr;
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
229 + mCopyTarget->CopySurface(source,
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
230 + IntRect(0, 0, mWidgetSize.width, mWidgetSize.height),
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
231 + IntPoint(0, 0));
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
232 } else {
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
233 // Most platforms require us to buffer drawing to the widget surface.
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
234 // That's why we don't draw to mDrawTarget directly.
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
235 - RefPtr<SourceSurface> source = mRenderTarget->mDrawTarget->Snapshot();
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
236 mDrawTarget->CopySurface(source,
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
237 - IntRect(0, 0, mWidgetSize.width, mWidgetSize.height),
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
238 - IntPoint(0, 0));
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
239 + IntRect(0, 0, mWidgetSize.width, mWidgetSize.height),
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
240 + IntPoint(0, 0));
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
241 mWidget->EndRemoteDrawing();
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
242 }
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
243 mDrawTarget = nullptr;
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
244 mRenderTarget = nullptr;
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
245 }
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
246
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
247 void
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
248 BasicCompositor::AbortFrame()
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
249 diff --git a/gfx/layers/basic/BasicCompositor.h b/gfx/layers/basic/BasicCompositor.h
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
250 --- a/gfx/layers/basic/BasicCompositor.h
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
251 +++ b/gfx/layers/basic/BasicCompositor.h
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
252 @@ -89,20 +89,20 @@ public:
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
253 virtual void EndFrame() MOZ_OVERRIDE;
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
254 virtual void EndFrameForExternalComposition(const gfxMatrix& aTransform) MOZ_OVERRIDE
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
255 {
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
256 NS_RUNTIMEABORT("We shouldn't ever hit this");
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
257 }
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
258 virtual void AbortFrame() MOZ_OVERRIDE;
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
259
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
260 virtual bool SupportsPartialTextureUpdate() { return true; }
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
261 - virtual bool CanUseCanvasLayerForSize(const gfxIntSize &aSize) MOZ_OVERRIDE { return true; }
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
262 + virtual bool CanUseCanvasLayerForSize(const gfx::IntSize &aSize) MOZ_OVERRIDE { return true; }
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
263 virtual int32_t GetMaxTextureSize() const MOZ_OVERRIDE { return INT32_MAX; }
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
264 virtual void SetDestinationSurfaceSize(const gfx::IntSize& aSize) MOZ_OVERRIDE { }
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
265 - virtual void SetTargetContext(gfxContext* aTarget) MOZ_OVERRIDE
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
266 + virtual void SetTargetContext(gfx::DrawTarget* aTarget) MOZ_OVERRIDE
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
267 {
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
268 mCopyTarget = aTarget;
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
269 }
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
270
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
271 virtual void SetScreenRenderOffset(const ScreenPoint& aOffset) MOZ_OVERRIDE {
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
272 }
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
273
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
274 virtual void MakeCurrent(MakeCurrentFlags aFlags = 0) { }
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
275 @@ -128,15 +128,15 @@ private:
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
276 nsIntSize mWidgetSize;
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
277
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
278 // The final destination surface
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
279 RefPtr<gfx::DrawTarget> mDrawTarget;
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
280 // The current render target for drawing
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
281 RefPtr<BasicCompositingRenderTarget> mRenderTarget;
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
282 // An optional destination target to copy the results
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
283 // to after drawing is completed.
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
284 - nsRefPtr<gfxContext> mCopyTarget;
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
285 + RefPtr<gfx::DrawTarget> mCopyTarget;
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
286 };
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
287
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
288 } // namespace layers
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
289 } // namespace mozilla
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
290
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
291 #endif /* MOZILLA_GFX_BASICCOMPOSITOR_H */
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
292 diff --git a/gfx/layers/composite/LayerManagerComposite.cpp b/gfx/layers/composite/LayerManagerComposite.cpp
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
293 --- a/gfx/layers/composite/LayerManagerComposite.cpp
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
294 +++ b/gfx/layers/composite/LayerManagerComposite.cpp
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
295 @@ -143,17 +143,17 @@ LayerManagerComposite::UpdateRenderBound
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
296
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
297 void
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
298 LayerManagerComposite::BeginTransaction()
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
299 {
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
300 mInTransaction = true;
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
301 }
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
302
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
303 void
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
304 -LayerManagerComposite::BeginTransactionWithTarget(gfxContext *aTarget)
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
305 +LayerManagerComposite::BeginTransactionWithDrawTarget(DrawTarget* aTarget)
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
306 {
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
307 mInTransaction = true;
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
308
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
309 #ifdef MOZ_LAYERS_HAVE_LOG
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
310 MOZ_LAYERS_LOG(("[----- BeginTransaction"));
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
311 Log();
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
312 #endif
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
313
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
314 @@ -757,17 +757,18 @@ void
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
315 LayerManagerComposite::NotifyShadowTreeTransaction()
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
316 {
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
317 mCompositor->NotifyLayersTransaction();
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
318 }
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
319
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
320 bool
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
321 LayerManagerComposite::CanUseCanvasLayerForSize(const gfxIntSize &aSize)
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
322 {
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
323 - return mCompositor->CanUseCanvasLayerForSize(aSize);
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
324 + return mCompositor->CanUseCanvasLayerForSize(gfx::IntSize(aSize.width,
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
325 + aSize.height));
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
326 }
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
327
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
328 TextureFactoryIdentifier
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
329 LayerManagerComposite::GetTextureFactoryIdentifier()
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
330 {
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
331 return mCompositor->GetTextureFactoryIdentifier();
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
332 }
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
333
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
334 diff --git a/gfx/layers/composite/LayerManagerComposite.h b/gfx/layers/composite/LayerManagerComposite.h
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
335 --- a/gfx/layers/composite/LayerManagerComposite.h
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
336 +++ b/gfx/layers/composite/LayerManagerComposite.h
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
337 @@ -97,18 +97,22 @@ public:
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
338 */
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
339 virtual LayerManagerComposite* AsLayerManagerComposite() MOZ_OVERRIDE
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
340 {
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
341 return this;
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
342 }
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
343
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
344 void UpdateRenderBounds(const nsIntRect& aRect);
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
345
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
346 - void BeginTransaction() MOZ_OVERRIDE;
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
347 - void BeginTransactionWithTarget(gfxContext* aTarget) MOZ_OVERRIDE;
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
348 + virtual void BeginTransaction() MOZ_OVERRIDE;
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
349 + virtual void BeginTransactionWithTarget(gfxContext* aTarget) MOZ_OVERRIDE
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
350 + {
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
351 + MOZ_CRASH("Use BeginTransactionWithDrawTarget");
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
352 + }
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
353 + void BeginTransactionWithDrawTarget(gfx::DrawTarget* aTarget);
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
354
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
355 void NotifyShadowTreeTransaction();
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
356
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
357 virtual bool EndEmptyTransaction(EndTransactionFlags aFlags = END_DEFAULT) MOZ_OVERRIDE;
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
358 virtual void EndTransaction(DrawThebesLayerCallback aCallback,
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
359 void* aCallbackData,
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
360 EndTransactionFlags aFlags = END_DEFAULT) MOZ_OVERRIDE;
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
361
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
362 diff --git a/gfx/layers/d3d11/CompositorD3D11.cpp b/gfx/layers/d3d11/CompositorD3D11.cpp
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
363 --- a/gfx/layers/d3d11/CompositorD3D11.cpp
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
364 +++ b/gfx/layers/d3d11/CompositorD3D11.cpp
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
365 @@ -344,17 +344,17 @@ CompositorD3D11::GetTextureFactoryIdenti
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
366 TextureFactoryIdentifier ident;
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
367 ident.mMaxTextureSize = GetMaxTextureSize();
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
368 ident.mParentProcessId = XRE_GetProcessType();
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
369 ident.mParentBackend = LAYERS_D3D11;
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
370 return ident;
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
371 }
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
372
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
373 bool
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
374 -CompositorD3D11::CanUseCanvasLayerForSize(const gfxIntSize& aSize)
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
375 +CompositorD3D11::CanUseCanvasLayerForSize(const gfx::IntSize& aSize)
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
376 {
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
377 int32_t maxTextureSize = GetMaxTextureSize();
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
378
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
379 if (aSize.width > maxTextureSize || aSize.height > maxTextureSize) {
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
380 return false;
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
381 }
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
382
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
383 return true;
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
384 @@ -903,23 +903,23 @@ CompositorD3D11::PaintToTarget()
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
385 nsRefPtr<ID3D11Texture2D> readTexture;
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
386
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
387 HRESULT hr = mDevice->CreateTexture2D(&softDesc, nullptr, getter_AddRefs(readTexture));
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
388 mContext->CopyResource(readTexture, backBuf);
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
389
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
390 D3D11_MAPPED_SUBRESOURCE map;
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
391 mContext->Map(readTexture, 0, D3D11_MAP_READ, 0, &map);
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
392
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
393 - nsRefPtr<gfxImageSurface> tmpSurface =
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
394 - new gfxImageSurface((unsigned char*)map.pData,
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
395 - gfxIntSize(bbDesc.Width, bbDesc.Height),
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
396 - map.RowPitch,
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
397 - gfxImageFormatARGB32);
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
398 -
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
399 - mTarget->SetSource(tmpSurface);
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
400 - mTarget->SetOperator(gfxContext::OPERATOR_SOURCE);
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
401 - mTarget->Paint();
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
402 -
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
403 + destSurf->LockRect(&rect, NULL, D3DLOCK_READONLY);
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
404 + RefPtr<DataSourceSurface> sourceSurface =
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
405 + Factory::CreateWrappingDataSourceSurface((uint8_t*)map.pData,
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
406 + map.RowPitch,
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
407 + IntSize(bbDesc.Width, bbDesc.Height),
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
408 + FORMAT_B8G8R8A8);
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
409 + mTarget->CopySurface(sourceSurface,
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
410 + IntRect(0, 0, bbDesc.Width, bbDesc.Height),
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
411 + IntPoint());
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
412 + mTarget->Flush();
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
413 mContext->Unmap(readTexture, 0);
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
414 }
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
415
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
416 }
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
417 }
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
418 diff --git a/gfx/layers/d3d11/CompositorD3D11.h b/gfx/layers/d3d11/CompositorD3D11.h
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
419 --- a/gfx/layers/d3d11/CompositorD3D11.h
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
420 +++ b/gfx/layers/d3d11/CompositorD3D11.h
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
421 @@ -1,16 +1,17 @@
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
422 /* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 2 -*-
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
423 * This Source Code Form is subject to the terms of the Mozilla Public
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
424 * License, v. 2.0. If a copy of the MPL was not distributed with this
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
425 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
426
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
427 #ifndef MOZILLA_GFX_COMPOSITORD3D11_H
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
428 #define MOZILLA_GFX_COMPOSITORD3D11_H
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
429
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
430 +#include "mozilla/gfx/2D.h"
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
431 #include "mozilla/layers/Compositor.h"
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
432 #include "TextureD3D11.h"
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
433 #include <d3d11.h>
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
434
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
435 class nsWidget;
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
436
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
437 namespace mozilla {
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
438 namespace layers {
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
439 @@ -45,20 +46,20 @@ public:
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
440 virtual void Destroy() MOZ_OVERRIDE {}
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
441
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
442 virtual TextureFactoryIdentifier
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
443 GetTextureFactoryIdentifier() MOZ_OVERRIDE;
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
444
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
445 virtual TemporaryRef<DataTextureSource>
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
446 CreateDataTextureSource(TextureFlags aFlags = 0) MOZ_OVERRIDE { return nullptr; }
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
447
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
448 - virtual bool CanUseCanvasLayerForSize(const gfxIntSize& aSize) MOZ_OVERRIDE;
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
449 + virtual bool CanUseCanvasLayerForSize(const gfx::IntSize& aSize) MOZ_OVERRIDE;
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
450 virtual int32_t GetMaxTextureSize() const MOZ_FINAL;
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
451
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
452 - virtual void SetTargetContext(gfxContext* aTarget) MOZ_OVERRIDE
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
453 + virtual void SetTargetContext(gfx::DrawTarget* aTarget) MOZ_OVERRIDE
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
454 {
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
455 mTarget = aTarget;
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
456 }
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
457
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
458 virtual void MakeCurrent(MakeCurrentFlags aFlags = 0) MOZ_OVERRIDE {}
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
459
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
460 virtual TemporaryRef<CompositingRenderTarget>
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
461 CreateRenderTarget(const gfx::IntRect &aRect,
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
462 @@ -162,17 +163,17 @@ private:
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
463 RefPtr<ID3D11DeviceContext> mContext;
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
464 RefPtr<ID3D11Device> mDevice;
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
465 RefPtr<IDXGISwapChain> mSwapChain;
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
466 RefPtr<CompositingRenderTargetD3D11> mDefaultRT;
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
467 RefPtr<CompositingRenderTargetD3D11> mCurrentRT;
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
468
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
469 DeviceAttachmentsD3D11* mAttachments;
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
470
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
471 - nsRefPtr<gfxContext> mTarget;
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
472 + RefPtr<gfx::DrawTarget> mTarget;
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
473
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
474 nsIWidget* mWidget;
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
475
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
476 nsIntSize mSize;
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
477
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
478 HWND mHwnd;
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
479
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
480 D3D_FEATURE_LEVEL mFeatureLevel;
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
481 diff --git a/gfx/layers/d3d9/CompositorD3D9.cpp b/gfx/layers/d3d9/CompositorD3D9.cpp
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
482 --- a/gfx/layers/d3d9/CompositorD3D9.cpp
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
483 +++ b/gfx/layers/d3d9/CompositorD3D9.cpp
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
484 @@ -60,17 +60,17 @@ CompositorD3D9::GetTextureFactoryIdentif
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
485 TextureFactoryIdentifier ident;
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
486 ident.mMaxTextureSize = GetMaxTextureSize();
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
487 ident.mParentBackend = LAYERS_D3D9;
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
488 ident.mParentProcessId = XRE_GetProcessType();
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
489 return ident;
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
490 }
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
491
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
492 bool
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
493 -CompositorD3D9::CanUseCanvasLayerForSize(const gfxIntSize &aSize)
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
494 +CompositorD3D9::CanUseCanvasLayerForSize(const IntSize &aSize)
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
495 {
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
496 int32_t maxTextureSize = GetMaxTextureSize();
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
497
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
498 if (aSize.width > maxTextureSize || aSize.height > maxTextureSize) {
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
499 return false;
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
500 }
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
501
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
502 return true;
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
503 @@ -560,24 +560,25 @@ CompositorD3D9::PaintToTarget()
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
504 device()->CreateOffscreenPlainSurface(desc.Width, desc.Height,
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
505 D3DFMT_A8R8G8B8, D3DPOOL_SYSTEMMEM,
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
506 getter_AddRefs(destSurf), NULL);
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
507
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
508 device()->GetRenderTargetData(backBuff, destSurf);
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
509
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
510 D3DLOCKED_RECT rect;
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
511 destSurf->LockRect(&rect, NULL, D3DLOCK_READONLY);
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
512 - mTarget->SetOperator(gfxContext::OPERATOR_SOURCE);
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
513 - nsRefPtr<gfxImageSurface> imageSurface =
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
514 - new gfxImageSurface((unsigned char*)rect.pBits,
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
515 - gfxIntSize(desc.Width, desc.Height),
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
516 - rect.Pitch,
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
517 - gfxImageFormatARGB32);
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
518 - mTarget->SetSource(imageSurface);
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
519 - mTarget->Paint();
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
520 + RefPtr<DataSourceSurface> sourceSurface =
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
521 + Factory::CreateWrappingDataSourceSurface((uint8_t*)rect.pBits,
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
522 + rect.Pitch,
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
523 + IntSize(desc.Width, desc.Height),
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
524 + FORMAT_B8G8R8A8);
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
525 + mTarget->CopySurface(sourceSurface,
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
526 + IntRect(0, 0, desc.Width, desc.Height),
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
527 + IntPoint());
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
528 + mTarget->Flush();
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
529 destSurf->UnlockRect();
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
530 }
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
531
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
532 void
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
533 CompositorD3D9::ReportFailure(const nsACString &aMsg, HRESULT aCode)
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
534 {
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
535 // We could choose to abort here when hr == E_OUTOFMEMORY.
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
536 nsCString msg;
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
537 diff --git a/gfx/layers/d3d9/CompositorD3D9.h b/gfx/layers/d3d9/CompositorD3D9.h
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
538 --- a/gfx/layers/d3d9/CompositorD3D9.h
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
539 +++ b/gfx/layers/d3d9/CompositorD3D9.h
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
540 @@ -1,16 +1,17 @@
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
541 /* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 2 -*-
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
542 * This Source Code Form is subject to the terms of the Mozilla Public
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
543 * License, v. 2.0. If a copy of the MPL was not distributed with this
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
544 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
545
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
546 #ifndef MOZILLA_GFX_COMPOSITORD3D9_H
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
547 #define MOZILLA_GFX_COMPOSITORD3D9_H
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
548
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
549 +#include "mozilla/gfx/2D.h"
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
550 #include "mozilla/layers/Compositor.h"
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
551 #include "mozilla/layers/TextureD3D9.h"
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
552 #include "DeviceManagerD3D9.h"
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
553
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
554 class nsWidget;
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
555
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
556 namespace mozilla {
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
557 namespace layers {
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
558 @@ -22,20 +23,20 @@ public:
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
559 ~CompositorD3D9();
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
560
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
561 virtual bool Initialize() MOZ_OVERRIDE;
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
562 virtual void Destroy() MOZ_OVERRIDE {}
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
563
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
564 virtual TextureFactoryIdentifier
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
565 GetTextureFactoryIdentifier() MOZ_OVERRIDE;
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
566
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
567 - virtual bool CanUseCanvasLayerForSize(const gfxIntSize &aSize) MOZ_OVERRIDE;
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
568 + virtual bool CanUseCanvasLayerForSize(const gfx::IntSize &aSize) MOZ_OVERRIDE;
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
569 virtual int32_t GetMaxTextureSize() const MOZ_FINAL;
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
570
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
571 - virtual void SetTargetContext(gfxContext *aTarget) MOZ_OVERRIDE
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
572 + virtual void SetTargetContext(gfx::DrawTarget *aTarget) MOZ_OVERRIDE
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
573 {
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
574 mTarget = aTarget;
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
575 }
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
576
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
577 virtual void MakeCurrent(MakeCurrentFlags aFlags = 0) MOZ_OVERRIDE {}
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
578
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
579 virtual TemporaryRef<CompositingRenderTarget>
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
580 CreateRenderTarget(const gfx::IntRect &aRect,
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
581 @@ -123,17 +124,17 @@ private:
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
582 nsRefPtr<SwapChainD3D9> mSwapChain;
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
583
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
584 /* Widget associated with this layer manager */
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
585 nsIWidget *mWidget;
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
586
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
587 /*
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
588 * Context target, NULL when drawing directly to our swap chain.
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
589 */
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
590 - nsRefPtr<gfxContext> mTarget;
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
591 + RefPtr<gfx::DrawTarget> mTarget;
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
592
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
593 RefPtr<CompositingRenderTargetD3D9> mDefaultRT;
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
594 RefPtr<CompositingRenderTargetD3D9> mCurrentRT;
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
595
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
596 nsIntSize mSize;
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
597 };
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
598
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
599 }
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
600 diff --git a/gfx/layers/ipc/CompositorParent.cpp b/gfx/layers/ipc/CompositorParent.cpp
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
601 --- a/gfx/layers/ipc/CompositorParent.cpp
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
602 +++ b/gfx/layers/ipc/CompositorParent.cpp
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
603 @@ -18,16 +18,17 @@
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
604 #include "base/task.h" // for CancelableTask, etc
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
605 #include "base/thread.h" // for Thread
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
606 #include "base/tracked.h" // for FROM_HERE
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
607 #include "gfxContext.h" // for gfxContext
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
608 #include "gfxPlatform.h" // for gfxPlatform
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
609 #include "ipc/ShadowLayersManager.h" // for ShadowLayersManager
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
610 #include "mozilla/AutoRestore.h" // for AutoRestore
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
611 #include "mozilla/DebugOnly.h" // for DebugOnly
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
612 +#include "mozilla/gfx/2D.h" // for DrawTarget
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
613 #include "mozilla/gfx/Point.h" // for IntSize
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
614 #include "mozilla/ipc/Transport.h" // for Transport
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
615 #include "mozilla/layers/APZCTreeManager.h" // for APZCTreeManager
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
616 #include "mozilla/layers/AsyncCompositionManager.h"
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
617 #include "mozilla/layers/BasicCompositor.h" // for BasicCompositor
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
618 #include "mozilla/layers/Compositor.h" // for Compositor
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
619 #include "mozilla/layers/CompositorOGL.h" // for CompositorOGL
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
620 #include "mozilla/layers/CompositorTypes.h"
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
621 @@ -47,16 +48,17 @@
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
622 #include "mozilla/layers/CompositorD3D11.h"
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
623 #include "mozilla/layers/CompositorD3D9.h"
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
624 #endif
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
625 #include "GeckoProfiler.h"
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
626
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
627 using namespace base;
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
628 using namespace mozilla;
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
629 using namespace mozilla::ipc;
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
630 +using namespace mozilla::gfx;
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
631 using namespace std;
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
632
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
633 namespace mozilla {
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
634 namespace layers {
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
635
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
636 CompositorParent::LayerTreeState::LayerTreeState()
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
637 : mParent(nullptr)
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
638 {
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
639 @@ -290,17 +292,23 @@ CompositorParent::RecvResume()
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
640 return true;
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
641 }
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
642
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
643 bool
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
644 CompositorParent::RecvMakeSnapshot(const SurfaceDescriptor& aInSnapshot,
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
645 SurfaceDescriptor* aOutSnapshot)
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
646 {
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
647 AutoOpenSurface opener(OPEN_READ_WRITE, aInSnapshot);
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
648 - nsRefPtr<gfxContext> target = new gfxContext(opener.Get());
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
649 + gfxIntSize size = opener.Size();
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
650 + // XXX CreateDrawTargetForSurface will always give us a Cairo surface, we can
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
651 + // do better if AutoOpenSurface uses Moz2D directly.
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
652 + RefPtr<DrawTarget> target =
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
653 + gfxPlatform::GetPlatform()->CreateDrawTargetForSurface(opener.Get(),
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
654 + IntSize(size.width,
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
655 + size.height));
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
656 ComposeToTarget(target);
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
657 *aOutSnapshot = aInSnapshot;
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
658 return true;
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
659 }
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
660
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
661 bool
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
662 CompositorParent::RecvFlushRendering()
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
663 {
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
664 @@ -536,26 +544,26 @@ CompositorParent::Composite()
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
665 if (mExpectedComposeTime + TimeDuration::FromMilliseconds(15) < TimeStamp::Now()) {
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
666 printf_stderr("Compositor: Composite took %i ms.\n",
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
667 15 + (int)(TimeStamp::Now() - mExpectedComposeTime).ToMilliseconds());
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
668 }
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
669 #endif
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
670 }
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
671
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
672 void
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
673 -CompositorParent::ComposeToTarget(gfxContext* aTarget)
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
674 +CompositorParent::ComposeToTarget(DrawTarget* aTarget)
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
675 {
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
676 PROFILER_LABEL("CompositorParent", "ComposeToTarget");
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
677 AutoRestore<bool> override(mOverrideComposeReadiness);
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
678 mOverrideComposeReadiness = true;
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
679
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
680 if (!CanComposite()) {
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
681 return;
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
682 }
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
683 - mLayerManager->BeginTransactionWithTarget(aTarget);
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
684 + mLayerManager->BeginTransactionWithDrawTarget(aTarget);
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
685 // Since CanComposite() is true, Composite() must end the layers txn
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
686 // we opened above.
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
687 Composite();
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
688 }
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
689
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
690 bool
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
691 CompositorParent::CanComposite()
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
692 {
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
693 diff --git a/gfx/layers/ipc/CompositorParent.h b/gfx/layers/ipc/CompositorParent.h
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
694 --- a/gfx/layers/ipc/CompositorParent.h
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
695 +++ b/gfx/layers/ipc/CompositorParent.h
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
696 @@ -34,16 +34,20 @@
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
697 #include "nsSize.h" // for nsIntSize
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
698
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
699 class CancelableTask;
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
700 class MessageLoop;
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
701 class gfxContext;
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
702 class nsIWidget;
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
703
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
704 namespace mozilla {
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
705 +namespace gfx {
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
706 +class DrawTarget;
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
707 +}
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
708 +
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
709 namespace layers {
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
710
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
711 class APZCTreeManager;
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
712 class AsyncCompositionManager;
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
713 class LayerManagerComposite;
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
714 class LayerTransactionParent;
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
715
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
716 struct ScopedLayerTreeRegistration
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
717 @@ -216,17 +220,17 @@ protected:
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
718 virtual PLayerTransactionParent*
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
719 AllocPLayerTransactionParent(const nsTArray<LayersBackend>& aBackendHints,
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
720 const uint64_t& aId,
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
721 TextureFactoryIdentifier* aTextureFactoryIdentifier,
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
722 bool* aSuccess);
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
723 virtual bool DeallocPLayerTransactionParent(PLayerTransactionParent* aLayers);
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
724 virtual void ScheduleTask(CancelableTask*, int);
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
725 virtual void Composite();
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
726 - virtual void ComposeToTarget(gfxContext* aTarget);
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
727 + virtual void ComposeToTarget(gfx::DrawTarget* aTarget);
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
728
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
729 void SetEGLSurfaceSize(int width, int height);
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
730
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
731 private:
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
732 void InitializeLayerManager(const nsTArray<LayersBackend>& aBackendHints);
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
733 void PauseComposition();
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
734 void ResumeComposition();
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
735 void ResumeCompositionAndResize(int width, int height);
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
736 diff --git a/gfx/layers/ipc/LayerTransactionParent.cpp b/gfx/layers/ipc/LayerTransactionParent.cpp
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
737 --- a/gfx/layers/ipc/LayerTransactionParent.cpp
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
738 +++ b/gfx/layers/ipc/LayerTransactionParent.cpp
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
739 @@ -195,17 +195,17 @@ LayerTransactionParent::RecvUpdate(const
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
740 MOZ_LAYERS_LOG(("[ParentSide] received txn with %d edits", cset.Length()));
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
741
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
742 if (mDestroyed || !layer_manager() || layer_manager()->IsDestroyed()) {
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
743 return true;
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
744 }
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
745
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
746 EditReplyVector replyv;
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
747
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
748 - layer_manager()->BeginTransactionWithTarget(nullptr);
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
749 + layer_manager()->BeginTransactionWithDrawTarget(nullptr);
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
750
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
751 for (EditArray::index_type i = 0; i < cset.Length(); ++i) {
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
752 const Edit& edit = cset[i];
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
753
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
754 switch (edit.type()) {
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
755 // Create* ops
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
756 case Edit::TOpCreateThebesLayer: {
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
757 MOZ_LAYERS_LOG(("[ParentSide] CreateThebesLayer"));
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
758 diff --git a/gfx/layers/opengl/CompositorOGL.cpp b/gfx/layers/opengl/CompositorOGL.cpp
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
759 --- a/gfx/layers/opengl/CompositorOGL.cpp
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
760 +++ b/gfx/layers/opengl/CompositorOGL.cpp
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
761 @@ -1256,21 +1256,20 @@ CompositorOGL::EndFrame()
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
762 #ifdef MOZ_DUMP_PAINTING
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
763 if (gfxUtils::sDumpPainting) {
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
764 nsIntRect rect;
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
765 if (mUseExternalSurfaceSize) {
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
766 rect = nsIntRect(0, 0, mSurfaceSize.width, mSurfaceSize.height);
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
767 } else {
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
768 mWidget->GetBounds(rect);
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
769 }
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
770 - nsRefPtr<gfxASurface> surf = gfxPlatform::GetPlatform()->CreateOffscreenSurface(rect.Size(), GFX_CONTENT_COLOR_ALPHA);
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
771 - nsRefPtr<gfxContext> ctx = new gfxContext(surf);
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
772 - CopyToTarget(ctx, mCurrentRenderTarget->GetTransform());
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
773 + RefPtr<DrawTarget> target = gfxPlatform::GetPlatform()->CreateOffscreenContentDrawTarget(IntSize(rect.width, rect.height), FORMAT_B8G8R8A8);
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
774 + CopyToTarget(target, mCurrentRenderTarget->GetTransform());
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
775
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
776 - WriteSnapshotToDumpFile(this, surf);
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
777 + WriteSnapshotToDumpFile(this, target);
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
778 }
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
779 #endif
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
780
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
781 mFrameInProgress = false;
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
782
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
783 if (mTarget) {
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
784 CopyToTarget(mTarget, mCurrentRenderTarget->GetTransform());
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
785 mGLContext->fBindBuffer(LOCAL_GL_ARRAY_BUFFER, 0);
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
786 @@ -1330,60 +1329,55 @@ CompositorOGL::AbortFrame()
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
787 void
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
788 CompositorOGL::SetDestinationSurfaceSize(const gfx::IntSize& aSize)
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
789 {
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
790 mSurfaceSize.width = aSize.width;
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
791 mSurfaceSize.height = aSize.height;
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
792 }
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
793
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
794 void
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
795 -CompositorOGL::CopyToTarget(gfxContext *aTarget, const gfxMatrix& aTransform)
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
796 +CompositorOGL::CopyToTarget(DrawTarget *aTarget, const gfxMatrix& aTransform)
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
797 {
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
798 - nsIntRect rect;
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
799 + IntRect rect;
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
800 if (mUseExternalSurfaceSize) {
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
801 - rect = nsIntRect(0, 0, mSurfaceSize.width, mSurfaceSize.height);
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
802 + rect = IntRect(0, 0, mSurfaceSize.width, mSurfaceSize.height);
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
803 } else {
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
804 - rect = nsIntRect(0, 0, mWidgetSize.width, mWidgetSize.height);
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
805 + rect = IntRect(0, 0, mWidgetSize.width, mWidgetSize.height);
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
806 }
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
807 GLint width = rect.width;
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
808 GLint height = rect.height;
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
809
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
810 if ((int64_t(width) * int64_t(height) * int64_t(4)) > PR_INT32_MAX) {
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
811 NS_ERROR("Widget size too big - integer overflow!");
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
812 return;
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
813 }
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
814
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
815 - nsRefPtr<gfxImageSurface> imageSurface =
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
816 - new gfxImageSurface(gfxIntSize(width, height),
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
817 - gfxImageFormatARGB32);
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
818 -
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
819 mGLContext->fBindFramebuffer(LOCAL_GL_FRAMEBUFFER, 0);
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
820
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
821 if (!mGLContext->IsGLES2()) {
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
822 // GLES2 promises that binding to any custom FBO will attach
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
823 // to GL_COLOR_ATTACHMENT0 attachment point.
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
824 mGLContext->fReadBuffer(LOCAL_GL_BACK);
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
825 }
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
826
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
827 - NS_ASSERTION(imageSurface->Stride() == width * 4,
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
828 - "Image Surfaces being created with weird stride!");
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
829 -
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
830 - mGLContext->ReadPixelsIntoImageSurface(imageSurface);
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
831 + RefPtr<SourceSurface> source =
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
832 + mGLContext->ReadPixelsToSourceSurface(IntSize(width, height));
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
833
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
834 // Map from GL space to Cairo space and reverse the world transform.
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
835 - gfxMatrix glToCairoTransform = aTransform;
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
836 + Matrix glToCairoTransform = MatrixForThebesMatrix(aTransform);
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
837 glToCairoTransform.Invert();
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
838 glToCairoTransform.Scale(1.0, -1.0);
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
839 - glToCairoTransform.Translate(-gfxPoint(0.0, height));
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
840 + glToCairoTransform.Translate(0.0, -height);
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
841
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
842 - gfxContextAutoSaveRestore restore(aTarget);
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
843 - aTarget->SetOperator(gfxContext::OPERATOR_SOURCE);
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
844 - aTarget->SetMatrix(glToCairoTransform);
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
845 - aTarget->SetSource(imageSurface);
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
846 - aTarget->Paint();
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
847 + Matrix oldMatrix = aTarget->GetTransform();
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
848 + aTarget->SetTransform(glToCairoTransform);
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
849 + Rect floatRect = Rect(rect.x, rect.y, rect.width, rect.height);
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
850 + aTarget->DrawSurface(source, floatRect, floatRect, DrawSurfaceOptions(), DrawOptions(1.0f, OP_SOURCE));
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
851 + aTarget->SetTransform(oldMatrix);
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
852 + aTarget->Flush();
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
853 }
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
854
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
855 double
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
856 CompositorOGL::AddFrameAndGetFps(const TimeStamp& timestamp)
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
857 {
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
858 if (sDrawFPS) {
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
859 if (!mFPS) {
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
860 mFPS = new FPSState();
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
861 diff --git a/gfx/layers/opengl/CompositorOGL.h b/gfx/layers/opengl/CompositorOGL.h
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
862 --- a/gfx/layers/opengl/CompositorOGL.h
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
863 +++ b/gfx/layers/opengl/CompositorOGL.h
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
864 @@ -5,32 +5,30 @@
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
865
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
866 #ifndef MOZILLA_GFX_COMPOSITOROGL_H
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
867 #define MOZILLA_GFX_COMPOSITOROGL_H
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
868
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
869 #include "GLContextTypes.h" // for GLContext, etc
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
870 #include "GLDefs.h" // for GLuint, LOCAL_GL_TEXTURE_2D, etc
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
871 #include "LayerManagerOGLProgram.h" // for ShaderProgramOGL, etc
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
872 #include "Units.h" // for ScreenPoint
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
873 -#include "gfxContext.h" // for gfxContext
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
874 -#include "gfxPoint.h" // for gfxIntSize
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
875 #include "mozilla/Assertions.h" // for MOZ_ASSERT, etc
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
876 #include "mozilla/Attributes.h" // for MOZ_OVERRIDE, MOZ_FINAL
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
877 #include "mozilla/RefPtr.h" // for TemporaryRef, RefPtr
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
878 +#include "mozilla/gfx/2D.h" // for DrawTarget
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
879 #include "mozilla/gfx/BaseSize.h" // for BaseSize
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
880 #include "mozilla/gfx/Point.h" // for IntSize, Point
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
881 #include "mozilla/gfx/Rect.h" // for Rect, IntRect
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
882 #include "mozilla/gfx/Types.h" // for Float, SurfaceFormat, etc
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
883 #include "mozilla/layers/Compositor.h" // for SurfaceInitMode, Compositor, etc
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
884 #include "mozilla/layers/CompositorTypes.h" // for MaskType::NumMaskTypes, etc
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
885 #include "mozilla/layers/LayersTypes.h"
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
886 #include "nsAutoPtr.h" // for nsRefPtr, nsAutoPtr
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
887 #include "nsCOMPtr.h" // for already_AddRefed
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
888 #include "nsDebug.h" // for NS_ASSERTION, NS_WARNING
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
889 -#include "nsISupportsImpl.h" // for gfxContext::AddRef, etc
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
890 #include "nsSize.h" // for nsIntSize
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
891 #include "nsTArray.h" // for nsAutoTArray, nsTArray, etc
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
892 #include "nsThreadUtils.h" // for nsRunnable
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
893 #include "nsTraceRefcnt.h" // for MOZ_COUNT_CTOR, etc
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
894 #include "nsXULAppAPI.h" // for XRE_GetProcessType
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
895 #include "nscore.h" // for NS_IMETHOD
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
896 #include "VBOArena.h" // for gl::VBOArena
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
897
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
898 @@ -101,39 +99,39 @@ public:
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
899 const gfx::Point& aOffset) MOZ_OVERRIDE;
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
900
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
901 virtual void EndFrame() MOZ_OVERRIDE;
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
902 virtual void EndFrameForExternalComposition(const gfxMatrix& aTransform) MOZ_OVERRIDE;
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
903 virtual void AbortFrame() MOZ_OVERRIDE;
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
904
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
905 virtual bool SupportsPartialTextureUpdate() MOZ_OVERRIDE;
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
906
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
907 - virtual bool CanUseCanvasLayerForSize(const gfxIntSize &aSize) MOZ_OVERRIDE
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
908 + virtual bool CanUseCanvasLayerForSize(const gfx::IntSize &aSize) MOZ_OVERRIDE
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
909 {
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
910 if (!mGLContext)
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
911 return false;
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
912 int32_t maxSize = GetMaxTextureSize();
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
913 - return aSize <= gfxIntSize(maxSize, maxSize);
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
914 + return aSize <= gfx::IntSize(maxSize, maxSize);
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
915 }
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
916
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
917 virtual int32_t GetMaxTextureSize() const MOZ_OVERRIDE;
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
918
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
919 /**
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
920 * Set the size of the EGL surface we're rendering to, if we're rendering to
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
921 * an EGL surface.
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
922 */
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
923 virtual void SetDestinationSurfaceSize(const gfx::IntSize& aSize) MOZ_OVERRIDE;
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
924
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
925 virtual void SetScreenRenderOffset(const ScreenPoint& aOffset) MOZ_OVERRIDE {
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
926 mRenderOffset = aOffset;
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
927 }
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
928
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
929 virtual void MakeCurrent(MakeCurrentFlags aFlags = 0) MOZ_OVERRIDE;
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
930
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
931 - virtual void SetTargetContext(gfxContext* aTarget) MOZ_OVERRIDE
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
932 + virtual void SetTargetContext(gfx::DrawTarget* aTarget) MOZ_OVERRIDE
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
933 {
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
934 mTarget = aTarget;
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
935 }
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
936
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
937 virtual void PrepareViewport(const gfx::IntSize& aSize,
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
938 const gfxMatrix& aWorldTransform) MOZ_OVERRIDE;
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
939
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
940
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
941 @@ -166,17 +164,17 @@ public:
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
942 * Doing so lets us use gralloc the way it has been designed to be used
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
943 * (see https://wiki.mozilla.org/Platform/GFX/Gralloc)
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
944 */
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
945 GLuint GetTemporaryTexture(GLenum aUnit);
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
946 private:
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
947 /**
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
948 * Context target, nullptr when drawing directly to our swap chain.
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
949 */
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
950 - nsRefPtr<gfxContext> mTarget;
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
951 + RefPtr<gfx::DrawTarget> mTarget;
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
952
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
953 /** Widget associated with this compositor */
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
954 nsIWidget *mWidget;
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
955 nsIntSize mWidgetSize;
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
956 nsRefPtr<GLContext> mGLContext;
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
957
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
958 /** The size of the surface we are rendering to */
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
959 nsIntSize mSurfaceSize;
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
960 @@ -295,17 +293,17 @@ private:
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
961 TextureSource *aTexture);
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
962
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
963 void CleanupResources();
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
964
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
965 /**
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
966 * Copies the content of our backbuffer to the set transaction target.
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
967 * Does not restore the target FBO, so only call from EndFrame.
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
968 */
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
969 - void CopyToTarget(gfxContext *aTarget, const gfxMatrix& aWorldMatrix);
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
970 + void CopyToTarget(gfx::DrawTarget* aTarget, const gfxMatrix& aWorldMatrix);
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
971
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
972 /**
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
973 * Records the passed frame timestamp and returns the current estimated FPS.
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
974 */
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
975 double AddFrameAndGetFps(const TimeStamp& timestamp);
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
976
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
977 bool mDestroyed;
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
978
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
979 diff --git a/gfx/thebes/gfx2DGlue.h b/gfx/thebes/gfx2DGlue.h
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
980 --- a/gfx/thebes/gfx2DGlue.h
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
981 +++ b/gfx/thebes/gfx2DGlue.h
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
982 @@ -194,16 +194,22 @@ inline JoinStyle ToJoinStyle(gfxContext:
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
983 }
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
984
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
985 inline gfxMatrix ThebesMatrix(const Matrix &aMatrix)
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
986 {
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
987 return gfxMatrix(aMatrix._11, aMatrix._12, aMatrix._21,
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
988 aMatrix._22, aMatrix._31, aMatrix._32);
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
989 }
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
990
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
991 +inline Matrix MatrixForThebesMatrix(const gfxMatrix &aMatrix)
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
992 +{
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
993 + return Matrix(aMatrix.xx, aMatrix.yx, aMatrix.xy,
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
994 + aMatrix.yy, aMatrix.x0, aMatrix.y0);
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
995 +}
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
996 +
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
997 inline gfxImageFormat SurfaceFormatToImageFormat(SurfaceFormat aFormat)
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
998 {
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
999 switch (aFormat) {
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
1000 case FORMAT_B8G8R8A8:
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
1001 return gfxImageFormatARGB32;
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
1002 case FORMAT_B8G8R8X8:
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
1003 return gfxImageFormatRGB24;
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
1004 case FORMAT_R5G6B5:
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
1005