Index: src/gpu/GrTextContext.cpp |
diff --git a/src/gpu/GrTextContext.cpp b/src/gpu/GrTextContext.cpp |
index d281173dca5d95d12a870e77784471b1220afb89..94c05a712439a8c8498c899a0059574df4c9e187 100644 |
--- a/src/gpu/GrTextContext.cpp |
+++ b/src/gpu/GrTextContext.cpp |
@@ -13,9 +13,14 @@ |
#include "GrFontScaler.h" |
GrTextContext::GrTextContext(GrContext* context, const SkDeviceProperties& properties) : |
+ fFallbackTextContext(NULL), |
fContext(context), fDeviceProperties(properties), fDrawTarget(NULL) { |
} |
+GrTextContext::~GrTextContext() { |
+ SkDELETE(fFallbackTextContext); |
+} |
+ |
void GrTextContext::init(const GrPaint& grPaint, const SkPaint& skPaint) { |
const GrClipData* clipData = fContext->getClip(); |
@@ -35,6 +40,41 @@ void GrTextContext::init(const GrPaint& grPaint, const SkPaint& skPaint) { |
fSkPaint = skPaint; |
} |
+bool GrTextContext::drawText(const GrPaint& paint, const SkPaint& skPaint, |
+ const char text[], size_t byteLength, |
+ SkScalar x, SkScalar y) { |
+ |
+ GrTextContext* textContext = this; |
+ do { |
+ if (textContext->canDraw(skPaint)) { |
+ textContext->onDrawText(paint, skPaint, text, byteLength, x, y); |
+ return true; |
+ } |
+ textContext = textContext->fFallbackTextContext; |
+ } while (textContext); |
+ |
+ return false; |
+} |
+ |
+bool GrTextContext::drawPosText(const GrPaint& paint, const SkPaint& skPaint, |
+ const char text[], size_t byteLength, |
+ const SkScalar pos[], int scalarsPerPosition, |
+ const SkPoint& offset) { |
+ |
+ GrTextContext* textContext = this; |
+ do { |
+ if (textContext->canDraw(skPaint)) { |
+ textContext->onDrawPosText(paint, skPaint, text, byteLength, pos, scalarsPerPosition, |
+ offset); |
+ return true; |
+ } |
+ textContext = textContext->fFallbackTextContext; |
+ } while (textContext); |
+ |
+ return false; |
+} |
+ |
+ |
//*** change to output positions? |
void GrTextContext::MeasureText(SkGlyphCache* cache, SkDrawCacheProc glyphCacheProc, |
const char text[], size_t byteLength, SkVector* stopVector) { |