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

Unified Diff: src/gpu/SkGpuDevice.cpp

Issue 650273003: Change GrTextContext fallbacks to be a linked list chain. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Fix include Created 6 years, 2 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/SkGpuDevice.h ('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 6f4d1a6f99ea6b83fc5ac1ae99a78704678e8228..0912b3d28e3f4475568ff3bc4f9901dd3a549fb0 100644
--- a/src/gpu/SkGpuDevice.cpp
+++ b/src/gpu/SkGpuDevice.cpp
@@ -147,8 +147,7 @@ SkGpuDevice::SkGpuDevice(GrSurface* surface, const SkSurfaceProps& props, unsign
this->setPixelGeometry(props.pixelGeometry());
bool useDFFonts = !!(flags & kDFFonts_Flag);
- fMainTextContext = fContext->createTextContext(fRenderTarget, this->getLeakyProperties(), useDFFonts);
- fFallbackTextContext = SkNEW_ARGS(GrBitmapTextContext, (fContext, this->getLeakyProperties()));
+ fTextContext = fContext->createTextContext(fRenderTarget, this->getLeakyProperties(), useDFFonts);
}
SkGpuDevice* SkGpuDevice::Create(GrContext* context, const SkImageInfo& origInfo,
@@ -192,8 +191,7 @@ SkGpuDevice::~SkGpuDevice() {
delete fDrawProcs;
}
- delete fMainTextContext;
- delete fFallbackTextContext;
+ delete fTextContext;
// The GrContext takes a ref on the target. We don't want to cause the render
// target to be unnecessarily kept alive.
@@ -1685,22 +1683,13 @@ void SkGpuDevice::drawText(const SkDraw& draw, const void* text,
CHECK_SHOULD_DRAW(draw, false);
GR_CREATE_TRACE_MARKER_CONTEXT("SkGpuDevice::drawText", fContext);
- if (fMainTextContext->canDraw(paint)) {
- GrPaint grPaint;
- SkPaint2GrPaintShader(this->context(), paint, true, &grPaint);
-
- SkDEBUGCODE(this->validate();)
-
- fMainTextContext->drawText(grPaint, paint, (const char *)text, byteLength, x, y);
- } else if (fFallbackTextContext && fFallbackTextContext->canDraw(paint)) {
- GrPaint grPaint;
- SkPaint2GrPaintShader(this->context(), paint, true, &grPaint);
+ GrPaint grPaint;
+ SkPaint2GrPaintShader(this->context(), paint, true, &grPaint);
- SkDEBUGCODE(this->validate();)
+ SkDEBUGCODE(this->validate();)
- fFallbackTextContext->drawText(grPaint, paint, (const char *)text, byteLength, x, y);
- } else {
- // this guy will just call our drawPath()
+ if (!fTextContext->drawText(grPaint, paint, (const char *)text, byteLength, x, y)) {
+ // this will just call our drawPath()
draw.drawText_asPaths((const char*)text, byteLength, x, y, paint);
}
}
@@ -1711,23 +1700,14 @@ void SkGpuDevice::drawPosText(const SkDraw& draw, const void* text, size_t byteL
GR_CREATE_TRACE_MARKER_CONTEXT("SkGpuDevice::drawPosText", fContext);
CHECK_SHOULD_DRAW(draw, false);
- if (fMainTextContext->canDraw(paint)) {
- GrPaint grPaint;
- SkPaint2GrPaintShader(this->context(), paint, true, &grPaint);
-
- SkDEBUGCODE(this->validate();)
-
- fMainTextContext->drawPosText(grPaint, paint, (const char *)text, byteLength, pos,
- scalarsPerPos, offset);
- } else if (fFallbackTextContext && fFallbackTextContext->canDraw(paint)) {
- GrPaint grPaint;
- SkPaint2GrPaintShader(this->context(), paint, true, &grPaint);
+ GrPaint grPaint;
+ SkPaint2GrPaintShader(this->context(), paint, true, &grPaint);
- SkDEBUGCODE(this->validate();)
+ SkDEBUGCODE(this->validate();)
- fFallbackTextContext->drawPosText(grPaint, paint, (const char *)text, byteLength, pos,
- scalarsPerPos, offset);
- } else {
+ if (!fTextContext->drawPosText(grPaint, paint, (const char *)text, byteLength, pos,
+ scalarsPerPos, offset)) {
+ // this will just call our drawPath()
draw.drawPosText_asPaths((const char*)text, byteLength, pos, scalarsPerPos, offset, paint);
}
}
« no previous file with comments | « src/gpu/SkGpuDevice.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698