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

Side by Side Diff: third_party/WebKit/Source/core/frame/ImageBitmap.cpp

Issue 2595833003: Correct the behavior of createImageBitmap's "default" color space conversion (Closed)
Patch Set: Replacing SRGB with display color profile Created 3 years, 12 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 unified diff | Download patch
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/frame/ImageBitmapTest.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "core/frame/ImageBitmap.h" 5 #include "core/frame/ImageBitmap.h"
6 6
7 #include "core/html/HTMLCanvasElement.h" 7 #include "core/html/HTMLCanvasElement.h"
8 #include "core/html/HTMLVideoElement.h" 8 #include "core/html/HTMLVideoElement.h"
9 #include "core/html/ImageData.h" 9 #include "core/html/ImageData.h"
10 #include "core/offscreencanvas/OffscreenCanvas.h" 10 #include "core/offscreencanvas/OffscreenCanvas.h"
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 } else { 66 } else {
67 parsedOptions.premultiplyAlpha = true; 67 parsedOptions.premultiplyAlpha = true;
68 DCHECK(options.premultiplyAlpha() == "default" || 68 DCHECK(options.premultiplyAlpha() == "default" ||
69 options.premultiplyAlpha() == "premultiply"); 69 options.premultiplyAlpha() == "premultiply");
70 } 70 }
71 71
72 if (options.colorSpaceConversion() != "none") { 72 if (options.colorSpaceConversion() != "none") {
73 if (!RuntimeEnabledFeatures::experimentalCanvasFeaturesEnabled() || 73 if (!RuntimeEnabledFeatures::experimentalCanvasFeaturesEnabled() ||
74 !RuntimeEnabledFeatures::colorCorrectRenderingEnabled()) { 74 !RuntimeEnabledFeatures::colorCorrectRenderingEnabled()) {
75 DCHECK_EQ(options.colorSpaceConversion(), "default"); 75 DCHECK_EQ(options.colorSpaceConversion(), "default");
76 // TODO(zakerinasab): Replace sRGB with a call to
77 // ImageDecoder::globalTargetColorSpace() when the crash problem on Mac
78 // is fixed. crbug.com/668546.
79 if (RuntimeEnabledFeatures::colorCorrectRenderingDefaultModeEnabled()) { 76 if (RuntimeEnabledFeatures::colorCorrectRenderingDefaultModeEnabled()) {
80 parsedOptions.dstColorSpace = 77 parsedOptions.dstColorSpace = ColorBehavior::globalTargetColorSpace();
81 SkColorSpace::MakeNamed(SkColorSpace::kSRGB_Named);
82 parsedOptions.dstColorType = SkColorType::kN32_SkColorType; 78 parsedOptions.dstColorType = SkColorType::kN32_SkColorType;
83 } 79 }
84 } else { 80 } else {
85 if (options.colorSpaceConversion() == "default" || 81 if (options.colorSpaceConversion() == "default" ||
86 options.colorSpaceConversion() == "srgb") { 82 options.colorSpaceConversion() == "srgb") {
87 parsedOptions.dstColorSpace = 83 parsedOptions.dstColorSpace =
88 SkColorSpace::MakeNamed(SkColorSpace::kSRGB_Named); 84 SkColorSpace::MakeNamed(SkColorSpace::kSRGB_Named);
89 parsedOptions.dstColorType = SkColorType::kN32_SkColorType; 85 parsedOptions.dstColorType = SkColorType::kN32_SkColorType;
90 } else if (options.colorSpaceConversion() == "linear-rgb") { 86 } else if (options.colorSpaceConversion() == "linear-rgb") {
91 parsedOptions.dstColorSpace = 87 parsedOptions.dstColorSpace =
(...skipping 1007 matching lines...) Expand 10 before | Expand all | Expand 10 after
1099 void ImageBitmap::adjustDrawRects(FloatRect* srcRect, 1095 void ImageBitmap::adjustDrawRects(FloatRect* srcRect,
1100 FloatRect* dstRect) const {} 1096 FloatRect* dstRect) const {}
1101 1097
1102 FloatSize ImageBitmap::elementSize(const FloatSize&) const { 1098 FloatSize ImageBitmap::elementSize(const FloatSize&) const {
1103 return FloatSize(width(), height()); 1099 return FloatSize(width(), height());
1104 } 1100 }
1105 1101
1106 DEFINE_TRACE(ImageBitmap) {} 1102 DEFINE_TRACE(ImageBitmap) {}
1107 1103
1108 } // namespace blink 1104 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/frame/ImageBitmapTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698