Bug 897409. Use a temporary surface instead of forcing image surfaces. r=mattwoodrow

This commit is contained in:
Nicholas Cameron 2013-07-31 09:45:31 +12:00
Родитель fb76ae538d
Коммит 4c625ffcef
2 изменённых файлов: 5 добавлений и 10 удалений

Просмотреть файл

@ -74,11 +74,6 @@ CopyableCanvasLayer::UpdateSurface(gfxASurface* aDestSurface, Layer* aMaskLayer)
} }
if (mGLContext) { if (mGLContext) {
if (aDestSurface && aDestSurface->GetType() != gfxASurface::SurfaceTypeImage) {
MOZ_ASSERT(false, "Destination surface must be ImageSurface type.");
return;
}
nsRefPtr<gfxImageSurface> readSurf; nsRefPtr<gfxImageSurface> readSurf;
nsRefPtr<gfxImageSurface> resultSurf; nsRefPtr<gfxImageSurface> resultSurf;
@ -93,9 +88,9 @@ CopyableCanvasLayer::UpdateSurface(gfxASurface* aDestSurface, Layer* aMaskLayer)
? gfxASurface::ImageFormatRGB24 ? gfxASurface::ImageFormatRGB24
: gfxASurface::ImageFormatARGB32; : gfxASurface::ImageFormatARGB32;
if (aDestSurface) { bool needsTempSurface = !aDestSurface ||
resultSurf = static_cast<gfxImageSurface*>(aDestSurface); !(resultSurf = aDestSurface->GetAsImageSurface());
} else { if (needsTempSurface) {
resultSurf = GetTempSurface(readSize, format); resultSurf = GetTempSurface(readSize, format);
} }
MOZ_ASSERT(resultSurf); MOZ_ASSERT(resultSurf);
@ -156,7 +151,7 @@ CopyableCanvasLayer::UpdateSurface(gfxASurface* aDestSurface, Layer* aMaskLayer)
} }
// stick our surface into mSurface, so that the Paint() path is the same // stick our surface into mSurface, so that the Paint() path is the same
if (!aDestSurface) { if (needsTempSurface) {
mSurface = resultSurf; mSurface = resultSurf;
} }
} }

Просмотреть файл

@ -66,7 +66,7 @@ CanvasClient2D::Update(gfx::IntSize aSize, ClientCanvasLayer* aLayer)
: gfxASurface::CONTENT_COLOR_ALPHA; : gfxASurface::CONTENT_COLOR_ALPHA;
mDeprecatedTextureClient->EnsureAllocated(aSize, contentType); mDeprecatedTextureClient->EnsureAllocated(aSize, contentType);
gfxASurface* surface = mDeprecatedTextureClient->LockImageSurface(); gfxASurface* surface = mDeprecatedTextureClient->LockSurface();
aLayer->UpdateSurface(surface); aLayer->UpdateSurface(surface);
mDeprecatedTextureClient->Unlock(); mDeprecatedTextureClient->Unlock();
} }