diff --git a/content/canvas/src/CanvasRenderingContext2D.cpp b/content/canvas/src/CanvasRenderingContext2D.cpp index d4ecac5b6d8..052d99c9002 100644 --- a/content/canvas/src/CanvasRenderingContext2D.cpp +++ b/content/canvas/src/CanvasRenderingContext2D.cpp @@ -874,7 +874,7 @@ CanvasRenderingContext2D::EnsureTarget() #endif mTarget = layerManager->CreateDrawTarget(size, format); } else { - mTarget = gfxPlatform::GetPlatform()->CreateOffscreenDrawTarget(size, format); + mTarget = gfxPlatform::GetPlatform()->CreateOffscreenCanvasDrawTarget(size, format); } } @@ -3566,7 +3566,7 @@ CanvasRenderingContext2D::EnsureErrorTarget() return; } - RefPtr errorTarget = gfxPlatform::GetPlatform()->CreateOffscreenDrawTarget(IntSize(1, 1), FORMAT_B8G8R8A8); + RefPtr errorTarget = gfxPlatform::GetPlatform()->CreateOffscreenCanvasDrawTarget(IntSize(1, 1), FORMAT_B8G8R8A8); NS_ABORT_IF_FALSE(errorTarget, "Failed to allocate the error target!"); sErrorTarget = errorTarget; diff --git a/gfx/layers/Layers.cpp b/gfx/layers/Layers.cpp index d7bb2e57896..fdba9778dd5 100644 --- a/gfx/layers/Layers.cpp +++ b/gfx/layers/Layers.cpp @@ -135,7 +135,7 @@ LayerManager::CreateDrawTarget(const IntSize &aSize, SurfaceFormat aFormat) { return gfxPlatform::GetPlatform()-> - CreateOffscreenDrawTarget(aSize, aFormat); + CreateOffscreenCanvasDrawTarget(aSize, aFormat); } TextureFactoryIdentifier diff --git a/gfx/layers/Layers.h b/gfx/layers/Layers.h index c73a656895a..002055d1fd2 100644 --- a/gfx/layers/Layers.h +++ b/gfx/layers/Layers.h @@ -408,8 +408,8 @@ public: CreateOptimalMaskSurface(const gfxIntSize &aSize); /** - * Creates a DrawTarget which is optimized for inter-operating with this - * layermanager. + * Creates a DrawTarget for use with canvas which is optimized for + * inter-operating with this layermanager. */ virtual TemporaryRef CreateDrawTarget(const mozilla::gfx::IntSize &aSize, diff --git a/gfx/layers/basic/BasicCompositor.cpp b/gfx/layers/basic/BasicCompositor.cpp index 66768c26766..e77cc31c7c9 100644 --- a/gfx/layers/basic/BasicCompositor.cpp +++ b/gfx/layers/basic/BasicCompositor.cpp @@ -373,7 +373,7 @@ BasicCompositor::BeginFrame(const gfx::Rect *aClipRectIn, if (mCopyTarget) { // If we have a copy target, then we don't have a widget-provided mDrawTarget (currently). Create a dummy // placeholder so that CreateRenderTarget() works. - mDrawTarget = gfxPlatform::GetPlatform()->CreateOffscreenDrawTarget(IntSize(1,1), FORMAT_B8G8R8A8); + mDrawTarget = gfxPlatform::GetPlatform()->CreateOffscreenCanvasDrawTarget(IntSize(1,1), FORMAT_B8G8R8A8); } else { mDrawTarget = mWidget->StartRemoteDrawing(); } diff --git a/gfx/thebes/gfxPlatform.cpp b/gfx/thebes/gfxPlatform.cpp index 1cfad902922..225a0c802d8 100644 --- a/gfx/thebes/gfxPlatform.cpp +++ b/gfx/thebes/gfxPlatform.cpp @@ -876,7 +876,7 @@ gfxPlatform::CreateDrawTargetForBackend(BackendType aBackend, const IntSize& aSi } RefPtr -gfxPlatform::CreateOffscreenDrawTarget(const IntSize& aSize, SurfaceFormat aFormat) +gfxPlatform::CreateOffscreenCanvasDrawTarget(const IntSize& aSize, SurfaceFormat aFormat) { NS_ASSERTION(mPreferredCanvasBackend, "No backend."); RefPtr target = CreateDrawTargetForBackend(mPreferredCanvasBackend, aSize, aFormat); @@ -888,6 +888,12 @@ gfxPlatform::CreateOffscreenDrawTarget(const IntSize& aSize, SurfaceFormat aForm return CreateDrawTargetForBackend(mFallbackCanvasBackend, aSize, aFormat); } +RefPtr +gfxPlatform::CreateOffscreenContentDrawTarget(const IntSize& aSize, SurfaceFormat aFormat) +{ + NS_ASSERTION(mContentBackend, "No backend."); + return CreateDrawTargetForBackend(mContentBackend, aSize, aFormat); +} RefPtr gfxPlatform::CreateDrawTargetForData(unsigned char* aData, const IntSize& aSize, int32_t aStride, SurfaceFormat aFormat) diff --git a/gfx/thebes/gfxPlatform.h b/gfx/thebes/gfxPlatform.h index e221690642e..b3a53167b37 100644 --- a/gfx/thebes/gfxPlatform.h +++ b/gfx/thebes/gfxPlatform.h @@ -234,8 +234,11 @@ public: virtual already_AddRefed GetThebesSurfaceForDrawTarget(mozilla::gfx::DrawTarget *aTarget); - virtual mozilla::RefPtr - CreateOffscreenDrawTarget(const mozilla::gfx::IntSize& aSize, mozilla::gfx::SurfaceFormat aFormat); + mozilla::RefPtr + CreateOffscreenContentDrawTarget(const mozilla::gfx::IntSize& aSize, mozilla::gfx::SurfaceFormat aFormat); + + mozilla::RefPtr + CreateOffscreenCanvasDrawTarget(const mozilla::gfx::IntSize& aSize, mozilla::gfx::SurfaceFormat aFormat); virtual mozilla::RefPtr CreateDrawTargetForData(unsigned char* aData, const mozilla::gfx::IntSize& aSize, diff --git a/image/src/ClippedImage.cpp b/image/src/ClippedImage.cpp index f42a2e03069..cad1fe070fe 100644 --- a/image/src/ClippedImage.cpp +++ b/image/src/ClippedImage.cpp @@ -232,8 +232,8 @@ ClippedImage::GetFrameInternal(const nsIntSize& aViewportSize, // Create a surface to draw into. mozilla::RefPtr target; target = gfxPlatform::GetPlatform()-> - CreateOffscreenDrawTarget(gfx::IntSize(mClip.width, mClip.height), - gfx::FORMAT_B8G8R8A8); + CreateOffscreenCanvasDrawTarget(gfx::IntSize(mClip.width, mClip.height), + gfx::FORMAT_B8G8R8A8); nsRefPtr surface = gfxPlatform::GetPlatform()-> GetThebesSurfaceForDrawTarget(target);