More liberally fold the path matrix into the CTM in GrTextBlob::flush
In this case, even if the path matrix was only a translate, we were losing the ability to create a mask-filter key (because we were transforming the path)
Bug: skia:
Change-Id: I953d8d4e9bbcda9cc0f91cc367c028fb568b2e00
Reviewed-on: https://skia-review.googlesource.com/149981
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
diff --git a/src/gpu/text/GrTextBlob.cpp b/src/gpu/text/GrTextBlob.cpp
index 7a1b3f7..9144e90 100644
--- a/src/gpu/text/GrTextBlob.cpp
+++ b/src/gpu/text/GrTextBlob.cpp
@@ -308,15 +308,23 @@
GrStyle style(runPaint);
+ SkMaskFilter* mf = runPaint.getMaskFilter();
+
// Styling, blurs, and shading are supposed to be applied *after* the pathMatrix.
- if (!runPaint.getMaskFilter() && !runPaint.getShader() && !style.applies()) {
- pathMatrix.postConcat(*ctm);
- ctm = &pathMatrix;
- } else {
+ // However, if the mask filter is a blur and the pathMatrix contains no scale, then
+ // we can still fold the path matrix into the CTM
+ bool needToApply = runPaint.getShader() || style.applies() ||
+ (mf && (!as_MFB(mf)->asABlur(nullptr) ||
+ !SkScalarNearlyEqual(pathGlyph.fScale, 1.0f)));
+
+ if (needToApply) {
SkPath* result = tmpPath.init();
path->transform(pathMatrix, result);
result->setIsVolatile(true);
path = result;
+ } else {
+ pathMatrix.postConcat(*ctm);
+ ctm = &pathMatrix;
}
// TODO: we are losing the mutability of the path here