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

Unified Diff: src/gpu/GrTextStrike.cpp

Issue 205343008: Distance field fixes for Android (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Fix int->float conversion issues Created 6 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/GrTextStrike.h ('k') | src/gpu/effects/GrDistanceFieldTextureEffect.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/GrTextStrike.cpp
diff --git a/src/gpu/GrTextStrike.cpp b/src/gpu/GrTextStrike.cpp
index 0a1fd1e71f765f8476d73cae4503a2745ffb9f81..7084b9383da6829f10ad3e712128f3fbedaadf89 100644
--- a/src/gpu/GrTextStrike.cpp
+++ b/src/gpu/GrTextStrike.cpp
@@ -181,7 +181,11 @@ void GrFontCache::dump() const {
GrTexture* texture = fAtlasMgr[i]->getTexture();
if (NULL != texture) {
SkString filename;
+#ifdef SK_BUILD_FOR_ANDROID
+ filename.printf("/sdcard/fontcache_%d%d.png", gDumpCount, i);
+#else
filename.printf("fontcache_%d%d.png", gDumpCount, i);
+#endif
texture->savePixels(filename.c_str());
}
}
@@ -248,11 +252,13 @@ GrGlyph* GrTextStrike::generateGlyph(GrGlyph::PackedID packed,
GrGlyph* glyph = fPool.alloc();
// expand bounds to hold full distance field data
+ // + room for bilerp
+ int pad = DISTANCE_FIELD_RANGE+1;
if (fUseDistanceField) {
- bounds.fLeft -= DISTANCE_FIELD_RANGE;
- bounds.fRight += DISTANCE_FIELD_RANGE;
- bounds.fTop -= DISTANCE_FIELD_RANGE;
- bounds.fBottom += DISTANCE_FIELD_RANGE;
+ bounds.fLeft -= pad;
+ bounds.fRight += pad;
+ bounds.fTop -= pad;
+ bounds.fBottom += pad;
}
glyph->init(packed, bounds);
fCache.insert(packed, glyph);
@@ -292,8 +298,9 @@ bool GrTextStrike::addGlyphToAtlas(GrGlyph* glyph, GrFontScaler* scaler) {
// but must shrink back down to get the packed glyph data
int dfWidth = glyph->width();
int dfHeight = glyph->height();
- int width = dfWidth - 2*DISTANCE_FIELD_RANGE;
- int height = dfHeight - 2*DISTANCE_FIELD_RANGE;
+ int pad = DISTANCE_FIELD_RANGE+1;
+ int width = dfWidth - 2*pad;
+ int height = dfHeight - 2*pad;
int stride = width*bytesPerPixel;
size_t size = width * height * bytesPerPixel;
« no previous file with comments | « src/gpu/GrTextStrike.h ('k') | src/gpu/effects/GrDistanceFieldTextureEffect.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698