]> Repositories - hackapet/Adafruit_Blinka_Displayio.git/blobdiff - displayio/tilegrid.py
Divide by zero and speed up bug fixes
[hackapet/Adafruit_Blinka_Displayio.git] / displayio / tilegrid.py
index 774dd77733a6c7bf0b89fd96ab434551cab589b5..c88498da33e94d2e11755c06ba0c51771b350169 100644 (file)
@@ -103,10 +103,10 @@ class TileGrid:
             tile_width = bitmap_width
         if tile_height is None:
             tile_height = bitmap_height
-        if bitmap_width % tile_width != 0:
+        if tile_width > 0 and bitmap_width % tile_width != 0:
             raise ValueError("Tile width must exactly divide bitmap width")
         self._tile_width = tile_width
-        if bitmap_height % tile_height != 0:
+        if tile_height > 0 and bitmap_height % tile_height != 0:
             raise ValueError("Tile height must exactly divide bitmap height")
         self._tile_height = tile_height
         if not 0 <= default_tile <= 255: