aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorGravatar Jim Van Verth <jvanverth@google.com>2018-05-17 12:33:52 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2018-05-17 17:15:33 +0000
commit8b7284df1a3d6935c063990c35bd3be0fbfaa84d (patch)
tree1e55d5feb158b97403c612bd8f6b3471ee4050db /src
parent4b7ae8290274babb1e32fd529728cf4686daab83 (diff)
Check for correct bounds of large rotated and skewed emoji.
Bug: skia:7879 Change-Id: I039ca9d216c3a9a913f5dd5f63d7f01de3abfdc8 Reviewed-on: https://skia-review.googlesource.com/128923 Reviewed-by: Brian Salomon <bsalomon@google.com> Commit-Queue: Jim Van Verth <jvanverth@google.com>
Diffstat (limited to 'src')
-rw-r--r--src/gpu/text/GrAtlasTextContext.cpp13
1 files changed, 11 insertions, 2 deletions
diff --git a/src/gpu/text/GrAtlasTextContext.cpp b/src/gpu/text/GrAtlasTextContext.cpp
index a7700cb17d..8cccdd369c 100644
--- a/src/gpu/text/GrAtlasTextContext.cpp
+++ b/src/gpu/text/GrAtlasTextContext.cpp
@@ -849,7 +849,16 @@ void GrAtlasTextContext::DfAppendGlyph(GrAtlasTextBlob* blob, int runIndex,
void GrAtlasTextContext::FallbackTextHelper::appendText(const SkGlyph& glyph, int count,
const char* text, SkPoint glyphPos) {
- SkScalar maxDim = SkTMax(glyph.fWidth, glyph.fHeight)*fTextRatio;
+ SkScalar maxDim;
+ if (fViewMatrix.isScaleTranslate()) {
+ maxDim = SkTMax(glyph.fWidth, glyph.fHeight)*fTextRatio;
+ } else {
+ SkRect glyphRect;
+ glyphRect.setXYWH(glyph.fLeft, glyph.fTop, glyph.fWidth, glyph.fHeight);
+ fViewMatrix.mapRect(&glyphRect);
+ maxDim = SkTMax(glyphRect.width(), glyphRect.height());
+ maxDim *= fTextRatio/fMaxScale;
+ }
if (!fUseScaledFallback) {
SkScalar scaledGlyphSize = maxDim * fMaxScale;
if (!fViewMatrix.hasPerspective() && scaledGlyphSize > fMaxTextSize) {
@@ -862,7 +871,7 @@ void GrAtlasTextContext::FallbackTextHelper::appendText(const SkGlyph& glyph, in
if (fUseScaledFallback) {
// If there's a glyph in the font that's particularly large, it's possible
// that fScaledFallbackTextSize may end up minimizing too much. We'd rather skip
- // that glyph than make the others pixelated, so we set a minimum size of half the
+ // that glyph than make the others blurry, so we set a minimum size of half the
// maximum text size to avoid this case.
SkScalar glyphTextSize = SkTMax(SkScalarFloorToScalar(fMaxTextSize*fTextSize / maxDim),
0.5f*fMaxTextSize);