From 80eb42ba9ee8b09a71d229ae8422c93e5c59f201 Mon Sep 17 00:00:00 2001 From: Herb Derby Date: Fri, 27 Jul 2018 16:46:49 -0400 Subject: Take advantage of newly const ref text stack Change-Id: Ib09669cbacc7b466c268af7a7bc1341b7d9e9916 Reviewed-on: https://skia-review.googlesource.com/144124 Commit-Queue: Herb Derby Auto-Submit: Herb Derby Reviewed-by: Brian Osman --- src/core/SkGlyphRun.cpp | 31 +++++++------------------------ src/core/SkGlyphRun.h | 2 +- 2 files changed, 8 insertions(+), 25 deletions(-) diff --git a/src/core/SkGlyphRun.cpp b/src/core/SkGlyphRun.cpp index 7683325c5b..006a4ba067 100644 --- a/src/core/SkGlyphRun.cpp +++ b/src/core/SkGlyphRun.cpp @@ -465,7 +465,7 @@ void SkGlyphRunBuilder::drawPosText(const SkPaint& paint, const void* bytes, if (!glyphIDs.empty()) { this->initialize(glyphIDs.size()); this->simplifyDrawPosText(paint, glyphIDs, pos, - fUniqueGlyphIDIndices, fUniqueGlyphIDs, fPositions); + fUniqueGlyphIDIndices, fUniqueGlyphIDs); } this->makeGlyphRunList(paint, nullptr, SkPoint::Make(0, 0)); @@ -521,7 +521,7 @@ void SkGlyphRunBuilder::drawTextBlob(const SkPaint& paint, const SkTextBlob& blo case SkTextBlobRunIterator::kFull_Positioning: uniqueGlyphIDsSize = this->simplifyDrawPosText( runPaint, glyphIDs, (const SkPoint*)it.pos(), - currentDenseIndices, currentUniqueGlyphIDs, currentPositions, + currentDenseIndices, currentUniqueGlyphIDs, text, clusters); break; } @@ -678,35 +678,20 @@ size_t SkGlyphRunBuilder::simplifyDrawPosTextH( const SkScalar* xpos, SkScalar constY, uint16_t* uniqueGlyphIDIndicesBuffer, SkGlyphID* uniqueGlyphIDsBuffer, SkPoint* positions, SkSpan text, SkSpan clusters) { - auto runSize = glyphIDs.size(); auto posCursor = positions; for (auto x : SkSpan{xpos, glyphIDs.size()}) { *posCursor++ = SkPoint::Make(x, constY); } - // The dense indices are not used by the rest of the stack yet. - SkSpan uniqueGlyphIDs; - #ifdef SK_DEBUG - uniqueGlyphIDs = this->addDenseAndUnique( - paint, glyphIDs, uniqueGlyphIDIndicesBuffer, uniqueGlyphIDsBuffer); - #endif - - this->makeGlyphRun( - paint, - glyphIDs, - SkSpan{positions, runSize}, - SkSpan{uniqueGlyphIDIndicesBuffer, runSize}, - uniqueGlyphIDs, - text, - clusters); - - return uniqueGlyphIDs.size(); + return simplifyDrawPosText(paint, glyphIDs, positions, + uniqueGlyphIDIndicesBuffer, uniqueGlyphIDsBuffer, + text, clusters); } size_t SkGlyphRunBuilder::simplifyDrawPosText( const SkPaint& paint, SkSpan glyphIDs, const SkPoint* pos, - uint16_t* uniqueGlyphIDIndicesBuffer, SkGlyphID* uniqueGlyphIDsBuffer, SkPoint* positions, + uint16_t* uniqueGlyphIDIndicesBuffer, SkGlyphID* uniqueGlyphIDsBuffer, SkSpan text, SkSpan clusters) { auto runSize = glyphIDs.size(); @@ -717,14 +702,12 @@ size_t SkGlyphRunBuilder::simplifyDrawPosText( paint, glyphIDs, uniqueGlyphIDIndicesBuffer, uniqueGlyphIDsBuffer); #endif - memcpy(positions, pos, runSize * sizeof(SkPoint)); - // TODO: when using the unique glyph system have a guard that there are actually glyphs like // drawText above. this->makeGlyphRun( paint, glyphIDs, - SkSpan{positions, runSize}, + SkSpan{pos, runSize}, SkSpan{uniqueGlyphIDIndicesBuffer, runSize}, uniqueGlyphIDs, text, diff --git a/src/core/SkGlyphRun.h b/src/core/SkGlyphRun.h index fc85c3ec03..003c13c91c 100644 --- a/src/core/SkGlyphRun.h +++ b/src/core/SkGlyphRun.h @@ -279,7 +279,7 @@ private: SkSpan clusters = SkSpan{}); size_t simplifyDrawPosText( const SkPaint& paint, SkSpan glyphIDs, const SkPoint* pos, - uint16_t* uniqueGlyphIDIndices, SkGlyphID* uniqueGlyphIDs, SkPoint* positions, + uint16_t* uniqueGlyphIDIndices, SkGlyphID* uniqueGlyphIDs, SkSpan text = SkSpan{}, SkSpan clusters = SkSpan{}); -- cgit v1.2.3