summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: a53d19f)
raw | patch | inline | side by side (parent: a53d19f)
author | Tomi Valkeinen <tomi.valkeinen@ti.com> | |
Tue, 30 May 2017 10:54:43 +0000 (13:54 +0300) | ||
committer | Tomi Valkeinen <tomi.valkeinen@ti.com> | |
Tue, 30 May 2017 11:08:29 +0000 (14:08 +0300) |
py/pykms/__init__.py | patch | blob | history | |
py/tests/rottest.py | patch | blob | history |
diff --git a/py/pykms/__init__.py b/py/pykms/__init__.py
index 41c12195d7f52621a3adcf9b01b20e742fb29cea..3b5f743aa43a4d4c3d5f92ee35237b8421641bd9 100644 (file)
--- a/py/pykms/__init__.py
+++ b/py/pykms/__init__.py
white = RGB(255, 255, 255)
cyan = RGB(0, 255, 255)
+#
+# Rotation enum
+#
+
+class Rotation(int, Enum):
+ ROTATE_0 = 1 << 0
+ ROTATE_90 = 1 << 1
+ ROTATE_180 = 1 << 2
+ ROTATE_270 = 1 << 3
+ ROTATE_MASK = ROTATE_0 | ROTATE_90 | ROTATE_180 | ROTATE_270
+ REFLECT_X = 1 << 4
+ REFLECT_Y = 1 << 5
+ REFLECT_MASK = REFLECT_X | REFLECT_Y
+
#
# DrmObject API extensions
#
diff --git a/py/tests/rottest.py b/py/tests/rottest.py
index 4dae95efe07c6d7ed77409f823dd344aca793792..d81a962a61ffb95028913ccaaad5e72f0bb003cc 100755 (executable)
--- a/py/tests/rottest.py
+++ b/py/tests/rottest.py
req.commit_sync(allow_modeset = True)
-class Rotation(int, Enum):
- ROTATE_0 = 1 << 0
- ROTATE_90 = 1 << 1
- ROTATE_180 = 1 << 2
- ROTATE_270 = 1 << 3
- ROTATE_MASK = ROTATE_0 | ROTATE_90 | ROTATE_180 | ROTATE_270
- REFLECT_X = 1 << 4
- REFLECT_Y = 1 << 5
- REFLECT_MASK = REFLECT_X | REFLECT_Y
-
-
def show_rot_plane(crtc, plane, fb, rot, x_scale, y_scale):
crtc_w = int(fb_w * x_scale)
crtc_h = int(fb_h * y_scale)
- if (rot & Rotation.ROTATE_90) or (rot & Rotation.ROTATE_270):
+ if (rot & pykms.Rotation.ROTATE_90) or (rot & pykms.Rotation.ROTATE_270):
tmp = crtc_w
crtc_w = crtc_h
crtc_h = tmp
src_x, src_y, src_w, src_h,
crtc_x, crtc_y, crtc_w, crtc_h))
- angle_str = Rotation(rot & Rotation.ROTATE_MASK).name
- reflect_x_str = "REFLECT_X" if rot & Rotation.REFLECT_X else ""
- reflect_y_str = "REFLECT_Y" if rot & Rotation.REFLECT_Y else ""
+ angle_str = pykms.Rotation(rot & pykms.Rotation.ROTATE_MASK).name
+ reflect_x_str = "REFLECT_X" if rot & pykms.Rotation.REFLECT_X else ""
+ reflect_y_str = "REFLECT_Y" if rot & pykms.Rotation.REFLECT_Y else ""
print("{} {} {}".format(angle_str, reflect_x_str, reflect_y_str))
@@ -119,7 +108,7 @@ pykms.draw_text(fb, even((fb_w // 2) - (8 * 6) // 2), fb_h - 8 - 4, "BOTTOM", py
pykms.draw_text(fb, 4, even(((fb_h // 2) - 4)), "L", pykms.white)
pykms.draw_text(fb, fb_w - 8 - 4, even(((fb_h // 2) - 4)), "R", pykms.white)
-rots = [ Rotation.ROTATE_0, Rotation.ROTATE_90, Rotation.ROTATE_180, Rotation.ROTATE_270 ]
+rots = [ pykms.Rotation.ROTATE_0, pykms.Rotation.ROTATE_90, pykms.Rotation.ROTATE_180, pykms.Rotation.ROTATE_270 ]
cursors = [ "A", "D", "B", "C" ]
print("Use the cursor keys, x and y to change rotation. Press q to quit.")
try:
esc_seq = 0
- current_rot = Rotation.ROTATE_0
+ current_rot = pykms.Rotation.ROTATE_0
show_rot_plane(crtc, plane, fb, current_rot, x_scale, y_scale)
rot = rots[cursors.index(c)]
- current_rot &= ~Rotation.ROTATE_MASK
+ current_rot &= ~pykms.Rotation.ROTATE_MASK
current_rot |= rot
changed = True
if c == "q":
break
elif c == "x":
- current_rot ^= Rotation.REFLECT_X
+ current_rot ^= pykms.Rotation.REFLECT_X
changed = True
elif c == "y":
- current_rot ^= Rotation.REFLECT_Y
+ current_rot ^= pykms.Rotation.REFLECT_Y
changed = True
if changed: