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 167779 6c0aa15ef904c790406cccc89a57bbacf0e71a43
parent 167778 abcbe0e114e3e6f2956169f39e8fe19e1d0d99a9
child 167780 0192ade0e746a9e71c1bc195ec3a239af3e6d2d1
push id428
push userbbajaj@mozilla.com
push dateTue, 28 Jan 2014 00:16:25 +0000
treeherdermozilla-release@cd72a7ff3a75 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersBas, lsblakk
bugs946475
milestone27.0
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
@@ -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)
 {