| Index: src/core/SkImageCacherator.h
|
| diff --git a/src/core/SkImageCacherator.h b/src/core/SkImageCacherator.h
|
| index 2d9e94cc4d7f9bc7b1e3a439f69eebe3a636b800..cd5ac9ba09b6b6c0f9c0d8336cef88f0dad5fe83 100644
|
| --- a/src/core/SkImageCacherator.h
|
| +++ b/src/core/SkImageCacherator.h
|
| @@ -9,7 +9,6 @@
|
| #define SkImageCacherator_DEFINED
|
|
|
| #include "SkImageGenerator.h"
|
| -#include "SkMutex.h"
|
| #include "SkTemplates.h"
|
|
|
| class GrContext;
|
| @@ -26,6 +25,8 @@ public:
|
| // Takes ownership of the generator
|
| static SkImageCacherator* NewFromGenerator(SkImageGenerator*, const SkIRect* subset = nullptr);
|
|
|
| + ~SkImageCacherator();
|
| +
|
| const SkImageInfo& info() const { return fInfo; }
|
| uint32_t uniqueID() const { return fUniqueID; }
|
|
|
| @@ -68,15 +69,19 @@ public:
|
| int srcX, int srcY);
|
|
|
| private:
|
| + class SharedGenerator;
|
| + class ScopedGenerator;
|
| +
|
| struct Validator {
|
| Validator(SkImageGenerator*, const SkIRect* subset);
|
| + ~Validator();
|
|
|
| - operator bool() const { return fGenerator.get(); }
|
| + operator bool() const { return fSharedGenerator.get(); }
|
|
|
| - std::unique_ptr<SkImageGenerator> fGenerator;
|
| - SkImageInfo fInfo;
|
| - SkIPoint fOrigin;
|
| - uint32_t fUniqueID;
|
| + sk_sp<SharedGenerator> fSharedGenerator;
|
| + SkImageInfo fInfo;
|
| + SkIPoint fOrigin;
|
| + uint32_t fUniqueID;
|
| };
|
|
|
| SkImageCacherator(Validator*);
|
| @@ -90,25 +95,10 @@ private:
|
| SkImage::CachingHint, bool willBeMipped, SkSourceGammaTreatment);
|
| #endif
|
|
|
| - class ScopedGenerator {
|
| - SkImageCacherator* fCacher;
|
| - public:
|
| - ScopedGenerator(SkImageCacherator* cacher) : fCacher(cacher) {
|
| - fCacher->fMutexForGenerator.acquire();
|
| - }
|
| - ~ScopedGenerator() {
|
| - fCacher->fMutexForGenerator.release();
|
| - }
|
| - SkImageGenerator* operator->() const { return fCacher->fNotThreadSafeGenerator; }
|
| - operator SkImageGenerator*() const { return fCacher->fNotThreadSafeGenerator; }
|
| - };
|
| -
|
| - SkMutex fMutexForGenerator;
|
| - SkAutoTDelete<SkImageGenerator> fNotThreadSafeGenerator;
|
| -
|
| - const SkImageInfo fInfo;
|
| - const SkIPoint fOrigin;
|
| - const uint32_t fUniqueID;
|
| + sk_sp<SharedGenerator> fSharedGenerator;
|
| + const SkImageInfo fInfo;
|
| + const SkIPoint fOrigin;
|
| + const uint32_t fUniqueID;
|
|
|
| friend class GrImageTextureMaker;
|
| friend class SkImage;
|
|
|