[vector icons] Incorrect vector icon generated |
||||
Issue descriptionI tried to convert the following SVG (which was ran through SVGO) <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M15 12l-5-4v3H2v2h8v3zm2-10.99L7 1c-1.1 0-2 .9-2 2v6h2V5h10v14H7v-4H5v6c0 1.1.9 2 2 2h10c1.1 0 2-.9 2-2V3c0-1.1-.9-1.99-2-1.99z"/><path fill="none" d="M0 0h24v24H0z"/></svg> The outputted .icon file was this: CANVAS_DIMENSIONS, 24, MOVE_TO, 15, 12, R_LINE_TO, -5, -4, R_V_LINE_TO, 3, H_LINE_TO, 2, R_V_LINE_TO, 2, R_H_LINE_TO, 8, R_V_LINE_TO, 3, CLOSE, R_MOVE_TO, 2, -10.99f, LINE_TO, 7, 1, R_CUBIC_TO, -1.1f, 0, -2, 0.9f, -2, 2, R_V_LINE_TO, 6, R_H_LINE_TO, 2, V_LINE_TO, 5, R_H_LINE_TO, 10, R_V_LINE_TO, 14, H_LINE_TO, 7, R_V_LINE_TO, -4, H_LINE_TO, 5, R_V_LINE_TO, 6, R_CUBIC_TO, 0, 1.1f, 0.9f, 2, 2, 2, R_H_LINE_TO, 10, R_CUBIC_TO, 1.1f, 0, 2, -0.9f, 2, -2, V_LINE_TO, 3, R_CUBIC_TO, 0, -1.1f, -0.9f, -1.99f, -2, -1.99f, CLOSE, END Changing the R_MOVE_TO, 2, -10.99f, line to R_MOVE_TO, 2, -14.99f, fixes the image. See attached comparison.
,
Mar 1 2017
I was about to change the component... but since I'm here. It looks like the "vector icons" renderer is relying on SkPath semantics matching SVG path semantics. They don't. rMoveTo use the "last point", while after a "close" (z/Z) the current point would be the starting point of the subpath (15,12 here it looks like.) You can have a look at third_party/WebKit/Source/core/svg/SVGPathBuilder.cpp for how Blink handles it/does the conversion. Hope that helps.
,
Mar 2 2017
thanks for the pointer
,
Mar 2 2017
The icon associated with -14.99 LGTM
,
Mar 2 2017
I have a fix for this, no need to manually adjust the icon.
,
Mar 3 2017
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/c570b631a9db029a57a73d0b4068d2f625795135 commit c570b631a9db029a57a73d0b4068d2f625795135 Author: estade <estade@chromium.org> Date: Fri Mar 03 20:49:00 2017 Vector icons: fix R_MOVE_TO after CLOSE This might affect some pre-existing vector icons, and in fact I found many that have a R_MOVE_TO right after a CLOSE. But all the ones I checked didn't exhibit the bug because the current subpath already happened to start and finish in the same place. BUG= 697497 Review-Url: https://codereview.chromium.org/2732493002 Cr-Commit-Position: refs/heads/master@{#454666} [modify] https://crrev.com/c570b631a9db029a57a73d0b4068d2f625795135/ui/gfx/BUILD.gn [modify] https://crrev.com/c570b631a9db029a57a73d0b4068d2f625795135/ui/gfx/paint_vector_icon.cc [add] https://crrev.com/c570b631a9db029a57a73d0b4068d2f625795135/ui/gfx/paint_vector_icon_unittest.cc
,
Mar 3 2017
,
Mar 14 2017
|
||||
►
Sign in to add a comment |
||||
Comment 1 by est...@chromium.org
, Mar 1 2017Owner: est...@chromium.org
Status: Assigned (was: Untriaged)