| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2015 Google Inc. | 2 * Copyright 2015 Google Inc. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
| 5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
| 6 */ | 6 */ |
| 7 | 7 |
| 8 #ifndef SkImageCacherator_DEFINED | 8 #ifndef SkImageCacherator_DEFINED |
| 9 #define SkImageCacherator_DEFINED | 9 #define SkImageCacherator_DEFINED |
| 10 | 10 |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 85 friend class SkImageCacherator; | 85 friend class SkImageCacherator; |
| 86 | 86 |
| 87 std::unique_ptr<SkImageGenerator> fGenerator; | 87 std::unique_ptr<SkImageGenerator> fGenerator; |
| 88 SkMutex fMutex; | 88 SkMutex fMutex; |
| 89 }; | 89 }; |
| 90 class ScopedGenerator; | 90 class ScopedGenerator; |
| 91 | 91 |
| 92 struct Validator { | 92 struct Validator { |
| 93 Validator(sk_sp<SharedGenerator>, const SkIRect* subset); | 93 Validator(sk_sp<SharedGenerator>, const SkIRect* subset); |
| 94 | 94 |
| 95 operator bool() const { return fSharedGenerator.get(); } | 95 operator bool() const { return SkToBool(fSharedGenerator.get()); } |
| 96 | 96 |
| 97 sk_sp<SharedGenerator> fSharedGenerator; | 97 sk_sp<SharedGenerator> fSharedGenerator; |
| 98 SkImageInfo fInfo; | 98 SkImageInfo fInfo; |
| 99 SkIPoint fOrigin; | 99 SkIPoint fOrigin; |
| 100 uint32_t fUniqueID; | 100 uint32_t fUniqueID; |
| 101 }; | 101 }; |
| 102 | 102 |
| 103 SkImageCacherator(Validator*); | 103 SkImageCacherator(Validator*); |
| 104 | 104 |
| 105 bool generateBitmap(SkBitmap*); | 105 bool generateBitmap(SkBitmap*); |
| 106 bool tryLockAsBitmap(SkBitmap*, const SkImage*, SkImage::CachingHint); | 106 bool tryLockAsBitmap(SkBitmap*, const SkImage*, SkImage::CachingHint); |
| 107 #if SK_SUPPORT_GPU | 107 #if SK_SUPPORT_GPU |
| 108 // Returns the texture. If the cacherator is generating the texture and want
s to cache it, | 108 // Returns the texture. If the cacherator is generating the texture and want
s to cache it, |
| 109 // it should use the passed in key (if the key is valid). | 109 // it should use the passed in key (if the key is valid). |
| 110 GrTexture* lockTexture(GrContext*, const GrUniqueKey& key, const SkImage* cl
ient, | 110 GrTexture* lockTexture(GrContext*, const GrUniqueKey& key, const SkImage* cl
ient, |
| 111 SkImage::CachingHint, bool willBeMipped, SkSourceGamm
aTreatment); | 111 SkImage::CachingHint, bool willBeMipped, SkSourceGamm
aTreatment); |
| 112 #endif | 112 #endif |
| 113 | 113 |
| 114 sk_sp<SharedGenerator> fSharedGenerator; | 114 sk_sp<SharedGenerator> fSharedGenerator; |
| 115 const SkImageInfo fInfo; | 115 const SkImageInfo fInfo; |
| 116 const SkIPoint fOrigin; | 116 const SkIPoint fOrigin; |
| 117 const uint32_t fUniqueID; | 117 const uint32_t fUniqueID; |
| 118 | 118 |
| 119 friend class GrImageTextureMaker; | 119 friend class GrImageTextureMaker; |
| 120 friend class SkImage; | 120 friend class SkImage; |
| 121 friend class SkImage_Generator; | 121 friend class SkImage_Generator; |
| 122 }; | 122 }; |
| 123 | 123 |
| 124 #endif | 124 #endif |
| OLD | NEW |