bug 332713 support getting image pixel data back for an optimized image

r=stuart
This commit is contained in:
cbiesinger%web.de 2006-04-07 18:35:04 +00:00
Родитель 5274a28c3d
Коммит 17b624959b
1 изменённых файлов: 19 добавлений и 0 удалений

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

@ -208,6 +208,21 @@ nsThebesImage::LockImagePixels(PRBool aMaskPixels)
{
if (aMaskPixels)
return NS_ERROR_NOT_IMPLEMENTED;
if (mOptSurface && !mImageSurface) {
// Recover the pixels
mImageSurface = new gfxImageSurface(gfxImageSurface::ImageFormatARGB32,
mWidth, mHeight);
if (!mImageSurface)
return NS_ERROR_OUT_OF_MEMORY;
nsRefPtr<gfxContext> context = new gfxContext(mImageSurface);
if (!context) {
mImageSurface = nsnull;
return NS_ERROR_OUT_OF_MEMORY;
}
context->SetOperator(gfxContext::OPERATOR_SOURCE);
context->SetSource(mOptSurface);
context->Paint();
}
return NS_OK;
}
@ -216,6 +231,10 @@ nsThebesImage::UnlockImagePixels(PRBool aMaskPixels)
{
if (aMaskPixels)
return NS_ERROR_NOT_IMPLEMENTED;
if (mImageSurface && mOptSurface) {
// Don't need the pixel data anymore
mImageSurface = nsnull;
}
return NS_OK;
}