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

Unified Diff: third_party/WebKit/Source/platform/graphics/ImageSource.cpp

Issue 2925623003: color: Remove unneeded ColorBehavior parameters from ImageSource (Closed)
Patch Set: Created 3 years, 6 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
« no previous file with comments | « third_party/WebKit/Source/platform/graphics/ImageSource.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/platform/graphics/ImageSource.cpp
diff --git a/third_party/WebKit/Source/platform/graphics/ImageSource.cpp b/third_party/WebKit/Source/platform/graphics/ImageSource.cpp
index ccac03fb0562d51ee5719e936f8a29646d1135b0..fa265c7d2d6c0dd988c753ea9d95d45353f6ab27 100644
--- a/third_party/WebKit/Source/platform/graphics/ImageSource.cpp
+++ b/third_party/WebKit/Source/platform/graphics/ImageSource.cpp
@@ -27,14 +27,14 @@
#include "platform/graphics/ImageSource.h"
+#include "platform/RuntimeEnabledFeatures.h"
#include "platform/graphics/DeferredImageDecoder.h"
#include "platform/image-decoders/ImageDecoder.h"
#include "third_party/skia/include/core/SkImage.h"
namespace blink {
-ImageSource::ImageSource()
- : decoder_color_behavior_(ColorBehavior::TransformToGlobalTarget()) {}
+ImageSource::ImageSource() {}
ImageSource::~ImageSource() {}
@@ -56,9 +56,13 @@ bool ImageSource::SetData(RefPtr<SharedBuffer> data, bool all_data_received) {
return true;
}
+ ColorBehavior color_behavior =
+ RuntimeEnabledFeatures::colorCorrectRenderingEnabled()
+ ? ColorBehavior::Tag()
+ : ColorBehavior::TransformToGlobalTarget();
decoder_ = DeferredImageDecoder::Create(data, all_data_received,
ImageDecoder::kAlphaPremultiplied,
- decoder_color_behavior_);
+ color_behavior);
// Insufficient data is not a failure.
return decoder_ || !ImageDecoder::HasSufficientDataToSniffImageType(*data);
@@ -107,22 +111,10 @@ size_t ImageSource::FrameCount() const {
return decoder_ ? decoder_->FrameCount() : 0;
}
-sk_sp<SkImage> ImageSource::CreateFrameAtIndex(
- size_t index,
- const ColorBehavior& color_behavior) {
+sk_sp<SkImage> ImageSource::CreateFrameAtIndex(size_t index) {
if (!decoder_)
return nullptr;
- if (color_behavior != decoder_color_behavior_) {
- decoder_ = DeferredImageDecoder::Create(Data(), all_data_received_,
- ImageDecoder::kAlphaPremultiplied,
- color_behavior);
- decoder_color_behavior_ = color_behavior;
- // The data has already been validated, so changing the color behavior
- // should always result in a valid decoder.
- DCHECK(decoder_);
- }
-
return decoder_->CreateFrameAtIndex(index);
}
« no previous file with comments | « third_party/WebKit/Source/platform/graphics/ImageSource.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698