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

Unified Diff: third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.cpp

Issue 2559013002: Add ColorBehavior to blink::Image draw methods (Closed)
Patch Set: Rebase Created 4 years 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/modules/webgl/WebGLRenderingContextBase.cpp
diff --git a/third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.cpp b/third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.cpp
index e9ed5ab552682b79ae4995856c696a8af07b6515..ce833cad30912d4678da102fce908c5799fc2a28 100644
--- a/third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.cpp
+++ b/third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.cpp
@@ -773,10 +773,13 @@ ImageData* WebGLRenderingContextBase::toImageData(SnapshotReason reason) const {
// TODO: Furnish toImageData in webgl renderingcontext for jpeg and webp
// images. See crbug.com/657531.
ImageData* imageData = nullptr;
+ // TODO(ccameron): WebGL should produce sRGB images.
+ // https://crbug.com/672299
if (this->drawingBuffer()) {
- sk_sp<SkImage> snapshot = this->drawingBuffer()
- ->transferToStaticBitmapImage()
- ->imageForCurrentFrame();
+ sk_sp<SkImage> snapshot =
+ this->drawingBuffer()
+ ->transferToStaticBitmapImage()
+ ->imageForCurrentFrame(ColorBehavior::transformToGlobalTarget());
if (snapshot) {
imageData = ImageData::create(this->getOffscreenCanvas()->size());
SkImageInfo imageInfo = SkImageInfo::Make(
@@ -4527,8 +4530,11 @@ PassRefPtr<Image> WebGLRenderingContextBase::drawImageIntoBuffer(
IntRect srcRect(IntPoint(), image->size());
IntRect destRect(0, 0, size.width(), size.height());
SkPaint paint;
+ // TODO(ccameron): WebGL should produce sRGB images.
+ // https://crbug.com/672299
image->draw(buf->canvas(), paint, destRect, srcRect,
- DoNotRespectImageOrientation, Image::DoNotClampImageToSourceRect);
+ DoNotRespectImageOrientation, Image::DoNotClampImageToSourceRect,
+ ColorBehavior::transformToGlobalTarget());
return buf->newImageSnapshot(PreferNoAcceleration,
SnapshotReasonWebGLDrawImageIntoBuffer);
}
@@ -5292,7 +5298,10 @@ void WebGLRenderingContextBase::texImageHelperImageBitmap(
}
return;
}
- sk_sp<SkImage> skImage = bitmap->bitmapImage()->imageForCurrentFrame();
+ // TODO(ccameron): WebGL should produce sRGB images.
+ // https://crbug.com/672299
+ sk_sp<SkImage> skImage = bitmap->bitmapImage()->imageForCurrentFrame(
+ ColorBehavior::transformToGlobalTarget());
SkPixmap pixmap;
uint8_t* pixelDataPtr = nullptr;
RefPtr<Uint8Array> pixelData;
« no previous file with comments | « third_party/WebKit/Source/modules/shapedetection/ShapeDetector.cpp ('k') | third_party/WebKit/Source/platform/DragImage.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698