Bug 279922 - <svg:image> not handling renderer surface creation fail

(libart).  r=pavlov
This commit is contained in:
tor%cs.brown.edu 2005-02-07 14:53:00 +00:00
Родитель ce1e5bcb15
Коммит 24a7beb3c1
1 изменённых файлов: 22 добавлений и 4 удалений

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

@ -434,16 +434,28 @@ nsSVGImageFrame::ConvertFrame(gfxIImageFrame *aNewFrame)
aNewFrame->GetWidth(&width);
aNewFrame->GetHeight(&height);
nsISVGOuterSVGFrame *outerSVGFrame = GetOuterSVGFrame();
nsresult rv;
nsCOMPtr<nsISVGRenderer> renderer;
outerSVGFrame->GetRenderer(getter_AddRefs(renderer));
renderer->CreateSurface(width, height, getter_AddRefs(mSurface));
nsISVGOuterSVGFrame *outerSVGFrame = GetOuterSVGFrame();
if (!outerSVGFrame)
return NS_ERROR_FAILURE;
rv = outerSVGFrame->GetRenderer(getter_AddRefs(renderer));
if (NS_FAILED(rv))
return rv;
rv = renderer->CreateSurface(width, height, getter_AddRefs(mSurface));
if (NS_FAILED(rv))
return rv;
PRUint8 *data, *target;
PRUint32 length;
PRInt32 stride;
mSurface->Lock();
mSurface->GetData(&data, &length, &stride);
if (!data) {
mSurface->Unlock();
return NS_ERROR_FAILURE;
}
#ifdef XP_WIN
stride = -stride;
#endif
@ -455,7 +467,13 @@ nsSVGImageFrame::ConvertFrame(gfxIImageFrame *aNewFrame)
PRUint32 bpr, abpr;
aNewFrame->GetImageData(&rgb, &length);
aNewFrame->GetImageBytesPerRow(&bpr);
if (!rgb) {
mSurface->Unlock();
aNewFrame->UnlockImageData();
aNewFrame->UnlockAlphaData();
return NS_ERROR_FAILURE;
}
aNewFrame->GetAlphaData(&alpha, &length);
aNewFrame->GetAlphaBytesPerRow(&abpr);