OLD | NEW |
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 |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
65 CHECK(false); | 65 CHECK(false); |
66 return ""; | 66 return ""; |
67 } | 67 } |
68 | 68 |
69 sk_sp<SkColorSpace> CanvasRenderingContext::skColorSpace() const | 69 sk_sp<SkColorSpace> CanvasRenderingContext::skColorSpace() const |
70 { | 70 { |
71 switch (m_colorSpace) { | 71 switch (m_colorSpace) { |
72 case kSRGBCanvasColorSpace: | 72 case kSRGBCanvasColorSpace: |
73 return SkColorSpace::NewNamed(SkColorSpace::kSRGB_Named); | 73 return SkColorSpace::NewNamed(SkColorSpace::kSRGB_Named); |
74 case kLinearRGBCanvasColorSpace: | 74 case kLinearRGBCanvasColorSpace: |
75 { | 75 return SkColorSpace::NewNamed(SkColorSpace::kSRGB_Named)->makeLinearGamm
a(); |
76 // Creating a temp srgb colorspace just to get the matrix. | |
77 // There should be a better way | |
78 sk_sp<SkColorSpace> tmp = SkColorSpace::NewNamed(SkColorSpace::kSRGB
_Named); | |
79 return SkColorSpace::NewRGB(SkColorSpace::kLinear_GammaNamed, tmp->x
yz()); | |
80 } | |
81 case kLegacyCanvasColorSpace: | 76 case kLegacyCanvasColorSpace: |
82 if (RuntimeEnabledFeatures::colorCorrectRenderingEnabled()) { | 77 if (RuntimeEnabledFeatures::colorCorrectRenderingEnabled()) { |
83 // Legacy colorspace ensures color matching with CSS is preserved. | 78 // Legacy colorspace ensures color matching with CSS is preserved. |
84 // So if CSS is color corrected from sRGB to display space, then | 79 // So if CSS is color corrected from sRGB to display space, then |
85 // canvas must do the same | 80 // canvas must do the same |
86 return SkColorSpace::NewNamed(SkColorSpace::kSRGB_Named); | 81 return SkColorSpace::NewNamed(SkColorSpace::kSRGB_Named); |
87 } | 82 } |
88 return nullptr; | 83 return nullptr; |
89 }; | 84 }; |
90 CHECK(false); | 85 CHECK(false); |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
152 return taintOrigin; | 147 return taintOrigin; |
153 } | 148 } |
154 | 149 |
155 DEFINE_TRACE(CanvasRenderingContext) | 150 DEFINE_TRACE(CanvasRenderingContext) |
156 { | 151 { |
157 visitor->trace(m_canvas); | 152 visitor->trace(m_canvas); |
158 visitor->trace(m_offscreenCanvas); | 153 visitor->trace(m_offscreenCanvas); |
159 } | 154 } |
160 | 155 |
161 } // namespace blink | 156 } // namespace blink |
OLD | NEW |