Bug 1082530, part 5 - remove the variant of Moz2D's UserToDevicePixelSnapped that takes a Matrix argument instead of a DrawTarget argument. r=mattwoodrow
authorJonathan Watt <jwatt@jwatt.org>
Sun, 19 Oct 2014 10:22:47 +0100
changeset 211055 1abfecf86c502bf7ca33be585d44f235f7592112
parent 211054 5f6dc495c8b612631fd91b67f7303e24178f3f15
child 211056 2dbb3fbd7385ae8a8e0e29d9d1dc00829eaee2d9
push id50633
push userjwatt@jwatt.org
push dateSun, 19 Oct 2014 09:23:28 +0000
treeherdermozilla-inbound@1abfecf86c50 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmattwoodrow
bugs1082530
milestone36.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 1082530, part 5 - remove the variant of Moz2D's UserToDevicePixelSnapped that takes a Matrix argument instead of a DrawTarget argument. r=mattwoodrow
gfx/2d/PathHelpers.h
--- a/gfx/2d/PathHelpers.h
+++ b/gfx/2d/PathHelpers.h
@@ -192,20 +192,24 @@ extern UserDataKey sDisablePixelSnapping
  *
  * Note that the snapping is such that filling the rect using a DrawTarget
  * which has the identity matrix as its transform will result in crisp edges.
  * (That is, aRect will have integer values, aligning its edges between pixel
  * boundaries.)  If on the other hand you stroking the rect with an odd valued
  * stroke width then the edges of the stroke will be antialiased (assuming an
  * AntialiasMode that does antialiasing).
  */
-inline bool UserToDevicePixelSnapped(Rect& aRect, const Matrix& aTransform,
+inline bool UserToDevicePixelSnapped(Rect& aRect, const DrawTarget& aDrawTarget,
                                      bool aAllowScaleOr90DegreeRotate = false)
 {
-  Matrix mat = aTransform;
+  if (aDrawTarget.GetUserData(&sDisablePixelSnapping)) {
+    return false;
+  }
+
+  Matrix mat = aDrawTarget.GetTransform();
 
   const Float epsilon = 0.0000001f;
 #define WITHIN_E(a,b) (fabs((a)-(b)) < epsilon)
   if (!aAllowScaleOr90DegreeRotate &&
       (!WITHIN_E(mat._11, 1.f) || !WITHIN_E(mat._22, 1.f) ||
        !WITHIN_E(mat._12, 0.f) || !WITHIN_E(mat._21, 0.f))) {
     // We have non-translation, but only translation is allowed.
     return false;
@@ -230,25 +234,16 @@ inline bool UserToDevicePixelSnapped(Rec
       aRect.SizeTo(Size(std::max(p1.x, p3.x) - aRect.X(),
                         std::max(p1.y, p3.y) - aRect.Y()));
       return true;
   }
 
   return false;
 }
 
-inline bool UserToDevicePixelSnapped(Rect& aRect, const DrawTarget& aDrawTarget,
-                                     bool aIgnoreScale = false)
-{
-  if (aDrawTarget.GetUserData(&sDisablePixelSnapping)) {
-    return false;
-  }
-  return UserToDevicePixelSnapped(aRect, aDrawTarget.GetTransform());
-}
-
 /**
  * This function has the same behavior as UserToDevicePixelSnapped except that
  * aRect is not transformed to device space.
  */
 inline void MaybeSnapToDevicePixels(Rect& aRect, const DrawTarget& aDrawTarget,
                                     bool aIgnoreScale = false)
 {
   if (UserToDevicePixelSnapped(aRect, aDrawTarget, aIgnoreScale)) {