Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(227)

Unified Diff: src/gpu/GrAtlasTextContext.cpp

Issue 1315933002: Fix for distance field draw large glyph as paths (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: fix Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/gpu/GrAtlasTextContext.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/GrAtlasTextContext.cpp
diff --git a/src/gpu/GrAtlasTextContext.cpp b/src/gpu/GrAtlasTextContext.cpp
index aa4c51d85aad0958ed6f02a155bc8fd6a09a538e..cbcfd654658566e5c1a4df91ab9ed5140a5f5aae 100644
--- a/src/gpu/GrAtlasTextContext.cpp
+++ b/src/gpu/GrAtlasTextContext.cpp
@@ -1341,7 +1341,7 @@ bool GrAtlasTextContext::dfAppendGlyph(GrAtlasTextBlob* blob, int runIndex,
// TODO combine with the above
// If the glyph is too large we fall back to paths
if (glyph->fTooLargeForAtlas) {
- this->appendGlyphPath(blob, glyph, scaler, skGlyph, sx - dx, sy - dy);
+ this->appendGlyphPath(blob, glyph, scaler, skGlyph, sx - dx, sy - dy, scale, true);
return true;
}
@@ -1363,7 +1363,8 @@ bool GrAtlasTextContext::dfAppendGlyph(GrAtlasTextBlob* blob, int runIndex,
inline void GrAtlasTextContext::appendGlyphPath(GrAtlasTextBlob* blob, GrGlyph* glyph,
GrFontScaler* scaler, const SkGlyph& skGlyph,
- SkScalar x, SkScalar y) {
+ SkScalar x, SkScalar y, SkScalar scale,
+ bool applyVM) {
if (NULL == glyph->fPath) {
const SkPath* glyphPath = scaler->getGlyphPath(skGlyph);
if (!glyphPath) {
@@ -1372,7 +1373,7 @@ inline void GrAtlasTextContext::appendGlyphPath(GrAtlasTextBlob* blob, GrGlyph*
glyph->fPath = SkNEW_ARGS(SkPath, (*glyphPath));
}
- blob->fBigGlyphs.push_back(GrAtlasTextBlob::BigGlyph(*glyph->fPath, x, y));
+ blob->fBigGlyphs.push_back(GrAtlasTextBlob::BigGlyph(*glyph->fPath, x, y, scale, applyVM));
}
inline void GrAtlasTextContext::appendGlyphCommon(GrAtlasTextBlob* blob, Run* run,
@@ -1931,6 +1932,7 @@ private:
// TODO see note above
if (kLCDDistanceField_MaskType == fMaskType && this->color() != that->color()) {
+ return false;
}
}
@@ -2158,21 +2160,19 @@ inline void GrAtlasTextContext::flushBigGlyphs(GrAtlasTextBlob* cacheBlob, GrRen
return;
}
- SkMatrix pathMatrix;
- if (!cacheBlob->fViewMatrix.invert(&pathMatrix)) {
- SkDebugf("could not invert viewmatrix\n");
- return;
- }
-
for (int i = 0; i < cacheBlob->fBigGlyphs.count(); i++) {
GrAtlasTextBlob::BigGlyph& bigGlyph = cacheBlob->fBigGlyphs[i];
bigGlyph.fVx += transX;
bigGlyph.fVy += transY;
- SkMatrix translate = cacheBlob->fViewMatrix;
- translate.postTranslate(bigGlyph.fVx, bigGlyph.fVy);
+ SkMatrix ctm;
+ ctm.setScale(bigGlyph.fScale, bigGlyph.fScale);
+ ctm.postTranslate(bigGlyph.fVx, bigGlyph.fVy);
+ if (bigGlyph.fApplyVM) {
+ ctm.postConcat(cacheBlob->fViewMatrix);
+ }
GrBlurUtils::drawPathWithMaskFilter(fContext, fDrawContext, rt, clip, bigGlyph.fPath,
- skPaint, translate, &pathMatrix, clipBounds, false);
+ skPaint, ctm, nullptr, clipBounds, false);
}
}
« no previous file with comments | « src/gpu/GrAtlasTextContext.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698