aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorGravatar Mike Reed <reed@google.com>2018-07-19 09:39:21 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2018-07-19 15:44:55 +0000
commit30301c48f73f80f99d651a077821d2e7c7469f31 (patch)
tree54b6791456262168bdaee2f518d1e3a41a6487e6 /src
parent7f644ec996eccb7385c63e7cc7b6c7cfbfe85b33 (diff)
share helper for flagging when added to raster cache
Rename to clarify that it is a "raster" cache we're talking about. clean up -- motivated by looking to make the purge of a staleID synchronous Bug: skia: Change-Id: I87493690dd5a4f2ebd002e2635ebd0e44fe27320 Reviewed-on: https://skia-review.googlesource.com/142325 Reviewed-by: Brian Salomon <bsalomon@google.com> Commit-Queue: Mike Reed <reed@google.com>
Diffstat (limited to 'src')
-rw-r--r--src/core/SkBitmapProvider.cpp2
-rw-r--r--src/gpu/GrImageTextureMaker.cpp4
-rw-r--r--src/gpu/GrImageTextureMaker.h2
-rw-r--r--src/image/SkImage.cpp4
-rw-r--r--src/image/SkImage_Base.h6
-rw-r--r--src/image/SkImage_Gpu.cpp11
-rw-r--r--src/image/SkImage_Lazy.cpp2
7 files changed, 11 insertions, 20 deletions
diff --git a/src/core/SkBitmapProvider.cpp b/src/core/SkBitmapProvider.cpp
index fa1e81544d..03f4a9d2a1 100644
--- a/src/core/SkBitmapProvider.cpp
+++ b/src/core/SkBitmapProvider.cpp
@@ -40,7 +40,7 @@ SkBitmapCacheDesc SkBitmapProvider::makeCacheDesc() const {
}
void SkBitmapProvider::notifyAddedToCache() const {
- as_IB(fImage)->notifyAddedToCache();
+ as_IB(fImage)->notifyAddedToRasterCache();
}
bool SkBitmapProvider::asBitmap(SkBitmap* bm) const {
diff --git a/src/gpu/GrImageTextureMaker.cpp b/src/gpu/GrImageTextureMaker.cpp
index a8e62162a6..8571b163f6 100644
--- a/src/gpu/GrImageTextureMaker.cpp
+++ b/src/gpu/GrImageTextureMaker.cpp
@@ -42,10 +42,6 @@ void GrImageTextureMaker::makeCopyKey(const CopyParams& stretch, GrUniqueKey* pa
}
}
-void GrImageTextureMaker::didCacheCopy(const GrUniqueKey& copyKey, uint32_t contextUniqueID) {
- as_IB(fClient)->notifyAddedToCache();
-}
-
SkAlphaType GrImageTextureMaker::alphaType() const {
return fClient->alphaType();
}
diff --git a/src/gpu/GrImageTextureMaker.h b/src/gpu/GrImageTextureMaker.h
index 1fe882a4f3..04148cfc71 100644
--- a/src/gpu/GrImageTextureMaker.h
+++ b/src/gpu/GrImageTextureMaker.h
@@ -29,7 +29,7 @@ protected:
void makeCopyKey(const CopyParams& stretch, GrUniqueKey* paramsCopyKey,
SkColorSpace* dstColorSpace) override;
- void didCacheCopy(const GrUniqueKey& copyKey, uint32_t contextUniqueID) override;
+ void didCacheCopy(const GrUniqueKey& copyKey, uint32_t contextUniqueID) override {}
SkAlphaType alphaType() const override;
sk_sp<SkColorSpace> getColorSpace(SkColorSpace* dstColorSpace) override;
diff --git a/src/image/SkImage.cpp b/src/image/SkImage.cpp
index e3e107ea2e..3be9f3791e 100644
--- a/src/image/SkImage.cpp
+++ b/src/image/SkImage.cpp
@@ -194,11 +194,11 @@ bool SkImage::isValid(GrContext* context) const {
SkImage_Base::SkImage_Base(int width, int height, uint32_t uniqueID)
: INHERITED(width, height, uniqueID)
- , fAddedToCache(false)
+ , fAddedToRasterCache(false)
{}
SkImage_Base::~SkImage_Base() {
- if (fAddedToCache.load()) {
+ if (fAddedToRasterCache.load()) {
SkNotifyBitmapGenIDIsStale(this->uniqueID());
}
}
diff --git a/src/image/SkImage_Base.h b/src/image/SkImage_Base.h
index 6a048ba51f..df6accbc72 100644
--- a/src/image/SkImage_Base.h
+++ b/src/image/SkImage_Base.h
@@ -86,8 +86,8 @@ public:
// Call when this image is part of the key to a resourcecache entry. This allows the cache
// to know automatically those entries can be purged when this SkImage deleted.
- void notifyAddedToCache() const {
- fAddedToCache.store(true);
+ void notifyAddedToRasterCache() const {
+ fAddedToRasterCache.store(true);
}
virtual bool onIsValid(GrContext*) const = 0;
@@ -101,7 +101,7 @@ protected:
private:
// Set true by caches when they cache content that's derived from the current pixels.
- mutable SkAtomic<bool> fAddedToCache;
+ mutable SkAtomic<bool> fAddedToRasterCache;
typedef SkImage INHERITED;
};
diff --git a/src/image/SkImage_Gpu.cpp b/src/image/SkImage_Gpu.cpp
index 0fcc01f0f0..0b3868d3fe 100644
--- a/src/image/SkImage_Gpu.cpp
+++ b/src/image/SkImage_Gpu.cpp
@@ -51,14 +51,9 @@ SkImage_Gpu::SkImage_Gpu(sk_sp<GrContext> context, uint32_t uniqueID, SkAlphaTyp
, fProxy(std::move(proxy))
, fAlphaType(at)
, fBudgeted(budgeted)
- , fColorSpace(std::move(colorSpace))
- , fAddedRasterVersionToCache(false) {}
+ , fColorSpace(std::move(colorSpace)) {}
-SkImage_Gpu::~SkImage_Gpu() {
- if (fAddedRasterVersionToCache.load()) {
- SkNotifyBitmapGenIDIsStale(this->uniqueID());
- }
-}
+SkImage_Gpu::~SkImage_Gpu() {}
SkImageInfo SkImage_Gpu::onImageInfo() const {
return SkImageInfo::Make(fProxy->width(), fProxy->height(), this->onColorType(), fAlphaType,
@@ -119,7 +114,7 @@ bool SkImage_Gpu::getROPixels(SkBitmap* dst, SkColorSpace*, CachingHint chint) c
if (rec) {
SkBitmapCache::Add(std::move(rec), dst);
- fAddedRasterVersionToCache.store(true);
+ this->notifyAddedToRasterCache();
}
return true;
}
diff --git a/src/image/SkImage_Lazy.cpp b/src/image/SkImage_Lazy.cpp
index 402acf5d73..3e6aea4ca9 100644
--- a/src/image/SkImage_Lazy.cpp
+++ b/src/image/SkImage_Lazy.cpp
@@ -360,7 +360,7 @@ bool SkImage_Lazy::lockAsBitmap(SkBitmap* bitmap, SkImage::CachingHint chint, Ca
SkASSERT(bitmap->getPixels()); // we're locked
SkASSERT(bitmap->isImmutable());
SkASSERT(bitmap->getGenerationID() == uniqueID);
- this->notifyAddedToCache();
+ this->notifyAddedToRasterCache();
} else {
*bitmap = tmpBitmap;
bitmap->pixelRef()->setImmutableWithID(uniqueID);