| 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 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 68 | 68 |
| 69 private: | 69 private: |
| 70 SkImageCacherator(SkImageGenerator*, const SkImageInfo&, const SkIPoint&, ui
nt32_t uniqueID); | 70 SkImageCacherator(SkImageGenerator*, const SkImageInfo&, const SkIPoint&, ui
nt32_t uniqueID); |
| 71 | 71 |
| 72 bool generateBitmap(SkBitmap*); | 72 bool generateBitmap(SkBitmap*); |
| 73 bool tryLockAsBitmap(SkBitmap*, const SkImage*, SkImage::CachingHint); | 73 bool tryLockAsBitmap(SkBitmap*, const SkImage*, SkImage::CachingHint); |
| 74 #if SK_SUPPORT_GPU | 74 #if SK_SUPPORT_GPU |
| 75 // Returns the texture. If the cacherator is generating the texture and want
s to cache it, | 75 // Returns the texture. If the cacherator is generating the texture and want
s to cache it, |
| 76 // it should use the passed in key (if the key is valid). | 76 // it should use the passed in key (if the key is valid). |
| 77 GrTexture* lockTexture(GrContext*, const GrUniqueKey& key, const SkImage* cl
ient, | 77 GrTexture* lockTexture(GrContext*, const GrUniqueKey& key, const SkImage* cl
ient, |
| 78 SkImage::CachingHint); | 78 SkImage::CachingHint, bool willBeMipped); |
| 79 #endif | 79 #endif |
| 80 | 80 |
| 81 class ScopedGenerator { | 81 class ScopedGenerator { |
| 82 SkImageCacherator* fCacher; | 82 SkImageCacherator* fCacher; |
| 83 public: | 83 public: |
| 84 ScopedGenerator(SkImageCacherator* cacher) : fCacher(cacher) { | 84 ScopedGenerator(SkImageCacherator* cacher) : fCacher(cacher) { |
| 85 fCacher->fMutexForGenerator.acquire(); | 85 fCacher->fMutexForGenerator.acquire(); |
| 86 } | 86 } |
| 87 ~ScopedGenerator() { | 87 ~ScopedGenerator() { |
| 88 fCacher->fMutexForGenerator.release(); | 88 fCacher->fMutexForGenerator.release(); |
| 89 } | 89 } |
| 90 SkImageGenerator* operator->() const { return fCacher->fNotThreadSafeGen
erator; } | 90 SkImageGenerator* operator->() const { return fCacher->fNotThreadSafeGen
erator; } |
| 91 operator SkImageGenerator*() const { return fCacher->fNotThreadSafeGener
ator; } | 91 operator SkImageGenerator*() const { return fCacher->fNotThreadSafeGener
ator; } |
| 92 }; | 92 }; |
| 93 | 93 |
| 94 SkMutex fMutexForGenerator; | 94 SkMutex fMutexForGenerator; |
| 95 SkAutoTDelete<SkImageGenerator> fNotThreadSafeGenerator; | 95 SkAutoTDelete<SkImageGenerator> fNotThreadSafeGenerator; |
| 96 | 96 |
| 97 const SkImageInfo fInfo; | 97 const SkImageInfo fInfo; |
| 98 const SkIPoint fOrigin; | 98 const SkIPoint fOrigin; |
| 99 const uint32_t fUniqueID; | 99 const uint32_t fUniqueID; |
| 100 | 100 |
| 101 friend class GrImageTextureMaker; | 101 friend class GrImageTextureMaker; |
| 102 }; | 102 }; |
| 103 | 103 |
| 104 #endif | 104 #endif |
| OLD | NEW |