From 6719fcc43b1eb5ffb18dad630cb6affe81189508 Mon Sep 17 00:00:00 2001 From: Mike Klein Date: Tue, 2 Oct 2018 18:58:32 +0000 Subject: [PATCH] Revert "Remove obsolete paint copy" This reverts commit cb969c76e7331bf99ef4e5c6f3b064b503eeadb9. Reason for revert: asserts triggering in PDF Original change's description: > Remove obsolete paint copy > > All the backends use the glyph run natively now, and > glyph runs never interpret these fields in paint. > > Change-Id: I1c6fde1202057391e3a3f9be65f1e8a851205df5 > Reviewed-on: https://skia-review.googlesource.com/158720 > Reviewed-by: Mike Klein > Commit-Queue: Herb Derby TBR=mtklein@google.com,herb@google.com Change-Id: I8ffcf633ffc41d4dc193ddf2a28a223cdaef9929 No-Presubmit: true No-Tree-Checks: true No-Try: true Reviewed-on: https://skia-review.googlesource.com/159061 Reviewed-by: Mike Klein Commit-Queue: Mike Klein --- src/core/SkGlyphRun.cpp | 10 +++++++--- src/core/SkGlyphRun.h | 2 +- src/pdf/SkClusterator.cpp | 1 + 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/src/core/SkGlyphRun.cpp b/src/core/SkGlyphRun.cpp index a6ac71b3fa..ec09a34d70 100644 --- a/src/core/SkGlyphRun.cpp +++ b/src/core/SkGlyphRun.cpp @@ -28,7 +28,7 @@ static SkTypeface::Encoding convert_encoding(SkPaint::TextEncoding encoding) { } // namespace // -- SkGlyphRun ----------------------------------------------------------------------------------- -SkGlyphRun::SkGlyphRun(const SkPaint& runPaint, +SkGlyphRun::SkGlyphRun(SkPaint&& runPaint, SkSpan denseIndices, SkSpan positions, SkSpan glyphIDs, @@ -41,7 +41,7 @@ SkGlyphRun::SkGlyphRun(const SkPaint& runPaint, , fUniqueGlyphIDs{uniqueGlyphIDs} , fText{text} , fClusters{clusters} - , fRunPaint{runPaint} {} + , fRunPaint{std::move(runPaint)} {} void SkGlyphRun::eachGlyphToGlyphRun(SkGlyphRun::PerGlyph perGlyph) { SkPaint paint{fRunPaint}; @@ -371,8 +371,12 @@ void SkGlyphRunBuilder::makeGlyphRun( // Ignore empty runs. if (!glyphIDs.empty()) { + SkPaint glyphRunPaint{runPaint}; + glyphRunPaint.setTextEncoding(SkPaint::kGlyphID_TextEncoding); + glyphRunPaint.setTextAlign(SkPaint::kLeft_Align); + fGlyphRunListStorage.emplace_back( - runPaint, + std::move(glyphRunPaint), uniqueGlyphIDIndices, positions, glyphIDs, diff --git a/src/core/SkGlyphRun.h b/src/core/SkGlyphRun.h index b905cbff33..8a4e6e021b 100644 --- a/src/core/SkGlyphRun.h +++ b/src/core/SkGlyphRun.h @@ -85,7 +85,7 @@ public: class SkGlyphRun { public: SkGlyphRun() = default; - SkGlyphRun(const SkPaint& runPaint, + SkGlyphRun(SkPaint&& runPaint, SkSpan denseIndices, SkSpan positions, SkSpan glyphIDs, diff --git a/src/pdf/SkClusterator.cpp b/src/pdf/SkClusterator.cpp index f575407e8c..988c84590a 100644 --- a/src/pdf/SkClusterator.cpp +++ b/src/pdf/SkClusterator.cpp @@ -31,6 +31,7 @@ SkClusterator::SkClusterator(const SkGlyphRun& run) , fGlyphCount(SkToU32(run.shuntGlyphsIDs().size())) , fTextByteLength(SkToU32(run.text().size())) { + SkASSERT(SkPaint::kGlyphID_TextEncoding == run.paint().getTextEncoding()); if (fClusters) { SkASSERT(fUtf8Text && fTextByteLength > 0 && fGlyphCount > 0); fReversedChars = is_reversed(fClusters, fGlyphCount);