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

Unified Diff: third_party/WebKit/Source/core/html/ImageData.cpp

Issue 2845193002: Refactor ImageBitmap constructor from ImageData to be color managed
Patch Set: local commit - all working except unpremultiply 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/core/html/ImageData.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/core/html/ImageData.cpp
diff --git a/third_party/WebKit/Source/core/html/ImageData.cpp b/third_party/WebKit/Source/core/html/ImageData.cpp
index 8a6f1b356e7beb70ec1b7102ec35f8310870b40c..fca2be31063d15ef893adaab27cee3e6ade6e38b 100644
--- a/third_party/WebKit/Source/core/html/ImageData.cpp
+++ b/third_party/WebKit/Source/core/html/ImageData.cpp
@@ -633,13 +633,17 @@ DOMArrayBufferBase* ImageData::BufferBase() const {
return nullptr;
}
-// For ImageData, the color space is only specified by color settings.
-// It cannot have a SkColorSpace. This doesn't mean anything. Fix this.
-sk_sp<SkColorSpace> ImageData::GetSkColorSpace() {
- if (!RuntimeEnabledFeatures::colorCanvasExtensionsEnabled())
- return nullptr;
+CanvasColorParams ImageData::GetCanvasColorParams() {
+ if (!RuntimeEnabledFeatures::experimentalCanvasFeaturesEnabled() ||
+ !RuntimeEnabledFeatures::colorCorrectRenderingEnabled())
+ return CanvasColorParams();
- return SkColorSpace::MakeSRGB();
+ CanvasColorSpace color_space =
+ ImageData::GetCanvasColorSpace(color_settings_.colorSpace());
+ CanvasPixelFormat pixel_format = kRGBA8CanvasPixelFormat;
+ if (color_settings_.storageFormat() != kUint8ClampedArrayStorageFormatName)
+ pixel_format = kF16CanvasPixelFormat;
+ return CanvasColorParams(color_space, pixel_format);
}
bool ImageData::ImageDataInCanvasColorSettings(
@@ -730,6 +734,14 @@ bool ImageData::ImageDataInCanvasColorSettings(
return true;
}
+bool ImageData::ImageDataInCanvasColorSettings(
+ const CanvasColorParams& canvas_color_params,
+ std::unique_ptr<uint8_t[]>& converted_pixels) {
+ return ImageDataInCanvasColorSettings(canvas_color_params.color_space(),
+ canvas_color_params.pixel_format(),
+ converted_pixels);
+}
+
void ImageData::Trace(Visitor* visitor) {
visitor->Trace(data_);
visitor->Trace(data_u16_);
« no previous file with comments | « third_party/WebKit/Source/core/html/ImageData.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698