| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc.
All rights reserved. | 2 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc.
All rights reserved. |
| 3 * Copyright (C) 2008, 2010 Nokia Corporation and/or its subsidiary(-ies) | 3 * Copyright (C) 2008, 2010 Nokia Corporation and/or its subsidiary(-ies) |
| 4 * Copyright (C) 2007 Alp Toker <alp@atoker.com> | 4 * Copyright (C) 2007 Alp Toker <alp@atoker.com> |
| 5 * Copyright (C) 2008 Eric Seidel <eric@webkit.org> | 5 * Copyright (C) 2008 Eric Seidel <eric@webkit.org> |
| 6 * Copyright (C) 2008 Dirk Schulze <krit@webkit.org> | 6 * Copyright (C) 2008 Dirk Schulze <krit@webkit.org> |
| 7 * Copyright (C) 2010 Torch Mobile (Beijing) Co. Ltd. All rights reserved. | 7 * Copyright (C) 2010 Torch Mobile (Beijing) Co. Ltd. All rights reserved. |
| 8 * Copyright (C) 2012 Intel Corporation. All rights reserved. | 8 * Copyright (C) 2012 Intel Corporation. All rights reserved. |
| 9 * Copyright (C) 2013 Adobe Systems Incorporated. All rights reserved. | 9 * Copyright (C) 2013 Adobe Systems Incorporated. All rights reserved. |
| 10 * | 10 * |
| (...skipping 18 matching lines...) Expand all Loading... |
| 29 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 29 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 30 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 30 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 31 */ | 31 */ |
| 32 | 32 |
| 33 #include "config.h" | 33 #include "config.h" |
| 34 #include "CanvasRenderingContext2D.h" | 34 #include "CanvasRenderingContext2D.h" |
| 35 | 35 |
| 36 #include "CSSFontSelector.h" | 36 #include "CSSFontSelector.h" |
| 37 #include "CSSParser.h" | 37 #include "CSSParser.h" |
| 38 #include "CSSPropertyNames.h" | 38 #include "CSSPropertyNames.h" |
| 39 #include "Canvas2DContextAttributes.h" |
| 39 #include "CanvasGradient.h" | 40 #include "CanvasGradient.h" |
| 40 #include "CanvasPattern.h" | 41 #include "CanvasPattern.h" |
| 41 #include "CanvasStyle.h" | 42 #include "CanvasStyle.h" |
| 42 #include "DOMPath.h" | 43 #include "DOMPath.h" |
| 43 #include "ExceptionCode.h" | 44 #include "ExceptionCode.h" |
| 44 #include "ExceptionCodePlaceholder.h" | 45 #include "ExceptionCodePlaceholder.h" |
| 45 #include "HTMLCanvasElement.h" | 46 #include "HTMLCanvasElement.h" |
| 46 #include "HTMLImageElement.h" | 47 #include "HTMLImageElement.h" |
| 47 #include "HTMLMediaElement.h" | 48 #include "HTMLMediaElement.h" |
| 48 #include "HTMLNames.h" | 49 #include "HTMLNames.h" |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 110 DashArray convertedLineDash(lineDash.size()); | 111 DashArray convertedLineDash(lineDash.size()); |
| 111 for (size_t i = 0; i < lineDash.size(); ++i) | 112 for (size_t i = 0; i < lineDash.size(); ++i) |
| 112 convertedLineDash[i] = static_cast<DashArrayElement>(lineDash[i]); | 113 convertedLineDash[i] = static_cast<DashArrayElement>(lineDash[i]); |
| 113 c->setLineDash(convertedLineDash, m_canvasContext->lineDashOffset()); | 114 c->setLineDash(convertedLineDash, m_canvasContext->lineDashOffset()); |
| 114 } | 115 } |
| 115 | 116 |
| 116 private: | 117 private: |
| 117 CanvasRenderingContext2D* m_canvasContext; | 118 CanvasRenderingContext2D* m_canvasContext; |
| 118 }; | 119 }; |
| 119 | 120 |
| 120 CanvasRenderingContext2D::CanvasRenderingContext2D(HTMLCanvasElement* canvas, bo
ol usesCSSCompatibilityParseMode) | 121 CanvasRenderingContext2D::CanvasRenderingContext2D(HTMLCanvasElement* canvas, co
nst Canvas2DContextAttributes* attrs, bool usesCSSCompatibilityParseMode) |
| 121 : CanvasRenderingContext(canvas) | 122 : CanvasRenderingContext(canvas) |
| 122 , m_stateStack(1) | 123 , m_stateStack(1) |
| 123 , m_unrealizedSaveCount(0) | 124 , m_unrealizedSaveCount(0) |
| 124 , m_usesCSSCompatibilityParseMode(usesCSSCompatibilityParseMode) | 125 , m_usesCSSCompatibilityParseMode(usesCSSCompatibilityParseMode) |
| 126 , m_hasAlpha(!attrs || attrs->alpha()) |
| 125 { | 127 { |
| 126 ScriptWrappable::init(this); | 128 ScriptWrappable::init(this); |
| 127 } | 129 } |
| 128 | 130 |
| 129 void CanvasRenderingContext2D::unwindStateStack() | 131 void CanvasRenderingContext2D::unwindStateStack() |
| 130 { | 132 { |
| 131 // Ensure that the state stack in the ImageBuffer's context | 133 // Ensure that the state stack in the ImageBuffer's context |
| 132 // is cleared before destruction, to avoid assertions in the | 134 // is cleared before destruction, to avoid assertions in the |
| 133 // GraphicsContext dtor. | 135 // GraphicsContext dtor. |
| 134 if (size_t stackSize = m_stateStack.size()) { | 136 if (size_t stackSize = m_stateStack.size()) { |
| (...skipping 2109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2244 if (enabled == state().m_imageSmoothingEnabled) | 2246 if (enabled == state().m_imageSmoothingEnabled) |
| 2245 return; | 2247 return; |
| 2246 | 2248 |
| 2247 realizeSaves(); | 2249 realizeSaves(); |
| 2248 modifiableState().m_imageSmoothingEnabled = enabled; | 2250 modifiableState().m_imageSmoothingEnabled = enabled; |
| 2249 GraphicsContext* c = drawingContext(); | 2251 GraphicsContext* c = drawingContext(); |
| 2250 if (c) | 2252 if (c) |
| 2251 c->setImageInterpolationQuality(enabled ? DefaultInterpolationQuality :
InterpolationNone); | 2253 c->setImageInterpolationQuality(enabled ? DefaultInterpolationQuality :
InterpolationNone); |
| 2252 } | 2254 } |
| 2253 | 2255 |
| 2256 PassRefPtr<Canvas2DContextAttributes> CanvasRenderingContext2D::getContextAttrib
utes() const |
| 2257 { |
| 2258 // We always need to return a new Canvas2DContextAttributes object to |
| 2259 // prevent the user from mutating any cached version. |
| 2260 RefPtr<Canvas2DContextAttributes> attributes = Canvas2DContextAttributes::cr
eate(); |
| 2261 attributes->setAlpha(m_hasAlpha); |
| 2262 return attributes.release(); |
| 2263 } |
| 2264 |
| 2254 } // namespace WebCore | 2265 } // namespace WebCore |
| OLD | NEW |