Remove the low hanging fruit with coord change matrices
BUG=skia:
Review URL: https://codereview.chromium.org/793013003
diff --git a/src/effects/SkBlurMaskFilter.cpp b/src/effects/SkBlurMaskFilter.cpp
index b4c020f..aa57669 100644
--- a/src/effects/SkBlurMaskFilter.cpp
+++ b/src/effects/SkBlurMaskFilter.cpp
@@ -860,13 +860,13 @@
return false;
}
- if (!grp->localCoordChangeInverse(viewMatrix)) {
- return false;
- }
-
grp->addCoverageProcessor(fp);
- context->drawRect(*grp, SkMatrix::I(), rect);
+ SkMatrix inverse;
+ if (!viewMatrix.invert(&inverse)) {
+ return false;
+ }
+ context->drawNonAARectWithLocalMatrix(*grp, SkMatrix::I(), rect, inverse);
return true;
}
@@ -1142,13 +1142,13 @@
return false;
}
- if (!grp->localCoordChangeInverse(viewMatrix)) {
- return false;
- }
-
grp->addCoverageProcessor(fp);
- context->drawRect(*grp, SkMatrix::I(), proxy_rect);
+ SkMatrix inverse;
+ if (!viewMatrix.invert(&inverse)) {
+ return false;
+ }
+ context->drawNonAARectWithLocalMatrix(*grp, SkMatrix::I(), proxy_rect, inverse);
return true;
}
diff --git a/src/gpu/GrBitmapTextContext.cpp b/src/gpu/GrBitmapTextContext.cpp
index 921c198..732a514 100755
--- a/src/gpu/GrBitmapTextContext.cpp
+++ b/src/gpu/GrBitmapTextContext.cpp
@@ -430,6 +430,7 @@
}
}
+ // If the glyph is too large we fall back to paths
if (NULL == glyph->fPlot && !uploadGlyph(glyph, scaler)) {
if (NULL == glyph->fPath) {
SkPath* path = SkNEW(SkPath);
@@ -447,10 +448,10 @@
SkMatrix translate;
translate.setTranslate(SkFixedToScalar(vx - SkIntToFixed(glyph->fBounds.fLeft)),
SkFixedToScalar(vy - SkIntToFixed(glyph->fBounds.fTop)));
- GrPaint tmpPaint(fPaint);
- tmpPaint.localCoordChange(translate);
+ SkPath tmpPath(*glyph->fPath);
+ tmpPath.transform(translate);
GrStrokeInfo strokeInfo(SkStrokeRec::kFill_InitStyle);
- fContext->drawPath(tmpPaint, translate, *glyph->fPath, strokeInfo);
+ fContext->drawPath(fPaint, SkMatrix::I(), tmpPath, strokeInfo);
// remove this glyph from the vertices we need to allocate
fTotalVertexCount -= kVerticesPerGlyph;
diff --git a/src/gpu/GrDistanceFieldTextContext.cpp b/src/gpu/GrDistanceFieldTextContext.cpp
index a6cb285..8d993fa 100755
--- a/src/gpu/GrDistanceFieldTextContext.cpp
+++ b/src/gpu/GrDistanceFieldTextContext.cpp
@@ -535,6 +535,8 @@
if (NULL == glyph->fPlot) {
// needs to be a separate conditional to avoid over-optimization
// on Nexus 7 and Nexus 10
+
+ // If the glyph is too large we fall back to paths
if (!uploadGlyph(glyph, scaler)) {
if (NULL == glyph->fPath) {
SkPath* path = SkNEW(SkPath);
@@ -552,13 +554,12 @@
SkMatrix ctm;
ctm.setScale(fTextRatio, fTextRatio);
ctm.postTranslate(sx - dx, sy - dy);
- GrPaint tmpPaint(fPaint);
- tmpPaint.localCoordChange(ctm);
- SkMatrix viewM = fViewMatrix;
- viewM.preConcat(ctm);
+ SkPath tmpPath(*glyph->fPath);
+ tmpPath.transform(ctm);
+
GrStrokeInfo strokeInfo(SkStrokeRec::kFill_InitStyle);
- fContext->drawPath(tmpPaint, viewM, *glyph->fPath, strokeInfo);
+ fContext->drawPath(fPaint, fViewMatrix, tmpPath, strokeInfo);
// remove this glyph from the vertices we need to allocate
fTotalVertexCount -= kVerticesPerGlyph;