Add flag for SkGpuSurface creation to enable distance fields.
BUG=skia:2173
R=bsalomon@google.com, reed@google.com, bungeman@google.com
Author: jvanverth@google.com
Review URL: https://codereview.chromium.org/261783004
git-svn-id: http://skia.googlecode.com/svn/trunk@14525 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/src/gpu/GrDistanceFieldTextContext.cpp b/src/gpu/GrDistanceFieldTextContext.cpp
index 238bcca..512420e 100755
--- a/src/gpu/GrDistanceFieldTextContext.cpp
+++ b/src/gpu/GrDistanceFieldTextContext.cpp
@@ -33,15 +33,15 @@
SK_CONF_DECLARE(bool, c_DumpFontCache, "gpu.dumpFontCache", false,
"Dump the contents of the font cache before every purge.");
-#if SK_FORCE_DISTANCEFIELD_FONTS
-static const bool kForceDistanceFieldFonts = true;
-#else
-static const bool kForceDistanceFieldFonts = false;
-#endif
-
GrDistanceFieldTextContext::GrDistanceFieldTextContext(GrContext* context,
- const SkDeviceProperties& properties)
+ const SkDeviceProperties& properties,
+ bool enable)
: GrTextContext(context, properties) {
+#if SK_FORCE_DISTANCEFIELD_FONTS
+ fEnableDFRendering = true;
+#else
+ fEnableDFRendering = enable;
+#endif
fStrike = NULL;
fCurrTexture = NULL;
@@ -56,7 +56,7 @@
}
bool GrDistanceFieldTextContext::canDraw(const SkPaint& paint) {
- if (!kForceDistanceFieldFonts && !paint.isDistanceFieldTextTEMP()) {
+ if (!fEnableDFRendering && !paint.isDistanceFieldTextTEMP()) {
return false;
}