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 (aDestSurface && aDestSurface->GetType() != gfxASurface::SurfaceTypeImage) {
MOZ_ASSERT(false, "Destination surface must be ImageSurface type.");
return;
}
nsRefPtr<gfxImageSurface> readSurf;
nsRefPtr<gfxImageSurface> resultSurf;
@ -93,9 +88,9 @@ CopyableCanvasLayer::UpdateSurface(gfxASurface* aDestSurface, Layer* aMaskLayer)
? gfxASurface::ImageFormatRGB24
: gfxASurface::ImageFormatARGB32;
if (aDestSurface) {
resultSurf = static_cast<gfxImageSurface*>(aDestSurface);
} else {
bool needsTempSurface = !aDestSurface ||
!(resultSurf = aDestSurface->GetAsImageSurface());
if (needsTempSurface) {
resultSurf = GetTempSurface(readSize, format);
}
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
if (!aDestSurface) {
if (needsTempSurface) {
mSurface = resultSurf;
}
}

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

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