diff options
author | 2014-03-11 17:07:15 +0000 | |
---|---|---|
committer | 2014-03-11 17:07:15 +0000 | |
commit | b97c3ffddf15ac65a0aae6823eb408b3b2772751 (patch) | |
tree | 7c567fc3d98c3c7b5bfcaf6164543023b0a9c556 /src/gpu/GrTextStrike.cpp | |
parent | 8065ec50f1937c1562810bfe2b216abfb98362b3 (diff) |
Enable use of distance fields via SkPaint flag.
Now that distance field generation is fast enough to make it practical, this makes distances field fonts easily available to anyone who wants to try them out (i.e Chromium).
BUG=skia:2173
R=reed@google.com, bsalomon@google.com
Author: jvanverth@google.com
Review URL: https://codereview.chromium.org/193163003
git-svn-id: http://skia.googlecode.com/svn/trunk@13741 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'src/gpu/GrTextStrike.cpp')
-rw-r--r-- | src/gpu/GrTextStrike.cpp | 10 |
1 files changed, 0 insertions, 10 deletions
diff --git a/src/gpu/GrTextStrike.cpp b/src/gpu/GrTextStrike.cpp index 0d7fcafe67..7e3314bc08 100644 --- a/src/gpu/GrTextStrike.cpp +++ b/src/gpu/GrTextStrike.cpp @@ -12,9 +12,7 @@ #include "GrTextStrike_impl.h" #include "SkString.h" -#if SK_DISTANCEFIELD_FONTS #include "SkDistanceFieldGen.h" -#endif /////////////////////////////////////////////////////////////////////////////// @@ -198,11 +196,9 @@ void GrFontCache::dump() const { static int gCounter; #endif -#if SK_DISTANCEFIELD_FONTS // this acts as the max magnitude for the distance field, // as well as the pad we need around the glyph #define DISTANCE_FIELD_RANGE 4 -#endif /* The text strike is specific to a given font/style/matrix setup, which is @@ -251,7 +247,6 @@ GrGlyph* GrTextStrike::generateGlyph(GrGlyph::PackedID packed, } GrGlyph* glyph = fPool.alloc(); -#if SK_DISTANCEFIELD_FONTS // expand bounds to hold full distance field data if (fUseDistanceField) { bounds.fLeft -= DISTANCE_FIELD_RANGE; @@ -259,7 +254,6 @@ GrGlyph* GrTextStrike::generateGlyph(GrGlyph::PackedID packed, bounds.fTop -= DISTANCE_FIELD_RANGE; bounds.fBottom += DISTANCE_FIELD_RANGE; } -#endif glyph->init(packed, bounds); fCache.insert(packed, glyph); return glyph; @@ -293,7 +287,6 @@ bool GrTextStrike::addGlyphToAtlas(GrGlyph* glyph, GrFontScaler* scaler) { int bytesPerPixel = GrMaskFormatBytesPerPixel(fMaskFormat); GrPlot* plot; -#if SK_DISTANCEFIELD_FONTS if (fUseDistanceField) { // we've already expanded the glyph dimensions to match the final size // but must shrink back down to get the packed glyph data @@ -341,7 +334,6 @@ bool GrTextStrike::addGlyphToAtlas(GrGlyph* glyph, GrFontScaler* scaler) { &glyph->fAtlasLocation); } else { -#endif size_t size = glyph->fBounds.area() * bytesPerPixel; SkAutoSMalloc<1024> storage(size); if (!scaler->getPackedGlyphImage(glyph->fPackedID, glyph->width(), @@ -354,9 +346,7 @@ bool GrTextStrike::addGlyphToAtlas(GrGlyph* glyph, GrFontScaler* scaler) { plot = fAtlasMgr->addToAtlas(&fAtlas, glyph->width(), glyph->height(), storage.get(), &glyph->fAtlasLocation); -#if SK_DISTANCEFIELD_FONTS } -#endif if (NULL == plot) { return false; |