diff options
author | bsalomon <bsalomon@google.com> | 2015-06-16 15:03:11 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-06-16 15:03:11 -0700 |
commit | 781d58215f03cfe43c6b5f7bf1a578bc3c9a1e6f (patch) | |
tree | 4f88e8af9f8504ea8898430aff586fa1ada96765 /src/gpu/GrStencilAndCoverTextContext.cpp | |
parent | e3b22dc742c9a9362f0c6501ab033a6e33fba3c5 (diff) |
Revert of Make GrTextContext be owned by the GrDrawContext (patchset #7 id:120001 of https://codereview.chromium.org/1175553002/)
Reason for revert:
Breaking Test-Win8-MSVC-ShuttleA-GPU-GTX660-x86_64-Debug ?
https://build.chromium.org/p/client.skia/builders/Test-Win8-MSVC-ShuttleA-GPU-GTX660-x86_64-Debug/builds/436/steps/dm/logs/stdio
Original issue's description:
> Make GrTextContext be owned by the GrDrawContext
>
> This CL makes the GrTextContext be owned (and hidden) by the GrDrawContext. This funnels all the drawText* calls through the GrDrawContext and hides the (dispreferred) GrPipelineBuilder drawText variant.
>
> Some consequences of this are:
>
> GrDrawContext now has to get the text drawing settings (i.e., SkDeviceProperties & useDFT). This means that we need a separate GrDrawContext for each combination of pixel geometry and DFT-use.
>
> All the GrTextContext-derived classes now get a back pointer to the originating GrDrawContext so their method calls no longer take one.
>
> Committed: https://skia.googlesource.com/skia/+/5b16e740fe6ab6d679083d06f07651602265081b
TBR=joshualitt@chromium.org,joshualitt@google.com,jvanverth@google.com,reed@google.com,robertphillips@google.com
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
Review URL: https://codereview.chromium.org/1178383003
Diffstat (limited to 'src/gpu/GrStencilAndCoverTextContext.cpp')
-rw-r--r-- | src/gpu/GrStencilAndCoverTextContext.cpp | 46 |
1 files changed, 23 insertions, 23 deletions
diff --git a/src/gpu/GrStencilAndCoverTextContext.cpp b/src/gpu/GrStencilAndCoverTextContext.cpp index d1b6a846b0..763863fe75 100644 --- a/src/gpu/GrStencilAndCoverTextContext.cpp +++ b/src/gpu/GrStencilAndCoverTextContext.cpp @@ -22,21 +22,18 @@ #include "SkTextFormatParams.h" GrStencilAndCoverTextContext::GrStencilAndCoverTextContext(GrContext* context, - GrDrawContext* drawContext, const SkDeviceProperties& properties) - : GrTextContext(context, drawContext, properties) + : GrTextContext(context, properties) , fStroke(SkStrokeRec::kFill_InitStyle) , fQueuedGlyphCount(0) , fFallbackGlyphsIdx(kGlyphBufferSize) { } GrStencilAndCoverTextContext* -GrStencilAndCoverTextContext::Create(GrContext* context, GrDrawContext* drawContext, - const SkDeviceProperties& props, bool fallbackUsesDFT) { +GrStencilAndCoverTextContext::Create(GrContext* context, const SkDeviceProperties& props) { GrStencilAndCoverTextContext* textContext = SkNEW_ARGS(GrStencilAndCoverTextContext, - (context, drawContext, props)); - textContext->fFallbackTextContext = GrAtlasTextContext::Create(context, drawContext, - props, fallbackUsesDFT); + (context, props)); + textContext->fFallbackTextContext = GrAtlasTextContext::Create(context, props, false); return textContext; } @@ -74,7 +71,7 @@ bool GrStencilAndCoverTextContext::canDraw(const GrRenderTarget* rt, return rec.getFormat() != SkMask::kARGB32_Format; } -void GrStencilAndCoverTextContext::onDrawText(GrRenderTarget* rt, +void GrStencilAndCoverTextContext::onDrawText(GrDrawContext* drawContext, GrRenderTarget* rt, const GrClip& clip, const GrPaint& paint, const SkPaint& skPaint, @@ -157,17 +154,19 @@ void GrStencilAndCoverTextContext::onDrawText(GrRenderTarget* rt, const SkGlyph& glyph = glyphCacheProc(fGlyphCache, &text, 0, 0); fx += SkFixedMul(autokern.adjust(glyph), fixedSizeRatio); if (glyph.fWidth) { - this->appendGlyph(glyph, SkPoint::Make(SkFixedToScalar(fx), SkFixedToScalar(fy))); + this->appendGlyph(drawContext, glyph, + SkPoint::Make(SkFixedToScalar(fx), SkFixedToScalar(fy))); } fx += SkFixedMul(glyph.fAdvanceX, fixedSizeRatio); fy += SkFixedMul(glyph.fAdvanceY, fixedSizeRatio); } - this->finish(); + this->finish(drawContext); } -void GrStencilAndCoverTextContext::onDrawPosText(GrRenderTarget* rt, +void GrStencilAndCoverTextContext::onDrawPosText(GrDrawContext* drawContext, + GrRenderTarget* rt, const GrClip& clip, const GrPaint& paint, const SkPaint& skPaint, @@ -211,12 +210,12 @@ void GrStencilAndCoverTextContext::onDrawPosText(GrRenderTarget* rt, SkPoint loc; alignProc(tmsLoc, glyph, &loc); - this->appendGlyph(glyph, loc); + this->appendGlyph(drawContext, glyph, loc); } pos += scalarsPerPosition; } - this->finish(); + this->finish(drawContext); } static GrPathRange* get_gr_glyphs(GrContext* ctx, @@ -411,10 +410,11 @@ bool GrStencilAndCoverTextContext::mapToFallbackContext(SkMatrix* inverse) { return true; } -inline void GrStencilAndCoverTextContext::appendGlyph(const SkGlyph& glyph, const SkPoint& pos) { +inline void GrStencilAndCoverTextContext::appendGlyph(GrDrawContext* drawContext, + const SkGlyph& glyph, const SkPoint& pos) { if (fQueuedGlyphCount >= fFallbackGlyphsIdx) { SkASSERT(fQueuedGlyphCount == fFallbackGlyphsIdx); - this->flush(); + this->flush(drawContext); } // 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() { +void GrStencilAndCoverTextContext::flush(GrDrawContext* drawContext) { if (fQueuedGlyphCount > 0) { SkAutoTUnref<GrPathProcessor> pp(GrPathProcessor::Create(fPaint.getColor(), fViewMatrix, fLocalMatrix)); - fDrawContext->drawPaths(&fPipelineBuilder, pp, fGlyphs, - fGlyphIndices, GrPathRange::kU16_PathIndexType, - get_xy_scalar_array(fGlyphPositions), - GrPathRendering::kTranslate_PathTransformType, - fQueuedGlyphCount, GrPathRendering::kWinding_FillType); + drawContext->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() { } } -void GrStencilAndCoverTextContext::finish() { - this->flush(); +void GrStencilAndCoverTextContext::finish(GrDrawContext* drawContext) { + this->flush(drawContext); fGlyphs->unref(); fGlyphs = NULL; |