Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

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

Open
melwyncarlo wants to merge5 commits intomatplotlib:main
base:main
Choose a base branch
Loading
frommelwyncarlo:issue_30549
Open
Changes fromall commits
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
28 changes: 21 additions & 7 deletionssrc/path_converters.h
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -557,32 +557,46 @@ class PathSnapper
double m_snap_value;

static bool should_snap(VertexSource &path, e_snap_mode snap_mode, unsigned total_vertices)
{
// 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;
unsigned code;
{
const unsigned path_cmd_end_poly_masked = agg::path_flags_close | agg::path_cmd_end_poly;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

paths can have multiple closed polygons, what happens in that case?

Copy link
Author

Choose a reason for hiding this comment

The 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)
If yes, then is that practically possible (multiple polygons in one command set)?

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) {
switch (snap_mode) {
case SNAP_AUTO:
if (total_vertices > 1024) {
return false;
}

code = path.vertex(&x0, &y0);
if (code == agg::path_cmd_stop) {
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;
Expand Down
Loading

[8]ページ先頭

©2009-2025 Movatter.jp