Remove prePathMatrix from SkDevice::drawPath
Change-Id: Id49d171252cab33378f00021bb395e6ae6991178
Reviewed-on: https://skia-review.googlesource.com/147101
Commit-Queue: Robert Phillips <robertphillips@google.com>
Reviewed-by: Mike Reed <reed@google.com>
diff --git a/src/gpu/text/GrTextBlob.cpp b/src/gpu/text/GrTextBlob.cpp
index 53b3b4d..bba3328 100644
--- a/src/gpu/text/GrTextBlob.cpp
+++ b/src/gpu/text/GrTextBlob.cpp
@@ -9,6 +9,7 @@
#include "GrBlurUtils.h"
#include "GrClip.h"
#include "GrContext.h"
+#include "GrStyle.h"
#include "GrTextTarget.h"
#include "SkColorFilter.h"
#include "SkGlyphCache.h"
@@ -295,11 +296,31 @@
GrTextBlob::Run::PathGlyph& pathGlyph = run.fPathGlyphs[i];
calculate_translation(pathGlyph.fPreTransformed, viewMatrix, x, y,
fInitialViewMatrix, fInitialX, fInitialY, &transX, &transY);
- const SkMatrix& ctm = pathGlyph.fPreTransformed ? SkMatrix::I() : viewMatrix;
+
+ const SkMatrix* ctm = pathGlyph.fPreTransformed ? &SkMatrix::I() : &viewMatrix;
SkMatrix pathMatrix;
pathMatrix.setScale(pathGlyph.fScale, pathGlyph.fScale);
pathMatrix.postTranslate(pathGlyph.fX + transX, pathGlyph.fY + transY);
- target->drawPath(clip, pathGlyph.fPath, runPaint, ctm, &pathMatrix);
+
+ const SkPath* path = &pathGlyph.fPath;
+ bool pathIsMutable = false;
+ SkTLazy<SkPath> tmpPath;
+
+ GrStyle style(runPaint);
+
+ // 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 {
+ SkPath* result = tmpPath.init();
+ path->transform(pathMatrix, result);
+ result->setIsVolatile(true);
+ path = result;
+ pathIsMutable = true;
+ }
+
+ target->drawPath(clip, *path, runPaint, *ctm, pathIsMutable);
}
}
diff --git a/src/gpu/text/GrTextTarget.h b/src/gpu/text/GrTextTarget.h
index 3bcbe9a..d220a1a 100644
--- a/src/gpu/text/GrTextTarget.h
+++ b/src/gpu/text/GrTextTarget.h
@@ -31,7 +31,7 @@
virtual void addDrawOp(const GrClip&, std::unique_ptr<GrAtlasTextOp> op) = 0;
virtual void drawPath(const GrClip&, const SkPath&, const SkPaint&,
- const SkMatrix& viewMatrix, const SkMatrix* pathMatrix) = 0;
+ const SkMatrix& viewMatrix, bool pathIsMutable) = 0;
virtual void makeGrPaint(GrMaskFormat, const SkPaint&, const SkMatrix& viewMatrix,
GrPaint*) = 0;