Bug 664764. Part 3: Don't record memory used by gfxWindowsSurface if we actually failed to allocate the surface. r=mattwoodrow

This commit is contained in:
Robert O'Callahan 2012-03-19 12:36:33 +13:00
parent 4ba1788a98
commit f17021b3aa

View File

@ -104,9 +104,11 @@ gfxWindowsSurface::gfxWindowsSurface(HDC dc, const gfxIntSize& realSize, gfxImag
Init(surf);
// DDBs will generally only use 3 bytes per pixel when RGB24
int bytesPerPixel = ((imageFormat == gfxASurface::ImageFormatRGB24) ? 3 : 4);
RecordMemoryUsed(size.width * size.height * bytesPerPixel + sizeof(gfxWindowsSurface));
if (mSurfaceValid) {
// DDBs will generally only use 3 bytes per pixel when RGB24
int bytesPerPixel = ((imageFormat == gfxASurface::ImageFormatRGB24) ? 3 : 4);
RecordMemoryUsed(size.width * size.height * bytesPerPixel + sizeof(gfxWindowsSurface));
}
if (CairoStatus() == 0)
mDC = cairo_win32_surface_get_dc(CairoSurface());