From db147d151c4889d86dcff5a1da9c5dbc8d94bd5a Mon Sep 17 00:00:00 2001
From: Sebastian Krzyszkowiak <dos@dosowisko.net>
Date: Wed, 6 Sep 2023 03:18:25 +0200
Subject: [PATCH] st3m: ViewTransitionSwipe*: Clip the drawn views

Otherwise views that draw outside of the screen can leak their
contents onto the other view.
---
 python_payload/st3m/ui/view.py | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/python_payload/st3m/ui/view.py b/python_payload/st3m/ui/view.py
index 77ef56461d..0f8ff1495c 100644
--- a/python_payload/st3m/ui/view.py
+++ b/python_payload/st3m/ui/view.py
@@ -110,6 +110,8 @@ class ViewTransitionSwipeLeft(ViewTransition):
 
         ctx.save()
         ctx.translate(240 + transition * -240, 0)
+        ctx.rectangle(-120, -120, 240, 240)
+        ctx.clip()
         incoming.draw(ctx)
         ctx.restore()
 
@@ -129,6 +131,8 @@ class ViewTransitionSwipeRight(ViewTransition):
 
         ctx.save()
         ctx.translate(-240 + transition * 240, 0)
+        ctx.rectangle(-120, -120, 240, 240)
+        ctx.clip()
         incoming.draw(ctx)
         ctx.restore()
 
-- 
GitLab