| 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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 44 m_offscreenCanvas(offscreenCanvas), | 44 m_offscreenCanvas(offscreenCanvas), |
| 45 m_colorSpace(kLegacyCanvasColorSpace), | 45 m_colorSpace(kLegacyCanvasColorSpace), |
| 46 m_creationAttributes(attrs) { | 46 m_creationAttributes(attrs) { |
| 47 if (RuntimeEnabledFeatures::experimentalCanvasFeaturesEnabled()) { | 47 if (RuntimeEnabledFeatures::experimentalCanvasFeaturesEnabled()) { |
| 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
requested one | 54 // Make m_creationAttributes reflect the effective colorSpace rather than the |
| 55 // requested one |
| 55 m_creationAttributes.setColorSpace(colorSpaceAsString()); | 56 m_creationAttributes.setColorSpace(colorSpaceAsString()); |
| 56 } | 57 } |
| 57 | 58 |
| 58 WTF::String CanvasRenderingContext::colorSpaceAsString() const { | 59 WTF::String CanvasRenderingContext::colorSpaceAsString() const { |
| 59 switch (m_colorSpace) { | 60 switch (m_colorSpace) { |
| 60 case kSRGBCanvasColorSpace: | 61 case kSRGBCanvasColorSpace: |
| 61 return kSRGBCanvasColorSpaceName; | 62 return kSRGBCanvasColorSpaceName; |
| 62 case kLinearRGBCanvasColorSpace: | 63 case kLinearRGBCanvasColorSpace: |
| 63 return kLinearRGBCanvasColorSpaceName; | 64 return kLinearRGBCanvasColorSpaceName; |
| 64 case kLegacyCanvasColorSpace: | 65 case kLegacyCanvasColorSpace: |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 154 } | 155 } |
| 155 return taintOrigin; | 156 return taintOrigin; |
| 156 } | 157 } |
| 157 | 158 |
| 158 DEFINE_TRACE(CanvasRenderingContext) { | 159 DEFINE_TRACE(CanvasRenderingContext) { |
| 159 visitor->trace(m_canvas); | 160 visitor->trace(m_canvas); |
| 160 visitor->trace(m_offscreenCanvas); | 161 visitor->trace(m_offscreenCanvas); |
| 161 } | 162 } |
| 162 | 163 |
| 163 } // namespace blink | 164 } // namespace blink |
| OLD | NEW |