diff --git a/gfx/src/mac/nsImageMac.cpp b/gfx/src/mac/nsImageMac.cpp index afefabb93cea..daf1d6f376d2 100644 --- a/gfx/src/mac/nsImageMac.cpp +++ b/gfx/src/mac/nsImageMac.cpp @@ -370,7 +370,7 @@ NS_IMETHODIMP nsImageMac::Draw(nsIRenderingContext &aContext, nsDrawingSurface a CopyBitsWithMask((BitMap*)(&mImagePixmap), mMaskBitsHandle ? (BitMap*)(&mMaskPixmap) : nsnull, mAlphaDepth, (BitMap*)(*destPixels), - srcRect, maskRect, dstRect); + srcRect, maskRect, dstRect, PR_TRUE); } return NS_OK; @@ -428,7 +428,7 @@ NS_IMETHODIMP nsImageMac :: DrawToImage(nsIImage* aDstImage, PRInt32 aDX, PRInt3 CopyBitsWithMask((BitMap*)(&mImagePixmap), mMaskBitsHandle ? (BitMap*)(&mMaskPixmap) : nsnull, mAlphaDepth, - (BitMap*)(destPixels), srcRect, maskRect, dstRect); + (BitMap*)(destPixels), srcRect, maskRect, dstRect, PR_FALSE); aDstImage->UnlockImagePixels(PR_FALSE); aDstImage->UnlockImagePixels(PR_TRUE); @@ -822,15 +822,20 @@ OSErr nsImageMac::AllocateGWorld(PRInt16 depth, CTabHandle colorTable, const Rec } void nsImageMac::CopyBitsWithMask(const BitMap* srcBits, const BitMap* maskBits, PRInt16 maskDepth, const BitMap* destBits, - const Rect& srcRect, const Rect& maskRect, const Rect& destRect) + const Rect& srcRect, const Rect& maskRect, const Rect& destRect, PRBool inDrawingToPort) { if (maskBits) { - // we need to pass in the clip region, even if it doesn't intersect the image, to avoid a bug - // on Mac OS X that causes bad image drawing (see bug 137295). StRegionFromPool clipRegion; - ::GetClip(clipRegion); - ::CopyDeepMask(srcBits, maskBits, destBits, &srcRect, &maskRect, &destRect, srcCopy, clipRegion); + + if (inDrawingToPort) + { + // we need to pass in the clip region, even if it doesn't intersect the image, to avoid a bug + // on Mac OS X that causes bad image drawing (see bug 137295). + ::GetClip(clipRegion); + } + + ::CopyDeepMask(srcBits, maskBits, destBits, &srcRect, &maskRect, &destRect, srcCopy, inDrawingToPort ? clipRegion : nsnull); } else { @@ -889,7 +894,7 @@ nsImageMac :: ConvertToPICT ( PicHandle* outPicture ) // copy from the destination into our temp GWorld, to get the background CopyBitsWithMask((BitMap*)(&mImagePixmap), mMaskBitsHandle ? (BitMap*)(&mMaskPixmap) : nsnull, mAlphaDepth, - (BitMap*)(*tempPixMap), picFrame, maskFrame, picFrame); + (BitMap*)(*tempPixMap), picFrame, maskFrame, picFrame, PR_FALSE); // now copy into the picture GWorldPtr currPort; @@ -993,7 +998,7 @@ nsImageMac::ConvertToIcon( const nsRect& aSrcRegion, } //returns null if there size specified isn't a valid size for an icon - OSType iconType = MakeIconType(aIconSize, aIconDepth, false); + OSType iconType = MakeIconType(aIconSize, aIconDepth, PR_FALSE); if (iconType == nil) { return NS_ERROR_INVALID_ARG; } @@ -1080,7 +1085,7 @@ nsImageMac::ConvertAlphaToIconMask( const nsRect& aSrcRegion, *aOutIconType = nsnull; //returns null if there size specified isn't a valid size for an icon - OSType iconType = MakeIconType(aMaskSize, aMaskDepth, true); + OSType iconType = MakeIconType(aMaskSize, aMaskDepth, PR_TRUE); if (iconType == nil) { return NS_ERROR_INVALID_ARG; } @@ -1608,7 +1613,7 @@ nsresult nsImageMac::DrawTileQuickly(nsIRenderingContext &aContext, // CopyBits will do the truncation for us at the edges CopyBitsWithMask((BitMap*)(&mImagePixmap), mMaskBitsHandle ? (BitMap*)(&mMaskPixmap) : nsnull, mAlphaDepth, - (BitMap*)(*destPixels), imageRect, imageRect, imageDestRect); + (BitMap*)(*destPixels), imageRect, imageRect, imageDestRect, PR_TRUE); } } @@ -1791,7 +1796,7 @@ nsresult nsImageMac::DrawTileQuickly(nsIRenderingContext &aContext, // finally, copy to the destination CopyBitsWithMask((BitMap*)(*tilingPixels), maskingPixels ? (BitMap*)(*maskingPixels) : nsnull, mAlphaDepth, - (BitMap*)(*destPixels), tileRect, tileRect, tileDestRect); + (BitMap*)(*destPixels), tileRect, tileRect, tileDestRect, PR_TRUE); } // scope for locks diff --git a/gfx/src/mac/nsImageMac.h b/gfx/src/mac/nsImageMac.h index 7ae0fbfc39fa..6079408b6f9b 100644 --- a/gfx/src/mac/nsImageMac.h +++ b/gfx/src/mac/nsImageMac.h @@ -181,7 +181,7 @@ protected: Handle *aMask); static void CopyBitsWithMask(const BitMap* srcBits, const BitMap* maskBits, PRInt16 maskDepth, const BitMap* destBits, - const Rect& srcRect, const Rect& maskRect, const Rect& destRect); + const Rect& srcRect, const Rect& maskRect, const Rect& destRect, PRBool inDrawingToPort); static PRBool RenderingToPrinter(nsIRenderingContext &aContext);