Bug 1151145 - Make sure we don't call CGContextSaveGState without calling CGContextRestoreGState in DrawTargetCG::StrokeRect. r=jrmuizel
authorMarkus Stange <mstange@themasta.com>
Sat, 04 Apr 2015 18:06:35 -0400
changeset 237713 852527d009a4
parent 237712 c1bd088b80bf
child 237714 135120efabd3
push id58006
push usermstange@themasta.com
push dateMon, 06 Apr 2015 15:40:22 +0000
treeherdermozilla-inbound@ce5528a5b564 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjrmuizel
bugs1151145
milestone40.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1151145 - Make sure we don't call CGContextSaveGState without calling CGContextRestoreGState in DrawTargetCG::StrokeRect. r=jrmuizel
gfx/2d/DrawTargetCG.cpp
--- a/gfx/2d/DrawTargetCG.cpp
+++ b/gfx/2d/DrawTargetCG.cpp
@@ -1222,39 +1222,39 @@ DrawTargetCG::StrokeRect(const Rect &aRe
   if (MOZ2D_ERROR_IF(!mCg)) {
     return;
   }
 
   if (!aRect.IsFinite()) {
     return;
   }
 
-  MarkChanged();
-
-  CGContextSaveGState(mCg);
-
-  UnboundnessFixer fixer;
-  CGContextRef cg = fixer.Check(mCg, aDrawOptions.mCompositionOp);
-  if (MOZ2D_ERROR_IF(!cg)) {
-    return;
-  }
-
   // Stroking large rectangles with dashes is expensive with CG (fixed
   // overhead based on the number of dashes, regardless of whether the dashes
   // are visible), so we try to reduce the size of the stroked rectangle as
   // much as possible before passing it on to CG.
   Rect rect = aRect;
   if (!rect.IsEmpty()) {
     Rect deviceClip(0, 0, mSize.width, mSize.height);
     rect = ShrinkClippedStrokedRect(rect, deviceClip, mTransform, aStrokeOptions);
     if (rect.IsEmpty()) {
       return;
     }
   }
 
+  MarkChanged();
+
+  CGContextSaveGState(mCg);
+
+  UnboundnessFixer fixer;
+  CGContextRef cg = fixer.Check(mCg, aDrawOptions.mCompositionOp);
+  if (MOZ2D_ERROR_IF(!cg)) {
+    return;
+  }
+
   CGContextSetAlpha(mCg, aDrawOptions.mAlpha);
   CGContextSetBlendMode(mCg, ToBlendMode(aDrawOptions.mCompositionOp));
 
   // Work around Quartz bug where antialiasing causes corner pixels to be off by
   // 1 channel value (e.g. rgb(1,1,1) values appear at the corner of solid
   // black stroke), by turning off antialiasing when the edges of the stroke
   // are pixel-aligned. Note that when a transform's components are all
   // integers, it maps integers coordinates to integer coordinates.