Separate the details of the bitmap packing from operations on the

packed representation (diff, apply etc).  This allows the (D)HGRBitmap
classes to focus on the bitmap packing and share common logic.

Numpy has unfortunate long-standing bugs to do with type coercion of
np.uint64, which leads to spurious "incompatible type" warnings when
e.g. operating on a np.uint64 and some other integer type.  To work
around this we cast explicitly to np.uint64 everywhere.

Get tests working again - for now HGR tests in screen_test.py are
disabled until I finish implementing new packing.

HGRBitmap is still incomplete although closer.
This commit is contained in:
kris
2019-07-04 15:21:20 +01:00
parent 666272a8fc
commit 5c550d8524
6 changed files with 1131 additions and 859 deletions

View File

@@ -7,7 +7,7 @@ HGRColours = colours.HGRColours
class TestColours(unittest.TestCase):
def test_int28_to_pixels(self):
def test_int34_to_pixels(self):
self.assertEqual(
(
HGRColours.BLACK,
@@ -38,9 +38,12 @@ class TestColours(unittest.TestCase):
HGRColours.BLACK,
HGRColours.BLACK,
HGRColours.BLACK,
HGRColours.BLACK,
HGRColours.BLACK,
HGRColours.BLACK
),
colours.int34_to_nominal_colour_pixels(
0b00000000000000000000111000000000, HGRColours
0b00000000000000000000111000000000, HGRColours, init_phase=0
)
)
@@ -73,10 +76,13 @@ class TestColours(unittest.TestCase):
HGRColours.BLACK,
HGRColours.BLACK,
HGRColours.BLACK,
HGRColours.BLACK,
HGRColours.BLACK,
HGRColours.BLACK,
HGRColours.BLACK
),
colours.int34_to_nominal_colour_pixels(
0b0000111100001111000011110000, HGRColours
0b0000111100001111000011110000, HGRColours, init_phase=0
)
)