| 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 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 82 // So if CSS is color corrected from sRGB to display space, then | 82 // So if CSS is color corrected from sRGB to display space, then |
| 83 // canvas must do the same | 83 // canvas must do the same |
| 84 return SkColorSpace::NewNamed(SkColorSpace::kSRGB_Named); | 84 return SkColorSpace::NewNamed(SkColorSpace::kSRGB_Named); |
| 85 } | 85 } |
| 86 return nullptr; | 86 return nullptr; |
| 87 }; | 87 }; |
| 88 CHECK(false); | 88 CHECK(false); |
| 89 return nullptr; | 89 return nullptr; |
| 90 } | 90 } |
| 91 | 91 |
| 92 SkColorType CanvasRenderingContext::colorType() const { |
| 93 switch (m_colorSpace) { |
| 94 case kLinearRGBCanvasColorSpace: |
| 95 return kRGBA_F16_SkColorType; |
| 96 default: |
| 97 return kN32_SkColorType; |
| 98 } |
| 99 } |
| 100 |
| 92 void CanvasRenderingContext::dispose() { | 101 void CanvasRenderingContext::dispose() { |
| 93 // HTMLCanvasElement and CanvasRenderingContext have a circular reference. | 102 // HTMLCanvasElement and CanvasRenderingContext have a circular reference. |
| 94 // When the pair is no longer reachable, their destruction order is non- | 103 // When the pair is no longer reachable, their destruction order is non- |
| 95 // deterministic, so the first of the two to be destroyed needs to notify | 104 // deterministic, so the first of the two to be destroyed needs to notify |
| 96 // the other in order to break the circular reference. This is to avoid | 105 // the other in order to break the circular reference. This is to avoid |
| 97 // an error when CanvasRenderingContext2D::didProcessTask() is invoked | 106 // an error when CanvasRenderingContext2D::didProcessTask() is invoked |
| 98 // after the HTMLCanvasElement is destroyed. | 107 // after the HTMLCanvasElement is destroyed. |
| 99 if (canvas()) { | 108 if (canvas()) { |
| 100 canvas()->detachContext(); | 109 canvas()->detachContext(); |
| 101 m_canvas = nullptr; | 110 m_canvas = nullptr; |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 155 } | 164 } |
| 156 return taintOrigin; | 165 return taintOrigin; |
| 157 } | 166 } |
| 158 | 167 |
| 159 DEFINE_TRACE(CanvasRenderingContext) { | 168 DEFINE_TRACE(CanvasRenderingContext) { |
| 160 visitor->trace(m_canvas); | 169 visitor->trace(m_canvas); |
| 161 visitor->trace(m_offscreenCanvas); | 170 visitor->trace(m_offscreenCanvas); |
| 162 } | 171 } |
| 163 | 172 |
| 164 } // namespace blink | 173 } // namespace blink |
| OLD | NEW |