Index: src/gpu/SkGpuDevice.cpp |
diff --git a/src/gpu/SkGpuDevice.cpp b/src/gpu/SkGpuDevice.cpp |
index db440c149af74b8d4d137d908eaeb4988177f22c..960b9acb79258536f6acf1e426032e96b149c955 100644 |
--- a/src/gpu/SkGpuDevice.cpp |
+++ b/src/gpu/SkGpuDevice.cpp |
@@ -12,6 +12,7 @@ |
#include "GrContext.h" |
#include "GrBitmapTextContext.h" |
+#include "GrDistanceFieldTextContext.h" |
#include "SkGrTexturePixelRef.h" |
@@ -28,6 +29,8 @@ |
#define CACHE_COMPATIBLE_DEVICE_TEXTURES 1 |
+#define USE_DISTANCE_FIELDS 1 |
+ |
#if 0 |
extern bool (*gShouldDrawProc)(); |
#define CHECK_SHOULD_DRAW(draw, forceI) \ |
@@ -1732,6 +1735,11 @@ SkDrawProcs* SkGpuDevice::initDrawForText(GrTextContext* context) { |
fDrawProcs = SkNEW(GrSkDrawProcs); |
fDrawProcs->fD1GProc = SkGPU_Draw1Glyph; |
fDrawProcs->fContext = fContext; |
+ fDrawProcs->fFlags = 0; |
+#if USE_DISTANCE_FIELDS |
+ fDrawProcs->fFlags |= SkDrawProcs::kSkipBakedGlyphTransform_Flag; |
+ fDrawProcs->fFlags |= SkDrawProcs::kUseScaledGlyphs_Flag; |
+#endif |
} |
// init our (and GL's) state |
@@ -1755,7 +1763,11 @@ void SkGpuDevice::drawText(const SkDraw& draw, const void* text, |
if (!skPaint2GrPaintShader(this, paint, true, &grPaint)) { |
return; |
} |
+#if USE_DISTANCE_FIELDS |
+ GrDistanceFieldTextContext context(fContext, grPaint, paint.getTextSize()); |
+#else |
GrBitmapTextContext context(fContext, grPaint); |
+#endif |
myDraw.fProcs = this->initDrawForText(&context); |
this->INHERITED::drawText(myDraw, text, byteLength, x, y, paint); |
} |
@@ -1778,7 +1790,11 @@ void SkGpuDevice::drawPosText(const SkDraw& draw, const void* text, |
if (!skPaint2GrPaintShader(this, paint, true, &grPaint)) { |
return; |
} |
+#if USE_DISTANCE_FIELDS |
+ GrDistanceFieldTextContext context(fContext, grPaint, paint.getTextSize()); |
+#else |
GrBitmapTextContext context(fContext, grPaint); |
+#endif |
myDraw.fProcs = this->initDrawForText(&context); |
this->INHERITED::drawPosText(myDraw, text, byteLength, pos, constY, |
scalarsPerPos, paint); |