Skip to content

Commit

Permalink
Added test_2692() and fix rebase implementation.
Browse files Browse the repository at this point in the history
Changed `fz_identity` to `mupdf.FzMatrix()` and use `mupdf.FzCookie()` instead
of `None.
  • Loading branch information
julian-smith-artifex-com committed Sep 26, 2023
1 parent a74fc9d commit f4cdca8
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -13723,9 +13723,9 @@ def JM_pixmap_from_page(doc, page, ctm, cs, alpha, annots, clip):

dev = mupdf.fz_new_draw_device(matrix, pix)
if annots:
mupdf.fz_run_page(page, dev, fz_identity, NULL);
mupdf.fz_run_page(page, dev, mupdf.FzMatrix(), NULL);
else:
fz_run_page_contents(ctx, page, dev, fz_identity, mupdf.FzCookie())
fz_run_page_contents(ctx, page, dev, mupdf.FzMatrix(), mupdf.FzCookie())
mupdf.fz_close_device(dev)
return pix

Expand Down Expand Up @@ -16236,7 +16236,7 @@ def JM_pixmap_from_display_list(

if not mupdf.fz_is_infinite_rect(rclip):
dev = mupdf.fz_new_draw_device_with_bbox(matrix, pix, irect)
mupdf.fz_run_display_list(list_, dev, fz_identity, rclip, None)
mupdf.fz_run_display_list(list_, dev, mupdf.FzMatrix(), rclip, mupdf.FzCookie())
else:
dev = mupdf.fz_new_draw_device(matrix, pix)
mupdf.fz_run_display_list(list_, dev, mupdf.FzMatrix(), mupdf.FzRect(mupdf.FzRect.Fixed_INFINITE), mupdf.FzCookie())
Expand Down Expand Up @@ -20518,7 +20518,7 @@ def _derotate_matrix(page):
if isinstance(page, mupdf.PdfPage):
return JM_py_from_matrix(JM_derotate_page_matrix(page))
else:
return JM_py_from_matrix(fz_identity)
return JM_py_from_matrix(mupdf.FzMatrix())

@staticmethod
def _fill_widget(annot, widget):
Expand Down
12 changes: 12 additions & 0 deletions tests/test_general.py
Original file line number Diff line number Diff line change
Expand Up @@ -511,3 +511,15 @@ def test_2430():
font = fitz.Font("helv")
for i in range(1000):
_ = font.flags

def test_2692():
document = fitz.Document(f'{scriptdir}/resources/2.pdf')
for page in document:
pix = pix = page.get_pixmap(clip=fitz.Rect(0,0,10,10))
dl = page.get_displaylist(annots=True)
pix = dl.get_pixmap(
matrix=fitz.Identity,
colorspace=fitz.csRGB,
alpha=False,
clip=fitz.Rect(0,0,10,10),
)

0 comments on commit f4cdca8

Please sign in to comment.