aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar bungeman <bungeman@google.com>2016-02-25 11:34:10 -0800
committerGravatar Commit bot <commit-bot@chromium.org>2016-02-25 11:34:10 -0800
commite37514d0b540a25471fe12ba6412dc4c8b9f9c88 (patch)
tree95d320c5ec01a4ba8b23730a0f894f95be90bd56
parent3854f11ce35857ccb6dbf8bb09bef9252543090f (diff)
Fully check basis vectors for extent degeneracy.
The test for 'nearly singular matrix' in SkScalerContext::computeMatrices is actually a check to see if anything will draw. Unfortunately, the current test only checks when the a skew causes nothing to draw. This adds the check for when the scale causes nothing to draw. BUG=skia:4998 GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1735613002 Review URL: https://codereview.chromium.org/1735613002
-rw-r--r--src/core/SkScalerContext.cpp10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/core/SkScalerContext.cpp b/src/core/SkScalerContext.cpp
index 29f794a99f..caef2d1377 100644
--- a/src/core/SkScalerContext.cpp
+++ b/src/core/SkScalerContext.cpp
@@ -724,13 +724,17 @@ void SkScalerContextRec::computeMatrices(PreMatrixScale preMatrixScale, SkVector
// If the 'total' matrix is singular, set the 'scale' to something finite and zero the matrices.
// All underlying ports have issues with zero text size, so use the matricies to zero.
- // Map the vectors [1,1] and [1,-1] (the EM) through the 'total' matrix.
+ // Map the vectors [0,1], [1,0], [1,1] and [1,-1] (the EM) through the 'total' matrix.
// If the length of one of these vectors is less than 1/256 then an EM filling square will
// never affect any pixels.
- SkVector diag[2] = { { A.getScaleX() + A.getSkewX(), A.getScaleY() + A.getSkewY() },
+ SkVector diag[4] = { { A.getScaleX() , A.getSkewY() },
+ { A.getSkewX(), A.getScaleY() },
+ { A.getScaleX() + A.getSkewX(), A.getScaleY() + A.getSkewY() },
{ A.getScaleX() - A.getSkewX(), A.getScaleY() - A.getSkewY() }, };
if (diag[0].lengthSqd() <= SK_ScalarNearlyZero * SK_ScalarNearlyZero ||
- diag[1].lengthSqd() <= SK_ScalarNearlyZero * SK_ScalarNearlyZero)
+ diag[1].lengthSqd() <= SK_ScalarNearlyZero * SK_ScalarNearlyZero ||
+ diag[2].lengthSqd() <= SK_ScalarNearlyZero * SK_ScalarNearlyZero ||
+ diag[3].lengthSqd() <= SK_ScalarNearlyZero * SK_ScalarNearlyZero)
{
s->fX = SK_Scalar1;
s->fY = SK_Scalar1;