Bug 593361. Part 1: Limit the region of a non-retained layer we repaint to the clip region of the destination buffer. r=tnikkel

--HG--
extra : rebase_source : 20bea1e114bffe61bb621e7e99757cccd9fc98a0
This commit is contained in:
Robert O'Callahan 2010-09-06 15:00:10 +12:00
Родитель 4d0d597a6f
Коммит 349f37cc97
1 изменённых файлов: 24 добавлений и 10 удалений

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

@ -384,6 +384,17 @@ ShouldRetainTransparentSurface(PRUint32 aContentFlags,
}
}
static nsIntRegion
IntersectWithClip(const nsIntRegion& aRegion, gfxContext* aContext)
{
gfxRect clip = aContext->GetClipExtents();
clip.RoundOut();
nsIntRect r(clip.X(), clip.Y(), clip.Width(), clip.Height());
nsIntRegion result;
result.And(aRegion, r);
return result;
}
void
BasicThebesLayer::Paint(gfxContext* aContext,
LayerManager::DrawThebesLayerCallback aCallback,
@ -409,17 +420,20 @@ BasicThebesLayer::Paint(gfxContext* aContext,
mValidRegion.SetEmpty();
mBuffer.Clear();
nsIntRegion toDraw = IntersectWithClip(mVisibleRegion, target);
if (!toDraw.IsEmpty()) {
target->Save();
gfxUtils::ClipToRegionSnapped(target, mVisibleRegion);
gfxUtils::ClipToRegionSnapped(target, toDraw);
if (aOpacity != 1.0) {
target->PushGroup(contentType);
}
aCallback(this, target, mVisibleRegion, nsIntRegion(), aCallbackData);
aCallback(this, target, toDraw, nsIntRegion(), aCallbackData);
if (aOpacity != 1.0) {
target->PopGroupToSource();
target->Paint(aOpacity);
}
target->Restore();
}
return;
}