Bug 590403. If we are asked to create a similar surface and our underling surface isn't valid just return null. r=jmuizelaar

This commit is contained in:
Timothy Nikkel 2010-08-27 18:15:08 -05:00
parent 7e9cbdb239
commit 78f46f0276
2 changed files with 8 additions and 0 deletions

View File

@ -310,6 +310,10 @@ already_AddRefed<gfxASurface>
gfxASurface::CreateSimilarSurface(gfxContentType aContent,
const gfxIntSize& aSize)
{
if (!mSurface || !mSurfaceValid) {
return nsnull;
}
cairo_surface_t *surface =
cairo_surface_create_similar(mSurface, cairo_content_t(aContent),
aSize.width, aSize.height);

View File

@ -182,6 +182,10 @@ already_AddRefed<gfxASurface>
gfxXlibSurface::CreateSimilarSurface(gfxContentType aContent,
const gfxIntSize& aSize)
{
if (!mSurface || !mSurfaceValid) {
return nsnull;
}
if (aContent == CONTENT_COLOR) {
// cairo_surface_create_similar will use a matching visual if it can.
// However, systems with 16-bit or indexed default visuals may benefit