diff options
| author | Dan Halbert <halbert@halwitz.org> | 2019-08-05 16:35:44 -0400 |
|---|---|---|
| committer | Dan Halbert <halbert@halwitz.org> | 2019-08-05 16:35:44 -0400 |
| commit | b67d04a5b1bd1ed3295627cde3cf8addc1252d6e (patch) | |
| tree | f779b36a5bcb4e28097111135bde43c5a5045ea1 /shared-bindings | |
| parent | 7ce3776b8086abbe0d01056651904a59bf4f8bec (diff) | |
| parent | 347fbb652fa8ceba7ee640a690f0996204136443 (diff) | |
Merge remote-tracking branch 'adafruit/master' into ble-pairing
Diffstat (limited to 'shared-bindings')
| -rw-r--r-- | shared-bindings/_stage/__init__.c | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/shared-bindings/_stage/__init__.c b/shared-bindings/_stage/__init__.c index 9f3f89462..485fa80c5 100644 --- a/shared-bindings/_stage/__init__.c +++ b/shared-bindings/_stage/__init__.c @@ -50,7 +50,7 @@ //| Layer //| Text //| -//| .. function:: render(x0, y0, x1, y1, layers, buffer, display) +//| .. function:: render(x0, y0, x1, y1, layers, buffer, display[, scale]) //| //| Render and send to the display a fragment of the screen. //| @@ -61,6 +61,7 @@ //| :param list layers: A list of the :py:class:`~_stage.Layer` objects. //| :param bytearray buffer: A buffer to use for rendering. //| :param ~displayio.Display display: The display to use. +//| :param int scale: How many times should the image be scaled up. //| //| There are also no sanity checks, outside of the basic overflow //| checking. The caller is responsible for making the passed parameters @@ -89,6 +90,10 @@ STATIC mp_obj_t stage_render(size_t n_args, const mp_obj_t *args) { mp_raise_TypeError(translate("argument num/types mismatch")); } displayio_display_obj_t *display = MP_OBJ_TO_PTR(native_display); + uint8_t scale = 1; + if (n_args >= 8) { + scale = mp_obj_get_int(args[7]); + } while (!displayio_display_begin_transaction(display)) { #ifdef MICROPY_VM_HOOK_LOOP @@ -101,12 +106,15 @@ STATIC mp_obj_t stage_render(size_t n_args, const mp_obj_t *args) { area.x2 = x1; area.y2 = y1; displayio_display_set_region_to_update(display, &area); - render_stage(x0, y0, x1, y1, layers, layers_size, buffer, buffer_size, display); + + display->send(display->bus, true, &display->write_ram_command, 1); + render_stage(x0, y0, x1, y1, layers, layers_size, buffer, buffer_size, + display, scale); displayio_display_end_transaction(display); return mp_const_none; } -MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(stage_render_obj, 7, 7, stage_render); +MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(stage_render_obj, 7, 8, stage_render); STATIC const mp_rom_map_elem_t stage_module_globals_table[] = { |
