diff options
author | jvanverth <jvanverth@google.com> | 2015-03-19 06:08:31 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-03-19 06:08:31 -0700 |
commit | a7634619ec653e94a8a506ca86c233753d10510e (patch) | |
tree | b4e294bbf08418e55c852cba877c4e2ab6f41444 /src/gpu/GrFontCache.cpp | |
parent | 9b77ddde08efe702256355a333cf31ade8f15bb0 (diff) |
Ensure that we use different glyph entries for regular and df text.
Currently if we switch between regular text and df text while using
the same GrContext, they may use the same entry in the Ganesh font cache,
which is incorrect. This change ensures that they will have different entries.
Committed: https://skia.googlesource.com/skia/+/8dc58edd71c11f232860724dfa3b566895478034
Review URL: https://codereview.chromium.org/1020593003
Diffstat (limited to 'src/gpu/GrFontCache.cpp')
-rw-r--r-- | src/gpu/GrFontCache.cpp | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/gpu/GrFontCache.cpp b/src/gpu/GrFontCache.cpp index f5c1c22a3d..5952366406 100644 --- a/src/gpu/GrFontCache.cpp +++ b/src/gpu/GrFontCache.cpp @@ -258,7 +258,7 @@ GrTextStrike::~GrTextStrike() { GrGlyph* GrTextStrike::generateGlyph(GrGlyph::PackedID packed, GrFontScaler* scaler) { SkIRect bounds; - if (fUseDistanceField) { + if (GrGlyph::kDistance_MaskStyle == GrGlyph::UnpackMaskStyle(packed)) { if (!scaler->getPackedGlyphDFBounds(packed, &bounds)) { return NULL; } @@ -290,7 +290,9 @@ void GrTextStrike::removePlot(const GrPlot* plot) { bool GrTextStrike::glyphTooLargeForAtlas(GrGlyph* glyph) { int width = glyph->fBounds.width(); int height = glyph->fBounds.height(); - int pad = fUseDistanceField ? 2 * SK_DistanceFieldPad : 0; + bool useDistanceField = + (GrGlyph::kDistance_MaskStyle == GrGlyph::UnpackMaskStyle(glyph->fPackedID)); + int pad = useDistanceField ? 2 * SK_DistanceFieldPad : 0; int plotWidth = (kA8_GrMaskFormat == glyph->fMaskFormat) ? GR_FONT_ATLAS_A8_PLOT_WIDTH : GR_FONT_ATLAS_PLOT_WIDTH; if (width + pad > plotWidth) { @@ -321,7 +323,7 @@ bool GrTextStrike::addGlyphToAtlas(GrGlyph* glyph, GrFontScaler* scaler) { size_t size = glyph->fBounds.area() * bytesPerPixel; GrAutoMalloc<1024> storage(size); - if (fUseDistanceField) { + if (GrGlyph::kDistance_MaskStyle == GrGlyph::UnpackMaskStyle(glyph->fPackedID)) { if (!scaler->getPackedGlyphDFImage(glyph->fPackedID, glyph->width(), glyph->height(), storage.get())) { |