Move makeOp to SubRun
Change-Id: Idb7fc569dabfb5626714e875eaaa97036d4f9a4a
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/293343
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Herb Derby <herb@google.com>
diff --git a/src/core/SkGlyphRunPainter.cpp b/src/core/SkGlyphRunPainter.cpp
index ab0fea3..54b4102 100644
--- a/src/core/SkGlyphRunPainter.cpp
+++ b/src/core/SkGlyphRunPainter.cpp
@@ -403,14 +403,13 @@
textContext->fOptions, blob.get());
}
- return blob->makeOp(blob->firstSubRun(),
- mtxProvider,
- drawOrigin,
- SkIRect::MakeEmpty(),
- skPaint,
- filteredColor,
- surfaceProps,
- rtc->textTarget());
+ return blob->firstSubRun()->makeOp(mtxProvider,
+ drawOrigin,
+ SkIRect::MakeEmpty(),
+ skPaint,
+ filteredColor,
+ surfaceProps,
+ rtc->textTarget());
}
#endif // GR_TEST_UTILS
diff --git a/src/gpu/text/GrTextBlob.cpp b/src/gpu/text/GrTextBlob.cpp
index ad8f289..0c5ba6b 100644
--- a/src/gpu/text/GrTextBlob.cpp
+++ b/src/gpu/text/GrTextBlob.cpp
@@ -402,6 +402,37 @@
return SubRun::InitForAtlas(kTransformedMask, drawables, strikeSpec, format, blob, alloc);
}
+std::unique_ptr<GrAtlasTextOp> GrTextBlob::SubRun::makeOp(const SkMatrixProvider& matrixProvider,
+ SkPoint drawOrigin,
+ const SkIRect& clipRect,
+ const SkPaint& paint,
+ const SkPMColor4f& filteredColor,
+ const SkSurfaceProps& props,
+ GrTextTarget* target) {
+ GrPaint grPaint;
+ target->makeGrPaint(this->maskFormat(), paint, matrixProvider, &grPaint);
+ if (this->drawAsDistanceFields()) {
+ // TODO: Can we be even smarter based on the dest transfer function?
+ return GrAtlasTextOp::MakeDistanceField(target->getContext(),
+ std::move(grPaint),
+ this,
+ matrixProvider.localToDevice(),
+ drawOrigin,
+ clipRect,
+ filteredColor,
+ target->colorInfo().isLinearlyBlended(),
+ SkPaintPriv::ComputeLuminanceColor(paint),
+ props);
+ } else {
+ return GrAtlasTextOp::MakeBitmap(target->getContext(),
+ std::move(grPaint),
+ this,
+ matrixProvider.localToDevice(),
+ drawOrigin,
+ clipRect,
+ filteredColor);
+ }
+}
auto GrTextBlob::SubRun::InitForAtlas(SubRunType type,
const SkZip<SkGlyphVariant, SkPoint>& drawables,
@@ -663,9 +694,9 @@
skipClip = true;
}
- auto op = this->makeOp(subRun, deviceMatrix, drawOrigin, clipRect,
- paint, filteredColor, props, target);
- if (op) {
+ auto op = subRun->makeOp(deviceMatrix, drawOrigin, clipRect,
+ paint, filteredColor, props, target);
+ if (op != nullptr) {
target->addDrawOp(skipClip ? nullptr : clip, std::move(op));
}
}
@@ -727,39 +758,6 @@
}
}
-std::unique_ptr<GrAtlasTextOp> GrTextBlob::makeOp(SubRun* subrun,
- const SkMatrixProvider& matrixProvider,
- SkPoint drawOrigin,
- const SkIRect& clipRect,
- const SkPaint& paint,
- const SkPMColor4f& filteredColor,
- const SkSurfaceProps& props,
- GrTextTarget* target) {
- GrPaint grPaint;
- target->makeGrPaint(subrun->maskFormat(), paint, matrixProvider, &grPaint);
- if (subrun->drawAsDistanceFields()) {
- // TODO: Can we be even smarter based on the dest transfer function?
- return GrAtlasTextOp::MakeDistanceField(target->getContext(),
- std::move(grPaint),
- subrun,
- matrixProvider.localToDevice(),
- drawOrigin,
- clipRect,
- filteredColor,
- target->colorInfo().isLinearlyBlended(),
- SkPaintPriv::ComputeLuminanceColor(paint),
- props);
- } else {
- return GrAtlasTextOp::MakeBitmap(target->getContext(),
- std::move(grPaint),
- subrun,
- matrixProvider.localToDevice(),
- drawOrigin,
- clipRect,
- filteredColor);
- }
-}
-
void GrTextBlob::processDeviceMasks(const SkZip<SkGlyphVariant, SkPoint>& drawables,
const SkStrikeSpec& strikeSpec) {
diff --git a/src/gpu/text/GrTextBlob.h b/src/gpu/text/GrTextBlob.h
index 64a0420..d4342ef 100644
--- a/src/gpu/text/GrTextBlob.h
+++ b/src/gpu/text/GrTextBlob.h
@@ -168,14 +168,6 @@
const SkZip<SkGlyphVariant, SkPoint>& drawables,
const SkStrikeSpec& strikeSpec);
- std::unique_ptr<GrAtlasTextOp> makeOp(SubRun* subrun,
- const SkMatrixProvider& matrixProvider,
- SkPoint drawOrigin,
- const SkIRect& clipRect,
- const SkPaint& paint,
- const SkPMColor4f& filteredColor,
- const SkSurfaceProps&,
- GrTextTarget*);
SubRun* firstSubRun() const;
bool forceWForDistanceFields() const;
@@ -384,6 +376,14 @@
GrTextBlob* blob,
SkArenaAlloc* alloc);
+ std::unique_ptr<GrAtlasTextOp> makeOp(const SkMatrixProvider& matrixProvider,
+ SkPoint drawOrigin,
+ const SkIRect& clipRect,
+ const SkPaint& paint,
+ const SkPMColor4f& filteredColor,
+ const SkSurfaceProps&,
+ GrTextTarget*);
+
SubRun* fNextSubRun{nullptr};
GrTextBlob* fBlob;
const SkStrikeSpec fStrikeSpec;