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

Unified Diff: src/gpu/SkGpuDevice.cpp

Issue 79283004: Minor fixes for distance field fonts: (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Replace local identity matrix with global Created 7 years, 1 month 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/GrBitmapTextContext.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/SkGpuDevice.cpp
diff --git a/src/gpu/SkGpuDevice.cpp b/src/gpu/SkGpuDevice.cpp
index 747688ed8b6371a48e3af6f6c2d26285ede30888..b1771e87ef5b75b2d1cf401d596ecd04ca723d95 100644
--- a/src/gpu/SkGpuDevice.cpp
+++ b/src/gpu/SkGpuDevice.cpp
@@ -1699,8 +1699,6 @@ SkDrawProcs* SkGpuDevice::initDrawForText(GrTextContext* context) {
fDrawProcs->fContext = fContext;
#if SK_DISTANCEFIELD_FONTS
fDrawProcs->fFlags = 0;
- fDrawProcs->fFlags |= SkDrawProcs::kSkipBakedGlyphTransform_Flag;
- fDrawProcs->fFlags |= SkDrawProcs::kUseScaledGlyphs_Flag;
#endif
}
@@ -1726,13 +1724,22 @@ void SkGpuDevice::drawText(const SkDraw& draw, const void* text,
return;
}
#if SK_DISTANCEFIELD_FONTS
- GrDistanceFieldTextContext context(fContext, grPaint, paint.getColor(),
- paint.getTextSize());
-#else
- GrBitmapTextContext context(fContext, grPaint, paint.getColor());
+ if (paint.getRasterizer()) {
+#endif
+ GrBitmapTextContext context(fContext, grPaint, paint.getColor());
+ myDraw.fProcs = this->initDrawForText(&context);
+ this->INHERITED::drawText(myDraw, text, byteLength, x, y, paint);
+#if SK_DISTANCEFIELD_FONTS
+ } else {
+ GrDistanceFieldTextContext context(fContext, grPaint, paint.getColor(),
+ paint.getTextSize()/SkDrawProcs::kBaseDFFontSize);
+ myDraw.fProcs = this->initDrawForText(&context);
+ fDrawProcs->fFlags |= SkDrawProcs::kSkipBakedGlyphTransform_Flag;
+ fDrawProcs->fFlags |= SkDrawProcs::kUseScaledGlyphs_Flag;
+ this->INHERITED::drawText(myDraw, text, byteLength, x, y, paint);
+ fDrawProcs->fFlags = 0;
+ }
#endif
- myDraw.fProcs = this->initDrawForText(&context);
- this->INHERITED::drawText(myDraw, text, byteLength, x, y, paint);
}
}
@@ -1754,14 +1761,24 @@ void SkGpuDevice::drawPosText(const SkDraw& draw, const void* text,
return;
}
#if SK_DISTANCEFIELD_FONTS
- GrDistanceFieldTextContext context(fContext, grPaint, paint.getColor(),
- paint.getTextSize()/SkDrawProcs::kBaseDFFontSize);
-#else
- GrBitmapTextContext context(fContext, grPaint, paint.getColor());
+ if (paint.getRasterizer()) {
+#endif
+ GrBitmapTextContext context(fContext, grPaint, paint.getColor());
+ myDraw.fProcs = this->initDrawForText(&context);
+ this->INHERITED::drawPosText(myDraw, text, byteLength, pos, constY,
+ scalarsPerPos, paint);
+#if SK_DISTANCEFIELD_FONTS
+ } else {
+ GrDistanceFieldTextContext context(fContext, grPaint, paint.getColor(),
+ paint.getTextSize()/SkDrawProcs::kBaseDFFontSize);
+ myDraw.fProcs = this->initDrawForText(&context);
+ fDrawProcs->fFlags |= SkDrawProcs::kSkipBakedGlyphTransform_Flag;
+ fDrawProcs->fFlags |= SkDrawProcs::kUseScaledGlyphs_Flag;
+ this->INHERITED::drawPosText(myDraw, text, byteLength, pos, constY,
+ scalarsPerPos, paint);
+ fDrawProcs->fFlags = 0;
+ }
#endif
- myDraw.fProcs = this->initDrawForText(&context);
- this->INHERITED::drawPosText(myDraw, text, byteLength, pos, constY,
- scalarsPerPos, paint);
}
}
« no previous file with comments | « src/gpu/GrBitmapTextContext.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698