Bug 1082530, part 5 - remove the variant of Moz2D's UserToDevicePixelSnapped that takes a Matrix argument instead of a DrawTarget argument. r=mattwoodrow
--- 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)) {