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