]> Repositories - hackapet/Adafruit_Blinka_Displayio.git/commitdiff
Speed improvements by making larger buffer
authorMelissa LeBlanc-Williams <melissa@adafruit.com>
Wed, 27 Sep 2023 18:21:59 +0000 (11:21 -0700)
committerMelissa LeBlanc-Williams <melissa@adafruit.com>
Wed, 27 Sep 2023 18:21:59 +0000 (11:21 -0700)
displayio/_display.py
displayio/_palette.py
displayio/_tilegrid.py

index d7d04cf2389dcf5ba1c3badbb42cd754c6851e1b..022103d35b4d6674685ce69296ad6131a0b6e9f7 100644 (file)
@@ -328,7 +328,6 @@ class Display:
     def _refresh_area(self, area) -> bool:
         """Loop through dirty areas and redraw that area."""
         # pylint: disable=too-many-locals
-        buffer_size = 128
 
         clipped = Area()
         # Clip the area to the display by overlapping the areas.
@@ -340,6 +339,9 @@ class Display:
         pixels_per_word = 32 // self._core.colorspace.depth
         pixels_per_buffer = clipped.size()
 
+        # We should have lots of memory
+        buffer_size = clipped.size() // pixels_per_word
+
         subrectangles = 1
         # for SH1107 and other boundary constrained controllers
         #      write one single row at a time
index c00d45491be85caf5392e7eea46c699c66a63436..a0172546de3a0cf035bf176d0077c9613970cef4 100644 (file)
@@ -98,21 +98,23 @@ class Palette:
         self._colors[palette_index].transparent = False
         self._needs_refresh = True
 
+    """
     def _get_palette(self):
-        """Generate a palette for use with PIL"""
+        # Generate a palette for use with PIL
         palette = []
         for color in self._colors:
             palette += color.rgba()[0:3]
         return palette
 
     def _get_alpha_palette(self):
-        """Generate an alpha channel palette with white being
-        opaque and black being transparent"""
+        Generate an alpha channel palette with white being
+        # opaque and black being transparent
         palette = []
         for color in self._colors:
             for _ in range(3):
                 palette += [0 if color.transparent else 0xFF]
         return palette
+    """
 
     def _get_color(
         self,
index 6705601681d16bae4a6ad9ce820847d44aa478f1..dc392b95a90b1369336fb58142bca1e293908024 100644 (file)
@@ -400,6 +400,7 @@ class TileGrid:
                             # Reverse the shift by subtracting it from the leftmost shift
                             shift = (pixels_per_byte - 1) * colorspace.depth - shift
                         buffer[offset // pixels_per_byte] |= output_pixel.pixel << shift
+
         return full_coverage
 
     def _finish_refresh(self):