diff options
| author | Daniel Thompson <daniel@redfelineninja.org.uk> | 2020-06-22 21:17:06 (GMT) |
|---|---|---|
| committer | Daniel Thompson <daniel@redfelineninja.org.uk> | 2020-06-22 21:17:06 (GMT) |
| commit | d81e8e75aca512e156e5af610db6026b9cb785dd (patch) | |
| tree | 24c35330840f624c64afb034f4b46686a8576777 /wasp/apps/testapp.py | |
| parent | f102d75ee72b276fa23b9fdb40c6d09b59b6dd47 (diff) | |
apps: testapp: Filled rectangle drawing benchmarks
Measure the performance of the quarter screen fill, horizontal lines and
vertical lines.
Signed-off-by: Daniel Thompson <daniel@redfelineninja.org.uk>
Diffstat (limited to 'wasp/apps/testapp.py')
| -rw-r--r-- | wasp/apps/testapp.py | 28 |
1 files changed, 27 insertions, 1 deletions
diff --git a/wasp/apps/testapp.py b/wasp/apps/testapp.py index 43b99ca..a312530 100644 --- a/wasp/apps/testapp.py +++ b/wasp/apps/testapp.py @@ -16,7 +16,7 @@ class TestApp(): ICON = icons.app def __init__(self): - self.tests = ('Button', 'Crash', 'Colours', 'RLE', 'String', 'Touch', 'Wrap') + self.tests = ('Button', 'Crash', 'Colours', 'Fill', 'Fill-H', 'Fill-V', 'RLE', 'String', 'Touch', 'Wrap') self.test = self.tests[0] self.scroll = wasp.widgets.ScrollIndicator() @@ -68,6 +68,8 @@ class TestApp(): s.update() self.scroll.draw() self._update_colours() + elif self.test.startswith('Fill'): + self._benchmark_fill() elif self.test == 'RLE': self._benchmark_rle() elif self.test == 'String': @@ -91,6 +93,30 @@ class TestApp(): del t draw.string('{}s'.format(elapsed / 1000000), 12, 24+192) + def _benchmark_fill(self): + draw = wasp.watch.drawable + draw.fill(0, 0, 30, 240, 240-30) + self.scroll.draw() + t = machine.Timer(id=1, period=8000000) + if self.test == 'Fill': + t.start() + draw.fill(0xffff, 60, 60, 120, 120) + elapsed = t.time() + elif self.test == 'Fill-H': + t.start() + for i in range(60, 180, 2): + draw.fill(0xffff, 60, i, 120, 1) + elapsed = t.time() + elif self.test == 'Fill-V': + t.start() + for i in range(60, 180, 2): + draw.fill(0xffff, i, 60, 1, 120) + elapsed = t.time() + + t.stop() + del t + draw.string('{}s'.format(elapsed / 1000000), 12, 24+192) + def _benchmark_string(self): draw = wasp.watch.drawable draw.fill(0, 0, 30, 240, 240-30) |
