diff options
author | 2016-10-27 14:47:55 -0400 | |
---|---|---|
committer | 2016-10-27 19:14:09 +0000 | |
commit | 1105224f9701e57ec5ce0354d6a380b664f5c638 (patch) | |
tree | 2b6f3db0bfd99da5e22adabc0da37d9271c8b543 /src/gpu/text | |
parent | 6e74412a9cf1ffa44271a55b42f18e8a0813a0a2 (diff) |
Rename GrDrawContext to GrRenderTargetContext
This is in preparation for GrTextureContext and GrSurfaceContext
BUG=skia:
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=4030
Change-Id: Ie58c93052e68f3f1f5fe8d15d63760de274a6fbd
Reviewed-on: https://skia-review.googlesource.com/4030
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
Diffstat (limited to 'src/gpu/text')
-rw-r--r-- | src/gpu/text/GrAtlasTextBlob.cpp | 37 | ||||
-rw-r--r-- | src/gpu/text/GrAtlasTextBlob.h | 10 | ||||
-rw-r--r-- | src/gpu/text/GrAtlasTextContext.cpp | 38 | ||||
-rw-r--r-- | src/gpu/text/GrAtlasTextContext.h | 10 | ||||
-rw-r--r-- | src/gpu/text/GrStencilAndCoverTextContext.cpp | 51 | ||||
-rw-r--r-- | src/gpu/text/GrStencilAndCoverTextContext.h | 12 | ||||
-rw-r--r-- | src/gpu/text/GrTextUtils.cpp | 10 | ||||
-rw-r--r-- | src/gpu/text/GrTextUtils.h | 6 |
8 files changed, 88 insertions, 86 deletions
diff --git a/src/gpu/text/GrAtlasTextBlob.cpp b/src/gpu/text/GrAtlasTextBlob.cpp index 12f35a38c8..a28f638a2c 100644 --- a/src/gpu/text/GrAtlasTextBlob.cpp +++ b/src/gpu/text/GrAtlasTextBlob.cpp @@ -9,7 +9,7 @@ #include "GrBlurUtils.h" #include "GrContext.h" -#include "GrDrawContext.h" +#include "GrRenderTargetContext.h" #include "GrPipelineBuilder.h" #include "GrTextUtils.h" #include "SkColorFilter.h" @@ -303,7 +303,7 @@ inline GrDrawBatch* GrAtlasTextBlob::createBatch( } inline -void GrAtlasTextBlob::flushRun(GrDrawContext* dc, const GrPaint& grPaint, +void GrAtlasTextBlob::flushRun(GrRenderTargetContext* rtc, const GrPaint& grPaint, const GrClip& clip, int run, const SkMatrix& viewMatrix, SkScalar x, SkScalar y, const SkPaint& skPaint, const SkSurfaceProps& props, @@ -321,12 +321,13 @@ void GrAtlasTextBlob::flushRun(GrDrawContext* dc, const GrPaint& grPaint, SkAutoTUnref<GrDrawBatch> batch(this->createBatch(info, glyphCount, run, subRun, viewMatrix, x, y, color, skPaint, props, - distanceAdjustTable, dc->isGammaCorrect(), + distanceAdjustTable, + rtc->isGammaCorrect(), cache)); - GrPipelineBuilder pipelineBuilder(grPaint, dc->mustUseHWAA(grPaint)); + GrPipelineBuilder pipelineBuilder(grPaint, rtc->mustUseHWAA(grPaint)); - dc->drawBatch(pipelineBuilder, clip, batch); + rtc->drawBatch(pipelineBuilder, clip, batch); } } @@ -351,7 +352,7 @@ static void calculate_translation(bool applyVM, } -void GrAtlasTextBlob::flushBigGlyphs(GrContext* context, GrDrawContext* dc, +void GrAtlasTextBlob::flushBigGlyphs(GrContext* context, GrRenderTargetContext* rtc, const GrClip& clip, const SkPaint& skPaint, const SkMatrix& viewMatrix, SkScalar x, SkScalar y, const SkIRect& clipBounds) { @@ -367,12 +368,12 @@ void GrAtlasTextBlob::flushBigGlyphs(GrContext* context, GrDrawContext* dc, ctm.postConcat(viewMatrix); } - GrBlurUtils::drawPathWithMaskFilter(context, dc, clip, bigGlyph.fPath, + GrBlurUtils::drawPathWithMaskFilter(context, rtc, clip, bigGlyph.fPath, skPaint, ctm, nullptr, clipBounds, false); } } -void GrAtlasTextBlob::flushRunAsPaths(GrContext* context, GrDrawContext* dc, +void GrAtlasTextBlob::flushRunAsPaths(GrContext* context, GrRenderTargetContext* rtc, const SkSurfaceProps& props, const SkTextBlobRunIterator& it, const GrClip& clip, const SkPaint& skPaint, @@ -393,18 +394,18 @@ void GrAtlasTextBlob::flushRunAsPaths(GrContext* context, GrDrawContext* dc, switch (it.positioning()) { case SkTextBlob::kDefault_Positioning: - GrTextUtils::DrawTextAsPath(context, dc, clip, runPaint, viewMatrix, + GrTextUtils::DrawTextAsPath(context, rtc, clip, runPaint, viewMatrix, (const char *)it.glyphs(), textLen, x + offset.x(), y + offset.y(), clipBounds); break; case SkTextBlob::kHorizontal_Positioning: - GrTextUtils::DrawPosTextAsPath(context, dc, props, clip, runPaint, viewMatrix, + GrTextUtils::DrawPosTextAsPath(context, rtc, props, clip, runPaint, viewMatrix, (const char*)it.glyphs(), textLen, it.pos(), 1, SkPoint::Make(x, y + offset.y()), clipBounds); break; case SkTextBlob::kFull_Positioning: - GrTextUtils::DrawPosTextAsPath(context, dc, props, clip, runPaint, viewMatrix, + GrTextUtils::DrawPosTextAsPath(context, rtc, props, clip, runPaint, viewMatrix, (const char*)it.glyphs(), textLen, it.pos(), 2, SkPoint::Make(x, y), clipBounds); break; @@ -412,7 +413,7 @@ void GrAtlasTextBlob::flushRunAsPaths(GrContext* context, GrDrawContext* dc, } void GrAtlasTextBlob::flushCached(GrContext* context, - GrDrawContext* dc, + GrRenderTargetContext* rtc, const SkTextBlob* blob, const SkSurfaceProps& props, const GrDistanceFieldAdjustTable* distanceAdjustTable, @@ -428,20 +429,20 @@ void GrAtlasTextBlob::flushCached(GrContext* context, SkTextBlobRunIterator it(blob); for (int run = 0; !it.done(); it.next(), run++) { if (fRuns[run].fDrawAsPaths) { - this->flushRunAsPaths(context, dc, props, it, clip, skPaint, + this->flushRunAsPaths(context, rtc, props, it, clip, skPaint, drawFilter, viewMatrix, clipBounds, x, y); continue; } - this->flushRun(dc, grPaint, clip, run, viewMatrix, x, y, skPaint, props, + this->flushRun(rtc, grPaint, clip, run, viewMatrix, x, y, skPaint, props, distanceAdjustTable, context->getBatchFontCache()); } // Now flush big glyphs - this->flushBigGlyphs(context, dc, clip, skPaint, viewMatrix, x, y, clipBounds); + this->flushBigGlyphs(context, rtc, clip, skPaint, viewMatrix, x, y, clipBounds); } void GrAtlasTextBlob::flushThrowaway(GrContext* context, - GrDrawContext* dc, + GrRenderTargetContext* rtc, const SkSurfaceProps& props, const GrDistanceFieldAdjustTable* distanceAdjustTable, const SkPaint& skPaint, @@ -451,12 +452,12 @@ void GrAtlasTextBlob::flushThrowaway(GrContext* context, const SkIRect& clipBounds, SkScalar x, SkScalar y) { for (int run = 0; run < fRunCount; run++) { - this->flushRun(dc, grPaint, clip, run, viewMatrix, x, y, skPaint, props, + this->flushRun(rtc, grPaint, clip, run, viewMatrix, x, y, skPaint, props, distanceAdjustTable, context->getBatchFontCache()); } // Now flush big glyphs - this->flushBigGlyphs(context, dc, clip, skPaint, viewMatrix, x, y, clipBounds); + this->flushBigGlyphs(context, rtc, clip, skPaint, viewMatrix, x, y, clipBounds); } GrDrawBatch* GrAtlasTextBlob::test_createBatch( diff --git a/src/gpu/text/GrAtlasTextBlob.h b/src/gpu/text/GrAtlasTextBlob.h index afc11a9bd4..5aaf2100c2 100644 --- a/src/gpu/text/GrAtlasTextBlob.h +++ b/src/gpu/text/GrAtlasTextBlob.h @@ -182,7 +182,7 @@ public: // flush a GrAtlasTextBlob associated with a SkTextBlob void flushCached(GrContext* context, - GrDrawContext* dc, + GrRenderTargetContext* rtc, const SkTextBlob* blob, const SkSurfaceProps& props, const GrDistanceFieldAdjustTable* distanceAdjustTable, @@ -196,7 +196,7 @@ public: // flush a throwaway GrAtlasTextBlob *not* associated with an SkTextBlob void flushThrowaway(GrContext* context, - GrDrawContext* dc, + GrRenderTargetContext* rtc, const SkSurfaceProps& props, const GrDistanceFieldAdjustTable* distanceAdjustTable, const SkPaint& skPaint, @@ -294,19 +294,19 @@ private: void appendLargeGlyph(GrGlyph* glyph, SkGlyphCache* cache, const SkGlyph& skGlyph, SkScalar x, SkScalar y, SkScalar scale, bool applyVM); - inline void flushRun(GrDrawContext* dc, const GrPaint&, const GrClip&, + inline void flushRun(GrRenderTargetContext* rtc, const GrPaint&, const GrClip&, int run, const SkMatrix& viewMatrix, SkScalar x, SkScalar y, const SkPaint& skPaint, const SkSurfaceProps& props, const GrDistanceFieldAdjustTable* distanceAdjustTable, GrBatchFontCache* cache); - void flushBigGlyphs(GrContext* context, GrDrawContext* dc, + void flushBigGlyphs(GrContext* context, GrRenderTargetContext* rtc, const GrClip& clip, const SkPaint& skPaint, const SkMatrix& viewMatrix, SkScalar x, SkScalar y, const SkIRect& clipBounds); void flushRunAsPaths(GrContext* context, - GrDrawContext* dc, + GrRenderTargetContext* rtc, const SkSurfaceProps& props, const SkTextBlobRunIterator& it, const GrClip& clip, const SkPaint& skPaint, diff --git a/src/gpu/text/GrAtlasTextContext.cpp b/src/gpu/text/GrAtlasTextContext.cpp index 83c34dfca8..1d6cef0bbf 100644 --- a/src/gpu/text/GrAtlasTextContext.cpp +++ b/src/gpu/text/GrAtlasTextContext.cpp @@ -7,7 +7,7 @@ #include "GrAtlasTextContext.h" #include "GrContext.h" -#include "GrDrawContext.h" +#include "GrRenderTargetContext.h" #include "GrTextBlobCache.h" #include "GrTextUtils.h" @@ -53,10 +53,10 @@ GrColor GrAtlasTextContext::ComputeCanonicalColor(const SkPaint& paint, bool lcd return canonicalColor; } -uint32_t GrAtlasTextContext::ComputeScalerContextFlags(GrDrawContext* dc) { +uint32_t GrAtlasTextContext::ComputeScalerContextFlags(GrRenderTargetContext* rtc) { // If we're doing gamma-correct rendering, then we can disable the gamma hacks. // Otherwise, leave them on. In either case, we still want the contrast boost: - if (dc->isGammaCorrect()) { + if (rtc->isGammaCorrect()) { return SkPaint::kBoostContrast_ScalerContextFlag; } else { return SkPaint::kFakeGammaAndBoostContrast_ScalerContextFlags; @@ -76,7 +76,7 @@ bool GrAtlasTextContext::HasLCD(const SkTextBlob* blob) { return false; } -void GrAtlasTextContext::drawTextBlob(GrContext* context, GrDrawContext* dc, +void GrAtlasTextContext::drawTextBlob(GrContext* context, GrRenderTargetContext* rtc, const GrClip& clip, const SkPaint& skPaint, const SkMatrix& viewMatrix, const SkSurfaceProps& props, const SkTextBlob* blob, @@ -96,7 +96,7 @@ void GrAtlasTextContext::drawTextBlob(GrContext* context, GrDrawContext* dc, bool canCache = !(skPaint.getPathEffect() || (mf && !mf->asABlur(&blurRec)) || drawFilter); - uint32_t scalerContextFlags = ComputeScalerContextFlags(dc); + uint32_t scalerContextFlags = ComputeScalerContextFlags(rtc); GrTextBlobCache* cache = context->getTextBlobCache(); if (canCache) { @@ -124,7 +124,7 @@ void GrAtlasTextContext::drawTextBlob(GrContext* context, GrDrawContext* dc, // Though for the time being runs in the textblob can override the paint, they only touch font // info. GrPaint grPaint; - if (!SkPaintToGrPaint(context, dc, skPaint, viewMatrix, &grPaint)) { + if (!SkPaintToGrPaint(context, rtc, skPaint, viewMatrix, &grPaint)) { return; } @@ -167,7 +167,7 @@ void GrAtlasTextContext::drawTextBlob(GrContext* context, GrDrawContext* dc, blob, x, y, drawFilter); } - cacheBlob->flushCached(context, dc, blob, props, fDistanceAdjustTable, skPaint, + cacheBlob->flushCached(context, rtc, blob, props, fDistanceAdjustTable, skPaint, grPaint, drawFilter, clip, viewMatrix, clipBounds, x, y); } @@ -313,7 +313,7 @@ GrAtlasTextContext::CreateDrawPosTextBlob(GrTextBlobCache* blobCache, GrBatchFon } void GrAtlasTextContext::drawText(GrContext* context, - GrDrawContext* dc, + GrRenderTargetContext* rtc, const GrClip& clip, const GrPaint& paint, const SkPaint& skPaint, const SkMatrix& viewMatrix, @@ -327,21 +327,21 @@ void GrAtlasTextContext::drawText(GrContext* context, CreateDrawTextBlob(context->getTextBlobCache(), context->getBatchFontCache(), *context->caps()->shaderCaps(), paint, skPaint, - ComputeScalerContextFlags(dc), + ComputeScalerContextFlags(rtc), viewMatrix, props, text, byteLength, x, y)); - blob->flushThrowaway(context, dc, props, fDistanceAdjustTable, skPaint, paint, + blob->flushThrowaway(context, rtc, props, fDistanceAdjustTable, skPaint, paint, clip, viewMatrix, regionClipBounds, x, y); return; } // fall back to drawing as a path - GrTextUtils::DrawTextAsPath(context, dc, clip, skPaint, viewMatrix, text, byteLength, x, y, + GrTextUtils::DrawTextAsPath(context, rtc, clip, skPaint, viewMatrix, text, byteLength, x, y, regionClipBounds); } void GrAtlasTextContext::drawPosText(GrContext* context, - GrDrawContext* dc, + GrRenderTargetContext* rtc, const GrClip& clip, const GrPaint& paint, const SkPaint& skPaint, const SkMatrix& viewMatrix, @@ -357,18 +357,18 @@ void GrAtlasTextContext::drawPosText(GrContext* context, context->getBatchFontCache(), *context->caps()->shaderCaps(), paint, skPaint, - ComputeScalerContextFlags(dc), + ComputeScalerContextFlags(rtc), viewMatrix, props, text, byteLength, pos, scalarsPerPosition, offset)); - blob->flushThrowaway(context, dc, props, fDistanceAdjustTable, skPaint, paint, + blob->flushThrowaway(context, rtc, props, fDistanceAdjustTable, skPaint, paint, clip, viewMatrix, regionClipBounds, offset.fX, offset.fY); return; } // fall back to drawing as a path - GrTextUtils::DrawPosTextAsPath(context, dc, props, clip, skPaint, viewMatrix, text, + GrTextUtils::DrawPosTextAsPath(context, rtc, props, clip, skPaint, viewMatrix, text, byteLength, pos, scalarsPerPosition, offset, regionClipBounds); } @@ -388,9 +388,9 @@ DRAW_BATCH_TEST_DEFINE(TextBlobBatch) { gTextContext = GrAtlasTextContext::Create(); } - // Setup dummy SkPaint / GrPaint / GrDrawContext - sk_sp<GrDrawContext> drawContext(context->makeDrawContext(SkBackingFit::kApprox, 1024, 1024, - kRGBA_8888_GrPixelConfig, nullptr)); + // Setup dummy SkPaint / GrPaint / GrRenderTargetContext + sk_sp<GrRenderTargetContext> renderTargetContext(context->makeRenderTargetContext( + SkBackingFit::kApprox, 1024, 1024, kRGBA_8888_GrPixelConfig, nullptr)); GrColor color = GrRandomColor(random); SkMatrix viewMatrix = GrTest::TestMatrixInvertible(random); @@ -401,7 +401,7 @@ DRAW_BATCH_TEST_DEFINE(TextBlobBatch) { skPaint.setSubpixelText(random->nextBool()); GrPaint grPaint; - if (!SkPaintToGrPaint(context, drawContext.get(), skPaint, viewMatrix, &grPaint)) { + if (!SkPaintToGrPaint(context, renderTargetContext.get(), skPaint, viewMatrix, &grPaint)) { SkFAIL("couldn't convert paint\n"); } diff --git a/src/gpu/text/GrAtlasTextContext.h b/src/gpu/text/GrAtlasTextContext.h index 5bf7662c48..20da8be1d1 100644 --- a/src/gpu/text/GrAtlasTextContext.h +++ b/src/gpu/text/GrAtlasTextContext.h @@ -18,7 +18,7 @@ #endif class GrDrawBatch; -class GrDrawContext; +class GrRenderTargetContext; class GrPipelineBuilder; class GrTextBlobCache; class SkGlyph; @@ -32,16 +32,16 @@ public: bool canDraw(const SkPaint&, const SkMatrix& viewMatrix, const SkSurfaceProps&, const GrShaderCaps&); - void drawText(GrContext*, GrDrawContext*, const GrClip&, const GrPaint&, const SkPaint&, + void drawText(GrContext*, GrRenderTargetContext*, const GrClip&, const GrPaint&, const SkPaint&, const SkMatrix& viewMatrix, const SkSurfaceProps&, const char text[], size_t byteLength, SkScalar x, SkScalar y, const SkIRect& regionClipBounds); - void drawPosText(GrContext*, GrDrawContext*, const GrClip&, const GrPaint&, + void drawPosText(GrContext*, GrRenderTargetContext*, const GrClip&, const GrPaint&, const SkPaint&, const SkMatrix& viewMatrix, const SkSurfaceProps&, const char text[], size_t byteLength, const SkScalar pos[], int scalarsPerPosition, const SkPoint& offset, const SkIRect& regionClipBounds); - void drawTextBlob(GrContext*, GrDrawContext*, const GrClip&, const SkPaint&, + void drawTextBlob(GrContext*, GrRenderTargetContext*, const GrClip&, const SkPaint&, const SkMatrix& viewMatrix, const SkSurfaceProps&, const SkTextBlob*, SkScalar x, SkScalar y, SkDrawFilter*, const SkIRect& clipBounds); @@ -52,7 +52,7 @@ private: // sets up the descriptor on the blob and returns a detached cache. Client must attach inline static GrColor ComputeCanonicalColor(const SkPaint&, bool lcd); // Determines if we need to use fake gamma (and contrast boost): - inline static uint32_t ComputeScalerContextFlags(GrDrawContext*); + inline static uint32_t ComputeScalerContextFlags(GrRenderTargetContext*); static void RegenerateTextBlob(GrAtlasTextBlob* bmp, GrBatchFontCache*, const GrShaderCaps&, diff --git a/src/gpu/text/GrStencilAndCoverTextContext.cpp b/src/gpu/text/GrStencilAndCoverTextContext.cpp index 32d80218d3..1d46fc6d62 100644 --- a/src/gpu/text/GrStencilAndCoverTextContext.cpp +++ b/src/gpu/text/GrStencilAndCoverTextContext.cpp @@ -8,7 +8,7 @@ #include "GrStencilAndCoverTextContext.h" #include "GrAtlasTextContext.h" #include "GrContext.h" -#include "GrDrawContext.h" +#include "GrRenderTargetContext.h" #include "GrPath.h" #include "GrPathRange.h" #include "GrPipelineBuilder.h" @@ -68,7 +68,7 @@ bool GrStencilAndCoverTextContext::internalCanDraw(const SkPaint& skPaint) { return SkPaint::kStroke_Style != skPaint.getStyle() || 0 != skPaint.getStrokeWidth(); } -void GrStencilAndCoverTextContext::drawText(GrContext* context, GrDrawContext* dc, +void GrStencilAndCoverTextContext::drawText(GrContext* context, GrRenderTargetContext* rtc, const GrClip& clip, const GrPaint& paint, const SkPaint& skPaint, const SkMatrix& viewMatrix, const SkSurfaceProps& props, @@ -80,23 +80,23 @@ void GrStencilAndCoverTextContext::drawText(GrContext* context, GrDrawContext* d if (skPaint.getTextSize() > 0) { TextRun run(skPaint); run.setText(text, byteLength, x, y); - run.draw(context, dc, paint, clip, viewMatrix, props, 0, 0, + run.draw(context, rtc, paint, clip, viewMatrix, props, 0, 0, clipBounds, fFallbackTextContext, skPaint); } return; } else if (fFallbackTextContext->canDraw(skPaint, viewMatrix, props, *context->caps()->shaderCaps())) { - fFallbackTextContext->drawText(context, dc, clip, paint, skPaint, viewMatrix, props, text, + fFallbackTextContext->drawText(context, rtc, clip, paint, skPaint, viewMatrix, props, text, byteLength, x, y, clipBounds); return; } // fall back to drawing as a path - GrTextUtils::DrawTextAsPath(context, dc, clip, skPaint, viewMatrix, text, byteLength, x, y, + GrTextUtils::DrawTextAsPath(context, rtc, clip, skPaint, viewMatrix, text, byteLength, x, y, clipBounds); } -void GrStencilAndCoverTextContext::drawPosText(GrContext* context, GrDrawContext* dc, +void GrStencilAndCoverTextContext::drawPosText(GrContext* context, GrRenderTargetContext* rtc, const GrClip& clip, const GrPaint& paint, const SkPaint& skPaint, @@ -114,25 +114,25 @@ void GrStencilAndCoverTextContext::drawPosText(GrContext* context, GrDrawContext if (skPaint.getTextSize() > 0) { TextRun run(skPaint); run.setPosText(text, byteLength, pos, scalarsPerPosition, offset); - run.draw(context, dc, paint, clip, viewMatrix, props, 0, 0, + run.draw(context, rtc, paint, clip, viewMatrix, props, 0, 0, clipBounds, fFallbackTextContext, skPaint); } return; } else if (fFallbackTextContext->canDraw(skPaint, viewMatrix, props, *context->caps()->shaderCaps())) { - fFallbackTextContext->drawPosText(context, dc, clip, paint, skPaint, viewMatrix, props, + fFallbackTextContext->drawPosText(context, rtc, clip, paint, skPaint, viewMatrix, props, text, byteLength, pos, scalarsPerPosition, offset, clipBounds); return; } // fall back to drawing as a path - GrTextUtils::DrawPosTextAsPath(context, dc, props, clip, skPaint, viewMatrix, text, + GrTextUtils::DrawPosTextAsPath(context, rtc, props, clip, skPaint, viewMatrix, text, byteLength, pos, scalarsPerPosition, offset, clipBounds); } void GrStencilAndCoverTextContext::uncachedDrawTextBlob(GrContext* context, - GrDrawContext* dc, + GrRenderTargetContext* rtc, const GrClip& clip, const SkPaint& skPaint, const SkMatrix& viewMatrix, @@ -161,24 +161,24 @@ void GrStencilAndCoverTextContext::uncachedDrawTextBlob(GrContext* context, runPaint.setFlags(GrTextUtils::FilterTextFlags(props, runPaint)); GrPaint grPaint; - if (!SkPaintToGrPaint(context, dc, runPaint, viewMatrix, &grPaint)) { + if (!SkPaintToGrPaint(context, rtc, runPaint, viewMatrix, &grPaint)) { return; } switch (it.positioning()) { case SkTextBlob::kDefault_Positioning: - this->drawText(context, dc, clip, grPaint, runPaint, viewMatrix, props, + this->drawText(context, rtc, clip, grPaint, runPaint, viewMatrix, props, (const char *)it.glyphs(), textLen, x + offset.x(), y + offset.y(), clipBounds); break; case SkTextBlob::kHorizontal_Positioning: - this->drawPosText(context, dc, clip, grPaint, runPaint, viewMatrix, props, + this->drawPosText(context, rtc, clip, grPaint, runPaint, viewMatrix, props, (const char*)it.glyphs(), textLen, it.pos(), 1, SkPoint::Make(x, y + offset.y()), clipBounds); break; case SkTextBlob::kFull_Positioning: - this->drawPosText(context, dc, clip, grPaint, runPaint, viewMatrix, props, + this->drawPosText(context, rtc, clip, grPaint, runPaint, viewMatrix, props, (const char*)it.glyphs(), textLen, it.pos(), 2, SkPoint::Make(x, y), clipBounds); break; @@ -191,7 +191,7 @@ void GrStencilAndCoverTextContext::uncachedDrawTextBlob(GrContext* context, } } -void GrStencilAndCoverTextContext::drawTextBlob(GrContext* context, GrDrawContext* dc, +void GrStencilAndCoverTextContext::drawTextBlob(GrContext* context, GrRenderTargetContext* rtc, const GrClip& clip, const SkPaint& skPaint, const SkMatrix& viewMatrix, const SkSurfaceProps& props, @@ -203,20 +203,20 @@ void GrStencilAndCoverTextContext::drawTextBlob(GrContext* context, GrDrawContex } if (!this->internalCanDraw(skPaint)) { - fFallbackTextContext->drawTextBlob(context, dc, clip, skPaint, viewMatrix, props, skBlob, + fFallbackTextContext->drawTextBlob(context, rtc, clip, skPaint, viewMatrix, props, skBlob, x, y, drawFilter, clipBounds); return; } if (drawFilter || skPaint.getPathEffect()) { // This draw can't be cached. - this->uncachedDrawTextBlob(context, dc, clip, skPaint, viewMatrix, props, skBlob, x, y, + this->uncachedDrawTextBlob(context, rtc, clip, skPaint, viewMatrix, props, skBlob, x, y, drawFilter, clipBounds); return; } GrPaint paint; - if (!SkPaintToGrPaint(context, dc, skPaint, viewMatrix, &paint)) { + if (!SkPaintToGrPaint(context, rtc, skPaint, viewMatrix, &paint)) { return; } @@ -226,7 +226,7 @@ void GrStencilAndCoverTextContext::drawTextBlob(GrContext* context, GrDrawContex for (TextRun* run = iter.get(); run; run = iter.next()) { // The run's "font" overrides the anti-aliasing of the passed in paint! paint.setAntiAlias(run->isAntiAlias()); - run->draw(context, dc, paint, clip, viewMatrix, props, x, y, + run->draw(context, rtc, paint, clip, viewMatrix, props, x, y, clipBounds, fFallbackTextContext, skPaint); run->releaseGlyphCache(); } @@ -596,7 +596,7 @@ inline void GrStencilAndCoverTextContext::TextRun::appendGlyph(const SkGlyph& gl } void GrStencilAndCoverTextContext::TextRun::draw(GrContext* ctx, - GrDrawContext* drawContext, + GrRenderTargetContext* renderTargetContext, const GrPaint& grPaint, const GrClip& clip, const SkMatrix& viewMatrix, @@ -606,7 +606,7 @@ void GrStencilAndCoverTextContext::TextRun::draw(GrContext* ctx, GrAtlasTextContext* fallbackTextContext, const SkPaint& originalSkPaint) const { SkASSERT(fInstanceData); - SkASSERT(drawContext->isStencilBufferMultisampled() || !grPaint.isAntiAlias()); + SkASSERT(renderTargetContext->isStencilBufferMultisampled() || !grPaint.isAntiAlias()); if (fInstanceData->count()) { static constexpr GrUserStencilSettings kCoverPass( @@ -631,7 +631,8 @@ void GrStencilAndCoverTextContext::TextRun::draw(GrContext* ctx, // NV_path_rendering will also support NV_blend_equation_advanced. // For clipping we'll just skip any optimizations based on the bounds. This does, however, // hurt batching. - const SkRect bounds = SkRect::MakeIWH(drawContext->width(), drawContext->height()); + const SkRect bounds = SkRect::MakeIWH(renderTargetContext->width(), + renderTargetContext->height()); SkAutoTUnref<GrDrawBatch> batch( GrDrawPathRangeBatch::Create(viewMatrix, fTextRatio, fTextInverseRatio * x, @@ -643,7 +644,7 @@ void GrStencilAndCoverTextContext::TextRun::draw(GrContext* ctx, pipelineBuilder.setState(GrPipelineBuilder::kHWAntialias_Flag, grPaint.isAntiAlias()); pipelineBuilder.setUserStencil(&kCoverPass); - drawContext->drawBatch(pipelineBuilder, clip, batch); + renderTargetContext->drawBatch(pipelineBuilder, clip, batch); } if (fFallbackTextBlob) { @@ -653,8 +654,8 @@ void GrStencilAndCoverTextContext::TextRun::draw(GrContext* ctx, fallbackSkPaint.setStrokeWidth(fStyle.strokeRec().getWidth() * fTextRatio); } - fallbackTextContext->drawTextBlob(ctx, drawContext, clip, fallbackSkPaint, viewMatrix, - props, fFallbackTextBlob.get(), x, y, nullptr, + fallbackTextContext->drawTextBlob(ctx, renderTargetContext, clip, fallbackSkPaint, + viewMatrix, props, fFallbackTextBlob.get(), x, y, nullptr, clipBounds); } } diff --git a/src/gpu/text/GrStencilAndCoverTextContext.h b/src/gpu/text/GrStencilAndCoverTextContext.h index c87041a9e4..470e1e49c3 100644 --- a/src/gpu/text/GrStencilAndCoverTextContext.h +++ b/src/gpu/text/GrStencilAndCoverTextContext.h @@ -8,7 +8,7 @@ #ifndef GrStencilAndCoverTextContext_DEFINED #define GrStencilAndCoverTextContext_DEFINED -#include "GrDrawContext.h" +#include "GrRenderTargetContext.h" #include "GrStyle.h" #include "SkDrawFilter.h" #include "SkOpts.h" @@ -31,18 +31,18 @@ class GrStencilAndCoverTextContext { public: static GrStencilAndCoverTextContext* Create(GrAtlasTextContext* fallbackTextContext); - void drawText(GrContext*, GrDrawContext* dc, + void drawText(GrContext*, GrRenderTargetContext* rtc, const GrClip&, const GrPaint&, const SkPaint&, const SkMatrix& viewMatrix, const SkSurfaceProps&, const char text[], size_t byteLength, SkScalar x, SkScalar y, const SkIRect& clipBounds); - void drawPosText(GrContext*, GrDrawContext*, + void drawPosText(GrContext*, GrRenderTargetContext*, const GrClip&, const GrPaint&, const SkPaint&, const SkMatrix& viewMatrix, const SkSurfaceProps&, const char text[], size_t byteLength, const SkScalar pos[], int scalarsPerPosition, const SkPoint& offset, const SkIRect& clipBounds); - void drawTextBlob(GrContext*, GrDrawContext*, const GrClip&, const SkPaint&, + void drawTextBlob(GrContext*, GrRenderTargetContext*, const GrClip&, const SkPaint&, const SkMatrix& viewMatrix, const SkSurfaceProps&, const SkTextBlob*, SkScalar x, SkScalar y, SkDrawFilter*, const SkIRect& clipBounds); @@ -58,7 +58,7 @@ private: bool internalCanDraw(const SkPaint&); - void uncachedDrawTextBlob(GrContext*, GrDrawContext* dc, + void uncachedDrawTextBlob(GrContext*, GrRenderTargetContext* rtc, const GrClip& clip, const SkPaint& skPaint, const SkMatrix& viewMatrix, const SkSurfaceProps&, @@ -79,7 +79,7 @@ private: void setPosText(const char text[], size_t byteLength, const SkScalar pos[], int scalarsPerPosition, const SkPoint& offset); - void draw(GrContext*, GrDrawContext*, const GrPaint&, const GrClip&, + void draw(GrContext*, GrRenderTargetContext*, const GrPaint&, const GrClip&, const SkMatrix&, const SkSurfaceProps&, SkScalar x, SkScalar y, const SkIRect& clipBounds, GrAtlasTextContext* fallbackTextContext, const SkPaint& originalSkPaint) const; diff --git a/src/gpu/text/GrTextUtils.cpp b/src/gpu/text/GrTextUtils.cpp index a5685f0381..14c4e8d3ac 100644 --- a/src/gpu/text/GrTextUtils.cpp +++ b/src/gpu/text/GrTextUtils.cpp @@ -12,7 +12,7 @@ #include "GrBlurUtils.h" #include "GrCaps.h" #include "GrContext.h" -#include "GrDrawContext.h" +#include "GrRenderTargetContext.h" #include "SkDistanceFieldGen.h" #include "SkDrawProcs.h" @@ -468,7 +468,7 @@ bool GrTextUtils::DfAppendGlyph(GrAtlasTextBlob* blob, int runIndex, GrBatchFont return true; } -void GrTextUtils::DrawTextAsPath(GrContext* context, GrDrawContext* dc, +void GrTextUtils::DrawTextAsPath(GrContext* context, GrRenderTargetContext* rtc, const GrClip& clip, const SkPaint& skPaint, const SkMatrix& viewMatrix, const char text[], size_t byteLength, SkScalar x, SkScalar y, @@ -486,7 +486,7 @@ void GrTextUtils::DrawTextAsPath(GrContext* context, GrDrawContext* dc, matrix.postTranslate(xpos - prevXPos, 0); if (iterPath) { const SkPaint& pnt = iter.getPaint(); - GrBlurUtils::drawPathWithMaskFilter(context, dc, clip, *iterPath, + GrBlurUtils::drawPathWithMaskFilter(context, rtc, clip, *iterPath, pnt, viewMatrix, &matrix, clipBounds, false); } prevXPos = xpos; @@ -494,7 +494,7 @@ void GrTextUtils::DrawTextAsPath(GrContext* context, GrDrawContext* dc, } void GrTextUtils::DrawPosTextAsPath(GrContext* context, - GrDrawContext* dc, + GrRenderTargetContext* rtc, const SkSurfaceProps& props, const GrClip& clip, const SkPaint& origPaint, const SkMatrix& viewMatrix, @@ -538,7 +538,7 @@ void GrTextUtils::DrawPosTextAsPath(GrContext* context, matrix[SkMatrix::kMTransX] = loc.fX; matrix[SkMatrix::kMTransY] = loc.fY; - GrBlurUtils::drawPathWithMaskFilter(context, dc, clip, *path, paint, + GrBlurUtils::drawPathWithMaskFilter(context, rtc, clip, *path, paint, viewMatrix, &matrix, clipBounds, false); } } diff --git a/src/gpu/text/GrTextUtils.h b/src/gpu/text/GrTextUtils.h index c218ab7da1..9529c540f4 100644 --- a/src/gpu/text/GrTextUtils.h +++ b/src/gpu/text/GrTextUtils.h @@ -17,7 +17,7 @@ class GrBatchFontCache; class GrBatchTextStrike; class GrClip; class GrContext; -class GrDrawContext; +class GrRenderTargetContext; class GrShaderCaps; class SkGlyph; class SkMatrix; @@ -68,13 +68,13 @@ public: const SkPoint& offset); // Functions for drawing text as paths - static void DrawTextAsPath(GrContext*, GrDrawContext*, const GrClip& clip, + static void DrawTextAsPath(GrContext*, GrRenderTargetContext*, const GrClip& clip, const SkPaint& origPaint, const SkMatrix& viewMatrix, const char text[], size_t byteLength, SkScalar x, SkScalar y, const SkIRect& clipBounds); static void DrawPosTextAsPath(GrContext* context, - GrDrawContext* dc, + GrRenderTargetContext* rtc, const SkSurfaceProps& props, const GrClip& clip, const SkPaint& origPaint, const SkMatrix& viewMatrix, |