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

Unified Diff: src/gpu/GrAtlasTextContext.cpp

Issue 1191943002: Add useDFT field to SkDeviceProperties (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: update to ToT Created 5 years, 6 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/GrAtlasTextContext.h ('k') | src/gpu/GrContext.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/GrAtlasTextContext.cpp
diff --git a/src/gpu/GrAtlasTextContext.cpp b/src/gpu/GrAtlasTextContext.cpp
index f2305ad2080e0e3aa2c5da5ba51a4d6aced1fa48..900d681b50c1f0b43fccbccffe0704a5df20bea9 100644
--- a/src/gpu/GrAtlasTextContext.cpp
+++ b/src/gpu/GrAtlasTextContext.cpp
@@ -97,8 +97,7 @@ static inline GrColor skcolor_to_grcolor_nopremultiply(SkColor c) {
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 @@ GrAtlasTextContext::GrAtlasTextContext(GrContext* context,
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 @@ void GrAtlasTextContext::DistanceAdjustTable::buildDistanceAdjustTable(float gam
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 @@ inline bool GrAtlasTextContext::canDrawAsDistanceFields(const SkPaint& skPaint,
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 @@ BATCH_TEST_DEFINE(TextBlobBatch) {
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
« no previous file with comments | « src/gpu/GrAtlasTextContext.h ('k') | src/gpu/GrContext.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698