Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork8.1k
Deterministic Rendering#30576
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
base:main
Are you sure you want to change the base?
Uh oh!
There was an error while loading.Please reload this page.
Deterministic Rendering#30576
Changes fromall commits
File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading.Please reload this page.
Jump to
Uh oh!
There was an error while loading.Please reload this page.
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -557,32 +557,46 @@ class PathSnapper | ||
double m_snap_value; | ||
static bool should_snap(VertexSource &path, e_snap_mode snap_mode, unsigned total_vertices) | ||
{ | ||
const unsigned path_cmd_end_poly_masked = agg::path_flags_close | agg::path_cmd_end_poly; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. paths can have multiple closed polygons, what happens in that case? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. I didn't understand. Do you mean multiple polygons within the same commands set? (like self-intersecting polygons) In that case, maybe modify: casepath_cmd_end_poly_masked:if (fabs(xs-x0)>=1e-4&&fabs(ys-y0)>=1e-4) {returnfalse; } to: casepath_cmd_end_poly_masked:if (fabs(xs-x0)>=1e-4&&fabs(ys-y0)>=1e-4) {returnfalse; }xs=x0=x1;ys=y0=y1; and continue on . . . I'm just guessing. It would be helpful to have a list of possible command sequences to verify against. | ||
// If this contains only straight horizontal or vertical lines, it should be | ||
// snapped to the nearest pixels | ||
double x0 = 0, y0 = 0, x1 = 0, y1 = 0, xs = 0, ys = 0; | ||
unsigned code; | ||
switch (snap_mode) { | ||
case SNAP_AUTO: | ||
if (total_vertices > 1024) { | ||
return false; | ||
} | ||
code = path.vertex(&x0, &y0); | ||
switch (code) { | ||
case agg::path_cmd_stop: | ||
return false; | ||
case agg::path_cmd_move_to: | ||
xs = x0; | ||
ys = y0; | ||
} | ||
while ((code = path.vertex(&x1, &y1)) != agg::path_cmd_stop) { | ||
switch (code) { | ||
case agg::path_cmd_move_to: | ||
xs = x1; | ||
ys = x1; | ||
break; | ||
case agg::path_cmd_curve3: | ||
case agg::path_cmd_curve4: | ||
return false; | ||
case agg::path_cmd_line_to: | ||
if (fabs(x0 - x1) >= 1e-4 && fabs(y0 - y1) >= 1e-4) { | ||
return false; | ||
} | ||
break; | ||
case path_cmd_end_poly_masked: | ||
if (fabs(xs - x0) >= 1e-4 && fabs(ys - y0) >= 1e-4) { | ||
return false; | ||
} | ||
} | ||
x0 = x1; | ||
y0 = y1; | ||
Uh oh!
There was an error while loading.Please reload this page.