Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright 2012 Google Inc. | 2 * Copyright 2012 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 SkImage_Base_DEFINED | 8 #ifndef SkImage_Base_DEFINED |
| 9 #define SkImage_Base_DEFINED | 9 #define SkImage_Base_DEFINED |
| 10 | 10 |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 60 virtual bool onAsLegacyBitmap(SkBitmap*, LegacyBitmapMode) const; | 60 virtual bool onAsLegacyBitmap(SkBitmap*, LegacyBitmapMode) const; |
| 61 | 61 |
| 62 virtual bool onIsLazyGenerated() const { return false; } | 62 virtual bool onIsLazyGenerated() const { return false; } |
| 63 | 63 |
| 64 // Return a bitmap suitable for passing to image-filters | 64 // Return a bitmap suitable for passing to image-filters |
| 65 // For now, that means wrapping textures into SkGrPixelRefs... | 65 // For now, that means wrapping textures into SkGrPixelRefs... |
| 66 virtual bool asBitmapForImageFilters(SkBitmap* bitmap) const { | 66 virtual bool asBitmapForImageFilters(SkBitmap* bitmap) const { |
| 67 return this->getROPixels(bitmap, kAllow_CachingHint); | 67 return this->getROPixels(bitmap, kAllow_CachingHint); |
| 68 } | 68 } |
| 69 | 69 |
| 70 virtual bool canBeImageFiltered() const { | |
|
robertphillips
2016/07/18 17:01:58
Make this live ?
reed1
2016/07/18 22:06:07
Done.
| |
| 71 // bitmap.info().colorType() == kN32_SkColorType && !bitmap.info().gamma CloseToSRGB() | |
| 72 return true; | |
| 73 } | |
| 74 | |
| 70 // Call when this image is part of the key to a resourcecache entry. This al lows the cache | 75 // Call when this image is part of the key to a resourcecache entry. This al lows the cache |
| 71 // to know automatically those entries can be purged when this SkImage delet ed. | 76 // to know automatically those entries can be purged when this SkImage delet ed. |
| 72 void notifyAddedToCache() const { | 77 void notifyAddedToCache() const { |
| 73 fAddedToCache.store(true); | 78 fAddedToCache.store(true); |
| 74 } | 79 } |
| 75 | 80 |
| 76 private: | 81 private: |
| 77 // Set true by caches when they cache content that's derived from the curren t pixels. | 82 // Set true by caches when they cache content that's derived from the curren t pixels. |
| 78 mutable SkAtomic<bool> fAddedToCache; | 83 mutable SkAtomic<bool> fAddedToCache; |
| 79 | 84 |
| 80 typedef SkImage INHERITED; | 85 typedef SkImage INHERITED; |
| 81 }; | 86 }; |
| 82 | 87 |
| 83 static inline SkImage_Base* as_IB(SkImage* image) { | 88 static inline SkImage_Base* as_IB(SkImage* image) { |
| 84 return static_cast<SkImage_Base*>(image); | 89 return static_cast<SkImage_Base*>(image); |
| 85 } | 90 } |
| 86 | 91 |
| 87 static inline SkImage_Base* as_IB(const sk_sp<SkImage>& image) { | 92 static inline SkImage_Base* as_IB(const sk_sp<SkImage>& image) { |
| 88 return static_cast<SkImage_Base*>(image.get()); | 93 return static_cast<SkImage_Base*>(image.get()); |
| 89 } | 94 } |
| 90 | 95 |
| 91 static inline const SkImage_Base* as_IB(const SkImage* image) { | 96 static inline const SkImage_Base* as_IB(const SkImage* image) { |
| 92 return static_cast<const SkImage_Base*>(image); | 97 return static_cast<const SkImage_Base*>(image); |
| 93 } | 98 } |
| 94 | 99 |
| 95 #endif | 100 #endif |
| OLD | NEW |