Bug 946475 - Clip to the clear area in DrawTargetD2D::ClearRect so that we don't accidentally restore pixels that weren't drawn. r=Bas, a=lsblakk
--- a/gfx/2d/DrawTargetD2D.cpp
+++ b/gfx/2d/DrawTargetD2D.cpp
@@ -716,37 +716,27 @@ DrawTargetD2D::DrawSurfaceWithShadow(Sou
mDevice->Draw(4, 0);
}
void
DrawTargetD2D::ClearRect(const Rect &aRect)
{
MarkChanged();
+ PushClipRect(aRect);
FlushTransformToRT();
PopAllClips();
AutoSaveRestoreClippedOut restoreClippedOut(this);
restoreClippedOut.Save();
- bool needsClip = false;
-
- needsClip = aRect.x > 0 || aRect.y > 0 ||
- aRect.XMost() < mSize.width ||
- aRect.YMost() < mSize.height;
-
- if (needsClip) {
- mRT->PushAxisAlignedClip(D2DRect(aRect), D2D1_ANTIALIAS_MODE_PER_PRIMITIVE);
- }
mRT->Clear(D2D1::ColorF(0, 0.0f));
- if (needsClip) {
- mRT->PopAxisAlignedClip();
- }
+ PopClip();
return;
}
void
DrawTargetD2D::CopySurface(SourceSurface *aSurface,
const IntRect &aSourceRect,
const IntPoint &aDestination)
{