| Index: src/gpu/GrBitmapTextContext.cpp
|
| diff --git a/src/gpu/GrBitmapTextContext.cpp b/src/gpu/GrBitmapTextContext.cpp
|
| index 488aa137e9a14f5c72033df5d74dedcea9d639ae..c7beb14e4204d58f3e01f74908a9edc3a047bc39 100755
|
| --- a/src/gpu/GrBitmapTextContext.cpp
|
| +++ b/src/gpu/GrBitmapTextContext.cpp
|
| @@ -29,15 +29,9 @@ static const int kGlyphCoordsAttributeIndex = 1;
|
| SK_CONF_DECLARE(bool, c_DumpFontCache, "gpu.dumpFontCache", false,
|
| "Dump the contents of the font cache before every purge.");
|
|
|
| -bool GrBitmapTextContext::CanDraw(const SkPaint& paint, const SkMatrix& ctm) {
|
| - return !SkDraw::ShouldDrawTextAsPaths(paint, ctm);
|
| -}
|
| -
|
| GrBitmapTextContext::GrBitmapTextContext(GrContext* context,
|
| - const GrPaint& grPaint,
|
| - const SkPaint& skPaint,
|
| const SkDeviceProperties& properties)
|
| - : GrTextContext(context, grPaint, skPaint, properties) {
|
| + : GrTextContext(context, properties) {
|
| fStrike = NULL;
|
|
|
| fCurrTexture = NULL;
|
| @@ -51,6 +45,10 @@ GrBitmapTextContext::~GrBitmapTextContext() {
|
| this->flushGlyphs();
|
| }
|
|
|
| +bool GrBitmapTextContext::canDraw(const SkPaint& paint) {
|
| + return !SkDraw::ShouldDrawTextAsPaths(paint, fContext->getMatrix());
|
| +}
|
| +
|
| static inline GrColor skcolor_to_grcolor_nopremultiply(SkColor c) {
|
| unsigned r = SkColorGetR(c);
|
| unsigned g = SkColorGetG(c);
|
| @@ -117,7 +115,26 @@ void GrBitmapTextContext::flushGlyphs() {
|
| }
|
| }
|
|
|
| -void GrBitmapTextContext::drawText(const char text[], size_t byteLength,
|
| +inline void GrBitmapTextContext::init(const GrPaint& paint, const SkPaint& skPaint) {
|
| + GrTextContext::init(paint, skPaint);
|
| +
|
| + fStrike = NULL;
|
| +
|
| + fCurrTexture = NULL;
|
| + fCurrVertex = 0;
|
| +
|
| + fVertices = NULL;
|
| + fMaxVertices = 0;
|
| +}
|
| +
|
| +inline void GrBitmapTextContext::finish() {
|
| + flushGlyphs();
|
| +
|
| + GrTextContext::finish();
|
| +}
|
| +
|
| +void GrBitmapTextContext::drawText(const GrPaint& paint, const SkPaint& skPaint,
|
| + const char text[], size_t byteLength,
|
| SkScalar x, SkScalar y) {
|
| SkASSERT(byteLength == 0 || text != NULL);
|
|
|
| @@ -126,6 +143,8 @@ void GrBitmapTextContext::drawText(const char text[], size_t byteLength,
|
| return;
|
| }
|
|
|
| + this->init(paint, skPaint);
|
| +
|
| SkDrawCacheProc glyphCacheProc = fSkPaint.getDrawCacheProc();
|
|
|
| SkAutoGlyphCache autoCache(fSkPaint, &fDeviceProperties, &fContext->getMatrix());
|
| @@ -201,6 +220,8 @@ void GrBitmapTextContext::drawText(const char text[], size_t byteLength,
|
| fx += glyph.fAdvanceX;
|
| fy += glyph.fAdvanceY;
|
| }
|
| +
|
| + this->finish();
|
| }
|
|
|
| ///////////////////////////////////////////////////////////////////////////////
|
| @@ -295,7 +316,8 @@ BitmapTextMapState::Proc BitmapTextMapState::pickProc(int scalarsPerPosition) {
|
|
|
| ///////////////////////////////////////////////////////////////////////////////
|
|
|
| -void GrBitmapTextContext::drawPosText(const char text[], size_t byteLength,
|
| +void GrBitmapTextContext::drawPosText(const GrPaint& paint, const SkPaint& skPaint,
|
| + const char text[], size_t byteLength,
|
| const SkScalar pos[], SkScalar constY,
|
| int scalarsPerPosition) {
|
| SkASSERT(byteLength == 0 || text != NULL);
|
| @@ -306,6 +328,8 @@ void GrBitmapTextContext::drawPosText(const char text[], size_t byteLength,
|
| return;
|
| }
|
|
|
| + this->init(paint, skPaint);
|
| +
|
| SkDrawCacheProc glyphCacheProc = fSkPaint.getDrawCacheProc();
|
|
|
| SkAutoGlyphCache autoCache(fSkPaint, &fDeviceProperties, &fContext->getMatrix());
|
| @@ -439,6 +463,8 @@ void GrBitmapTextContext::drawPosText(const char text[], size_t byteLength,
|
| }
|
| }
|
| }
|
| +
|
| + this->finish();
|
| }
|
|
|
| namespace {
|
|
|