From 9d62e631cf143d4ed50d66fc157a24370cd5489a Mon Sep 17 00:00:00 2001 From: inmarket Date: Wed, 8 Jul 2015 13:34:53 +1000 Subject: Allow a zero sized clipping region --- src/gdisp/gdisp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/gdisp/gdisp.c b/src/gdisp/gdisp.c index 86931952..377ccddb 100644 --- a/src/gdisp/gdisp.c +++ b/src/gdisp/gdisp.c @@ -1259,7 +1259,7 @@ void gdispGBlitArea(GDisplay *g, coord_t x, coord_t y, coord_t cx, coord_t cy, c { if (x < 0) { cx += x; x = 0; } if (y < 0) { cy += y; y = 0; } - if (cx <= 0 || cy <= 0 || x >= g->g.Width || y >= g->g.Height) { MUTEX_EXIT(g); return; } + if (cx <= 0 || cy <= 0 || x >= g->g.Width || y >= g->g.Height) { x = y = cx = cy = 0; } g->clipx0 = x; g->clipy0 = y; g->clipx1 = x+cx; if (g->clipx1 > g->g.Width) g->clipx1 = g->g.Width; -- cgit v1.2.3 From 8318e8dc29c571f56742df6ea81d2f8298127826 Mon Sep 17 00:00:00 2001 From: inmarket Date: Wed, 8 Jul 2015 13:53:54 +1000 Subject: Provide better access to compiler optimisations for the raw scheduler --- src/gos/gos_arduino.c | 11 ++++++----- src/gos/gos_options.h | 12 ++++++++++++ src/gos/gos_raw32.c | 9 +++++---- 3 files changed, 23 insertions(+), 9 deletions(-) (limited to 'src') diff --git a/src/gos/gos_arduino.c b/src/gos/gos_arduino.c index 0c01a30c..380d528a 100644 --- a/src/gos/gos_arduino.c +++ b/src/gos/gos_arduino.c @@ -229,18 +229,19 @@ void gfxSleepMicroseconds(delaytime_t ms) { * For those it doesn't - read the compiler manuals and the library source code to * work out the correct macro values. * You can use the debugger to work out the values for your compiler and put them here. - * Defining these macros as constant values makes the system behaviour guaranteed but also - * makes your code compiler and cpu architecture dependant. + * Defining these macros as constant values makes the system behavior guaranteed but also + * makes your code compiler and cpu architecture dependent. It also saves a heap of code + * and a few bytes of RAM. */ -#if 0 - // Define your compiler constant values here. - // These example values are for mingw32 compiler (x86). +#if GFX_COMPILER == GFX_COMPILER_MINGW32 #define AUTO_DETECT_MASK FALSE #define STACK_DIR_UP FALSE #define MASK1 0x00000011 #define MASK2 0x00000000 #define STACK_BASE 12 #else + // Use auto-detection of the stack frame format + // Assumes all the relevant stuff to be relocated is in the first 256 bytes of the jmpbuf. #define AUTO_DETECT_MASK TRUE #define STACK_DIR_UP stackdirup // TRUE if the stack grow up instead of down #define MASK1 jmpmask1 // The 1st mask of jmp_buf elements that need relocation diff --git a/src/gos/gos_options.h b/src/gos/gos_options.h index 2f896508..8fb4f51b 100644 --- a/src/gos/gos_options.h +++ b/src/gos/gos_options.h @@ -82,6 +82,18 @@ * @name GOS Optional Parameters * @{ */ + /** + * @brief Enable compiler specific code + * @details Defaults to GFX_COMPILER_UNKNOWN + * @note This is setting enables optimisations that are compiler specific. It does + * not need to be specified as reasonable defaults and various auto-detection + * will happen as required. + */ + #ifndef GFX_COMPILER + #define GFX_COMPILER GFX_COMPILER_UNKNOWN + #endif + #define GFX_COMPILER_UNKNOWN 0 // Unknown compiler + #define GFX_COMPILER_MINGW32 1 // MingW32 (x86) compiler for windows /** * @brief Should uGFX avoid initializing the operating system * @details Defaults to FALSE diff --git a/src/gos/gos_raw32.c b/src/gos/gos_raw32.c index 71d8be08..f1ff6c45 100644 --- a/src/gos/gos_raw32.c +++ b/src/gos/gos_raw32.c @@ -438,17 +438,18 @@ void gfxSleepMicroseconds(delaytime_t ms) { * work out the correct macro values. * You can use the debugger to work out the values for your compiler and put them here. * Defining these macros as constant values makes the system behavior guaranteed but also - * makes your code compiler and cpu architecture dependent. + * makes your code compiler and cpu architecture dependent. It also saves a heap of code + * and a few bytes of RAM. */ -#if 0 - // Define your compiler constant values here. - // These example values are for mingw32 compiler (x86). +#if GFX_COMPILER == GFX_COMPILER_MINGW32 #define AUTO_DETECT_MASK FALSE #define STACK_DIR_UP FALSE #define MASK1 0x00000011 #define MASK2 0x00000000 #define STACK_BASE 12 #else + // Use auto-detection of the stack frame format + // Assumes all the relevant stuff to be relocated is in the first 256 bytes of the jmpbuf. #define AUTO_DETECT_MASK TRUE #define STACK_DIR_UP stackdirup // TRUE if the stack grow up instead of down #define MASK1 jmpmask1 // The 1st mask of jmp_buf elements that need relocation -- cgit v1.2.3