Revert "Remove obsolete paint copy"

This reverts commit cb969c76e7.

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 <mtklein@google.com>
> Commit-Queue: Herb Derby <herb@google.com>

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 <mtklein@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
This commit is contained in:
Mike Klein 2018-10-02 18:58:32 +00:00 committed by Skia Commit-Bot
parent 412dd56589
commit 6719fcc43b
3 changed files with 9 additions and 4 deletions

View File

@ -28,7 +28,7 @@ static SkTypeface::Encoding convert_encoding(SkPaint::TextEncoding encoding) {
} // namespace
// -- SkGlyphRun -----------------------------------------------------------------------------------
SkGlyphRun::SkGlyphRun(const SkPaint& runPaint,
SkGlyphRun::SkGlyphRun(SkPaint&& runPaint,
SkSpan<const uint16_t> denseIndices,
SkSpan<const SkPoint> positions,
SkSpan<const SkGlyphID> 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,

View File

@ -85,7 +85,7 @@ public:
class SkGlyphRun {
public:
SkGlyphRun() = default;
SkGlyphRun(const SkPaint& runPaint,
SkGlyphRun(SkPaint&& runPaint,
SkSpan<const uint16_t> denseIndices,
SkSpan<const SkPoint> positions,
SkSpan<const SkGlyphID> glyphIDs,

View File

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