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

Side by Side Diff: third_party/WebKit/Source/core/html/canvas/CanvasRenderingContext.cpp

Issue 2496913003: Display linear-srgb color managed canvas (Closed)
Patch Set: Setting the layout test to fail on Mac. Created 4 years, 1 month 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2009 Apple Inc. All rights reserved. 2 * Copyright (C) 2009 Apple Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution. 11 * documentation and/or other materials provided with the distribution.
12 * 12 *
13 * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY 13 * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
14 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 14 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 15 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
16 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR 16 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
17 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 17 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
18 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 18 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
19 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 19 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
20 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 20 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
21 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 21 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24 */ 24 */
25 25
26 #include "core/html/canvas/CanvasRenderingContext.h" 26 #include "core/html/canvas/CanvasRenderingContext.h"
27
Justin Novosad 2016/11/17 21:37:06 Please revert this whitespace change
zakerinasab 2016/11/18 14:38:27 Done.
28 #include "core/html/canvas/CanvasContextCreationAttributes.h" 27 #include "core/html/canvas/CanvasContextCreationAttributes.h"
29 #include "core/html/canvas/CanvasImageSource.h" 28 #include "core/html/canvas/CanvasImageSource.h"
30 #include "platform/RuntimeEnabledFeatures.h" 29 #include "platform/RuntimeEnabledFeatures.h"
31 #include "platform/weborigin/SecurityOrigin.h" 30 #include "platform/weborigin/SecurityOrigin.h"
32 31
33 const char* const kLinearRGBCanvasColorSpaceName = "linear-rgb"; 32 const char* const kLinearRGBCanvasColorSpaceName = "linear-rgb";
34 const char* const kSRGBCanvasColorSpaceName = "srgb"; 33 const char* const kSRGBCanvasColorSpaceName = "srgb";
35 const char* const kLegacyCanvasColorSpaceName = "legacy-srgb"; 34 const char* const kLegacyCanvasColorSpaceName = "legacy-srgb";
36 35
37 namespace blink { 36 namespace blink {
38 37
39 CanvasRenderingContext::CanvasRenderingContext( 38 CanvasRenderingContext::CanvasRenderingContext(
40 HTMLCanvasElement* canvas, 39 HTMLCanvasElement* canvas,
41 OffscreenCanvas* offscreenCanvas, 40 OffscreenCanvas* offscreenCanvas,
42 const CanvasContextCreationAttributes& attrs) 41 const CanvasContextCreationAttributes& attrs)
43 : m_canvas(canvas), 42 : m_canvas(canvas),
44 m_offscreenCanvas(offscreenCanvas), 43 m_offscreenCanvas(offscreenCanvas),
45 m_colorSpace(kLegacyCanvasColorSpace), 44 m_colorSpace(kLegacyCanvasColorSpace),
46 m_creationAttributes(attrs) { 45 m_creationAttributes(attrs) {
47 if (RuntimeEnabledFeatures::experimentalCanvasFeaturesEnabled()) { 46 if (RuntimeEnabledFeatures::experimentalCanvasFeaturesEnabled() &&
47 RuntimeEnabledFeatures::colorCorrectRenderingEnabled()) {
48 if (m_creationAttributes.colorSpace() == kSRGBCanvasColorSpaceName) 48 if (m_creationAttributes.colorSpace() == kSRGBCanvasColorSpaceName)
49 m_colorSpace = kSRGBCanvasColorSpace; 49 m_colorSpace = kSRGBCanvasColorSpace;
50 else if (m_creationAttributes.colorSpace() == 50 else if (m_creationAttributes.colorSpace() ==
51 kLinearRGBCanvasColorSpaceName) 51 kLinearRGBCanvasColorSpaceName)
52 m_colorSpace = kLinearRGBCanvasColorSpace; 52 m_colorSpace = kLinearRGBCanvasColorSpace;
53 } 53 }
54 // Make m_creationAttributes reflect the effective colorSpace rather than the 54 // Make m_creationAttributes reflect the effective colorSpace rather than the
55 // requested one 55 // requested one
56 m_creationAttributes.setColorSpace(colorSpaceAsString()); 56 m_creationAttributes.setColorSpace(colorSpaceAsString());
57 } 57 }
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
163 } 163 }
164 return taintOrigin; 164 return taintOrigin;
165 } 165 }
166 166
167 DEFINE_TRACE(CanvasRenderingContext) { 167 DEFINE_TRACE(CanvasRenderingContext) {
168 visitor->trace(m_canvas); 168 visitor->trace(m_canvas);
169 visitor->trace(m_offscreenCanvas); 169 visitor->trace(m_offscreenCanvas);
170 } 170 }
171 171
172 } // namespace blink 172 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698