OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "ui/gfx/paint_vector_icon.h" | 5 #include "ui/gfx/paint_vector_icon.h" |
6 | 6 |
7 #include <map> | 7 #include <map> |
8 #include <tuple> | 8 #include <tuple> |
9 | 9 |
10 #include "base/i18n/rtl.h" | 10 #include "base/i18n/rtl.h" |
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
141 } | 141 } |
142 | 142 |
143 case MOVE_TO: { | 143 case MOVE_TO: { |
144 SkScalar x = path_elements[++i].arg; | 144 SkScalar x = path_elements[++i].arg; |
145 SkScalar y = path_elements[++i].arg; | 145 SkScalar y = path_elements[++i].arg; |
146 path.moveTo(x, y); | 146 path.moveTo(x, y); |
147 break; | 147 break; |
148 } | 148 } |
149 | 149 |
150 case R_MOVE_TO: { | 150 case R_MOVE_TO: { |
| 151 if (previous_command_type == CLOSE) { |
| 152 // This triggers injectMoveToIfNeeded() so that the next subpath will |
| 153 // start at the correct place. See |
| 154 // [ https://www.w3.org/TR/SVG/paths.html#PathDataClosePathCommand ]. |
| 155 path.rLineTo(0, 0); |
| 156 } |
| 157 |
151 SkScalar x = path_elements[++i].arg; | 158 SkScalar x = path_elements[++i].arg; |
152 SkScalar y = path_elements[++i].arg; | 159 SkScalar y = path_elements[++i].arg; |
153 path.rMoveTo(x, y); | 160 path.rMoveTo(x, y); |
154 break; | 161 break; |
155 } | 162 } |
156 | 163 |
157 case ARC_TO: | 164 case ARC_TO: |
158 case R_ARC_TO: { | 165 case R_ARC_TO: { |
159 SkScalar rx = path_elements[++i].arg; | 166 SkScalar rx = path_elements[++i].arg; |
160 SkScalar ry = path_elements[++i].arg; | 167 SkScalar ry = path_elements[++i].arg; |
(...skipping 434 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
595 } | 602 } |
596 | 603 |
597 ImageSkia CreateVectorIconFromSource(const std::string& source, | 604 ImageSkia CreateVectorIconFromSource(const std::string& source, |
598 int dip_size, | 605 int dip_size, |
599 SkColor color) { | 606 SkColor color) { |
600 return CanvasImageSource::MakeImageSkia<VectorIconSourceLegacy>( | 607 return CanvasImageSource::MakeImageSkia<VectorIconSourceLegacy>( |
601 source, dip_size, color); | 608 source, dip_size, color); |
602 } | 609 } |
603 | 610 |
604 } // namespace gfx | 611 } // namespace gfx |
OLD | NEW |