| Index: src/gpu/GrStencilAndCoverTextContext.cpp
|
| diff --git a/src/gpu/GrStencilAndCoverTextContext.cpp b/src/gpu/GrStencilAndCoverTextContext.cpp
|
| index 763863fe758915705df47180e3aa222e003ea514..d1b6a846b0b5dccc14047aef759d149966be05d6 100644
|
| --- a/src/gpu/GrStencilAndCoverTextContext.cpp
|
| +++ b/src/gpu/GrStencilAndCoverTextContext.cpp
|
| @@ -22,18 +22,21 @@
|
| #include "SkTextFormatParams.h"
|
|
|
| GrStencilAndCoverTextContext::GrStencilAndCoverTextContext(GrContext* context,
|
| + GrDrawContext* drawContext,
|
| const SkDeviceProperties& properties)
|
| - : GrTextContext(context, properties)
|
| + : GrTextContext(context, drawContext, properties)
|
| , fStroke(SkStrokeRec::kFill_InitStyle)
|
| , fQueuedGlyphCount(0)
|
| , fFallbackGlyphsIdx(kGlyphBufferSize) {
|
| }
|
|
|
| GrStencilAndCoverTextContext*
|
| -GrStencilAndCoverTextContext::Create(GrContext* context, const SkDeviceProperties& props) {
|
| +GrStencilAndCoverTextContext::Create(GrContext* context, GrDrawContext* drawContext,
|
| + const SkDeviceProperties& props, bool fallbackUsesDFT) {
|
| GrStencilAndCoverTextContext* textContext = SkNEW_ARGS(GrStencilAndCoverTextContext,
|
| - (context, props));
|
| - textContext->fFallbackTextContext = GrAtlasTextContext::Create(context, props, false);
|
| + (context, drawContext, props));
|
| + textContext->fFallbackTextContext = GrAtlasTextContext::Create(context, drawContext,
|
| + props, fallbackUsesDFT);
|
|
|
| return textContext;
|
| }
|
| @@ -71,7 +74,7 @@ bool GrStencilAndCoverTextContext::canDraw(const GrRenderTarget* rt,
|
| return rec.getFormat() != SkMask::kARGB32_Format;
|
| }
|
|
|
| -void GrStencilAndCoverTextContext::onDrawText(GrDrawContext* drawContext, GrRenderTarget* rt,
|
| +void GrStencilAndCoverTextContext::onDrawText(GrRenderTarget* rt,
|
| const GrClip& clip,
|
| const GrPaint& paint,
|
| const SkPaint& skPaint,
|
| @@ -154,19 +157,17 @@ void GrStencilAndCoverTextContext::onDrawText(GrDrawContext* drawContext, GrRend
|
| const SkGlyph& glyph = glyphCacheProc(fGlyphCache, &text, 0, 0);
|
| fx += SkFixedMul(autokern.adjust(glyph), fixedSizeRatio);
|
| if (glyph.fWidth) {
|
| - this->appendGlyph(drawContext, glyph,
|
| - SkPoint::Make(SkFixedToScalar(fx), SkFixedToScalar(fy)));
|
| + this->appendGlyph(glyph, SkPoint::Make(SkFixedToScalar(fx), SkFixedToScalar(fy)));
|
| }
|
|
|
| fx += SkFixedMul(glyph.fAdvanceX, fixedSizeRatio);
|
| fy += SkFixedMul(glyph.fAdvanceY, fixedSizeRatio);
|
| }
|
|
|
| - this->finish(drawContext);
|
| + this->finish();
|
| }
|
|
|
| -void GrStencilAndCoverTextContext::onDrawPosText(GrDrawContext* drawContext,
|
| - GrRenderTarget* rt,
|
| +void GrStencilAndCoverTextContext::onDrawPosText(GrRenderTarget* rt,
|
| const GrClip& clip,
|
| const GrPaint& paint,
|
| const SkPaint& skPaint,
|
| @@ -210,12 +211,12 @@ void GrStencilAndCoverTextContext::onDrawPosText(GrDrawContext* drawContext,
|
| SkPoint loc;
|
| alignProc(tmsLoc, glyph, &loc);
|
|
|
| - this->appendGlyph(drawContext, glyph, loc);
|
| + this->appendGlyph(glyph, loc);
|
| }
|
| pos += scalarsPerPosition;
|
| }
|
|
|
| - this->finish(drawContext);
|
| + this->finish();
|
| }
|
|
|
| static GrPathRange* get_gr_glyphs(GrContext* ctx,
|
| @@ -410,11 +411,10 @@ bool GrStencilAndCoverTextContext::mapToFallbackContext(SkMatrix* inverse) {
|
| return true;
|
| }
|
|
|
| -inline void GrStencilAndCoverTextContext::appendGlyph(GrDrawContext* drawContext,
|
| - const SkGlyph& glyph, const SkPoint& pos) {
|
| +inline void GrStencilAndCoverTextContext::appendGlyph(const SkGlyph& glyph, const SkPoint& pos) {
|
| if (fQueuedGlyphCount >= fFallbackGlyphsIdx) {
|
| SkASSERT(fQueuedGlyphCount == fFallbackGlyphsIdx);
|
| - this->flush(drawContext);
|
| + this->flush();
|
| }
|
|
|
| // Stick the glyphs we can't draw at the end of the buffer, growing backwards.
|
| @@ -432,17 +432,17 @@ static const SkScalar* get_xy_scalar_array(const SkPoint* pointArray) {
|
| return &pointArray[0].fX;
|
| }
|
|
|
| -void GrStencilAndCoverTextContext::flush(GrDrawContext* drawContext) {
|
| +void GrStencilAndCoverTextContext::flush() {
|
| if (fQueuedGlyphCount > 0) {
|
| SkAutoTUnref<GrPathProcessor> pp(GrPathProcessor::Create(fPaint.getColor(),
|
| fViewMatrix,
|
| fLocalMatrix));
|
|
|
| - drawContext->drawPaths(&fPipelineBuilder, pp, fGlyphs,
|
| - fGlyphIndices, GrPathRange::kU16_PathIndexType,
|
| - get_xy_scalar_array(fGlyphPositions),
|
| - GrPathRendering::kTranslate_PathTransformType,
|
| - fQueuedGlyphCount, GrPathRendering::kWinding_FillType);
|
| + fDrawContext->drawPaths(&fPipelineBuilder, pp, fGlyphs,
|
| + fGlyphIndices, GrPathRange::kU16_PathIndexType,
|
| + get_xy_scalar_array(fGlyphPositions),
|
| + GrPathRendering::kTranslate_PathTransformType,
|
| + fQueuedGlyphCount, GrPathRendering::kWinding_FillType);
|
|
|
| fQueuedGlyphCount = 0;
|
| }
|
| @@ -474,8 +474,8 @@ void GrStencilAndCoverTextContext::flush(GrDrawContext* drawContext) {
|
| }
|
| }
|
|
|
| -void GrStencilAndCoverTextContext::finish(GrDrawContext* drawContext) {
|
| - this->flush(drawContext);
|
| +void GrStencilAndCoverTextContext::finish() {
|
| + this->flush();
|
|
|
| fGlyphs->unref();
|
| fGlyphs = NULL;
|
|
|