From 18139b1ada90e91faf6ddab847f2dc39f3f55035 Mon Sep 17 00:00:00 2001 From: XANTRONIX Development Date: Mon, 8 Jan 2024 23:54:42 -0500 Subject: [PATCH] This seems to work better on Intel graphics? --- py/hexagram/cluster.py | 24 +++--------------------- 1 file changed, 3 insertions(+), 21 deletions(-) diff --git a/py/hexagram/cluster.py b/py/hexagram/cluster.py index 9bd0685..ee4a171 100644 --- a/py/hexagram/cluster.py +++ b/py/hexagram/cluster.py @@ -83,8 +83,8 @@ class Clock(TextGauge): ) class Cluster(): - __slots__ = '_redraw', 'bg', 'gauges', 'speedo', 'fuel', 'tacho', 'thermo', \ - 'odo', 'ambient', 'clock', 'shift_indicator', 'status', + __slots__ = 'gauges', 'speedo', 'fuel', 'tacho', 'thermo', 'odo', \ + 'ambient', 'clock', 'shift_indicator', 'status', WIDTH = 1280 HEIGHT = 480 @@ -96,11 +96,6 @@ class Cluster(): SECTION_HEIGHT_BOTTOM = 52 def __init__(self, rpm_min: float, rpm_redline: float, rpm_max: float): - self._redraw = True - self.bg = cairo.ImageSurface(cairo.FORMAT_ARGB32, - self.WIDTH, - self.HEIGHT) - self.gauges: List[Gauge] = list() self.speedo = Speedo(self.HEIGHT / 2, @@ -146,8 +141,7 @@ class Cluster(): self.gauges.append(self.shift_indicator) self.gauges.append(self.status) - def _update_bg(self): - cr = cairo.Context(self.bg) + def draw_bg(self, cr: cairo.Context): cr.set_source_rgb(0.1, 0.1, 0.1) cr.rectangle(0, 0, self.WIDTH, self.HEIGHT) cr.fill() @@ -181,18 +175,6 @@ class Cluster(): for gauge in self.gauges: gauge.draw_bg(cr) - def draw_bg(self, cr: cairo.Context): - if self._redraw: - self._update_bg() - self._redraw = False - - op = cr.get_operator() - cr.set_source_surface(self.bg, 0, 0) - cr.set_operator(cairo.OPERATOR_SOURCE) - cr.rectangle(0, 0, self.WIDTH, self.HEIGHT) - cr.fill() - cr.set_operator(op) - def draw_fg(self, cr: cairo.Context): for gauge in self.gauges: gauge.draw_fg(cr)