Bug 907926 - Supprt having different content/canvas backends in gfxPlatform. r=nrc

This commit is contained in:
Matt Woodrow 2013-08-23 18:13:55 +12:00
parent bd22797dd3
commit 11914fb596
7 changed files with 20 additions and 11 deletions

View File

@ -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<DrawTarget> errorTarget = gfxPlatform::GetPlatform()->CreateOffscreenDrawTarget(IntSize(1, 1), FORMAT_B8G8R8A8);
RefPtr<DrawTarget> errorTarget = gfxPlatform::GetPlatform()->CreateOffscreenCanvasDrawTarget(IntSize(1, 1), FORMAT_B8G8R8A8);
NS_ABORT_IF_FALSE(errorTarget, "Failed to allocate the error target!");
sErrorTarget = errorTarget;

View File

@ -135,7 +135,7 @@ LayerManager::CreateDrawTarget(const IntSize &aSize,
SurfaceFormat aFormat)
{
return gfxPlatform::GetPlatform()->
CreateOffscreenDrawTarget(aSize, aFormat);
CreateOffscreenCanvasDrawTarget(aSize, aFormat);
}
TextureFactoryIdentifier

View File

@ -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<mozilla::gfx::DrawTarget>
CreateDrawTarget(const mozilla::gfx::IntSize &aSize,

View File

@ -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();
}

View File

@ -876,7 +876,7 @@ gfxPlatform::CreateDrawTargetForBackend(BackendType aBackend, const IntSize& aSi
}
RefPtr<DrawTarget>
gfxPlatform::CreateOffscreenDrawTarget(const IntSize& aSize, SurfaceFormat aFormat)
gfxPlatform::CreateOffscreenCanvasDrawTarget(const IntSize& aSize, SurfaceFormat aFormat)
{
NS_ASSERTION(mPreferredCanvasBackend, "No backend.");
RefPtr<DrawTarget> target = CreateDrawTargetForBackend(mPreferredCanvasBackend, aSize, aFormat);
@ -888,6 +888,12 @@ gfxPlatform::CreateOffscreenDrawTarget(const IntSize& aSize, SurfaceFormat aForm
return CreateDrawTargetForBackend(mFallbackCanvasBackend, aSize, aFormat);
}
RefPtr<DrawTarget>
gfxPlatform::CreateOffscreenContentDrawTarget(const IntSize& aSize, SurfaceFormat aFormat)
{
NS_ASSERTION(mContentBackend, "No backend.");
return CreateDrawTargetForBackend(mContentBackend, aSize, aFormat);
}
RefPtr<DrawTarget>
gfxPlatform::CreateDrawTargetForData(unsigned char* aData, const IntSize& aSize, int32_t aStride, SurfaceFormat aFormat)

View File

@ -234,8 +234,11 @@ public:
virtual already_AddRefed<gfxASurface>
GetThebesSurfaceForDrawTarget(mozilla::gfx::DrawTarget *aTarget);
virtual mozilla::RefPtr<mozilla::gfx::DrawTarget>
CreateOffscreenDrawTarget(const mozilla::gfx::IntSize& aSize, mozilla::gfx::SurfaceFormat aFormat);
mozilla::RefPtr<mozilla::gfx::DrawTarget>
CreateOffscreenContentDrawTarget(const mozilla::gfx::IntSize& aSize, mozilla::gfx::SurfaceFormat aFormat);
mozilla::RefPtr<mozilla::gfx::DrawTarget>
CreateOffscreenCanvasDrawTarget(const mozilla::gfx::IntSize& aSize, mozilla::gfx::SurfaceFormat aFormat);
virtual mozilla::RefPtr<mozilla::gfx::DrawTarget>
CreateDrawTargetForData(unsigned char* aData, const mozilla::gfx::IntSize& aSize,

View File

@ -232,8 +232,8 @@ ClippedImage::GetFrameInternal(const nsIntSize& aViewportSize,
// Create a surface to draw into.
mozilla::RefPtr<mozilla::gfx::DrawTarget> 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<gfxASurface> surface = gfxPlatform::GetPlatform()->
GetThebesSurfaceForDrawTarget(target);