g13gui: Fix the display height

Apparently I misunderstood the source of pbm2lpbm. There is no padding, despite
the count of rows being off in the source.
This commit is contained in:
June Tate-Gans 2021-04-29 20:29:42 -05:00
parent aeced13908
commit cc7232e580
2 changed files with 3 additions and 5 deletions

View File

@ -10,7 +10,7 @@ from g13gui.observer import ChangeType
class DisplayMetrics(object): class DisplayMetrics(object):
WIDTH_PIXELS = 160 WIDTH_PIXELS = 160
HEIGHT_PIXELS = 43 HEIGHT_PIXELS = 48
LPBM_LENGTH = 960 LPBM_LENGTH = 960
@ -42,9 +42,6 @@ def ImageToLPBM(image):
col = 0 col = 0
row += 8 row += 8
# padding? lpbm files are always 960 bytes, the last bytes are filled with garbage.
bio.write(bytes(LPBM_LENGTH - maxBytes))
return bio.getvalue() return bio.getvalue()

View File

@ -16,8 +16,9 @@ class DisplayTests(unittest.TestCase):
def testConversion(self): def testConversion(self):
ctx = self.d.getContext() ctx = self.d.getContext()
ctx.rectangle((0, 0, 160, 43), fill=1)
ctx.text((0, 0), "Hello world!", ctx.text((0, 0), "Hello world!",
font=FontManager.getFont(Fonts.HUGE), fill=1) font=FontManager.getFont(Fonts.HUGE), fill=0)
result = ImageToLPBM(self.d._bitmap) result = ImageToLPBM(self.d._bitmap)
self.assertEqual(len(result), LPBM_LENGTH) self.assertEqual(len(result), LPBM_LENGTH)