mirror of
https://github.com/jtgans/g13gui.git
synced 2025-07-09 17:31:41 -04:00
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:
parent
aeced13908
commit
cc7232e580
@ -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()
|
||||||
|
|
||||||
|
|
||||||
|
@ -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)
|
||||||
|
Loading…
Reference in New Issue
Block a user