| 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 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 60 * formats, so others (e.g. PNG) can just return nullptr. | 60 * formats, so others (e.g. PNG) can just return nullptr. |
| 61 */ | 61 */ |
| 62 SkData* refEncoded(GrContext*); | 62 SkData* refEncoded(GrContext*); |
| 63 | 63 |
| 64 // Only return true if the generate has already been cached. | 64 // Only return true if the generate has already been cached. |
| 65 bool lockAsBitmapOnlyIfAlreadyCached(SkBitmap*); | 65 bool lockAsBitmapOnlyIfAlreadyCached(SkBitmap*); |
| 66 // Call the underlying generator directly | 66 // Call the underlying generator directly |
| 67 bool directGeneratePixels(const SkImageInfo& dstInfo, void* dstPixels, size_
t dstRB, | 67 bool directGeneratePixels(const SkImageInfo& dstInfo, void* dstPixels, size_
t dstRB, |
| 68 int srcX, int srcY); | 68 int srcX, int srcY); |
| 69 | 69 |
| 70 #if SK_SUPPORT_GPU |
| 71 /** |
| 72 * Returns true if the generate can efficiently return a texture (given the
properties of the |
| 73 * proxy). By default, simple codecs will usually return false, since they m
ust be decoded |
| 74 * on the CPU and then uploaded to become a texture. |
| 75 */ |
| 76 bool canGenerateTexture(const GrContextThreadSafeProxy& proxy); |
| 77 #endif |
| 78 |
| 70 private: | 79 private: |
| 71 SkImageCacherator(SkImageGenerator*, const SkImageInfo&, const SkIPoint&, ui
nt32_t uniqueID); | 80 SkImageCacherator(SkImageGenerator*, const SkImageInfo&, const SkIPoint&, ui
nt32_t uniqueID); |
| 72 | 81 |
| 73 bool generateBitmap(SkBitmap*); | 82 bool generateBitmap(SkBitmap*); |
| 74 bool tryLockAsBitmap(SkBitmap*, const SkImage*, SkImage::CachingHint); | 83 bool tryLockAsBitmap(SkBitmap*, const SkImage*, SkImage::CachingHint); |
| 75 #if SK_SUPPORT_GPU | 84 #if SK_SUPPORT_GPU |
| 76 // Returns the texture. If the cacherator is generating the texture and want
s to cache it, | 85 // Returns the texture. If the cacherator is generating the texture and want
s to cache it, |
| 77 // it should use the passed in key (if the key is valid). | 86 // it should use the passed in key (if the key is valid). |
| 78 GrTexture* lockTexture(GrContext*, const GrUniqueKey& key, const SkImage* cl
ient, | 87 GrTexture* lockTexture(GrContext*, const GrUniqueKey& key, const SkImage* cl
ient, |
| 79 SkImage::CachingHint, bool willBeMipped, SkSourceGamm
aTreatment); | 88 SkImage::CachingHint, bool willBeMipped, SkSourceGamm
aTreatment); |
| (...skipping 16 matching lines...) Expand all Loading... |
| 96 SkAutoTDelete<SkImageGenerator> fNotThreadSafeGenerator; | 105 SkAutoTDelete<SkImageGenerator> fNotThreadSafeGenerator; |
| 97 | 106 |
| 98 const SkImageInfo fInfo; | 107 const SkImageInfo fInfo; |
| 99 const SkIPoint fOrigin; | 108 const SkIPoint fOrigin; |
| 100 const uint32_t fUniqueID; | 109 const uint32_t fUniqueID; |
| 101 | 110 |
| 102 friend class GrImageTextureMaker; | 111 friend class GrImageTextureMaker; |
| 103 }; | 112 }; |
| 104 | 113 |
| 105 #endif | 114 #endif |
| OLD | NEW |