From 2604a89d3353ae6a6ae24081008f1e507cd2d472 Mon Sep 17 00:00:00 2001 From: Herb Derby Date: Mon, 13 Jul 2020 12:13:30 -0400 Subject: [PATCH] make single draw() for SubRun Change-Id: I293298562393bcd092d719e1402d361528d8369f Reviewed-on: https://skia-review.googlesource.com/c/skia/+/302336 Reviewed-by: Robert Phillips Commit-Queue: Herb Derby --- src/gpu/GrRenderTargetContext.cpp | 9 +-------- src/gpu/GrRenderTargetContextPriv.h | 4 ++++ src/gpu/text/GrTextBlob.cpp | 14 ++++++++++++++ src/gpu/text/GrTextBlob.h | 5 +++++ 4 files changed, 24 insertions(+), 8 deletions(-) diff --git a/src/gpu/GrRenderTargetContext.cpp b/src/gpu/GrRenderTargetContext.cpp index 22f18d6a2c..827bd0e9bf 100644 --- a/src/gpu/GrRenderTargetContext.cpp +++ b/src/gpu/GrRenderTargetContext.cpp @@ -504,14 +504,7 @@ void GrRenderTargetContext::drawGlyphRunList(const GrClip* clip, } for (GrTextBlob::SubRun* subRun : blob->subRunList()) { - if (subRun->drawAsPaths()) { - subRun->drawPaths(clip, viewMatrix, glyphRunList, this); - } else { - auto [drawingClip, op] = subRun->makeAtlasTextOp(clip, viewMatrix, glyphRunList, this); - if (op != nullptr) { - this->addDrawOp(drawingClip, std::move(op)); - } - } + subRun->draw(clip, viewMatrix, glyphRunList, this); } } diff --git a/src/gpu/GrRenderTargetContextPriv.h b/src/gpu/GrRenderTargetContextPriv.h index 60ad088012..a26894d609 100644 --- a/src/gpu/GrRenderTargetContextPriv.h +++ b/src/gpu/GrRenderTargetContextPriv.h @@ -110,6 +110,10 @@ public: return fRenderTargetContext->asRenderTargetProxy()->refsWrappedObjects(); } + void addDrawOp(const GrClip* clip, std::unique_ptr op) { + fRenderTargetContext->addDrawOp(clip, std::move(op)); + } + private: explicit GrRenderTargetContextPriv(GrRenderTargetContext* renderTargetContext) : fRenderTargetContext(renderTargetContext) {} diff --git a/src/gpu/text/GrTextBlob.cpp b/src/gpu/text/GrTextBlob.cpp index bbc01390ed..9c2d92a53d 100644 --- a/src/gpu/text/GrTextBlob.cpp +++ b/src/gpu/text/GrTextBlob.cpp @@ -244,6 +244,20 @@ void GrTextBlob::SubRun::drawPaths(const GrClip* clip, } } +void GrTextBlob::SubRun::draw(const GrClip* clip, + const SkMatrixProvider& viewMatrix, + const SkGlyphRunList& glyphRunList, + GrRenderTargetContext* rtc) { + if (this->drawAsPaths()) { + this->drawPaths(clip, viewMatrix, glyphRunList, rtc); + } else { + auto [drawingClip, op] = this->makeAtlasTextOp(clip, viewMatrix, glyphRunList, rtc); + if (op != nullptr) { + rtc->priv().addDrawOp(drawingClip, std::move(op)); + } + } +} + void GrTextBlob::SubRun::resetBulkUseToken() { fBulkUseToken.reset(); } GrDrawOpAtlas::BulkUseTokenUpdater* GrTextBlob::SubRun::bulkUseToken() { return &fBulkUseToken; } diff --git a/src/gpu/text/GrTextBlob.h b/src/gpu/text/GrTextBlob.h index b6bbb391a5..56db62ae57 100644 --- a/src/gpu/text/GrTextBlob.h +++ b/src/gpu/text/GrTextBlob.h @@ -272,6 +272,11 @@ public: const SkGlyphRunList& glyphRunList, GrRenderTargetContext* rtc); + void draw(const GrClip* clip, + const SkMatrixProvider& viewMatrix, + const SkGlyphRunList& glyphRunList, + GrRenderTargetContext* rtc); + // TODO when this object is more internal, drop the privacy void resetBulkUseToken(); GrDrawOpAtlas::BulkUseTokenUpdater* bulkUseToken();