Index: src/gpu/GrTextContext.cpp |
diff --git a/src/gpu/GrTextContext.cpp b/src/gpu/GrTextContext.cpp |
index 5559b2da6d3d6b1b54315550b1dc2a40d3d80f8f..91c8e851783b64d7d0e41f43bc7d562932a393c7 100644 |
--- a/src/gpu/GrTextContext.cpp |
+++ b/src/gpu/GrTextContext.cpp |
@@ -20,12 +20,10 @@ |
#include "SkTextMapStateProc.h" |
#include "SkTextToPathIter.h" |
-GrTextContext::GrTextContext(GrContext* context, GrDrawContext* drawContext, |
- const SkDeviceProperties& properties) |
+GrTextContext::GrTextContext(GrContext* context, const SkDeviceProperties& properties) |
: fFallbackTextContext(NULL) |
, fContext(context) |
- , fDeviceProperties(properties) |
- , fDrawContext(drawContext) { |
+ , fDeviceProperties(properties) { |
} |
GrTextContext::~GrTextContext() { |
@@ -49,14 +47,19 @@ |
const SkPaint& skPaint, const SkMatrix& viewMatrix, |
const char text[], size_t byteLength, |
SkScalar x, SkScalar y, const SkIRect& clipBounds) { |
- if (fContext->abandoned() || !fDrawContext) { |
+ if (fContext->abandoned()) { |
+ return; |
+ } |
+ |
+ GrDrawContext* drawContext = fContext->drawContext(); |
+ if (!drawContext) { |
return; |
} |
GrTextContext* textContext = this; |
do { |
if (textContext->canDraw(rt, clip, paint, skPaint, viewMatrix)) { |
- textContext->onDrawText(rt, clip, paint, skPaint, viewMatrix, |
+ textContext->onDrawText(drawContext, rt, clip, paint, skPaint, viewMatrix, |
text, byteLength, x, y, clipBounds); |
return; |
} |
@@ -64,7 +67,7 @@ |
} while (textContext); |
// fall back to drawing as a path |
- this->drawTextAsPath(rt, clip, skPaint, viewMatrix, |
+ this->drawTextAsPath(drawContext, rt, clip, skPaint, viewMatrix, |
text, byteLength, x, y, clipBounds); |
} |
@@ -73,14 +76,19 @@ |
const char text[], size_t byteLength, |
const SkScalar pos[], int scalarsPerPosition, |
const SkPoint& offset, const SkIRect& clipBounds) { |
- if (fContext->abandoned() || !fDrawContext) { |
+ if (fContext->abandoned()) { |
+ return; |
+ } |
+ |
+ GrDrawContext* drawContext = fContext->drawContext(); |
+ if (!drawContext) { |
return; |
} |
GrTextContext* textContext = this; |
do { |
if (textContext->canDraw(rt, clip, paint, skPaint, viewMatrix)) { |
- textContext->onDrawPosText(rt, clip, paint, skPaint, viewMatrix, |
+ textContext->onDrawPosText(drawContext, rt, clip, paint, skPaint, viewMatrix, |
text, byteLength, pos, |
scalarsPerPosition, offset, clipBounds); |
return; |
@@ -89,7 +97,7 @@ |
} while (textContext); |
// fall back to drawing as a path |
- this->drawPosTextAsPath(rt, clip, skPaint, viewMatrix, text, byteLength, pos, |
+ this->drawPosTextAsPath(drawContext, rt, clip, skPaint, viewMatrix, text, byteLength, pos, |
scalarsPerPosition, offset, clipBounds); |
} |
@@ -175,7 +183,7 @@ |
} |
} |
-void GrTextContext::drawTextAsPath(GrRenderTarget* rt, |
+void GrTextContext::drawTextAsPath(GrDrawContext* drawContext, GrRenderTarget* rt, |
const GrClip& clip, |
const SkPaint& skPaint, const SkMatrix& viewMatrix, |
const char text[], size_t byteLength, SkScalar x, SkScalar y, |
@@ -193,14 +201,14 @@ |
matrix.postTranslate(xpos - prevXPos, 0); |
if (iterPath) { |
const SkPaint& pnt = iter.getPaint(); |
- GrBlurUtils::drawPathWithMaskFilter(fContext, fDrawContext, rt, clip, *iterPath, |
+ GrBlurUtils::drawPathWithMaskFilter(fContext, drawContext, rt, clip, *iterPath, |
pnt, viewMatrix, &matrix, clipBounds, false); |
} |
prevXPos = xpos; |
} |
} |
-void GrTextContext::drawPosTextAsPath(GrRenderTarget* rt, |
+void GrTextContext::drawPosTextAsPath(GrDrawContext* drawContext, GrRenderTarget* rt, |
const GrClip& clip, |
const SkPaint& origPaint, const SkMatrix& viewMatrix, |
const char text[], size_t byteLength, |
@@ -241,7 +249,7 @@ |
matrix[SkMatrix::kMTransX] = loc.fX; |
matrix[SkMatrix::kMTransY] = loc.fY; |
- GrBlurUtils::drawPathWithMaskFilter(fContext, fDrawContext, rt, clip, *path, paint, |
+ GrBlurUtils::drawPathWithMaskFilter(fContext, drawContext, rt, clip, *path, paint, |
viewMatrix, &matrix, clipBounds, false); |
} |
} |