Skip to content
Snippets Groups Projects
Commit 11a9ce15 authored by pippin's avatar pippin
Browse files

ui: stop using buffers for volume overlay

parent fbd13e04
No related branches found
No related tags found
No related merge requests found
...@@ -144,8 +144,7 @@ def run_main() -> None: ...@@ -144,8 +144,7 @@ def run_main() -> None:
log.info(f"free memory: {gc.mem_free()}") log.info(f"free memory: {gc.mem_free()}")
captouch.calibration_request() captouch.calibration_request()
# TODO(q3k): volume control. but until then, make slightly less loud on startup. audio.set_volume_dB(-10) # slightly less loud startup volume
audio.set_volume_dB(-10)
leds.set_rgb(0, 255, 0, 0) leds.set_rgb(0, 255, 0, 0)
leds.update() leds.update()
bundles = BundleManager() bundles = BundleManager()
......
...@@ -283,27 +283,20 @@ class OverlayVolume(Overlay): ...@@ -283,27 +283,20 @@ class OverlayVolume(Overlay):
opacity = self._showing / 200 opacity = self._showing / 200
opacity = min(opacity, 0.8) opacity = min(opacity, 0.8)
ctx.start_group()
ctx.global_alpha = opacity
# Background # Background
ctx.gray(0) ctx.rgba(0, 0, 0, opacity)
ctx.round_rectangle(-40, -40, 80, 80, 5) ctx.round_rectangle(-40, -40, 80, 80, 5)
ctx.fill() ctx.fill()
ctx.end_group()
# Foreground # Foreground
opacity = self._showing / 200 opacity = self._showing / 200
opacity = min(opacity, 1) opacity = min(opacity, 1)
ctx.start_group()
ctx.global_alpha = opacity
muted = self._muted muted = self._muted
if muted: if muted:
ctx.gray(0.5) ctx.rgba(0.5, 0.5, 0.5, opacity)
else: else:
ctx.gray(1) ctx.rgba(1.0, 1.0, 1.0, opacity)
# Icon # Icon
if self._headphones: if self._headphones:
...@@ -323,7 +316,7 @@ class OverlayVolume(Overlay): ...@@ -323,7 +316,7 @@ class OverlayVolume(Overlay):
ctx.line_to(-10, 0) ctx.line_to(-10, 0)
ctx.fill() ctx.fill()
ctx.gray(1) ctx.rgba(1.0, 1.0, 1.0, opacity)
# Volume slider # Volume slider
ctx.round_rectangle(-30, 20, 60, 10, 3) ctx.round_rectangle(-30, 20, 60, 10, 3)
...@@ -337,8 +330,6 @@ class OverlayVolume(Overlay): ...@@ -337,8 +330,6 @@ class OverlayVolume(Overlay):
ctx.round_rectangle(-30, 20, width, 10, 3) ctx.round_rectangle(-30, 20, width, 10, 3)
ctx.fill() ctx.fill()
ctx.end_group()
class Icon(Responder): class Icon(Responder):
""" """
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment