diff options
author | 2014-03-26 18:03:05 +0000 | |
---|---|---|
committer | 2014-03-26 18:03:05 +0000 | |
commit | 8fe2ee1cf380ee8972c846f74fabd81b34665053 (patch) | |
tree | 4a3cc589c70bda08cb973e8dbd6d5b22c16c753e /src/gpu/GrTextStrike.cpp | |
parent | 3fcab54c7f8d3936f6c854b2c4e19cfffafa1066 (diff) |
Distance field fixes for Android
- Expand glyph size by 2 on each side to compensate for bilerp lookup
- Correct for Adreno tendency to drop entire tile if any pixel has divide-by-0
- Fix blurriness on Adreno by using uv coords to compute gradient instead
of st coords
- Add faster version for uniform scale
BUG=skia:2173
R=bsalomon@google.com
Author: jvanverth@google.com
Review URL: https://codereview.chromium.org/205343008
git-svn-id: http://skia.googlecode.com/svn/trunk@13955 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'src/gpu/GrTextStrike.cpp')
-rw-r--r-- | src/gpu/GrTextStrike.cpp | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/src/gpu/GrTextStrike.cpp b/src/gpu/GrTextStrike.cpp index 0a1fd1e71f..7084b9383d 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; |