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
authorMatt Woodrow <mwoodrow@mozilla.com>
Thu, 12 Dec 2013 10:11:07 +1300
changeset 174369 cc5c82e3f1093d466ebf498e190c9589a296deb6
parent 174368 a5d8e2a7f24559cce2e1fb72cdff1a3554569a31
child 174370 320a46ff06741bde536d392fbd12cfb2027a4753
push id3224
push userlsblakk@mozilla.com
push dateTue, 04 Feb 2014 01:06:49 +0000
treeherdermozilla-beta@60c04d0987f1 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersBas, lsblakk
bugs946475
milestone28.0a2
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
gfx/2d/DrawTargetD2D.cpp
--- a/gfx/2d/DrawTargetD2D.cpp
+++ b/gfx/2d/DrawTargetD2D.cpp
@@ -759,37 +759,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)
 {