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

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

Issue 2797213002: Fix BaseRenderingContext2D create/put/get-ImageData() for color managed canvas (Closed)
Patch Set: Rebaseline 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 | « third_party/WebKit/Source/core/html/ImageData.h ('k') | third_party/WebKit/Source/core/html/ImageData.idl » ('j') | 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 b42e161b4dcd789ac903e81e86824386e446a959..71f62d53ec0f11a90325a9f64cf1f43c52ad19a3 100644
--- a/third_party/WebKit/Source/core/html/ImageData.cpp
+++ b/third_party/WebKit/Source/core/html/ImageData.cpp
@@ -276,11 +276,15 @@ ImageData* ImageData::Create(NotShared<DOMUint8ClampedArray> data,
return new ImageData(IntSize(width, height), data.View());
}
-ImageData* ImageData::createImageData(
+ImageData* ImageData::CreateImageData(
unsigned width,
unsigned height,
const ImageDataColorSettings& color_settings,
ExceptionState& exception_state) {
+ if (!RuntimeEnabledFeatures::experimentalCanvasFeaturesEnabled() ||
+ !RuntimeEnabledFeatures::colorCorrectRenderingEnabled())
+ return nullptr;
+
if (!ImageData::ValidateConstructorArguments(
kParamWidth | kParamHeight, nullptr, width, height, nullptr,
&color_settings, &exception_state))
@@ -297,12 +301,17 @@ ImageData* ImageData::createImageData(
return new ImageData(IntSize(width, height), buffer_view, &color_settings);
}
-ImageData* ImageData::createImageData(ImageDataArray& data,
+ImageData* ImageData::CreateImageData(ImageDataArray& data,
unsigned width,
unsigned height,
ImageDataColorSettings& color_settings,
ExceptionState& exception_state) {
+ if (!RuntimeEnabledFeatures::experimentalCanvasFeaturesEnabled() ||
+ !RuntimeEnabledFeatures::colorCorrectRenderingEnabled())
+ return nullptr;
+
DOMArrayBufferView* buffer_view = nullptr;
+
// When pixels data is provided, we need to override the storage format of
// ImageDataColorSettings with the one that matches the data type of the
// pixels.
@@ -574,6 +583,16 @@ ImageData::ConvertPixelsFromCanvasPixelFormatToImageDataStorageFormat(
return nullptr;
}
+DOMArrayBufferBase* ImageData::BufferBase() const {
+ if (data_)
+ return data_->BufferBase();
+ if (data_u16_)
+ return data_u16_->BufferBase();
+ if (data_f32_)
+ return data_f32_->BufferBase();
+ 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() {
« no previous file with comments | « third_party/WebKit/Source/core/html/ImageData.h ('k') | third_party/WebKit/Source/core/html/ImageData.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698