OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "modules/canvas2d/BaseRenderingContext2D.h" | 5 #include "modules/canvas2d/BaseRenderingContext2D.h" |
6 | 6 |
7 #include "bindings/core/v8/ExceptionMessages.h" | 7 #include "bindings/core/v8/ExceptionMessages.h" |
8 #include "bindings/core/v8/ExceptionState.h" | 8 #include "bindings/core/v8/ExceptionState.h" |
9 #include "bindings/core/v8/ExceptionStatePlaceholder.h" | 9 #include "bindings/core/v8/ExceptionStatePlaceholder.h" |
10 #include "core/css/parser/CSSParser.h" | 10 #include "core/css/parser/CSSParser.h" |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
87 m_path.transform(state().transform().inverse()); | 87 m_path.transform(state().transform().inverse()); |
88 SkCanvas* c = drawingCanvas(); | 88 SkCanvas* c = drawingCanvas(); |
89 if (c) | 89 if (c) |
90 c->restore(); | 90 c->restore(); |
91 | 91 |
92 validateStateStack(); | 92 validateStateStack(); |
93 } | 93 } |
94 | 94 |
95 static inline void convertCanvasStyleToUnionType(CanvasStyle* style, StringOrCan
vasGradientOrCanvasPattern& returnValue) | 95 static inline void convertCanvasStyleToUnionType(CanvasStyle* style, StringOrCan
vasGradientOrCanvasPattern& returnValue) |
96 { | 96 { |
97 if (CanvasGradient* gradient = style->canvasGradient()) { | 97 if (CanvasGradient* gradient = style->getCanvasGradient()) { |
98 returnValue.setCanvasGradient(gradient); | 98 returnValue.setCanvasGradient(gradient); |
99 return; | 99 return; |
100 } | 100 } |
101 if (CanvasPattern* pattern = style->canvasPattern()) { | 101 if (CanvasPattern* pattern = style->getCanvasPattern()) { |
102 returnValue.setCanvasPattern(pattern); | 102 returnValue.setCanvasPattern(pattern); |
103 return; | 103 return; |
104 } | 104 } |
105 returnValue.setString(style->color()); | 105 returnValue.setString(style->color()); |
106 } | 106 } |
107 | 107 |
108 void BaseRenderingContext2D::strokeStyle(StringOrCanvasGradientOrCanvasPattern&
returnValue) const | 108 void BaseRenderingContext2D::strokeStyle(StringOrCanvasGradientOrCanvasPattern&
returnValue) const |
109 { | 109 { |
110 convertCanvasStyleToUnionType(state().strokeStyle(), returnValue); | 110 convertCanvasStyleToUnionType(state().strokeStyle(), returnValue); |
111 } | 111 } |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
169 return; | 169 return; |
170 } | 170 } |
171 canvasStyle = CanvasStyle::createFromRGBA(parsedColor.rgb()); | 171 canvasStyle = CanvasStyle::createFromRGBA(parsedColor.rgb()); |
172 } else if (style.isCanvasGradient()) { | 172 } else if (style.isCanvasGradient()) { |
173 canvasStyle = CanvasStyle::createFromGradient(style.getAsCanvasGradient(
)); | 173 canvasStyle = CanvasStyle::createFromGradient(style.getAsCanvasGradient(
)); |
174 } else if (style.isCanvasPattern()) { | 174 } else if (style.isCanvasPattern()) { |
175 CanvasPattern* canvasPattern = style.getAsCanvasPattern(); | 175 CanvasPattern* canvasPattern = style.getAsCanvasPattern(); |
176 | 176 |
177 if (originClean() && !canvasPattern->originClean()) | 177 if (originClean() && !canvasPattern->originClean()) |
178 setOriginTainted(); | 178 setOriginTainted(); |
179 if (canvasPattern->pattern()->isTextureBacked()) | 179 if (canvasPattern->getPattern()->isTextureBacked()) |
180 disableDeferral(DisableDeferralReasonUsingTextureBackedPattern); | 180 disableDeferral(DisableDeferralReasonUsingTextureBackedPattern); |
181 canvasStyle = CanvasStyle::createFromPattern(canvasPattern); | 181 canvasStyle = CanvasStyle::createFromPattern(canvasPattern); |
182 } | 182 } |
183 | 183 |
184 ASSERT(canvasStyle); | 184 ASSERT(canvasStyle); |
185 modifiableState().setFillStyle(canvasStyle); | 185 modifiableState().setFillStyle(canvasStyle); |
186 modifiableState().setUnparsedFillColor(colorString); | 186 modifiableState().setUnparsedFillColor(colorString); |
187 modifiableState().clearResolvedFilter(); | 187 modifiableState().clearResolvedFilter(); |
188 } | 188 } |
189 | 189 |
(...skipping 1184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1374 | 1374 |
1375 imageBuffer()->willOverwriteCanvas(); | 1375 imageBuffer()->willOverwriteCanvas(); |
1376 } | 1376 } |
1377 | 1377 |
1378 DEFINE_TRACE(BaseRenderingContext2D) | 1378 DEFINE_TRACE(BaseRenderingContext2D) |
1379 { | 1379 { |
1380 visitor->trace(m_stateStack); | 1380 visitor->trace(m_stateStack); |
1381 } | 1381 } |
1382 | 1382 |
1383 } // namespace blink | 1383 } // namespace blink |
OLD | NEW |