This seems to work better on Intel graphics?
This commit is contained in:
parent
004c803ddc
commit
18139b1ada
1 changed files with 3 additions and 21 deletions
|
@ -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)
|
||||
|
|
Loading…
Add table
Reference in a new issue