Cleanup GrStrike management because we do not abandon strikes
Change-Id: I23e44ae389d00ae6dad6b04e24522f854dc98d75
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/267177
Commit-Queue: Herb Derby <herb@google.com>
Reviewed-by: Jim Van Verth <jvanverth@google.com>
diff --git a/src/gpu/GrDrawOpAtlas.cpp b/src/gpu/GrDrawOpAtlas.cpp
index 1740d9d..4b2272e 100644
--- a/src/gpu/GrDrawOpAtlas.cpp
+++ b/src/gpu/GrDrawOpAtlas.cpp
@@ -54,7 +54,9 @@
return nullptr;
}
- atlas->fEvictionCallbacks.emplace_back(evictor);
+ if (evictor != nullptr) {
+ atlas->fEvictionCallbacks.emplace_back(evictor);
+ }
return atlas;
}
diff --git a/src/gpu/text/GrAtlasManager.cpp b/src/gpu/text/GrAtlasManager.cpp
index b4274d6..e74b02d 100644
--- a/src/gpu/text/GrAtlasManager.cpp
+++ b/src/gpu/text/GrAtlasManager.cpp
@@ -40,7 +40,6 @@
GrTextStrike* strike, GrDrawOpAtlas::PlotLocator* plotLocator,
GrDeferredUploadTarget* target, GrMaskFormat format,
int width, int height, const void* image, SkIPoint16* loc) {
- glyphCache->setStrikeToPreserve(strike);
return this->getAtlas(format)->addToAtlas(
resourceProvider, plotLocator, target, width, height, image, loc);
}
@@ -161,7 +160,7 @@
fProxyProvider, format, grColorType,
atlasDimensions.width(), atlasDimensions.height(),
plotDimensions.width(), plotDimensions.height(),
- this, fAllowMultitexturing, fGlyphCache);
+ this, fAllowMultitexturing, nullptr);
if (!fAtlases[index]) {
return false;
}
diff --git a/src/gpu/text/GrStrikeCache.cpp b/src/gpu/text/GrStrikeCache.cpp
index 05be441..46793d8 100644
--- a/src/gpu/text/GrStrikeCache.cpp
+++ b/src/gpu/text/GrStrikeCache.cpp
@@ -18,8 +18,7 @@
#include "src/gpu/text/GrStrikeCache.h"
GrStrikeCache::GrStrikeCache(const GrCaps* caps, size_t maxTextureBytes)
- : fPreserveStrike(nullptr)
- , f565Masks(SkMasks::CreateMasks({0xF800, 0x07E0, 0x001F, 0},
+ : f565Masks(SkMasks::CreateMasks({0xF800, 0x07E0, 0x001F, 0},
GrMaskFormatBytesPerPixel(kA565_GrMaskFormat))) { }
GrStrikeCache::~GrStrikeCache() {
@@ -30,8 +29,6 @@
fCache.reset();
}
-void GrStrikeCache::evict(GrDrawOpAtlas::PlotLocator) { }
-
// expands each bit in a bitmask to 0 or ~0 of type INT_TYPE. Used to expand a BW glyph mask to
// A8, RGB565, or RGBA8888.
template <typename INT_TYPE>
diff --git a/src/gpu/text/GrStrikeCache.h b/src/gpu/text/GrStrikeCache.h
index 420b867..30ad05c 100644
--- a/src/gpu/text/GrStrikeCache.h
+++ b/src/gpu/text/GrStrikeCache.h
@@ -80,12 +80,10 @@
* GrStrikeCache manages strikes which are indexed by a SkStrike. These strikes can then be
* used to generate individual Glyph Masks.
*/
-class GrStrikeCache final : public GrDrawOpAtlas::EvictionCallback {
+class GrStrikeCache final {
public:
GrStrikeCache(const GrCaps* caps, size_t maxTextureBytes);
- ~GrStrikeCache() override;
-
- void setStrikeToPreserve(GrTextStrike* strike) { fPreserveStrike = strike; }
+ ~GrStrikeCache();
// The user of the cache may hold a long-lived ref to the returned strike. However, actions by
// another client of the cache may cause the strike to be purged while it is still reffed.
@@ -102,8 +100,6 @@
void freeAll();
- void evict(GrDrawOpAtlas::PlotLocator plotLocator) override;
-
private:
sk_sp<GrTextStrike> generateStrike(const SkDescriptor& desc) {
sk_sp<GrTextStrike> strike = sk_make_sp<GrTextStrike>(desc);
@@ -121,7 +117,6 @@
using StrikeHash = SkTHashTable<sk_sp<GrTextStrike>, SkDescriptor, DescriptorHashTraits>;
StrikeHash fCache;
- GrTextStrike* fPreserveStrike;
std::unique_ptr<const SkMasks> f565Masks;
};