From 41474b9f251cdb5fae45a86fd09a219418db4b67 Mon Sep 17 00:00:00 2001 From: "pinkerton%netscape.com" Date: Thu, 29 Oct 1998 20:03:57 +0000 Subject: [PATCH] Don't use the offscreen pixmap if it is null (low memory situations) git-svn-id: svn://10.0.0.236/trunk@13664 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/gfx/src/mac/nsRenderingContextMac.cpp | 21 ++++++++++--------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/mozilla/gfx/src/mac/nsRenderingContextMac.cpp b/mozilla/gfx/src/mac/nsRenderingContextMac.cpp index 31068652e65..18ce8a27f1b 100644 --- a/mozilla/gfx/src/mac/nsRenderingContextMac.cpp +++ b/mozilla/gfx/src/mac/nsRenderingContextMac.cpp @@ -1116,7 +1116,6 @@ NS_IMETHODIMP nsRenderingContextMac :: CopyOffScreenBits(nsDrawingSurface aSrcSu const nsRect &aDestBounds, PRUint32 aCopyFlags) { - PixMapHandle offscreenPM; PixMapPtr srcpix; PixMapPtr destpix; RGBColor rgbblack = {0x0000,0x0000,0x0000}; @@ -1154,15 +1153,17 @@ NS_IMETHODIMP nsRenderingContextMac :: CopyOffScreenBits(nsDrawingSurface aSrcSu destpix = *((CGrafPtr)destport)->portPixMap; - offscreenPM = ::GetGWorldPixMap((GWorldPtr)aSrcSurf); - LockPixels(offscreenPM); - srcpix = (PixMapPtr)*offscreenPM; - ::RGBForeColor(&rgbblack); - ::RGBBackColor(&rgbwhite); - - ::CopyBits((BitMap*)srcpix,(BitMap*)destpix,&srcrect,&dstrect,ditherCopy,0L); - UnlockPixels(offscreenPM); - + PixMapHandle offscreenPM = ::GetGWorldPixMap((GWorldPtr)aSrcSurf); + if ( offscreenPM ) { + LockPixels(offscreenPM); + srcpix = (PixMapPtr)*offscreenPM; + ::RGBForeColor(&rgbblack); + ::RGBBackColor(&rgbwhite); + + ::CopyBits((BitMap*)srcpix,(BitMap*)destpix,&srcrect,&dstrect,ditherCopy,0L); + UnlockPixels(offscreenPM); + } + return NS_OK; }