aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar Herb Derby <herb@google.com>2018-07-27 16:46:49 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2018-07-27 21:45:00 +0000
commit80eb42ba9ee8b09a71d229ae8422c93e5c59f201 (patch)
tree28ef32936197d1a32c5d677ad81547337c8e979d
parent2183142feaf11d4ad4fee0c2b46f81de443424a5 (diff)
Take advantage of newly const ref text stack
Change-Id: Ib09669cbacc7b466c268af7a7bc1341b7d9e9916 Reviewed-on: https://skia-review.googlesource.com/144124 Commit-Queue: Herb Derby <herb@google.com> Auto-Submit: Herb Derby <herb@google.com> Reviewed-by: Brian Osman <brianosman@google.com>
-rw-r--r--src/core/SkGlyphRun.cpp31
-rw-r--r--src/core/SkGlyphRun.h2
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<const char> text, SkSpan<const uint32_t> clusters) {
- auto runSize = glyphIDs.size();
auto posCursor = positions;
for (auto x : SkSpan<const SkScalar>{xpos, glyphIDs.size()}) {
*posCursor++ = SkPoint::Make(x, constY);
}
- // The dense indices are not used by the rest of the stack yet.
- SkSpan<const SkGlyphID> uniqueGlyphIDs;
- #ifdef SK_DEBUG
- uniqueGlyphIDs = this->addDenseAndUnique(
- paint, glyphIDs, uniqueGlyphIDIndicesBuffer, uniqueGlyphIDsBuffer);
- #endif
-
- this->makeGlyphRun(
- paint,
- glyphIDs,
- SkSpan<const SkPoint>{positions, runSize},
- SkSpan<const SkGlyphID>{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<const SkGlyphID> glyphIDs, const SkPoint* pos,
- uint16_t* uniqueGlyphIDIndicesBuffer, SkGlyphID* uniqueGlyphIDsBuffer, SkPoint* positions,
+ uint16_t* uniqueGlyphIDIndicesBuffer, SkGlyphID* uniqueGlyphIDsBuffer,
SkSpan<const char> text, SkSpan<const uint32_t> 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<const SkPoint>{positions, runSize},
+ SkSpan<const SkPoint>{pos, runSize},
SkSpan<const SkGlyphID>{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<const uint32_t> clusters = SkSpan<const uint32_t>{});
size_t simplifyDrawPosText(
const SkPaint& paint, SkSpan<const SkGlyphID> glyphIDs, const SkPoint* pos,
- uint16_t* uniqueGlyphIDIndices, SkGlyphID* uniqueGlyphIDs, SkPoint* positions,
+ uint16_t* uniqueGlyphIDIndices, SkGlyphID* uniqueGlyphIDs,
SkSpan<const char> text = SkSpan<const char>{},
SkSpan<const uint32_t> clusters = SkSpan<const uint32_t>{});