SkScalerContextRec::computeMatrices to return status.
When computing the matricies for a scaler context, there is a special
case when the matrix is determined to be singular. No port properly
handles zero sized text, so we detect this case and return a 'normal'
text size and a zero matrix for all computed transformations. This
CL causes computeMatricies to return 'false' in this case.
This is used in the constructor of SkScalerContext_Mac in order to
avoid calling CGAffineTransformInvert on non-invertible transformations.
CGAffineTransformInvert documents that if the transform is
non-invertible it will return the passed transform unchanged. It does
so, but then also prints a message to stdout. Since the information is
already available to avoid this chatty behavior, use it to keep things
quiet.
BUG=skia:3231,chromium:630169
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2276583003
Review-Url: https://codereview.chromium.org/2276583003
diff --git a/src/core/SkScalerContext.cpp b/src/core/SkScalerContext.cpp
index 85e8994..ecac82a 100644
--- a/src/core/SkScalerContext.cpp
+++ b/src/core/SkScalerContext.cpp
@@ -687,7 +687,7 @@
m->postConcat(deviceMatrix);
}
-void SkScalerContextRec::computeMatrices(PreMatrixScale preMatrixScale, SkVector* s, SkMatrix* sA,
+bool SkScalerContextRec::computeMatrices(PreMatrixScale preMatrixScale, SkVector* s, SkMatrix* sA,
SkMatrix* GsA, SkMatrix* G_inv, SkMatrix* A_out)
{
// A is the 'total' matrix.
@@ -723,7 +723,7 @@
if (G_inv) {
G_inv->reset();
}
- return;
+ return false;
}
// GA is the matrix A with rotation removed.
@@ -803,6 +803,8 @@
// G is rotational so reorders with the scale.
GsA->preScale(SkScalarInvert(s->fX), SkScalarInvert(s->fY));
}
+
+ return true;
}
SkAxisAlignment SkScalerContext::computeAxisAlignmentForHText() {