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

Unified Diff: third_party/WebKit/Source/core/frame/ImageBitmap.cpp

Issue 2825183002: Plumb CanvasColorParams to canvas image classes (Closed)
Patch Set: Require both runtime flags 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
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/html/HTMLCanvasElement.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/frame/ImageBitmap.cpp
diff --git a/third_party/WebKit/Source/core/frame/ImageBitmap.cpp b/third_party/WebKit/Source/core/frame/ImageBitmap.cpp
index 74e0cefdb8c8c8bfb85ccbcd086c6a89733e8317..070d70a0d666f602d61135db789b31339bae0f06 100644
--- a/third_party/WebKit/Source/core/frame/ImageBitmap.cpp
+++ b/third_party/WebKit/Source/core/frame/ImageBitmap.cpp
@@ -896,9 +896,24 @@ ImageBitmap::ImageBitmap(ImageData* data,
return;
}
+ CanvasColorParams canvas_color_params;
+ if (RuntimeEnabledFeatures::experimentalCanvasFeaturesEnabled() &&
+ RuntimeEnabledFeatures::colorCorrectRenderingEnabled()) {
+ ImageDataColorSettings color_settings;
+ data->getColorSettings(color_settings);
+ CanvasColorSpace canvas_color_space =
+ ImageData::GetCanvasColorSpace(color_settings.colorSpace());
+ CanvasPixelFormat canvas_pixel_format = kRGBA8CanvasPixelFormat;
+ if (ImageData::GetImageDataStorageFormat(color_settings.storageFormat()) !=
+ kUint8ClampedArrayStorageFormat) {
+ canvas_pixel_format = kF16CanvasPixelFormat;
+ }
+ canvas_color_params =
+ CanvasColorParams(canvas_color_space, canvas_pixel_format);
+ }
std::unique_ptr<ImageBuffer> buffer =
ImageBuffer::Create(parsed_options.crop_rect.Size(), kNonOpaque,
- kDoNotInitializeImagePixels, data->GetSkColorSpace());
+ kDoNotInitializeImagePixels, canvas_color_params);
if (!buffer)
return;
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/html/HTMLCanvasElement.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698