Add useDFT field to SkDeviceProperties
Review URL: https://codereview.chromium.org/1191943002
diff --git a/src/gpu/GrAtlasTextContext.cpp b/src/gpu/GrAtlasTextContext.cpp
index f2305ad..900d681 100644
--- a/src/gpu/GrAtlasTextContext.cpp
+++ b/src/gpu/GrAtlasTextContext.cpp
@@ -97,8 +97,7 @@
GrAtlasTextContext::GrAtlasTextContext(GrContext* context,
GrDrawContext* drawContext,
- const SkDeviceProperties& properties,
- bool useDFT)
+ const SkDeviceProperties& properties)
: INHERITED(context, drawContext, properties)
, fDistanceAdjustTable(SkNEW_ARGS(DistanceAdjustTable, (properties.gamma()))) {
// We overallocate vertices in our textblobs based on the assumption that A8 has the greatest
@@ -107,12 +106,6 @@
vertex_attribute_changed);
fCurrStrike = NULL;
fCache = context->getTextBlobCache();
-
-#if SK_FORCE_DISTANCE_FIELD_TEXT
- fEnableDFRendering = true;
-#else
- fEnableDFRendering = useDFT;
-#endif
}
void GrAtlasTextContext::DistanceAdjustTable::buildDistanceAdjustTable(float gamma) {
@@ -199,9 +192,8 @@
GrAtlasTextContext* GrAtlasTextContext::Create(GrContext* context,
GrDrawContext* drawContext,
- const SkDeviceProperties& props,
- bool useDFT) {
- return SkNEW_ARGS(GrAtlasTextContext, (context, drawContext, props, useDFT));
+ const SkDeviceProperties& props) {
+ return SkNEW_ARGS(GrAtlasTextContext, (context, drawContext, props));
}
bool GrAtlasTextContext::canDraw(const GrRenderTarget*,
@@ -450,8 +442,12 @@
return false;
}
- if (!fEnableDFRendering && !skPaint.isDistanceFieldTextTEMP() &&
- scaledTextSize < kLargeDFFontSize) {
+ bool useDFT = fDeviceProperties.useDFT();
+#if SK_FORCE_DISTANCE_FIELD_TEXT
+ useDFT = true;
+#endif
+
+ if (!useDFT && !skPaint.isDistanceFieldTextTEMP() && scaledTextSize < kLargeDFFontSize) {
return false;
}
@@ -2228,13 +2224,12 @@
gContextID = context->uniqueID();
SkDELETE(gTextContext);
- static const bool kUseDFT = false;
// We don't yet test the fall back to paths in the GrTextContext base class. This is mostly
// because we don't really want to have a gpu device here.
// We enable distance fields by twiddling a knob on the paint
- GrDrawContext* drawContext = context->drawContext(&gDevProperties, kUseDFT);
+ GrDrawContext* drawContext = context->drawContext(&gDevProperties);
- gTextContext = GrAtlasTextContext::Create(context, drawContext, gDevProperties, kUseDFT);
+ gTextContext = GrAtlasTextContext::Create(context, drawContext, gDevProperties);
}
// create dummy render target