Skip to content

Commit a9ff26e

Browse files
authored
Merge pull request #2 from dastels/master
Refinement and changes to reflect displayio.Display changes
2 parents ab737ac + 18f9f24 commit a9ff26e

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

adafruit_bitmapsaver.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,7 @@ def _write_pixels(output_file, pixel_source, palette):
9191
saving_bitmap = isinstance(pixel_source, Bitmap)
9292
width, height = _rotated_height_and_width(pixel_source)
9393
row_buffer = bytearray(_bytes_per_row(width))
94+
result_buffer = bytearray(2048)
9495
for y in range(height, 0, -1):
9596
buffer_index = 0
9697
if saving_bitmap:
@@ -102,7 +103,7 @@ def _write_pixels(output_file, pixel_source, palette):
102103
color >>= 8
103104
buffer_index += 1
104105
else:
105-
data = pixel_source.fill_area(x=0, y=y-1, width=width, height=1)
106+
data = pixel_source.fill_row(y-1, result_buffer)
106107
for i in range(width):
107108
pixel565 = (data[i * 2] << 8) + data[i * 2 + 1]
108109
for b in _rgb565_to_bgr_tuple(pixel565):
@@ -137,7 +138,7 @@ def save_pixels(file_or_filename, pixel_source=board.DISPLAY, palette=None):
137138
_write_bmp_header(output_file, filesize)
138139
_write_dib_header(output_file, width, height)
139140
_write_pixels(output_file, pixel_source, palette)
140-
except Exception:
141-
raise
141+
except Exception as ex:
142+
raise ex
142143
else:
143144
output_file.close()

0 commit comments

Comments
 (0)