Skip to content

Fix #5895: Properly clip MOVETO commands #5911

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

Merged
merged 7 commits into from
Feb 22, 2016
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Remove unused members
  • Loading branch information
mdboom committed Jan 26, 2016
commit cf78dc1a47ba609c286b0d77a6aa9a5b38585ee7
22 changes: 4 additions & 18 deletions src/path_converters.h
Original file line number Diff line number Diff line change
Expand Up @@ -286,25 +286,17 @@ class PathClipper : public EmbeddedQueue<2>
double m_lastX;
double m_lastY;
bool m_moveto;
double m_nextX;
double m_nextY;
bool m_has_next;
bool m_end_poly;
double m_initX;
double m_initY;
bool m_has_init;
bool m_broke_path;

public:
PathClipper(VertexSource &source, bool do_clipping, double width, double height)
: m_source(&source),
m_do_clipping(do_clipping),
m_cliprect(-1.0, -1.0, width + 1.0, height + 1.0),
m_moveto(true),
m_has_next(false),
m_end_poly(false),
m_has_init(false),
m_broke_path(false)
m_has_init(false)
{
// empty
}
Expand All @@ -314,10 +306,7 @@ class PathClipper : public EmbeddedQueue<2>
m_do_clipping(do_clipping),
m_cliprect(rect),
m_moveto(true),
m_has_next(false),
m_end_poly(false),
m_has_init(false),
m_broke_path(false)
m_has_init(false)
{
m_cliprect.x1 -= 1.0;
m_cliprect.y1 -= 1.0;
Expand All @@ -327,7 +316,7 @@ class PathClipper : public EmbeddedQueue<2>

inline void rewind(unsigned path_id)
{
m_has_next = false;
m_has_init = false;
m_moveto = true;
m_source->rewind(path_id);
}
Expand All @@ -346,10 +335,7 @@ class PathClipper : public EmbeddedQueue<2>
while ((code = m_source->vertex(x, y)) != agg::path_cmd_stop) {
if (code == (agg::path_cmd_end_poly | agg::path_flags_close)) {
if (m_has_init) {
*x = m_initX;
*y = m_initY;
code = agg::path_cmd_line_to;
m_end_poly = true;
queue_push(agg::path_cmd_line_to, m_initX, m_initY);
break;
}
}
Expand Down