From 0b9db701a1d52c8a6d63ca692619b0dde47805d1 Mon Sep 17 00:00:00 2001 From: inmarket Date: Mon, 21 Oct 2013 13:34:55 +1000 Subject: [PATCH] Fix missing case in gdispStreamStop(). Add support for controllers that need flushing. Add both automatic and manual flushing (via the gdispFlush() method) --- demos/modules/gdisp/gdisp_streaming/gfxconf.h | 1 + demos/modules/gdisp/gdisp_streaming/main.c | 3 + drivers/multiple/Win32/gdisp_lld.c | 9 + drivers/multiple/Win32/gdisp_lld_config.h | 4 + gfxconf.example.h | 1 + include/gdisp/gdisp.h | 21 ++ include/gdisp/lld/gdisp_lld.h | 84 ++++--- include/gdisp/options.h | 14 ++ src/gdisp/gdisp.c | 205 +++++++----------- 9 files changed, 194 insertions(+), 148 deletions(-) diff --git a/demos/modules/gdisp/gdisp_streaming/gfxconf.h b/demos/modules/gdisp/gdisp_streaming/gfxconf.h index 72bb0618..4db07fb9 100644 --- a/demos/modules/gdisp/gdisp_streaming/gfxconf.h +++ b/demos/modules/gdisp/gdisp_streaming/gfxconf.h @@ -19,6 +19,7 @@ #define GFX_USE_GMISC TRUE /* Features for the GDISP sub-system. */ +#define GDISP_NEED_AUTOFLUSH FALSE #define GDISP_NEED_VALIDATION TRUE #define GDISP_NEED_CLIP FALSE #define GDISP_NEED_TEXT FALSE diff --git a/demos/modules/gdisp/gdisp_streaming/main.c b/demos/modules/gdisp/gdisp_streaming/main.c index 41b900c3..774ee833 100644 --- a/demos/modules/gdisp/gdisp_streaming/main.c +++ b/demos/modules/gdisp/gdisp_streaming/main.c @@ -106,6 +106,9 @@ int main(void) { } gdispStreamStop(); + // Force a display update if the controller supports it + gdispFlush(); + // Calculate the new frame size (note this is a drawing optimisation only) minx = ballx - radius; miny = bally - radius; maxx = minx + ballcx; maxy = miny + ballcy; diff --git a/drivers/multiple/Win32/gdisp_lld.c b/drivers/multiple/Win32/gdisp_lld.c index 6c2e7f33..011f8e74 100644 --- a/drivers/multiple/Win32/gdisp_lld.c +++ b/drivers/multiple/Win32/gdisp_lld.c @@ -457,6 +457,15 @@ LLDSPEC bool_t gdisp_lld_init(GDisplay *g) { return TRUE; } +#if GDISP_HARDWARE_FLUSH + LLDSPEC void gdisp_lld_flush(GDisplay *g) { + winPriv * priv; + + priv = g->priv; + UpdateWindow(priv->hwnd); + } +#endif + #if GDISP_HARDWARE_DRAWPIXEL LLDSPEC void gdisp_lld_draw_pixel(GDisplay *g) { winPriv * priv; diff --git a/drivers/multiple/Win32/gdisp_lld_config.h b/drivers/multiple/Win32/gdisp_lld_config.h index 5720eaed..f6544eb4 100644 --- a/drivers/multiple/Win32/gdisp_lld_config.h +++ b/drivers/multiple/Win32/gdisp_lld_config.h @@ -22,6 +22,10 @@ /* Driver hardware support. */ /*===========================================================================*/ +// Calling gdispGFlush() is optional for this driver but can be used by the +// application to force a display update. eg after streaming. + +#define GDISP_HARDWARE_FLUSH TRUE #define GDISP_HARDWARE_DRAWPIXEL TRUE #define GDISP_HARDWARE_FILLS TRUE #define GDISP_HARDWARE_PIXELREAD TRUE diff --git a/gfxconf.example.h b/gfxconf.example.h index 44a8ecd2..958d35da 100644 --- a/gfxconf.example.h +++ b/gfxconf.example.h @@ -34,6 +34,7 @@ #define GFX_USE_GMISC FALSE /* Features for the GDISP subsystem */ +#define GDISP_NEED_AUTOFLUSH FALSE #define GDISP_NEED_VALIDATION TRUE #define GDISP_NEED_CLIP TRUE #define GDISP_NEED_TEXT TRUE diff --git a/include/gdisp/gdisp.h b/include/gdisp/gdisp.h index 0c8310bb..006fa08b 100644 --- a/include/gdisp/gdisp.h +++ b/include/gdisp/gdisp.h @@ -395,6 +395,27 @@ void gdispSetDisplay(GDisplay *g); /* Drawing Functions */ +/** + * @brief Flush current drawing operations to the display + * @note Some low level drivers do not update the display until + * the display is flushed. For others it is optional but can + * help prevent tearing effects. For some it is ignored. + * Calling it at the end of a logic set of drawing operations + * in your application will ensure controller portability. If you + * know your controller does not need to be flushed there is no + * need to call it (which is in reality most controllers). + * @note Even for displays that require flushing, there is no need to + * call this function if GDISP_NEED_AUTOFLUSH is TRUE. + * Calling it again won't hurt though. + * + * + * @param[in] display The display number (0..n) + * + * @api + */ +void gdispGFlush(GDisplay *g); +#define gdispFlush() gdispGFlush(GDISP) + /** * @brief Clear the display to the specified color. * diff --git a/include/gdisp/lld/gdisp_lld.h b/include/gdisp/lld/gdisp_lld.h index 442e9b6d..b5d9c699 100644 --- a/include/gdisp/lld/gdisp_lld.h +++ b/include/gdisp/lld/gdisp_lld.h @@ -34,6 +34,17 @@ * @name GDISP hardware accelerated support * @{ */ + /** + * @brief The display hardware can benefit from being flushed. + * @details Can be set to TRUE, FALSE or HARDWARE_AUTODETECT + * + * @note HARDWARE_AUTODETECT is only meaningful when GDISP_TOTAL_CONTROLLERS > 1 + * @note Some controllers ** require ** the application to flush + */ + #ifndef GDISP_HARDWARE_FLUSH + #define GDISP_HARDWARE_FLUSH HARDWARE_DEFAULT + #endif + /** * @brief Hardware streaming writing is supported. * @details Can be set to TRUE, FALSE or HARDWARE_AUTODETECT @@ -247,6 +258,18 @@ struct GDisplay { */ LLDSPEC bool_t gdisp_lld_init(GDisplay *g); + #if GDISP_HARDWARE_FLUSH || defined(__DOXYGEN__) + /** + * @brief Flush the current drawing operations to the display + * @pre GDISP_HARDWARE_FLUSH is TRUE + * + * @param[in] g The driver structure + * + * @note The parameter variables must not be altered by the driver. + */ + LLDSPEC void gdisp_lld_flush(GDisplay *g); + #endif + #if GDISP_HARDWARE_STREAM_WRITE || defined(__DOXYGEN__) /** * @brief Start a streamed write operation @@ -495,6 +518,7 @@ struct GDisplay { void (*control)(GDisplay *g); // Uses p.x (=what) p.ptr (=value) void *(*query)(GDisplay *g); // Uses p.x (=what); void (*setclip)(GDisplay *g); // Uses p.x,p.y p.cx,p.cy + void (*flush)(GDisplay *g); // Uses no parameters } GDISPVMT; #if defined(GDISP_DRIVER_VMT) @@ -503,6 +527,11 @@ struct GDisplay { #endif const GDISPVMT const GDISP_DRIVER_VMT[1] = {{ gdisp_lld_init, + #if GDISP_HARDWARE_FLUSH + gdisp_lld_flush, + #else + 0, + #endif #if GDISP_HARDWARE_STREAM_WRITE gdisp_lld_write_start, #if GDISP_HARDWARE_STREAM_POS @@ -571,6 +600,7 @@ struct GDisplay { #else #define gdisp_lld_init(g) g->vmt->init(g) + #define gdisp_lld_flush(g) g->vmt->flush(g) #define gdisp_lld_write_start(g) g->vmt->writestart(g) #define gdisp_lld_write_pos(g) g->vmt->writepos(g) #define gdisp_lld_write_color(g) g->vmt->writecolor(g) @@ -591,34 +621,34 @@ struct GDisplay { #endif // GDISP_TOTAL_CONTROLLERS > 1 - /* Verify information for packed pixels and define a non-packed pixel macro */ - #if !GDISP_PACKED_PIXELS - #define gdispPackPixels(buf,cx,x,y,c) { ((color_t *)(buf))[(y)*(cx)+(x)] = (c); } - #elif !GDISP_HARDWARE_BITFILLS - #error "GDISP: packed pixel formats are only supported for hardware accelerated drivers." - #elif GDISP_PIXELFORMAT != GDISP_PIXELFORMAT_RGB888 \ - && GDISP_PIXELFORMAT != GDISP_PIXELFORMAT_RGB444 \ - && GDISP_PIXELFORMAT != GDISP_PIXELFORMAT_RGB666 \ - && GDISP_PIXELFORMAT != GDISP_PIXELFORMAT_CUSTOM - #error "GDISP: A packed pixel format has been specified for an unsupported pixel format." - #endif +/* Verify information for packed pixels and define a non-packed pixel macro */ +#if !GDISP_PACKED_PIXELS + #define gdispPackPixels(buf,cx,x,y,c) { ((color_t *)(buf))[(y)*(cx)+(x)] = (c); } +#elif !GDISP_HARDWARE_BITFILLS + #error "GDISP: packed pixel formats are only supported for hardware accelerated drivers." +#elif GDISP_PIXELFORMAT != GDISP_PIXELFORMAT_RGB888 \ + && GDISP_PIXELFORMAT != GDISP_PIXELFORMAT_RGB444 \ + && GDISP_PIXELFORMAT != GDISP_PIXELFORMAT_RGB666 \ + && GDISP_PIXELFORMAT != GDISP_PIXELFORMAT_CUSTOM + #error "GDISP: A packed pixel format has been specified for an unsupported pixel format." +#endif - /* Support routine for packed pixel formats */ - #if !defined(gdispPackPixels) || defined(__DOXYGEN__) - /** - * @brief Pack a pixel into a pixel buffer. - * @note This function performs no buffer boundary checking - * regardless of whether GDISP_NEED_CLIP has been specified. - * - * @param[in] buf The buffer to put the pixel in - * @param[in] cx The width of a pixel line - * @param[in] x, y The location of the pixel to place - * @param[in] color The color to put into the buffer - * - * @api - */ - void gdispPackPixels(const pixel_t *buf, coord_t cx, coord_t x, coord_t y, color_t color); - #endif +/* Support routine for packed pixel formats */ +#if !defined(gdispPackPixels) || defined(__DOXYGEN__) + /** + * @brief Pack a pixel into a pixel buffer. + * @note This function performs no buffer boundary checking + * regardless of whether GDISP_NEED_CLIP has been specified. + * + * @param[in] buf The buffer to put the pixel in + * @param[in] cx The width of a pixel line + * @param[in] x, y The location of the pixel to place + * @param[in] color The color to put into the buffer + * + * @api + */ + void gdispPackPixels(const pixel_t *buf, coord_t cx, coord_t x, coord_t y, color_t color); +#endif #endif /* GFX_USE_GDISP */ diff --git a/include/gdisp/options.h b/include/gdisp/options.h index 9af7788f..72fe2038 100644 --- a/include/gdisp/options.h +++ b/include/gdisp/options.h @@ -20,6 +20,20 @@ * @name GDISP Functionality to be included * @{ */ + /** + * @brief Should drawing operations be automatically flushed. + * @details Defaults to FALSE + * @note If set to FALSE and the controller requires flushing + * then the application must manually call @p gdispGFlush(). + * Setting this to TRUE causes GDISP to automatically flush + * after each drawing operation. Note this may be slow but enables + * an application to avoid having to manually call the flush routine. + * @note Most controllers don't need flushing which is why this is set to + * FALSE by default. + */ + #ifndef GDISP_NEED_AUTOFLUSH + #define GDISP_NEED_AUTOFLUSH FALSE + #endif /** * @brief Should all operations be clipped to the screen and colors validated. * @details Defaults to TRUE. diff --git a/src/gdisp/gdisp.c b/src/gdisp/gdisp.c index 66cd59fd..172cddcc 100644 --- a/src/gdisp/gdisp.c +++ b/src/gdisp/gdisp.c @@ -94,6 +94,27 @@ GDisplay *GDISP = GDisplayArray; } #endif +#if GDISP_NEED_AUTOFLUSH && GDISP_HARDWARE_FLUSH == HARDWARE_AUTODETECT + #define autoflush_stopdone(g) if (g->vmt->flush) gdisp_lld_flush(g) +#elif GDISP_NEED_AUTOFLUSH && GDISP_HARDWARE_FLUSH + #define autoflush_stopdone(g) gdisp_lld_flush(g) +#else + #define autoflush_stopdone(g) +#endif + +#if GDISP_HARDWARE_STREAM_POS && GDISP_HARDWARE_STREAM_WRITE + #define autoflush(g) \ + { \ + if ((g->flags & GDISP_FLG_SCRSTREAM)) { \ + gdisp_lld_write_stop(g); \ + g->flags &= ~GDISP_FLG_SCRSTREAM; \ + } + autoflush_stopdone(g); + } +#else + #define autoflush(g) autoflush_stopdone(g) +#endif + // drawpixel(g) // Parameters: x,y // Alters: cx, cy (if using streaming) @@ -551,11 +572,18 @@ void _gdispInit(void) { #if GDISP_STARTUP_LOGO_TIMEOUT > 0 StatupLogoDisplay(g); #endif + #if !GDISP_NEED_AUTOFLUSH && GDISP_HARDWARE_FLUSH + gdispGFlush(g); + #endif } #if GDISP_STARTUP_LOGO_TIMEOUT > 0 gfxSleepMilliseconds(GDISP_STARTUP_LOGO_TIMEOUT); - for(g = GDisplayArray, i = 0; i < GDISP_TOTAL_DISPLAYS; g++, i++) + for(g = GDisplayArray, i = 0; i < GDISP_TOTAL_DISPLAYS; g++, i++) { gdispGClear(g, GDISP_STARTUP_COLOR); + #if !GDISP_NEED_AUTOFLUSH && GDISP_HARDWARE_FLUSH + gdispGFlush(g); + #endif + } #endif } @@ -569,6 +597,21 @@ void gdispSetDisplay(GDisplay *g) { if (g) GDISP = g; } +void gdispGFlush(GDisplay *g) { + #if GDISP_HARDWARE_FLUSH + #if GDISP_HARDWARE_FLUSH == HARDWARE_AUTODETECT + if (g->vmt->flush) + #endif + { + MUTEX_ENTER(g); + gdisp_lld_flush(g); + MUTEX_EXIT(g); + } + #else + (void) g; + #endif +} + #if GDISP_NEED_STREAMING void gdispGStreamStart(GDisplay *g, coord_t x, coord_t y, coord_t cx, coord_t cy) { MUTEX_ENTER(g); @@ -766,6 +809,7 @@ void gdispSetDisplay(GDisplay *g) { #endif { gdisp_lld_write_stop(g); + autoflush_stopdone(g); MUTEX_EXIT(g); return; } @@ -782,6 +826,7 @@ void gdispSetDisplay(GDisplay *g) { g->p.ptr = (void *)g->linebuf; gdisp_lld_blit_area(g); } + autoflush_stopdone(g); MUTEX_EXIT(g); return; } @@ -799,10 +844,18 @@ void gdispSetDisplay(GDisplay *g) { else gdisp_lld_fill_area(g); } + autoflush_stopdone(g); MUTEX_EXIT(g); return; } #endif + + #if GDISP_HARDWARE_STREAM_WRITE != TRUE && (GDISP_LINEBUF_SIZE == 0 || GDISP_HARDWARE_BITFILLS != TRUE) && GDISP_HARDWARE_FILLS != TRUE + { + autoflush_stopdone(g); + MUTEX_EXIT(g); + } + #endif } #endif @@ -812,12 +865,7 @@ void gdispGDrawPixel(GDisplay *g, coord_t x, coord_t y, color_t color) { g->p.y = y; g->p.color = color; drawpixel_clip(g); - #if GDISP_HARDWARE_STREAM_POS && GDISP_HARDWARE_STREAM_WRITE - if ((g->flags & GDISP_FLG_SCRSTREAM)) { - gdisp_lld_write_stop(g); - g->flags &= ~GDISP_FLG_SCRSTREAM; - } - #endif + autoflush(g); MUTEX_EXIT(g); } @@ -829,12 +877,7 @@ void gdispGDrawLine(GDisplay *g, coord_t x0, coord_t y0, coord_t x1, coord_t y1, g->p.y1 = y1; g->p.color = color; line_clip(g); - #if GDISP_HARDWARE_STREAM_POS && GDISP_HARDWARE_STREAM_WRITE - if ((g->flags & GDISP_FLG_SCRSTREAM)) { - gdisp_lld_write_stop(g); - g->flags &= ~GDISP_FLG_SCRSTREAM; - } - #endif + autoflush(g); MUTEX_EXIT(g); } @@ -850,6 +893,7 @@ void gdispGClear(GDisplay *g, color_t color) { { g->p.color = color; gdisp_lld_clear(g); + autoflush_stopdone(g); MUTEX_EXIT(g); return; } @@ -866,6 +910,7 @@ void gdispGClear(GDisplay *g, color_t color) { g->p.cy = g->g.Height; g->p.color = color; gdisp_lld_fill_area(g); + autoflush_stopdone(g); MUTEX_EXIT(g); return; } @@ -895,6 +940,7 @@ void gdispGClear(GDisplay *g, color_t color) { for(; area; area--) gdisp_lld_write_color(g); gdisp_lld_write_stop(g); + autoflush_stopdone(g); MUTEX_EXIT(g); return; } @@ -911,6 +957,7 @@ void gdispGClear(GDisplay *g, color_t color) { for(g->p.y = 0; g->p.y < g->g.Height; g->p.y++) for(g->p.x = 0; g->p.x < g->g.Width; g->p.x++) gdisp_lld_draw_pixel(g); + autoflush_stopdone(g); MUTEX_EXIT(g); return; } @@ -927,6 +974,7 @@ void gdispGFillArea(GDisplay *g, coord_t x, coord_t y, coord_t cx, coord_t cy, c TEST_CLIP_AREA(g) { fillarea(g); } + autoflush_stopdone(g); MUTEX_EXIT(g); } @@ -963,6 +1011,7 @@ void gdispGBlitArea(GDisplay *g, coord_t x, coord_t y, coord_t cx, coord_t cy, c g->p.x2 = srccx; g->p.ptr = (void *)buffer; gdisp_lld_blit_area(g); + autoflush_stopdone(g); MUTEX_EXIT(g); return; } @@ -998,6 +1047,7 @@ void gdispGBlitArea(GDisplay *g, coord_t x, coord_t y, coord_t cx, coord_t cy, c } } gdisp_lld_write_stop(g); + autoflush_stopdone(g); MUTEX_EXIT(g); return; } @@ -1032,6 +1082,7 @@ void gdispGBlitArea(GDisplay *g, coord_t x, coord_t y, coord_t cx, coord_t cy, c } } } + autoflush_stopdone(g); MUTEX_EXIT(g); return; } @@ -1056,6 +1107,7 @@ void gdispGBlitArea(GDisplay *g, coord_t x, coord_t y, coord_t cx, coord_t cy, c gdisp_lld_draw_pixel(g); } } + autoflush_stopdone(g); MUTEX_EXIT(g); return; } @@ -1136,12 +1188,7 @@ void gdispGBlitArea(GDisplay *g, coord_t x, coord_t y, coord_t cx, coord_t cy, c g->p.x = x - a; g->p.y = y + b; drawpixel_clip(g); g->p.x = x - a; g->p.y = y - b; drawpixel_clip(g); - #if GDISP_HARDWARE_STREAM_POS && GDISP_HARDWARE_STREAM_WRITE - if ((g->flags & GDISP_FLG_SCRSTREAM)) { - gdisp_lld_write_stop(g); - g->flags &= ~GDISP_FLG_SCRSTREAM; - } - #endif + autoflush(g); MUTEX_EXIT(g); } #endif @@ -1177,12 +1224,7 @@ void gdispGBlitArea(GDisplay *g, coord_t x, coord_t y, coord_t cx, coord_t cy, c g->p.y = y+a; g->p.x = x-b; g->p.x1 = x+b; hline_clip(g); g->p.y = y-a; g->p.x = x-b; g->p.x1 = x+b; hline_clip(g); - #if GDISP_HARDWARE_STREAM_POS && GDISP_HARDWARE_STREAM_WRITE - if ((g->flags & GDISP_FLG_SCRSTREAM)) { - gdisp_lld_write_stop(g); - g->flags &= ~GDISP_FLG_SCRSTREAM; - } - #endif + autoflush(g); MUTEX_EXIT(g); } #endif @@ -1221,12 +1263,7 @@ void gdispGBlitArea(GDisplay *g, coord_t x, coord_t y, coord_t cx, coord_t cy, c } } while(dy >= 0); - #if GDISP_HARDWARE_STREAM_POS && GDISP_HARDWARE_STREAM_WRITE - if ((g->flags & GDISP_FLG_SCRSTREAM)) { - gdisp_lld_write_stop(g); - g->flags &= ~GDISP_FLG_SCRSTREAM; - } - #endif + autoflush(g); MUTEX_EXIT(g); } #endif @@ -1263,12 +1300,7 @@ void gdispGBlitArea(GDisplay *g, coord_t x, coord_t y, coord_t cx, coord_t cy, c } } while(dy >= 0); - #if GDISP_HARDWARE_STREAM_POS && GDISP_HARDWARE_STREAM_WRITE - if ((g->flags & GDISP_FLG_SCRSTREAM)) { - gdisp_lld_write_stop(g); - g->flags &= ~GDISP_FLG_SCRSTREAM; - } - #endif + autoflush(g); MUTEX_EXIT(g); } #endif @@ -1336,12 +1368,7 @@ void gdispGBlitArea(GDisplay *g, coord_t x, coord_t y, coord_t cx, coord_t cy, c if (full & 0x03) { g->p.x = x+a; g->p.y = y-b; drawpixel_clip(g); } if (full & 0x30) { g->p.x = x-a; g->p.y = y+b; drawpixel_clip(g); } if (full == 0xFF) { - #if GDISP_HARDWARE_STREAM_POS && GDISP_HARDWARE_STREAM_WRITE - if ((g->flags & GDISP_FLG_SCRSTREAM)) { - gdisp_lld_write_stop(g); - g->flags &= ~GDISP_FLG_SCRSTREAM; - } - #endif + autoflush(g); MUTEX_EXIT; return; } @@ -1458,12 +1485,7 @@ void gdispGBlitArea(GDisplay *g, coord_t x, coord_t y, coord_t cx, coord_t cy, c { g->p.x = x-a; g->p.y = y+b; drawpixel_clip(g); } } - #if GDISP_HARDWARE_STREAM_POS && GDISP_HARDWARE_STREAM_WRITE - if ((g->flags & GDISP_FLG_SCRSTREAM)) { - gdisp_lld_write_stop(g); - g->flags &= ~GDISP_FLG_SCRSTREAM; - } - #endif + autoflush(g); MUTEX_EXIT(g); } #endif @@ -1961,12 +1983,7 @@ void gdispGBlitArea(GDisplay *g, coord_t x, coord_t y, coord_t cx, coord_t cy, c break; } - #if GDISP_HARDWARE_STREAM_POS && GDISP_HARDWARE_STREAM_WRITE - if ((g->flags & GDISP_FLG_SCRSTREAM)) { - gdisp_lld_write_stop(g); - g->flags &= ~GDISP_FLG_SCRSTREAM; - } - #endif + autoflush(g); MUTEX_EXIT(g); } @@ -2246,6 +2263,7 @@ void gdispGBlitArea(GDisplay *g, coord_t x, coord_t y, coord_t cx, coord_t cy, c g->p.cy = abslines; g->p.color = bgcolor; fillarea(g); + autoflush_stopdone(g); MUTEX_EXIT(g); } #endif @@ -2354,12 +2372,7 @@ void gdispGDrawBox(GDisplay *g, coord_t x, coord_t y, coord_t cx, coord_t cy, co } } - #if GDISP_HARDWARE_STREAM_POS && GDISP_HARDWARE_STREAM_WRITE - if ((g->flags & GDISP_FLG_SCRSTREAM)) { - gdisp_lld_write_stop(g); - g->flags &= ~GDISP_FLG_SCRSTREAM; - } - #endif + autoflush(g); MUTEX_EXIT(g); } @@ -2376,12 +2389,7 @@ void gdispGDrawBox(GDisplay *g, coord_t x, coord_t y, coord_t cx, coord_t cy, co } g->p.x=tx+p->x; g->p.y=ty+p->y; g->p.x1=tx+pntarray->x; g->p.y1=ty+pntarray->y; line_clip(g); - #if GDISP_HARDWARE_STREAM_POS && GDISP_HARDWARE_STREAM_WRITE - if ((g->flags & GDISP_FLG_SCRSTREAM)) { - gdisp_lld_write_stop(g); - g->flags &= ~GDISP_FLG_SCRSTREAM; - } - #endif + autoflush(g); MUTEX_EXIT(g); } @@ -2441,12 +2449,7 @@ void gdispGDrawBox(GDisplay *g, coord_t x, coord_t y, coord_t cx, coord_t cy, co } if (!cnt) { - #if GDISP_HARDWARE_STREAM_POS && GDISP_HARDWARE_STREAM_WRITE - if ((g->flags & GDISP_FLG_SCRSTREAM)) { - gdisp_lld_write_stop(g); - g->flags &= ~GDISP_FLG_SCRSTREAM; - } - #endif + autoflush(g); MUTEX_EXIT(g); return; } @@ -2456,12 +2459,7 @@ void gdispGDrawBox(GDisplay *g, coord_t x, coord_t y, coord_t cx, coord_t cy, co if (ymax == lpnt->y) { for (lpnt = lpnt <= pntarray ? epnts : lpnt-1; lpnt->y == y; cnt--) { if (!cnt) { - #if GDISP_HARDWARE_STREAM_POS && GDISP_HARDWARE_STREAM_WRITE - if ((g->flags & GDISP_FLG_SCRSTREAM)) { - gdisp_lld_write_stop(g); - g->flags &= ~GDISP_FLG_SCRSTREAM; - } - #endif + autoflush(g); MUTEX_EXIT(g); return; } @@ -2472,12 +2470,7 @@ void gdispGDrawBox(GDisplay *g, coord_t x, coord_t y, coord_t cx, coord_t cy, co } else { for (rpnt = rpnt >= epnts ? pntarray : rpnt+1; rpnt->y == y; cnt--) { if (!cnt) { - #if GDISP_HARDWARE_STREAM_POS && GDISP_HARDWARE_STREAM_WRITE - if ((g->flags & GDISP_FLG_SCRSTREAM)) { - gdisp_lld_write_stop(g); - g->flags &= ~GDISP_FLG_SCRSTREAM; - } - #endif + autoflush(g); MUTEX_EXIT(g); return; } @@ -2561,12 +2554,7 @@ void gdispGDrawBox(GDisplay *g, coord_t x, coord_t y, coord_t cx, coord_t cy, co g->t.clipy1 = y + font->height; g->t.color = color; mf_render_character(font, x, y, c, drawcharline, g); - #if GDISP_HARDWARE_STREAM_POS && GDISP_HARDWARE_STREAM_WRITE - if ((g->flags & GDISP_FLG_SCRSTREAM)) { - gdisp_lld_write_stop(g); - g->flags &= ~GDISP_FLG_SCRSTREAM; - } - #endif + autoflush(g); MUTEX_EXIT(g); } @@ -2586,12 +2574,7 @@ void gdispGDrawBox(GDisplay *g, coord_t x, coord_t y, coord_t cx, coord_t cy, co fillarea(g); mf_render_character(font, x, y, c, fillcharline, g); } - #if GDISP_HARDWARE_STREAM_POS && GDISP_HARDWARE_STREAM_WRITE - if ((g->flags & GDISP_FLG_SCRSTREAM)) { - gdisp_lld_write_stop(g); - g->flags &= ~GDISP_FLG_SCRSTREAM; - } - #endif + autoflush(g); MUTEX_EXIT(g); } @@ -2605,12 +2588,7 @@ void gdispGDrawBox(GDisplay *g, coord_t x, coord_t y, coord_t cx, coord_t cy, co g->t.color = color; mf_render_aligned(font, x+font->baseline_x, y, MF_ALIGN_LEFT, str, 0, drawcharglyph, g); - #if GDISP_HARDWARE_STREAM_POS && GDISP_HARDWARE_STREAM_WRITE - if ((g->flags & GDISP_FLG_SCRSTREAM)) { - gdisp_lld_write_stop(g); - g->flags &= ~GDISP_FLG_SCRSTREAM; - } - #endif + autoflush(g); MUTEX_EXIT(g); } @@ -2631,12 +2609,7 @@ void gdispGDrawBox(GDisplay *g, coord_t x, coord_t y, coord_t cx, coord_t cy, co mf_render_aligned(font, x+font->baseline_x, y, MF_ALIGN_LEFT, str, 0, fillcharglyph, g); } - #if GDISP_HARDWARE_STREAM_POS && GDISP_HARDWARE_STREAM_WRITE - if ((g->flags & GDISP_FLG_SCRSTREAM)) { - gdisp_lld_write_stop(g); - g->flags &= ~GDISP_FLG_SCRSTREAM; - } - #endif + autoflush(g); MUTEX_EXIT(g); } @@ -2665,12 +2638,7 @@ void gdispGDrawBox(GDisplay *g, coord_t x, coord_t y, coord_t cx, coord_t cy, co mf_render_aligned(font, x, y, justify, str, 0, drawcharglyph, g); - #if GDISP_HARDWARE_STREAM_POS && GDISP_HARDWARE_STREAM_WRITE - if ((g->flags & GDISP_FLG_SCRSTREAM)) { - gdisp_lld_write_stop(g); - g->flags &= ~GDISP_FLG_SCRSTREAM; - } - #endif + autoflush(g); MUTEX_EXIT(g); } @@ -2709,12 +2677,7 @@ void gdispGDrawBox(GDisplay *g, coord_t x, coord_t y, coord_t cx, coord_t cy, co mf_render_aligned(font, x, y, justify, str, 0, fillcharglyph, g); } - #if GDISP_HARDWARE_STREAM_POS && GDISP_HARDWARE_STREAM_WRITE - if ((g->flags & GDISP_FLG_SCRSTREAM)) { - gdisp_lld_write_stop(g); - g->flags &= ~GDISP_FLG_SCRSTREAM; - } - #endif + autoflush(g); MUTEX_EXIT(g); }