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 29 matching lines...) Expand all Loading... |
40 #include "core/css/StylePropertySet.h" | 40 #include "core/css/StylePropertySet.h" |
41 #include "core/css/StyleResolver.h" | 41 #include "core/css/StyleResolver.h" |
42 #include "core/dom/ExceptionCode.h" | 42 #include "core/dom/ExceptionCode.h" |
43 #include "core/dom/ExceptionCodePlaceholder.h" | 43 #include "core/dom/ExceptionCodePlaceholder.h" |
44 #include "core/html/HTMLCanvasElement.h" | 44 #include "core/html/HTMLCanvasElement.h" |
45 #include "core/html/HTMLImageElement.h" | 45 #include "core/html/HTMLImageElement.h" |
46 #include "core/html/HTMLMediaElement.h" | 46 #include "core/html/HTMLMediaElement.h" |
47 #include "core/html/HTMLVideoElement.h" | 47 #include "core/html/HTMLVideoElement.h" |
48 #include "core/html/ImageData.h" | 48 #include "core/html/ImageData.h" |
49 #include "core/html/TextMetrics.h" | 49 #include "core/html/TextMetrics.h" |
| 50 #include "core/html/canvas/Canvas2DContextAttributes.h" |
50 #include "core/html/canvas/CanvasGradient.h" | 51 #include "core/html/canvas/CanvasGradient.h" |
51 #include "core/html/canvas/CanvasPattern.h" | 52 #include "core/html/canvas/CanvasPattern.h" |
52 #include "core/html/canvas/CanvasStyle.h" | 53 #include "core/html/canvas/CanvasStyle.h" |
53 #include "core/html/canvas/DOMPath.h" | 54 #include "core/html/canvas/DOMPath.h" |
54 #include "core/loader/cache/CachedImage.h" | 55 #include "core/loader/cache/CachedImage.h" |
55 #include "core/page/Console.h" | 56 #include "core/page/Console.h" |
56 #include "core/page/Page.h" | 57 #include "core/page/Page.h" |
57 #include "core/page/SecurityOrigin.h" | 58 #include "core/page/SecurityOrigin.h" |
58 #include "core/page/Settings.h" | 59 #include "core/page/Settings.h" |
59 #include "core/platform/FloatConversion.h" | 60 #include "core/platform/FloatConversion.h" |
(...skipping 50 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 2108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2243 if (enabled == state().m_imageSmoothingEnabled) | 2245 if (enabled == state().m_imageSmoothingEnabled) |
2244 return; | 2246 return; |
2245 | 2247 |
2246 realizeSaves(); | 2248 realizeSaves(); |
2247 modifiableState().m_imageSmoothingEnabled = enabled; | 2249 modifiableState().m_imageSmoothingEnabled = enabled; |
2248 GraphicsContext* c = drawingContext(); | 2250 GraphicsContext* c = drawingContext(); |
2249 if (c) | 2251 if (c) |
2250 c->setImageInterpolationQuality(enabled ? DefaultInterpolationQuality :
InterpolationNone); | 2252 c->setImageInterpolationQuality(enabled ? DefaultInterpolationQuality :
InterpolationNone); |
2251 } | 2253 } |
2252 | 2254 |
| 2255 PassRefPtr<Canvas2DContextAttributes> CanvasRenderingContext2D::getContextAttrib
utes() const |
| 2256 { |
| 2257 RefPtr<Canvas2DContextAttributes> attributes = Canvas2DContextAttributes::cr
eate(); |
| 2258 attributes->setAlpha(m_hasAlpha); |
| 2259 return attributes.release(); |
| 2260 } |
| 2261 |
2253 } // namespace WebCore | 2262 } // namespace WebCore |
OLD | NEW |