Remove redundant positionMatrix in TextBlob

Change-Id: I3f913a37e261d2b0916b7f8d15f26c4ec809827f
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/546107
Commit-Queue: Herb Derby <herb@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
This commit is contained in:
Herb Derby 2022-06-02 12:10:36 -04:00 committed by SkCQ
parent d881def3e5
commit c2fac25c6e
2 changed files with 4 additions and 10 deletions

View File

@ -376,7 +376,6 @@ sk_sp<TextBlob> TextBlob::Make(const SkGlyphRunList& glyphRunList,
sk_sp<TextBlob> blob = sk_sp<TextBlob>(initializer.initialize(std::move(alloc), sk_sp<TextBlob> blob = sk_sp<TextBlob>(initializer.initialize(std::move(alloc),
std::move(container), std::move(container),
totalMemoryAllocated, totalMemoryAllocated,
positionMatrix,
initialLuminance)); initialLuminance));
// Be sure to pass the ref to the matrix that the SubRuns will capture. // Be sure to pass the ref to the matrix that the SubRuns will capture.
@ -389,14 +388,16 @@ void TextBlob::addKey(const Key& key) {
fKey = key; fKey = key;
} }
bool TextBlob::hasPerspective() const { return fInitialPositionMatrix.hasPerspective(); } bool TextBlob::hasPerspective() const {
return fSubRuns->initialPosition().hasPerspective();
}
bool TextBlob::canReuse(const SkPaint& paint, const SkMatrix& positionMatrix) const { bool TextBlob::canReuse(const SkPaint& paint, const SkMatrix& positionMatrix) const {
// A singular matrix will create a TextBlob with no SubRuns, but unknown glyphs can // A singular matrix will create a TextBlob with no SubRuns, but unknown glyphs can
// also cause empty runs. If there are no subRuns or some glyphs were excluded or perspective, // also cause empty runs. If there are no subRuns or some glyphs were excluded or perspective,
// then regenerate when the matrices don't match. // then regenerate when the matrices don't match.
if ((fSubRuns->isEmpty() || fSomeGlyphsExcluded || hasPerspective()) && if ((fSubRuns->isEmpty() || fSomeGlyphsExcluded || hasPerspective()) &&
fInitialPositionMatrix != positionMatrix) { fSubRuns->initialPosition() != positionMatrix) {
return false; return false;
} }
@ -446,12 +447,10 @@ const AtlasSubRun* TextBlob::testingOnlyFirstSubRun() const {
TextBlob::TextBlob(SubRunAllocator&& alloc, TextBlob::TextBlob(SubRunAllocator&& alloc,
SubRunContainerOwner subRuns, SubRunContainerOwner subRuns,
int totalMemorySize, int totalMemorySize,
const SkMatrix& positionMatrix,
SkColor initialLuminance) SkColor initialLuminance)
: fAlloc{std::move(alloc)} : fAlloc{std::move(alloc)}
, fSubRuns{std::move(subRuns)} , fSubRuns{std::move(subRuns)}
, fSize(totalMemorySize) , fSize(totalMemorySize)
, fInitialPositionMatrix{positionMatrix}
, fInitialLuminance{initialLuminance} { } , fInitialLuminance{initialLuminance} { }

View File

@ -97,7 +97,6 @@ public:
TextBlob(SubRunAllocator&& alloc, TextBlob(SubRunAllocator&& alloc,
SubRunContainerOwner subRuns, SubRunContainerOwner subRuns,
int totalMemorySize, int totalMemorySize,
const SkMatrix& positionMatrix,
SkColor initialLuminance); SkColor initialLuminance);
~TextBlob() override; ~TextBlob() override;
@ -138,10 +137,6 @@ private:
// Overall size of this struct plus vertices and glyphs at the end. // Overall size of this struct plus vertices and glyphs at the end.
const int fSize; const int fSize;
// The initial view matrix combined with the initial origin. Used to determine if a cached
// subRun can be used in this draw situation.
const SkMatrix fInitialPositionMatrix;
const SkColor fInitialLuminance; const SkColor fInitialLuminance;
Key fKey; Key fKey;