make single draw() for SubRun

Change-Id: I293298562393bcd092d719e1402d361528d8369f
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/302336
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Herb Derby <herb@google.com>
This commit is contained in:
Herb Derby 2020-07-13 12:13:30 -04:00 committed by Skia Commit-Bot
parent 52ceaea51d
commit 2604a89d33
4 changed files with 24 additions and 8 deletions

View File

@ -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);
}
}

View File

@ -110,6 +110,10 @@ public:
return fRenderTargetContext->asRenderTargetProxy()->refsWrappedObjects();
}
void addDrawOp(const GrClip* clip, std::unique_ptr<GrDrawOp> op) {
fRenderTargetContext->addDrawOp(clip, std::move(op));
}
private:
explicit GrRenderTargetContextPriv(GrRenderTargetContext* renderTargetContext)
: fRenderTargetContext(renderTargetContext) {}

View File

@ -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; }

View File

@ -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();