Pass back an error when allocating offscreen fails on GTK. bug=70424 r=pavlov@netscape.com, sr=attinasi@netscape.com

This commit is contained in:
kmcclusk%netscape.com 2001-10-08 20:17:26 +00:00
Родитель 25161eec21
Коммит fb44a17136
2 изменённых файлов: 8 добавлений и 3 удалений

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

@ -265,6 +265,8 @@ NS_IMETHODIMP nsDrawingSurfaceGTK :: Init(GdkDrawable *aDrawable, GdkGC *aGC)
gdk_image_destroy(mImage); gdk_image_destroy(mImage);
mImage = nsnull; mImage = nsnull;
g_return_val_if_fail(mPixmap != nsnull, NS_ERROR_FAILURE);
return NS_OK; return NS_OK;
} }

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

@ -775,10 +775,11 @@ NS_IMETHODIMP nsRenderingContextGTK::CreateDrawingSurface(nsRect *aBounds,
aSurface = nsnull; aSurface = nsnull;
return NS_ERROR_FAILURE; return NS_ERROR_FAILURE;
} }
g_return_val_if_fail (aBounds != NULL, NS_ERROR_FAILURE); g_return_val_if_fail (aBounds != NULL, NS_ERROR_FAILURE);
g_return_val_if_fail ((aBounds->width > 0) && (aBounds->height > 0), NS_ERROR_FAILURE); g_return_val_if_fail ((aBounds->width > 0) && (aBounds->height > 0), NS_ERROR_FAILURE);
nsresult rv = NS_OK;
nsDrawingSurfaceGTK *surf = new nsDrawingSurfaceGTK(); nsDrawingSurfaceGTK *surf = new nsDrawingSurfaceGTK();
if (surf) if (surf)
@ -786,12 +787,14 @@ NS_IMETHODIMP nsRenderingContextGTK::CreateDrawingSurface(nsRect *aBounds,
NS_ADDREF(surf); NS_ADDREF(surf);
if (!mGC) if (!mGC)
UpdateGC(); UpdateGC();
surf->Init(mGC, aBounds->width, aBounds->height, aSurfFlags); rv = surf->Init(mGC, aBounds->width, aBounds->height, aSurfFlags);
} else {
rv = NS_ERROR_FAILURE;
} }
aSurface = (nsDrawingSurface)surf; aSurface = (nsDrawingSurface)surf;
return NS_OK; return rv;
} }
NS_IMETHODIMP nsRenderingContextGTK::DestroyDrawingSurface(nsDrawingSurface aDS) NS_IMETHODIMP nsRenderingContextGTK::DestroyDrawingSurface(nsDrawingSurface aDS)