Index: third_party/WebKit/Source/platform/graphics/ImageDecodingStore.h |
diff --git a/third_party/WebKit/Source/platform/graphics/ImageDecodingStore.h b/third_party/WebKit/Source/platform/graphics/ImageDecodingStore.h |
index fadf40f878dda3658e4242618a976ea09cee49c5..7a9686b8bbdd40c680d0af6c15b980e3bf2ae4e7 100644 |
--- a/third_party/WebKit/Source/platform/graphics/ImageDecodingStore.h |
+++ b/third_party/WebKit/Source/platform/graphics/ImageDecodingStore.h |
@@ -78,6 +78,7 @@ class PLATFORM_EXPORT ImageDecodingStore final { |
// found. |
bool lockDecoder(const ImageFrameGenerator*, |
const SkISize& scaledSize, |
+ ImageDecoder::AlphaOption, |
ImageDecoder**); |
void unlockDecoder(const ImageFrameGenerator*, const ImageDecoder*); |
void insertDecoder(const ImageFrameGenerator*, std::unique_ptr<ImageDecoder>); |
@@ -96,7 +97,9 @@ class PLATFORM_EXPORT ImageDecodingStore final { |
// Decoder cache entry is identified by: |
// 1. Pointer to ImageFrameGenerator. |
// 2. Size of the image. |
- typedef std::pair<const ImageFrameGenerator*, SkISize> DecoderCacheKey; |
+ // 3. Decoder alpha option |
scroggo_chromium
2017/04/10 17:31:24
nit: Maybe be explicit that this is AlphaOption?
msarett1
2017/04/10 21:34:26
Done.
|
+ typedef std::pair<const ImageFrameGenerator*, std::pair<SkISize, uint8_t>> |
+ DecoderCacheKey; |
// Base class for all cache entries. |
class CacheEntry : public DoublyLinkedListNode<CacheEntry> { |
@@ -145,37 +148,43 @@ class PLATFORM_EXPORT ImageDecodingStore final { |
new DecoderCacheEntry(generator, 0, std::move(decoder))); |
} |
- DecoderCacheEntry(const ImageFrameGenerator* generator, |
- int count, |
- std::unique_ptr<ImageDecoder> decoder) |
- : CacheEntry(generator, count), |
- m_cachedDecoder(std::move(decoder)), |
- m_size(SkISize::Make(m_cachedDecoder->decodedSize().width(), |
- m_cachedDecoder->decodedSize().height())) {} |
- |
size_t memoryUsageInBytes() const override { |
return m_size.width() * m_size.height() * 4; |
} |
CacheType type() const override { return TypeDecoder; } |
static DecoderCacheKey makeCacheKey(const ImageFrameGenerator* generator, |
- const SkISize& size) { |
- return std::make_pair(generator, size); |
+ const SkISize& size, |
+ ImageDecoder::AlphaOption alphaOption) { |
+ return std::make_pair(generator, |
+ std::make_pair(size, (uint8_t)alphaOption)); |
scroggo_chromium
2017/04/10 17:31:24
nit: C++ style cast
msarett1
2017/04/10 21:34:26
Done.
|
} |
static DecoderCacheKey makeCacheKey(const ImageFrameGenerator* generator, |
const ImageDecoder* decoder) { |
- return std::make_pair(generator, |
- SkISize::Make(decoder->decodedSize().width(), |
- decoder->decodedSize().height())); |
+ return makeCacheKey(generator, |
+ SkISize::Make(decoder->decodedSize().width(), |
+ decoder->decodedSize().height()), |
+ decoder->alphaOption()); |
} |
DecoderCacheKey cacheKey() const { |
- return makeCacheKey(m_generator, m_size); |
+ return makeCacheKey(m_generator, m_size, m_alphaOption); |
} |
ImageDecoder* cachedDecoder() const { return m_cachedDecoder.get(); } |
private: |
+ DecoderCacheEntry(const ImageFrameGenerator* generator, |
+ int count, |
+ std::unique_ptr<ImageDecoder> decoder) |
+ : CacheEntry(generator, count), |
+ m_cachedDecoder(std::move(decoder)), |
+ m_size(SkISize::Make(m_cachedDecoder->decodedSize().width(), |
+ m_cachedDecoder->decodedSize().height())) { |
+ m_alphaOption = m_cachedDecoder->alphaOption(); |
scroggo_chromium
2017/04/10 17:31:24
nit: This could go in the initializer list.
(See
msarett1
2017/04/10 21:34:26
Yes of course, you're right. Thanks.
|
+ } |
+ |
std::unique_ptr<ImageDecoder> m_cachedDecoder; |
SkISize m_size; |
+ ImageDecoder::AlphaOption m_alphaOption; |
}; |
ImageDecodingStore(); |