From c2fac25c6e4d6208f7e33b37e10ffaaf257a1b80 Mon Sep 17 00:00:00 2001 From: Herb Derby Date: Thu, 2 Jun 2022 12:10:36 -0400 Subject: [PATCH] Remove redundant positionMatrix in TextBlob Change-Id: I3f913a37e261d2b0916b7f8d15f26c4ec809827f Reviewed-on: https://skia-review.googlesource.com/c/skia/+/546107 Commit-Queue: Herb Derby Reviewed-by: Robert Phillips --- src/text/gpu/TextBlob.cpp | 9 ++++----- src/text/gpu/TextBlob.h | 5 ----- 2 files changed, 4 insertions(+), 10 deletions(-) diff --git a/src/text/gpu/TextBlob.cpp b/src/text/gpu/TextBlob.cpp index 3e0a70a693..c5464ca123 100644 --- a/src/text/gpu/TextBlob.cpp +++ b/src/text/gpu/TextBlob.cpp @@ -376,7 +376,6 @@ sk_sp TextBlob::Make(const SkGlyphRunList& glyphRunList, sk_sp blob = sk_sp(initializer.initialize(std::move(alloc), std::move(container), totalMemoryAllocated, - positionMatrix, initialLuminance)); // 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; } -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 { // 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, // then regenerate when the matrices don't match. if ((fSubRuns->isEmpty() || fSomeGlyphsExcluded || hasPerspective()) && - fInitialPositionMatrix != positionMatrix) { + fSubRuns->initialPosition() != positionMatrix) { return false; } @@ -446,12 +447,10 @@ const AtlasSubRun* TextBlob::testingOnlyFirstSubRun() const { TextBlob::TextBlob(SubRunAllocator&& alloc, SubRunContainerOwner subRuns, int totalMemorySize, - const SkMatrix& positionMatrix, SkColor initialLuminance) : fAlloc{std::move(alloc)} , fSubRuns{std::move(subRuns)} , fSize(totalMemorySize) - , fInitialPositionMatrix{positionMatrix} , fInitialLuminance{initialLuminance} { } diff --git a/src/text/gpu/TextBlob.h b/src/text/gpu/TextBlob.h index d534c4b040..068171ad67 100644 --- a/src/text/gpu/TextBlob.h +++ b/src/text/gpu/TextBlob.h @@ -97,7 +97,6 @@ public: TextBlob(SubRunAllocator&& alloc, SubRunContainerOwner subRuns, int totalMemorySize, - const SkMatrix& positionMatrix, SkColor initialLuminance); ~TextBlob() override; @@ -138,10 +137,6 @@ private: // Overall size of this struct plus vertices and glyphs at the end. 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; Key fKey;