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

Unified Diff: src/gpu/GrFontCache.cpp

Issue 1020593003: Ensure that we use different glyph entries for regular and df text. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Rebase Created 5 years, 9 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/GrFontCache.h ('k') | src/gpu/GrGlyph.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/GrFontCache.cpp
diff --git a/src/gpu/GrFontCache.cpp b/src/gpu/GrFontCache.cpp
index f5c1c22a3da9cd87e2a081ddc1fb4b88a376947b..59523664064b5b640c8e73f95369d20c0cc52451 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())) {
« no previous file with comments | « src/gpu/GrFontCache.h ('k') | src/gpu/GrGlyph.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698