Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(42)

Unified Diff: third_party/WebKit/Source/platform/graphics/ImageDecodingStore.h

Issue 2787053004: Respect colorSpace in DecodingImageGenerator::onGetPixels() (Closed)
Patch Set: AlphaOption Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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 04ee218b7d00bf1695dca826e010a9ea0954aef0..ff2efd2b62b32a9dcb8d30af7d669833e5d48d9b 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& scaled_size,
+ 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. ImageDecoder::AlphaOption
+ typedef std::tuple<const ImageFrameGenerator*, SkISize, uint8_t>
+ DecoderCacheKey;
Nico 2017/04/11 15:41:05 Do you have an idea how much this will increase th
msarett1 2017/04/11 20:52:05 I imagine it's very small. I'm just adding a 8 by
// Base class for all cache entries.
class CacheEntry : public DoublyLinkedListNode<CacheEntry> {
@@ -145,35 +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),
- cached_decoder_(std::move(decoder)),
- size_(SkISize::Make(cached_decoder_->DecodedSize().Width(),
- cached_decoder_->DecodedSize().Height())) {}
-
size_t MemoryUsageInBytes() const override {
return size_.width() * size_.height() * 4;
}
CacheType GetType() const override { return kTypeDecoder; }
- static DecoderCacheKey MakeCacheKey(const ImageFrameGenerator* generator,
- const SkISize& size) {
- return std::make_pair(generator, size);
+ static DecoderCacheKey MakeCacheKey(
+ const ImageFrameGenerator* generator,
+ const SkISize& size,
+ ImageDecoder::AlphaOption alpha_option) {
+ return std::make_tuple(generator, size,
+ static_cast<uint8_t>(alpha_option));
}
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->GetAlphaOption());
+ }
+ DecoderCacheKey CacheKey() const {
+ return MakeCacheKey(generator_, size_, alpha_option_);
}
- DecoderCacheKey CacheKey() const { return MakeCacheKey(generator_, size_); }
ImageDecoder* CachedDecoder() const { return cached_decoder_.get(); }
private:
+ DecoderCacheEntry(const ImageFrameGenerator* generator,
+ int count,
+ std::unique_ptr<ImageDecoder> decoder)
+ : CacheEntry(generator, count),
+ cached_decoder_(std::move(decoder)),
+ size_(SkISize::Make(cached_decoder_->DecodedSize().Width(),
+ cached_decoder_->DecodedSize().Height())),
+ alpha_option_(cached_decoder_->GetAlphaOption()) {}
+
std::unique_ptr<ImageDecoder> cached_decoder_;
SkISize size_;
+ ImageDecoder::AlphaOption alpha_option_;
};
ImageDecodingStore();

Powered by Google App Engine
This is Rietveld 408576698