-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Generate path strings in C++ for PDF and PS #4197
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
Conversation
template <class PathIterator> | ||
void convert_to_svg(PathIterator &path, |
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.
Do we consider this part of the public API?
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.
No. It's in a module with a leading underscore (_path
).
I miss writing c++ regularly. |
I've updated this with changes that I think address all of the comments above. |
if (code == 0x4f) { | ||
if ((p = __append_to_string(p, buffer, *buffersize, codes[4])) == NULL) return 1; | ||
} else { | ||
size = sizes[code - 1]; |
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.
This should probably have a check that code < 5
so we can't walk out the end.
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.
Ok. This should be fixed now as well.
sarcasm? |
|
||
--wait; | ||
if ((p = __append_to_string(p, buffer, *buffersize, "\n")) == NULL) return 1; | ||
} | ||
|
||
*p = '\0'; |
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.
This should use __append_to_string
too? I think this can be an issue if the path is exactly the length of the buffer when the '\n' is added.
Sorry, one more nit-pick. I really do miss c++ a bit. |
BTW -- hold off one more second: I have one more improvement I want to make... |
@mdboom That last commits seems to have broken everything 😈 |
Interesting -- |
PRF : Generate path strings in C++ for PDF and PS
This is an optimization I've meant to implement for a long time.
The hottest spot performance-wise in the PDF and PS backends is the conversion of Path objects to a string of commands to draw that path. This has been done in C++ in the SVG backend for a long time -- this generalizes that code to make it usable in the PDF and PS backends as well.