Skip to content

Commit a7f3157

Browse files
herbderbySkia Commit-Bot
authored andcommitted
Only scale fallback font if it is too big
If the drawing is rotate, then it won't be handled by the device fallback case. So, the source glyphs can fit in the atlas with out scaling, so don't scale. Previously, the system would put the largest possible glyph in the cache, and scale it down. Change-Id: If4261854100d4736702d192e4f0847014c55f1c5 Reviewed-on: https://skia-review.googlesource.com/c/skia/+/250796 Reviewed-by: Ben Wagner <bungeman@google.com> Commit-Queue: Herb Derby <herb@google.com>
1 parent 24a4096 commit a7f3157

1 file changed

Lines changed: 6 additions & 4 deletions

File tree

src/core/SkStrikeSpec.cpp

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -57,10 +57,12 @@ SkStrikeSpec SkStrikeSpec::MakeSourceFallback(
5757
SkScalar maxAtlasDimension = SkStrikeCommon::kSkSideTooBigForAtlas - 2;
5858

5959
SkScalar runFontTextSize = font.getSize();
60-
61-
// Scale the text size down so the long side of all the glyphs will fit in the atlas.
62-
SkScalar fallbackTextSize = SkScalarFloorToScalar(
63-
(maxAtlasDimension / maxSourceGlyphDimension) * runFontTextSize);
60+
SkScalar fallbackTextSize = runFontTextSize;
61+
if (maxSourceGlyphDimension > maxAtlasDimension) {
62+
// Scale the text size down so the long side of all the glyphs will fit in the atlas.
63+
fallbackTextSize = SkScalarFloorToScalar(
64+
(maxAtlasDimension / maxSourceGlyphDimension) * runFontTextSize);
65+
}
6466

6567
SkFont fallbackFont{font};
6668
fallbackFont.setSize(fallbackTextSize);

0 commit comments

Comments
 (0)