| Index: src/gpu/GrBitmapTextContext.cpp
|
| diff --git a/src/gpu/GrTextContext.cpp b/src/gpu/GrBitmapTextContext.cpp
|
| old mode 100644
|
| new mode 100755
|
| similarity index 88%
|
| copy from src/gpu/GrTextContext.cpp
|
| copy to src/gpu/GrBitmapTextContext.cpp
|
| index 8178032ae7a6351d9e4c714ef05b04cc0f3b5721..7a99f093e5149108163a402a2aa9ee7788dc1f47
|
| --- a/src/gpu/GrTextContext.cpp
|
| +++ b/src/gpu/GrBitmapTextContext.cpp
|
| @@ -1,15 +1,12 @@
|
| /*
|
| - * Copyright 2010 Google Inc.
|
| + * Copyright 2013 Google Inc.
|
| *
|
| * Use of this source code is governed by a BSD-style license that can be
|
| * found in the LICENSE file.
|
| */
|
|
|
| -
|
| -
|
| -#include "GrTextContext.h"
|
| +#include "GrBitmapTextContext.h"
|
| #include "GrAtlas.h"
|
| -#include "GrContext.h"
|
| #include "GrDrawTarget.h"
|
| #include "GrFontScaler.h"
|
| #include "GrIndexBuffer.h"
|
| @@ -25,7 +22,24 @@ static const int kGlyphCoordsAttributeIndex = 1;
|
| SK_CONF_DECLARE(bool, c_DumpFontCache, "gpu.dumpFontCache", false,
|
| "Dump the contents of the font cache before every purge.");
|
|
|
| -void GrTextContext::flushGlyphs() {
|
| +GrBitmapTextContext::GrBitmapTextContext(GrContext* context, const GrPaint& paint) :
|
| + GrTextContext(context, paint) {
|
| + fAutoMatrix.setIdentity(fContext, &fPaint);
|
| +
|
| + fStrike = NULL;
|
| +
|
| + fCurrTexture = NULL;
|
| + fCurrVertex = 0;
|
| +
|
| + fVertices = NULL;
|
| + fMaxVertices = 0;
|
| +}
|
| +
|
| +GrBitmapTextContext::~GrBitmapTextContext() {
|
| + this->flushGlyphs();
|
| +}
|
| +
|
| +void GrBitmapTextContext::flushGlyphs() {
|
| if (NULL == fDrawTarget) {
|
| return;
|
| }
|
| @@ -76,41 +90,6 @@ void GrTextContext::flushGlyphs() {
|
| }
|
| }
|
|
|
| -GrTextContext::GrTextContext(GrContext* context, const GrPaint& paint) : fPaint(paint) {
|
| - fContext = context;
|
| - fStrike = NULL;
|
| -
|
| - fCurrTexture = NULL;
|
| - fCurrVertex = 0;
|
| -
|
| - const GrClipData* clipData = context->getClip();
|
| -
|
| - SkRect devConservativeBound;
|
| - clipData->fClipStack->getConservativeBounds(
|
| - -clipData->fOrigin.fX,
|
| - -clipData->fOrigin.fY,
|
| - context->getRenderTarget()->width(),
|
| - context->getRenderTarget()->height(),
|
| - &devConservativeBound);
|
| -
|
| - devConservativeBound.roundOut(&fClipRect);
|
| -
|
| - fAutoMatrix.setIdentity(fContext, &fPaint);
|
| -
|
| - fDrawTarget = fContext->getTextTarget();
|
| -
|
| - fVertices = NULL;
|
| - fMaxVertices = 0;
|
| -}
|
| -
|
| -GrTextContext::~GrTextContext() {
|
| - this->flushGlyphs();
|
| -}
|
| -
|
| -void GrTextContext::flush() {
|
| - this->flushGlyphs();
|
| -}
|
| -
|
| namespace {
|
|
|
| // position + texture coord
|
| @@ -121,9 +100,9 @@ extern const GrVertexAttrib gTextVertexAttribs[] = {
|
|
|
| };
|
|
|
| -void GrTextContext::drawPackedGlyph(GrGlyph::PackedID packed,
|
| - GrFixed vx, GrFixed vy,
|
| - GrFontScaler* scaler) {
|
| +void GrBitmapTextContext::drawPackedGlyph(GrGlyph::PackedID packed,
|
| + GrFixed vx, GrFixed vy,
|
| + GrFontScaler* scaler) {
|
| if (NULL == fDrawTarget) {
|
| return;
|
| }
|
|
|