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

Unified Diff: src/gpu/SkGpuDevice.cpp

Issue 135683006: Add fallback code for TextContexts that don't support all features (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Fix nits Created 6 years, 11 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/GrDistanceFieldTextContext.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 df302c4736b9fe106d3417a47dab54256c605924..f951a1555ef3e16a2c0c42b38134fafd246c7b91 100644
--- a/src/gpu/SkGpuDevice.cpp
+++ b/src/gpu/SkGpuDevice.cpp
@@ -1771,9 +1771,7 @@ void SkGpuDevice::drawText(const SkDraw& draw, const void* text,
const SkPaint& paint) {
CHECK_SHOULD_DRAW(draw, false);
- if (SkDraw::ShouldDrawTextAsPaths(paint, fContext->getMatrix())) {
- draw.drawText_asPaths((const char*)text, byteLength, x, y, paint);
- } else {
+ if (fTextContextManager->canDraw(paint, fContext->getMatrix())) {
GrPaint grPaint;
if (!skPaint2GrPaintShader(this, paint, true, &grPaint)) {
return;
@@ -1785,6 +1783,20 @@ void SkGpuDevice::drawText(const SkDraw& draw, const void* text,
grPaint, paint,
this->getDeviceProperties()));
ctx->drawText((const char *)text, byteLength, x, y);
+ } else if (GrBitmapTextContext::CanDraw(paint, fContext->getMatrix())) {
+ GrPaint grPaint;
+ if (!skPaint2GrPaintShader(this, paint, true, &grPaint)) {
+ return;
+ }
+
+ SkDEBUGCODE(this->validate();)
+
+ GrBitmapTextContext textContext(this->context(), grPaint, paint,
+ this->getDeviceProperties());
+ textContext.drawText((const char *)text, byteLength, x, y);
+ } else {
+ // this guy will just call our drawPath()
+ draw.drawText_asPaths((const char*)text, byteLength, x, y, paint);
}
}
@@ -1794,11 +1806,7 @@ void SkGpuDevice::drawPosText(const SkDraw& draw, const void* text,
const SkPaint& paint) {
CHECK_SHOULD_DRAW(draw, false);
- if (SkDraw::ShouldDrawTextAsPaths(paint, fContext->getMatrix())) {
- // this guy will just call our drawPath()
- draw.drawPosText_asPaths((const char*)text, byteLength, pos, constY,
- scalarsPerPos, paint);
- } else {
+ if (fTextContextManager->canDraw(paint, fContext->getMatrix())) {
GrPaint grPaint;
if (!skPaint2GrPaintShader(this, paint, true, &grPaint)) {
return;
@@ -1810,6 +1818,20 @@ void SkGpuDevice::drawPosText(const SkDraw& draw, const void* text,
grPaint, paint,
this->getDeviceProperties()));
ctx->drawPosText((const char *)text, byteLength, pos, constY, scalarsPerPos);
+ } else if (GrBitmapTextContext::CanDraw(paint, fContext->getMatrix())) {
+ GrPaint grPaint;
+ if (!skPaint2GrPaintShader(this, paint, true, &grPaint)) {
+ return;
+ }
+
+ SkDEBUGCODE(this->validate();)
+
+ GrBitmapTextContext textContext(this->context(), grPaint, paint,
+ this->getDeviceProperties());
+ textContext.drawPosText((const char *)text, byteLength, pos, constY, scalarsPerPos);
+ } else {
+ draw.drawPosText_asPaths((const char*)text, byteLength, pos, constY,
+ scalarsPerPos, paint);
}
}
« no previous file with comments | « src/gpu/GrDistanceFieldTextContext.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698