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 1075 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1086 } else { | 1086 } else { |
1087 c->fillRect(rect); | 1087 c->fillRect(rect); |
1088 didDraw(rect); | 1088 didDraw(rect); |
1089 } | 1089 } |
1090 } | 1090 } |
1091 | 1091 |
1092 void CanvasRenderingContext2D::strokeRect(float x, float y, float width, float h
eight) | 1092 void CanvasRenderingContext2D::strokeRect(float x, float y, float width, float h
eight) |
1093 { | 1093 { |
1094 if (!validateRectForCanvas(x, y, width, height)) | 1094 if (!validateRectForCanvas(x, y, width, height)) |
1095 return; | 1095 return; |
1096 strokeRect(x, y, width, height, state().m_lineWidth); | |
1097 } | |
1098 | |
1099 void CanvasRenderingContext2D::strokeRect(float x, float y, float width, float h
eight, float lineWidth) | |
1100 { | |
1101 if (!validateRectForCanvas(x, y, width, height)) | |
1102 return; | |
1103 | 1096 |
1104 if (!(lineWidth >= 0)) | 1097 if (!(state().m_lineWidth >= 0)) |
1105 return; | 1098 return; |
1106 | 1099 |
1107 GraphicsContext* c = drawingContext(); | 1100 GraphicsContext* c = drawingContext(); |
1108 if (!c) | 1101 if (!c) |
1109 return; | 1102 return; |
1110 if (!state().m_invertibleCTM) | 1103 if (!state().m_invertibleCTM) |
1111 return; | 1104 return; |
1112 | 1105 |
1113 // If gradient size is zero, then paint nothing. | 1106 // If gradient size is zero, then paint nothing. |
1114 Gradient* gradient = c->strokeGradient(); | 1107 Gradient* gradient = c->strokeGradient(); |
1115 if (gradient && gradient->isZeroSize()) | 1108 if (gradient && gradient->isZeroSize()) |
1116 return; | 1109 return; |
1117 | 1110 |
1118 FloatRect rect(x, y, width, height); | 1111 FloatRect rect(x, y, width, height); |
1119 | 1112 |
1120 FloatRect boundingRect = rect; | 1113 FloatRect boundingRect = rect; |
1121 boundingRect.inflate(lineWidth / 2); | 1114 boundingRect.inflate(state().m_lineWidth / 2); |
1122 | 1115 |
1123 c->strokeRect(rect, lineWidth); | 1116 c->strokeRect(rect, state().m_lineWidth); |
1124 didDraw(boundingRect); | 1117 didDraw(boundingRect); |
1125 } | 1118 } |
1126 | 1119 |
1127 void CanvasRenderingContext2D::setShadow(float width, float height, float blur) | 1120 void CanvasRenderingContext2D::setShadow(float width, float height, float blur) |
1128 { | 1121 { |
1129 setShadow(FloatSize(width, height), blur, Color::transparent); | 1122 setShadow(FloatSize(width, height), blur, Color::transparent); |
1130 } | 1123 } |
1131 | 1124 |
1132 void CanvasRenderingContext2D::setShadow(float width, float height, float blur,
const String& color) | 1125 void CanvasRenderingContext2D::setShadow(float width, float height, float blur,
const String& color) |
1133 { | 1126 { |
(...skipping 1122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2256 } | 2249 } |
2257 | 2250 |
2258 PassRefPtr<Canvas2DContextAttributes> CanvasRenderingContext2D::getContextAttrib
utes() const | 2251 PassRefPtr<Canvas2DContextAttributes> CanvasRenderingContext2D::getContextAttrib
utes() const |
2259 { | 2252 { |
2260 RefPtr<Canvas2DContextAttributes> attributes = Canvas2DContextAttributes::cr
eate(); | 2253 RefPtr<Canvas2DContextAttributes> attributes = Canvas2DContextAttributes::cr
eate(); |
2261 attributes->setAlpha(m_hasAlpha); | 2254 attributes->setAlpha(m_hasAlpha); |
2262 return attributes.release(); | 2255 return attributes.release(); |
2263 } | 2256 } |
2264 | 2257 |
2265 } // namespace WebCore | 2258 } // namespace WebCore |
OLD | NEW |