Remove RunPaint
Change-Id: I3742cbf3b636f10bb2006e0c86390661deb9f9b8
Reviewed-on: https://skia-review.googlesource.com/146164
Commit-Queue: Herb Derby <herb@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
diff --git a/src/gpu/text/GrTextBlob.cpp b/src/gpu/text/GrTextBlob.cpp
index 783d36f..3d30dd8 100644
--- a/src/gpu/text/GrTextBlob.cpp
+++ b/src/gpu/text/GrTextBlob.cpp
@@ -282,7 +282,7 @@
// GrTextBlob::makeOp only takes uint16_t values for run and subRun indices.
// Encountering something larger than this is highly unlikely, so we'll just not draw it.
int lastRun = SkTMin(fRunCount, (1 << 16)) - 1;
- GrTextUtils::RunPaint runPaint(&paint);
+ SkPaint runPaint{paint};
for (int runIndex = 0; runIndex <= lastRun; runIndex++) {
Run& run = fRuns[runIndex];
@@ -290,12 +290,8 @@
if (run.fPathGlyphs.count()) {
SkScalar transX, transY;
uint16_t paintFlags = run.fPaintFlags;
- if (!runPaint.modifyForRun(
- [paintFlags](SkPaint* p) {
- p->setFlags((p->getFlags() & ~Run::kPaintFlagsMask) | paintFlags);
- })) {
- continue;
- }
+ runPaint.setFlags((runPaint.getFlags() & ~Run::kPaintFlagsMask) | paintFlags);
+
for (int i = 0; i < run.fPathGlyphs.count(); i++) {
GrTextBlob::Run::PathGlyph& pathGlyph = run.fPathGlyphs[i];
calculate_translation(pathGlyph.fPreTransformed, viewMatrix, x, y,
@@ -349,7 +345,7 @@
if (submitOp) {
auto op = this->makeOp(info, glyphCount, runIndex, subRun, viewMatrix, x, y,
- clipRect, std::move(paint), props, distanceAdjustTable,
+ clipRect, paint, props, distanceAdjustTable,
target);
if (op) {
if (skipClip) {
diff --git a/src/gpu/text/GrTextUtils.h b/src/gpu/text/GrTextUtils.h
index e2e56e3..ed87509 100644
--- a/src/gpu/text/GrTextUtils.h
+++ b/src/gpu/text/GrTextUtils.h
@@ -108,32 +108,5 @@
// the fragment shader.
GrColor fFilteredPremulColor;
};
-
- /**
- * An extension of Paint that incorporated per-run modifications to the paint text settings and
- * application of a draw filter. It expects its constructor arguments to remain alive and const
- * during its lifetime.
- */
- class RunPaint : public Paint {
- public:
- RunPaint(const Paint* paint) : fOriginalPaint(paint) {
- // Initially we represent the original paint.
- fPaint = paint->fPaint;
- fDstColorSpaceInfo = paint->fDstColorSpaceInfo;
- fFilteredPremulColor = paint->fFilteredPremulColor;
- }
-
- bool modifyForRun(std::function<void(SkPaint*)> paintModFunc) {
- if (!fModifiedPaint.isValid()) {
- fModifiedPaint.init(fOriginalPaint->skPaint());
- fPaint = fModifiedPaint.get();
- }
- paintModFunc(fModifiedPaint.get());
- return true;
- }
- private:
- SkTLazy<SkPaint> fModifiedPaint;
- const Paint* fOriginalPaint;
- };
};
#endif