Skip to content

Commit

Permalink
cover all cases of 4-float sequences
Browse files Browse the repository at this point in the history
Resulting quad was all zeroes if argument was a tupl4 or list of floats.
  • Loading branch information
JorjMcKie committed Dec 27, 2023
1 parent 82592c9 commit 4675b84
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -16982,8 +16982,9 @@ def JM_py_from_rect(r):
def JM_quad_from_py(r):
if isinstance(r, mupdf.FzQuad):
return r
if isinstance( r, Rect):
r = mupdf.FzRect( r.x0, r.y0, r.x1, r.y1)
# cover all cases of 4-float-sequences
if hasattr(r, "__getitem__") and len(r) == 4 and hasattr(r[0], "__float__"):
r = mupdf.FzRect(*tuple(r))
if isinstance( r, mupdf.FzRect):
return mupdf.fz_quad_from_rect( r)
if isinstance( r, Quad):
Expand Down

0 comments on commit 4675b84

Please sign in to comment.