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

Unified Diff: src/gpu/GrTextStrike.cpp

Issue 193163003: Enable use of distance fields via SkPaint flag. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Change HACK to TEMP 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/GrTextStrike_impl.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 0d7fcafe678ebb9cc1fb96f0e32d4c5cea17dc0a..7e3314bc08e9099aa2185ee4a76bca80d4ce3147 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;
« no previous file with comments | « src/gpu/GrTextStrike.h ('k') | src/gpu/GrTextStrike_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698