-
Notifications
You must be signed in to change notification settings - Fork 10.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[SVG] Optimization of constructPath & Adds unit lengths #5000
Conversation
pramodhkp
commented
Jun 24, 2014
- Changed multiple string operations to one final operation for 'd' in constructPath.
- Added units to all the svg lengths, as per https://jwatt.org/svg/authoring/#specifying-units
break; | ||
case OPS.curveTo: | ||
x = args[j + 4]; | ||
y = args[j + 5]; | ||
arr = [args[j], args[j + 1], args[j + 2], args[j + 3], x, y]; | ||
d += 'C ' + arr.join(' '); | ||
d.push( 'C ' , arr.join(' ')); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't join it here. Add utility function that will push items with spaces in between. But I would recommend to add space after each item at the end .join(' '). M1 2C 2 3ZM1 0Z
does not look right, M 1 2 C 2 3 Z M 1 0 Z
- much better
Have made the changes. But I didn't add the util function. I have modified the code to reduce the stress on GC, by reducing the number of objects created. Not sure how a util function is helpful here (a single join operation). Would be happy to add if it is necesary. |
cc @timvandermeij Could I please get a review on this. I think this also fixes the black boxes in tutorial.pdf. |
@pramodhkp I have reviewed this and added two comments above. I can indeed confirm that the black boxes in |
Have made the changes. |
[SVG] Optimization of constructPath & Adds unit lengths
Thanks for the patch! |