Skip to content

Commit

Permalink
auto_bitmap_format(): flatten if/else tree
Browse files Browse the repository at this point in the history
a bit less obvious, but looks better anyway
  • Loading branch information
mara004 committed Sep 20, 2022
1 parent c44d81a commit fc736ec
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions src/pypdfium2/_helpers/_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,12 @@ def auto_bitmap_format(bg_color, greyscale, prefer_bgrx):
# even if a custom color scheme is given and its values contain transparency, we don't need to care, because drawings are additive
if (bg_color[3] < 255):
return pdfium.FPDFBitmap_BGRA
elif greyscale:
return pdfium.FPDFBitmap_Gray
elif prefer_bgrx:
return pdfium.FPDFBitmap_BGRx
else:
if greyscale:
return pdfium.FPDFBitmap_Gray
else:
if prefer_bgrx:
return pdfium.FPDFBitmap_BGRx
else:
return pdfium.FPDFBitmap_BGR
return pdfium.FPDFBitmap_BGR


def color_tohex(color, rev_byteorder):
Expand Down

0 comments on commit fc736ec

Please sign in to comment.