aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/SkGlyphRun.cpp
diff options
context:
space:
mode:
authorGravatar Herb Derby <herb@google.com>2018-07-09 14:46:48 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2018-07-10 14:57:55 +0000
commit45e27c8eed8f1673efebcb6cb2c03b8644c9c7a5 (patch)
tree74f2c2aa41e286c94eb2ea97f3bdd197743031fe /src/core/SkGlyphRun.cpp
parent653f42f72a1ccb4a5d86cdf128993cbb5c9a310b (diff)
Remove run list code
Temporarily remove run list code to gut some overly complicated code. Change-Id: Ib12efc394c05dee391143b440b2fab5bba4f22ae Reviewed-on: https://skia-review.googlesource.com/139865 Reviewed-by: Mike Klein <mtklein@google.com> Commit-Queue: Herb Derby <herb@google.com>
Diffstat (limited to 'src/core/SkGlyphRun.cpp')
-rw-r--r--src/core/SkGlyphRun.cpp32
1 files changed, 10 insertions, 22 deletions
diff --git a/src/core/SkGlyphRun.cpp b/src/core/SkGlyphRun.cpp
index ce1c336d88..fa070da3a7 100644
--- a/src/core/SkGlyphRun.cpp
+++ b/src/core/SkGlyphRun.cpp
@@ -85,7 +85,7 @@ void SkGlyphSet::reuse(uint32_t glyphUniverseSize, std::vector<SkGlyphID>* uniqu
}
// -- SkGlyphRun -----------------------------------------------------------------------------------
-SkGlyphRun::SkGlyphRun(const SkIndexedRunInfo& runInfo,
+SkGlyphRun::SkGlyphRun(const SkIndexedRunInfo* runInfo,
size_t denseOffset, size_t denseSize,
size_t uniqueOffset, uint16_t uniqueSize,
SkSpan<SkGlyphID> scratchGlyphs,
@@ -114,11 +114,6 @@ void SkGlyphRun::temporaryShuntToCallback(TemporaryShuntCallback callback) {
callback(this->runSize(), bytes, pos);
}
-// -- SkGlyphRunList -------------------------------------------------------------------------------
-SkGlyphRunList::SkGlyphRunList(SkSpan<SkGlyphRun> glyphRuns, uint64_t uniqueID)
- : fUniqueID{uniqueID}
- , fGlyphRuns{glyphRuns} { }
-
// -- SkGlyphRunBuilder ----------------------------------------------------------------------------
void SkGlyphRunBuilder::prepareDrawText(
const SkPaint& paint, const void* bytes, size_t byteLength, SkPoint origin) {
@@ -187,14 +182,7 @@ void SkGlyphRunBuilder::prepareTextBlob(
}
SkGlyphRun* SkGlyphRunBuilder::useGlyphRun() {
- auto glyphRunList = this->useGlyphRunList();
- SkASSERT(glyphRunList->size() == 1);
- return &(*glyphRunList)[0];
-}
-
-SkGlyphRunList* SkGlyphRunBuilder::useGlyphRunList() {
- new ((void*)&fScratchGlyphRunList) SkGlyphRunList{SkSpan<SkGlyphRun>(fGlyphRuns), fUniqueID};
- return &fScratchGlyphRunList;
+ return &fScratchGlyphRun;
}
size_t SkGlyphRunBuilder::runSize() const { return fDenseIndex.size() - fLastDenseIndex; }
@@ -206,7 +194,6 @@ void SkGlyphRunBuilder::initialize() {
fDenseIndex.clear();
fPositions.clear();
fUniqueGlyphIDs.clear();
- fGlyphRuns.clear();
fLastDenseIndex = 0;
fLastUniqueIndex = 0;
}
@@ -244,7 +231,7 @@ SkGlyphID* SkGlyphRunBuilder::addDenseAndUnique(
return glyphIDs;
}
-void SkGlyphRunBuilder::addGlyphRunToList(
+void SkGlyphRunBuilder::makeGlyphRun(
SkGlyphID* temporaryShuntGlyphIDs, SkSpan<const char> text, SkSpan<uint32_t> clusters) {
// Ignore empty runs.
@@ -252,13 +239,14 @@ void SkGlyphRunBuilder::addGlyphRunToList(
auto runSize = this->runSize();
auto uniqueSize = this->uniqueSize();
- fGlyphRuns.emplace_back(
- fIndexed,
+ new ((void*)&fScratchGlyphRun) SkGlyphRun{
+ &fIndexed,
fLastDenseIndex, runSize,
fLastUniqueIndex, SkTo<uint16_t>(uniqueSize),
SkSpan<SkGlyphID>(temporaryShuntGlyphIDs, runSize),
text,
- clusters);
+ clusters
+ };
fLastDenseIndex = fDenseIndex.size();
fLastUniqueIndex = fUniqueGlyphIDs.size();
@@ -295,7 +283,7 @@ void SkGlyphRunBuilder::drawText(
}
}
- this->addGlyphRunToList(temporaryShuntGlyphIDs, text, clusters);
+ this->makeGlyphRun(temporaryShuntGlyphIDs, text, clusters);
}
void SkGlyphRunBuilder::drawPosTextH(const SkPaint& paint, const void* bytes,
@@ -309,7 +297,7 @@ void SkGlyphRunBuilder::drawPosTextH(const SkPaint& paint, const void* bytes,
fPositions.push_back(SkPoint::Make(xpos[i], constY));
}
- this->addGlyphRunToList(temporaryShuntGlyphIDs, text, clusters);
+ this->makeGlyphRun(temporaryShuntGlyphIDs, text, clusters);
}
void SkGlyphRunBuilder::drawPosText(const SkPaint& paint, const void* bytes,
@@ -321,7 +309,7 @@ void SkGlyphRunBuilder::drawPosText(const SkPaint& paint, const void* bytes,
fPositions.push_back(pos[i]);
}
- this->addGlyphRunToList(temporaryShuntGlyphIDs, text, clusters);
+ this->makeGlyphRun(temporaryShuntGlyphIDs, text, clusters);
}