5050//| Layer
5151//| Text
5252//|
53- //| .. function:: render(x0, y0, x1, y1, layers, buffer, display)
53+ //| .. function:: render(x0, y0, x1, y1, layers, buffer, display[, scale] )
5454//|
5555//| Render and send to the display a fragment of the screen.
5656//|
6161//| :param list layers: A list of the :py:class:`~_stage.Layer` objects.
6262//| :param bytearray buffer: A buffer to use for rendering.
6363//| :param ~displayio.Display display: The display to use.
64+ //| :param int scale: How many times should the image be scaled up.
6465//|
6566//| There are also no sanity checks, outside of the basic overflow
6667//| 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) {
8990 mp_raise_TypeError (translate ("argument num/types mismatch" ));
9091 }
9192 displayio_display_obj_t * display = MP_OBJ_TO_PTR (native_display );
93+ uint8_t scale = 1 ;
94+ if (n_args >= 8 ) {
95+ scale = mp_obj_get_int (args [7 ]);
96+ }
9297
9398 while (!displayio_display_begin_transaction (display )) {
9499#ifdef MICROPY_VM_HOOK_LOOP
@@ -103,12 +108,13 @@ STATIC mp_obj_t stage_render(size_t n_args, const mp_obj_t *args) {
103108 displayio_display_set_region_to_update (display , & area );
104109
105110 display -> send (display -> bus , true, & display -> write_ram_command , 1 );
106- render_stage (x0 , y0 , x1 , y1 , layers , layers_size , buffer , buffer_size , display );
111+ render_stage (x0 , y0 , x1 , y1 , layers , layers_size , buffer , buffer_size ,
112+ display , scale );
107113 displayio_display_end_transaction (display );
108114
109115 return mp_const_none ;
110116}
111- MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN (stage_render_obj , 7 , 7 , stage_render );
117+ MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN (stage_render_obj , 7 , 8 , stage_render );
112118
113119
114120STATIC const mp_rom_map_elem_t stage_module_globals_table [] = {
0 commit comments