Fix bug 137295 -- gaps in images sometimes. We need to work around a CopyDeepMask bug when the clip region is complex, by restricting the clip region to the image destination rectangle. r=sdagley, sr=scc.

This commit is contained in:
sfraser%netscape.com 2002-09-20 06:33:06 +00:00
Родитель 7af99a0c3d
Коммит b3280c8d59
1 изменённых файлов: 20 добавлений и 5 удалений

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

@ -826,16 +826,31 @@ void nsImageMac::CopyBitsWithMask(const BitMap* srcBits, const BitMap* maskBits,
{
if (maskBits)
{
StRegionFromPool clipRegion;
StRegionFromPool origClipRegion;
if (inDrawingToPort)
{
// we need to pass in the clip region, even if it doesn't intersect the image, to avoid a bug
// 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);
::GetClip(origClipRegion);
// There is a bug in the OS that causes bad image drawing if the clip region in
// the destination port is complex (has holes in??), which hits us on pages with iframes.
// To work around this, temporarily set the clip to the intersection of the clip
// and this image (which, most of the time, will be rectangular). See bug 137295.
StRegionFromPool newClip;
::CopyRgn(origClipRegion, newClip);
::SetRectRgn(newClip, destRect.left, destRect.top, destRect.right, destRect.bottom);
::SetClip(newClip);
}
::CopyDeepMask(srcBits, maskBits, destBits, &srcRect, &maskRect, &destRect, srcCopy, inDrawingToPort ? clipRegion : (RgnHandle)nsnull);
::CopyDeepMask(srcBits, maskBits, destBits, &srcRect, &maskRect, &destRect, srcCopy, nsnull);
if (inDrawingToPort)
{
::SetClip(origClipRegion);
}
}
else
{