diff options
author | joshualitt <joshualitt@chromium.org> | 2015-02-18 12:29:52 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-02-18 12:29:52 -0800 |
commit | 25d9c154087d2132a51d1ca74a104726f60ef380 (patch) | |
tree | ef43d8593418753e47805fff64da7c6b3741a3a3 /src/gpu/GrDistanceFieldTextContext.cpp | |
parent | 5a105ff05303ac82a867b8b84a1edd145bd46218 (diff) |
Pass Rendertarget into context.
Adding Jim for text context stuff, and Steven for image blur stuff.
BUG=skia:
Review URL: https://codereview.chromium.org/939623005
Diffstat (limited to 'src/gpu/GrDistanceFieldTextContext.cpp')
-rwxr-xr-x | src/gpu/GrDistanceFieldTextContext.cpp | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/src/gpu/GrDistanceFieldTextContext.cpp b/src/gpu/GrDistanceFieldTextContext.cpp index 65e899960e..4e8b16049f 100755 --- a/src/gpu/GrDistanceFieldTextContext.cpp +++ b/src/gpu/GrDistanceFieldTextContext.cpp @@ -112,8 +112,9 @@ bool GrDistanceFieldTextContext::canDraw(const SkPaint& paint, const SkMatrix& v return true; } -inline void GrDistanceFieldTextContext::init(const GrPaint& paint, const SkPaint& skPaint) { - GrTextContext::init(paint, skPaint); +inline void GrDistanceFieldTextContext::init(GrRenderTarget* rt, const GrPaint& paint, + const SkPaint& skPaint) { + GrTextContext::init(rt, paint, skPaint); fStrike = NULL; @@ -206,8 +207,8 @@ static void setup_gamma_texture(GrContext* context, const SkGlyphCache* cache, } } -void GrDistanceFieldTextContext::onDrawText(const GrPaint& paint, const SkPaint& skPaint, - const SkMatrix& viewMatrix, +void GrDistanceFieldTextContext::onDrawText(GrRenderTarget* rt, const GrPaint& paint, + const SkPaint& skPaint, const SkMatrix& viewMatrix, const char text[], size_t byteLength, SkScalar x, SkScalar y) { SkASSERT(byteLength == 0 || text != NULL); @@ -267,11 +268,12 @@ void GrDistanceFieldTextContext::onDrawText(const GrPaint& paint, const SkPaint& y -= alignY; SkPoint offset = SkPoint::Make(x, y); - this->drawPosText(paint, skPaint, viewMatrix, text, byteLength, positions.begin(), 2, offset); + this->drawPosText(rt, paint, skPaint, viewMatrix, text, byteLength, positions.begin(), 2, + offset); } -void GrDistanceFieldTextContext::onDrawPosText(const GrPaint& paint, const SkPaint& skPaint, - const SkMatrix& viewMatrix, +void GrDistanceFieldTextContext::onDrawPosText(GrRenderTarget* rt, const GrPaint& paint, + const SkPaint& skPaint, const SkMatrix& viewMatrix, const char text[], size_t byteLength, const SkScalar pos[], int scalarsPerPosition, const SkPoint& offset) { @@ -285,7 +287,7 @@ void GrDistanceFieldTextContext::onDrawPosText(const GrPaint& paint, const SkPai } fViewMatrix = viewMatrix; - this->init(paint, skPaint); + this->init(rt, paint, skPaint); SkDrawCacheProc glyphCacheProc = fSkPaint.getDrawCacheProc(); @@ -360,7 +362,7 @@ void GrDistanceFieldTextContext::onDrawPosText(const GrPaint& paint, const SkPai this->finish(); if (fallbackTxt.count() > 0) { - fFallbackTextContext->drawPosText(paint, skPaint, viewMatrix, fallbackTxt.begin(), + fFallbackTextContext->drawPosText(rt, paint, skPaint, viewMatrix, fallbackTxt.begin(), fallbackTxt.count(), fallbackPos.begin(), scalarsPerPosition, offset); } @@ -569,7 +571,7 @@ bool GrDistanceFieldTextContext::appendGlyph(GrGlyph::PackedID packed, tmpPath.transform(ctm); GrStrokeInfo strokeInfo(SkStrokeRec::kFill_InitStyle); - fContext->drawPath(fPaint, fViewMatrix, tmpPath, strokeInfo); + fContext->drawPath(fRenderTarget, fPaint, fViewMatrix, tmpPath, strokeInfo); // remove this glyph from the vertices we need to allocate fTotalVertexCount -= kVerticesPerGlyph; @@ -666,7 +668,7 @@ void GrDistanceFieldTextContext::flush() { if (fCurrVertex > 0) { GrPipelineBuilder pipelineBuilder; - pipelineBuilder.setFromPaint(fPaint, fContext->getRenderTarget()); + pipelineBuilder.setFromPaint(fPaint, fRenderTarget); // setup our sampler state for our text texture/atlas SkASSERT(SkIsAlign4(fCurrVertex)); |