Skip to content
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

Address #3182: Pixmap.invert_irect argument type error. #3187

Merged
merged 2 commits into from Feb 20, 2024

Conversation

julian-smith-artifex-com
Copy link
Collaborator

@julian-smith-artifex-com julian-smith-artifex-com commented Feb 20, 2024

Address #3182 and #3186.

src/__init__.py Outdated
@@ -16267,15 +16267,15 @@ def JM_irect_from_py(r):
r = mupdf.FzIrect( r.x0, r.y0, r.x1, r.y1)
return r
if isinstance(r, Rect):
ret = mupdf.fz_make_irect(r.x0, r.y0, r.x1, r.y1)
ret = mupdf.fz_make_irect(int(r.x0), int(r.y0), int(r.x1), int(r.y1))
Copy link
Collaborator

Choose a reason for hiding this comment

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

I don't think this is correct, because rounding is different from how MuPDF makes a IRect from a Rect: uppper and left coords must be rounded in direction left / up, but lower / right coords must take the next available integer ceiling.

Copy link
Collaborator

Choose a reason for hiding this comment

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

In principle we must first form Rect and then an IRect from the result: fz_irect_from_rect(fz_rect rect).

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Thanks, i hadn't realised that. New commit fixes hopefully.

@JorjMcKie JorjMcKie self-requested a review February 20, 2024 15:10
Copy link
Collaborator

@JorjMcKie JorjMcKie left a comment

Choose a reason for hiding this comment

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

In principle we must first form Rect and then an IRect from the result: fz_irect_from_rect(fz_rect rect).

@julian-smith-artifex-com
Copy link
Collaborator Author

Have added a commit that addresses #3186.

@julian-smith-artifex-com julian-smith-artifex-com merged commit 25adc23 into main Feb 20, 2024
2 checks passed
@github-actions github-actions bot locked and limited conversation to collaborators Feb 20, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants