From 34ebf1e6e0a67df47191a3a4db7c880d3756fe92 Mon Sep 17 00:00:00 2001 From: Gabriel Ozouf Date: Wed, 12 Aug 2020 10:16:28 +0200 Subject: [PATCH] [python/kandinsky] Remove additional interrupt Additional checks for interruptions were making the kandinsky module slower. /!\ Some scripts are now very difficult to interrupt Change-Id: I4c18273d8895deaac68084411a52556c8459d52b --- python/port/mod/kandinsky/modkandinsky.cpp | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/python/port/mod/kandinsky/modkandinsky.cpp b/python/port/mod/kandinsky/modkandinsky.cpp index cf1b326d3..f6f797bc7 100644 --- a/python/port/mod/kandinsky/modkandinsky.cpp +++ b/python/port/mod/kandinsky/modkandinsky.cpp @@ -62,16 +62,6 @@ mp_obj_t modkandinsky_draw_string(size_t n_args, const mp_obj_t * args) { KDColor backgroundColor = (n_args >= 5) ? MicroPython::Color::Parse(args[4]) : KDColorWhite; MicroPython::ExecutionEnvironment::currentExecutionEnvironment()->displaySandbox(); KDIonContext::sharedContext()->drawString(text, point, KDFont::LargeFont, textColor, backgroundColor); - /* Before and after execution of "modkandinsky_draw_string", - * "micropython_port_vm_hook_loop" is called by "mp_execute_bytecode" and will - * call "micropython_port_interrupt_if_needed" every 20000 calls. - * However, "drawString" function might take some time to execute leading to - * drastically decrease the frequency of calls to - * "micropython_port_vm_hook_loop" and thus to - * "micropython_port_interrupt_if_needed". So we add an extra - * check for user interruption here. This way the user can still interrupt an - * infinite loop calling 'drawString' for instance. */ - micropython_port_interrupt_if_needed(); return mp_const_none; } @@ -92,7 +82,5 @@ mp_obj_t modkandinsky_fill_rect(size_t n_args, const mp_obj_t * args) { KDColor color = MicroPython::Color::Parse(args[4]); MicroPython::ExecutionEnvironment::currentExecutionEnvironment()->displaySandbox(); KDIonContext::sharedContext()->fillRect(rect, color); - // Cf comment on modkandinsky_draw_string - micropython_port_interrupt_if_needed(); return mp_const_none; }