summaryrefslogtreecommitdiffstats
path: root/skia
diff options
context:
space:
mode:
authorjhaas@google.com <jhaas@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-08-21 20:45:23 +0000
committerjhaas@google.com <jhaas@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-08-21 20:45:23 +0000
commit9451fde471832f8da5026dcf47a341bb5c88d53e (patch)
treeb1153ebf089e4aee5dbf1ac4c13b5cb42dcf1557 /skia
parent77b2868b86b268178c28d3f267b9c3f1fde72cad (diff)
downloadchromium_src-9451fde471832f8da5026dcf47a341bb5c88d53e.zip
chromium_src-9451fde471832f8da5026dcf47a341bb5c88d53e.tar.gz
chromium_src-9451fde471832f8da5026dcf47a341bb5c88d53e.tar.bz2
Fixed bug #1251296
This is a regression that is causing me to wonder why it ever worked in the first place. The underflow bug was getting tripped by a very small scaling matrix being improperly treated as a zero matrix, and also, the scaling code was getting bitten by a bug in Skia's edge comparison function which caused incorrect results to be returned when the difference between two values exceeded the maximum signed integer. git-svn-id: svn://svn.chromium.org/chrome/trunk/src@1180 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'skia')
-rw-r--r--skia/corecg/SkMatrix.cpp5
-rw-r--r--skia/sgl/SkScan_Path.cpp2
2 files changed, 5 insertions, 2 deletions
diff --git a/skia/corecg/SkMatrix.cpp b/skia/corecg/SkMatrix.cpp
index d5b64ec..4c9a087 100644
--- a/skia/corecg/SkMatrix.cpp
+++ b/skia/corecg/SkMatrix.cpp
@@ -667,9 +667,12 @@ bool SkMatrix::postConcat(const SkMatrix& mat) {
det = (double)mat[SkMatrix::kMScaleX] * mat[SkMatrix::kMScaleY] - (double)mat[SkMatrix::kMSkewX] * mat[SkMatrix::kMSkewY];
}
- if (SkScalarNearlyZero((float)det)) {
+ // Since the determinant is on the order of the square of the matrix members,
+ // compare to the square of the default nearly-zero constant
+ if (SkScalarNearlyZero((float)det, SK_ScalarNearlyZero * SK_ScalarNearlyZero)) {
return 0;
}
+
return (float)(1.0 / det);
}
#else
diff --git a/skia/sgl/SkScan_Path.cpp b/skia/sgl/SkScan_Path.cpp
index 81b0233..4e58518 100644
--- a/skia/sgl/SkScan_Path.cpp
+++ b/skia/sgl/SkScan_Path.cpp
@@ -368,7 +368,7 @@ extern "C" {
valuea = edgea->fX;
valueb = edgeb->fX;
}
- return valuea - valueb;
+ return valuea > valueb ? 1 : valuea < valueb ? -1 : 0;
}
}