]> Repositories - hackapet/Adafruit_Blinka_Displayio.git/blobdiff - displayio/_displaycore.py
Merge pull request #136 from FoamyGuy/8.x_compatibility
[hackapet/Adafruit_Blinka_Displayio.git] / displayio / _displaycore.py
index 76a5d18a1871e085e8ca65fd8fa2b3ffa4560c7a..286f9037673358f584ac3ff0a3c7f4859ba17ec2 100644 (file)
@@ -25,13 +25,13 @@ __repo__ = "https://github.com/adafruit/Adafruit_Blinka_Displayio.git"
 import time
 import struct
 from circuitpython_typing import WriteableBuffer, ReadableBuffer
-from paralleldisplay import ParallelBus
-from ._fourwire import FourWire
+from paralleldisplaybus import ParallelBus
+from fourwire import FourWire
+from i2cdisplaybus import I2CDisplayBus
+from busdisplay._displaybus import _DisplayBus
 from ._group import Group
-from ._i2cdisplay import I2CDisplay
 from ._structs import ColorspaceStruct, TransformStruct
 from ._area import Area
-from ._displaybus import _DisplayBus
 from ._helpers import bswap16
 from ._constants import (
     CHIP_SELECT_UNTOUCHED,
@@ -99,7 +99,7 @@ class _DisplayCore:
         self.last_refresh = 0
 
         if bus:
-            if isinstance(bus, (FourWire, I2CDisplay, ParallelBus)):
+            if isinstance(bus, (FourWire, I2CDisplayBus, ParallelBus)):
                 self._bus_reset = bus.reset
                 self._bus_free = bus._free
                 self._begin_transaction = bus._begin_transaction
@@ -118,16 +118,13 @@ class _DisplayCore:
         self.rotation = rotation
         self.transform = TransformStruct()
 
+        self.set_rotation(rotation)
+
     def set_rotation(self, rotation: int) -> None:
         """
         Sets the rotation of the display as an int in degrees.
         """
         # pylint: disable=protected-access, too-many-branches
-        transposed = self.rotation in (90, 270)
-        will_be_transposed = rotation in (90, 270)
-        if transposed != will_be_transposed:
-            self.width, self.height = self.height, self.width
-
         height = self.height
         width = self.width
 
@@ -176,9 +173,6 @@ class _DisplayCore:
                 self.transform.y = height
                 self.transform.dy = -1
 
-        if self.current_group is not None:
-            self.current_group._update_transform(self.transform)
-
     def set_root_group(self, root_group: Group) -> bool:
         """
         Switches to displaying the given group of layers. When group is `None`, the
@@ -289,7 +283,6 @@ class _DisplayCore:
             else:
                 region_y1 //= pixels_per_byte * self.colorspace.bytes_per_cell
                 region_y2 //= pixels_per_byte * self.colorspace.bytes_per_cell
-
         region_x2 -= 1
         region_y2 -= 1
 
@@ -343,7 +336,7 @@ class _DisplayCore:
         if not self.data_as_commands:
             self.send(DISPLAY_COMMAND, CHIP_SELECT_UNTOUCHED, data)
             data = bytearray(0)
-        if self.ram_width < 0x100:  # Single Byte Bounds
+        if self.ram_height < 0x100:  # Single Byte Bounds
             data += struct.pack(">BB", region_y1, region_y2)
         else:
             if self.address_little_endian: