Rename a macro and fix some bugs
This commit is contained in:
parent
c5ceb31e73
commit
30154560b6
3 changed files with 36 additions and 46 deletions
|
@ -287,12 +287,6 @@ static DECLARE_THREAD_FUNCTION(WindowThread, param) {
|
||||||
/* Driver exported functions. */
|
/* Driver exported functions. */
|
||||||
/*===========================================================================*/
|
/*===========================================================================*/
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Low level GDISP driver initialization.
|
|
||||||
* @return TRUE if successful, FALSE on error.
|
|
||||||
*
|
|
||||||
* @notapi
|
|
||||||
*/
|
|
||||||
LLDSPEC bool_t gdisp_lld_init(GDISPDriver *g) {
|
LLDSPEC bool_t gdisp_lld_init(GDISPDriver *g) {
|
||||||
RECT rect;
|
RECT rect;
|
||||||
gfxThreadHandle hth;
|
gfxThreadHandle hth;
|
||||||
|
|
|
@ -45,8 +45,8 @@
|
||||||
* @brief Hardware streaming requires an explicit end call.
|
* @brief Hardware streaming requires an explicit end call.
|
||||||
* @details If set to @p FALSE if an explicit stream end call is not required.
|
* @details If set to @p FALSE if an explicit stream end call is not required.
|
||||||
*/
|
*/
|
||||||
#ifndef GDISP_HARDWARE_STREAM_END
|
#ifndef GDISP_HARDWARE_STREAM_STOP
|
||||||
#define GDISP_HARDWARE_STREAM_END FALSE
|
#define GDISP_HARDWARE_STREAM_STOP FALSE
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -143,6 +143,7 @@ typedef struct GDISPDriver {
|
||||||
|
|
||||||
uint16_t flags;
|
uint16_t flags;
|
||||||
#define GDISP_FLG_INSTREAM 0x0001
|
#define GDISP_FLG_INSTREAM 0x0001
|
||||||
|
#define GDISP_FLG_DRIVER 0x0002 // This flags and above are for use by the driver
|
||||||
|
|
||||||
// Multithread Mutex
|
// Multithread Mutex
|
||||||
#if GDISP_NEED_MULTITHREAD
|
#if GDISP_NEED_MULTITHREAD
|
||||||
|
@ -241,10 +242,10 @@ typedef struct GDISPDriver {
|
||||||
LLDSPEC color_t gdisp_lld_stream_read(GDISPDriver *g);
|
LLDSPEC color_t gdisp_lld_stream_read(GDISPDriver *g);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if GDISP_HARDWARE_STREAM_END || defined(__DOXYGEN__)
|
#if GDISP_HARDWARE_STREAM_STOP || defined(__DOXYGEN__)
|
||||||
/**
|
/**
|
||||||
* @brief End the current streaming operation
|
* @brief End the current streaming operation
|
||||||
* @pre GDISP_HARDWARE_STREAM and GDISP_HARDWARE_STREAM_END is TRUE
|
* @pre GDISP_HARDWARE_STREAM and GDISP_HARDWARE_STREAM_STOP is TRUE
|
||||||
*
|
*
|
||||||
* @param[in] g The driver structure
|
* @param[in] g The driver structure
|
||||||
*
|
*
|
||||||
|
@ -421,7 +422,7 @@ typedef struct GDISPDriver {
|
||||||
gdisp_lld_stream_start,
|
gdisp_lld_stream_start,
|
||||||
gdisp_lld_stream_color,
|
gdisp_lld_stream_color,
|
||||||
gdisp_lld_stream_read,
|
gdisp_lld_stream_read,
|
||||||
#if GDISP_HARDWARE_STREAM_END
|
#if GDISP_HARDWARE_STREAM_STOP
|
||||||
gdisp_lld_stream_stop,
|
gdisp_lld_stream_stop,
|
||||||
#else
|
#else
|
||||||
0,
|
0,
|
||||||
|
|
|
@ -48,9 +48,9 @@ GDISPControl *GDISP = &GDISP_DRIVER_STRUCT.g;
|
||||||
#define MUTEX_EXIT()
|
#define MUTEX_EXIT()
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if GDISP_HARDWARE_STREAM_END
|
#if GDISP_HARDWARE_STREAM_STOP
|
||||||
#define STREAM_CLEAR() if ((GC->flags & GDISP_FLG_INSTREAM)) { \
|
#define STREAM_CLEAR() if ((GC->flags & GDISP_FLG_INSTREAM)) { \
|
||||||
gdisp_lld_stream_end(GC); \
|
gdisp_lld_stream_stop(GC); \
|
||||||
GC->flags &= ~GDISP_FLG_INSTREAM; \
|
GC->flags &= ~GDISP_FLG_INSTREAM; \
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
|
@ -84,11 +84,11 @@ GDISPControl *GDISP = &GDISP_DRIVER_STRUCT.g;
|
||||||
return;
|
return;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
GC->cx = GC->cy = 1;
|
GC->p.cx = GC->p.cy = 1;
|
||||||
gdisp_lld_stream_start(GC);
|
gdisp_lld_stream_start(GC);
|
||||||
gdisp_lld_stream_color(GC);
|
gdisp_lld_stream_color(GC);
|
||||||
#if GDISP_HARDWARE_STREAM_END
|
#if GDISP_HARDWARE_STREAM_STOP
|
||||||
gdisp_lld_stream_end(GC);
|
gdisp_lld_stream_stop(GC);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -110,8 +110,8 @@ GDISPControl *GDISP = &GDISP_DRIVER_STRUCT.g;
|
||||||
gdisp_lld_stream_start(GC);
|
gdisp_lld_stream_start(GC);
|
||||||
for(; area; area--)
|
for(; area; area--)
|
||||||
gdisp_lld_stream_color(GC);
|
gdisp_lld_stream_color(GC);
|
||||||
#if GDISP_HARDWARE_STREAM_END
|
#if GDISP_HARDWARE_STREAM_STOP
|
||||||
gdisp_lld_stream_end(GC);
|
gdisp_lld_stream_stop(GC);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
|
@ -170,8 +170,8 @@ static void hline_clip(void) {
|
||||||
GC->p.cx = GC->p.cy = 1;
|
GC->p.cx = GC->p.cy = 1;
|
||||||
gdisp_lld_stream_start(GC);
|
gdisp_lld_stream_start(GC);
|
||||||
gdisp_lld_stream_color(GC);
|
gdisp_lld_stream_color(GC);
|
||||||
#if GDISP_HARDWARE_STREAM_END
|
#if GDISP_HARDWARE_STREAM_STOP
|
||||||
gdisp_lld_stream_end(GC);
|
gdisp_lld_stream_stop(GC);
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
return;
|
return;
|
||||||
|
@ -186,10 +186,11 @@ static void hline_clip(void) {
|
||||||
#elif GDISP_HARDWARE_STREAM
|
#elif GDISP_HARDWARE_STREAM
|
||||||
// Next best is streaming
|
// Next best is streaming
|
||||||
GC->p.cx = GC->p.x1 - GC->p.x;
|
GC->p.cx = GC->p.x1 - GC->p.x;
|
||||||
|
GC->p.cy = 1;
|
||||||
gdisp_lld_stream_start(GC);
|
gdisp_lld_stream_start(GC);
|
||||||
do { gdisp_lld_stream_color(GC); } while(GC->p.cx--);
|
do { gdisp_lld_stream_color(GC); } while(GC->p.cx--);
|
||||||
#if GDISP_HARDWARE_STREAM_END
|
#if GDISP_HARDWARE_STREAM_STOP
|
||||||
gdisp_lld_stream_end(GC);
|
gdisp_lld_stream_stop(GC);
|
||||||
#endif
|
#endif
|
||||||
#else
|
#else
|
||||||
// Worst is drawing pixels
|
// Worst is drawing pixels
|
||||||
|
@ -227,8 +228,8 @@ static void vline_clip(void) {
|
||||||
GC->p.cx = GC->p.cy = 1;
|
GC->p.cx = GC->p.cy = 1;
|
||||||
gdisp_lld_stream_start(GC);
|
gdisp_lld_stream_start(GC);
|
||||||
gdisp_lld_stream_color(GC);
|
gdisp_lld_stream_color(GC);
|
||||||
#if GDISP_HARDWARE_STREAM_END
|
#if GDISP_HARDWARE_STREAM_STOP
|
||||||
gdisp_lld_stream_end(GC);
|
gdisp_lld_stream_stop(GC);
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
return;
|
return;
|
||||||
|
@ -243,10 +244,11 @@ static void vline_clip(void) {
|
||||||
#elif GDISP_HARDWARE_STREAM
|
#elif GDISP_HARDWARE_STREAM
|
||||||
// Next best is streaming
|
// Next best is streaming
|
||||||
GC->p.cy = GC->p.y1 - GC->p.y;
|
GC->p.cy = GC->p.y1 - GC->p.y;
|
||||||
|
GC->p.cx = 1;
|
||||||
gdisp_lld_stream_start(GC);
|
gdisp_lld_stream_start(GC);
|
||||||
do { gdisp_lld_stream_color(GC); } while(GC->p.cy--);
|
do { gdisp_lld_stream_color(GC); } while(GC->p.cy--);
|
||||||
#if GDISP_HARDWARE_STREAM_END
|
#if GDISP_HARDWARE_STREAM_STOP
|
||||||
gdisp_lld_stream_end(GC);
|
gdisp_lld_stream_stop(GC);
|
||||||
#endif
|
#endif
|
||||||
#else
|
#else
|
||||||
// Worst is drawing pixels
|
// Worst is drawing pixels
|
||||||
|
@ -398,7 +400,7 @@ void _gdispInit(void) {
|
||||||
|
|
||||||
void gdispStreamColor(color_t color) {
|
void gdispStreamColor(color_t color) {
|
||||||
#if !GDISP_HARDWARE_STREAM && GDISP_LINEBUF_SIZE != 0 && GDISP_HARDWARE_BITFILLS
|
#if !GDISP_HARDWARE_STREAM && GDISP_LINEBUF_SIZE != 0 && GDISP_HARDWARE_BITFILLS
|
||||||
coord_t sx1, sy1, sx2;
|
coord_t sx1, sy1;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Don't touch the mutex as we should already own it
|
// Don't touch the mutex as we should already own it
|
||||||
|
@ -417,17 +419,14 @@ void _gdispInit(void) {
|
||||||
if (GC->p.cx >= GDISP_LINEBUF_SIZE) {
|
if (GC->p.cx >= GDISP_LINEBUF_SIZE) {
|
||||||
sx1 = GC->p.x1;
|
sx1 = GC->p.x1;
|
||||||
sy1 = GC->p.y1;
|
sy1 = GC->p.y1;
|
||||||
//sx2 = GC->p.x2;
|
|
||||||
GC->p.x -= GC->p.cx;
|
GC->p.x -= GC->p.cx;
|
||||||
GC->p.cy = 1;
|
GC->p.cy = 1;
|
||||||
GC->p.x1 = 0;
|
GC->p.x1 = 0;
|
||||||
GC->p.y1 = 0;
|
GC->p.y1 = 0;
|
||||||
//GC->p.x2 = GC->p.cx;
|
|
||||||
GC->p.ptr = (void *)GC->linebuf;
|
GC->p.ptr = (void *)GC->linebuf;
|
||||||
gdisp_lld_blit_area(GC);
|
gdisp_lld_blit_area(GC);
|
||||||
GC->p.x1 = sx1;
|
GC->p.x1 = sx1;
|
||||||
GC->p.y1 = sy1;
|
GC->p.y1 = sy1;
|
||||||
//GC->p.x2 = sx2;
|
|
||||||
GC->p.x += GC->p.cx;
|
GC->p.x += GC->p.cx;
|
||||||
GC->p.cx = 0;
|
GC->p.cx = 0;
|
||||||
}
|
}
|
||||||
|
@ -437,17 +436,14 @@ void _gdispInit(void) {
|
||||||
if (GC->p.cx) {
|
if (GC->p.cx) {
|
||||||
sx1 = GC->p.x1;
|
sx1 = GC->p.x1;
|
||||||
sy1 = GC->p.y1;
|
sy1 = GC->p.y1;
|
||||||
//sx2 = GC->p.x2;
|
|
||||||
GC->p.x -= GC->p.cx;
|
GC->p.x -= GC->p.cx;
|
||||||
GC->p.cy = 1;
|
GC->p.cy = 1;
|
||||||
GC->p.x1 = 0;
|
GC->p.x1 = 0;
|
||||||
GC->p.y1 = 0;
|
GC->p.y1 = 0;
|
||||||
//GC->p.x2 = GC->p.cx;
|
|
||||||
GC->p.ptr = (void *)GC->linebuf;
|
GC->p.ptr = (void *)GC->linebuf;
|
||||||
gdisp_lld_blit_area(GC);
|
gdisp_lld_blit_area(GC);
|
||||||
GC->p.x1 = sx1;
|
GC->p.x1 = sx1;
|
||||||
GC->p.y1 = sy1;
|
GC->p.y1 = sy1;
|
||||||
//GC->p.x2 = sx2;
|
|
||||||
GC->p.cx = 0;
|
GC->p.cx = 0;
|
||||||
}
|
}
|
||||||
GC->p.x = GC->p.x1;
|
GC->p.x = GC->p.x1;
|
||||||
|
@ -474,8 +470,8 @@ void _gdispInit(void) {
|
||||||
return;
|
return;
|
||||||
|
|
||||||
#if GDISP_HARDWARE_STREAM
|
#if GDISP_HARDWARE_STREAM
|
||||||
#if GDISP_HARDWARE_STREAM_END
|
#if GDISP_HARDWARE_STREAM_STOP
|
||||||
gdisp_lld_stream_end(GC);
|
gdisp_lld_stream_stop(GC);
|
||||||
#endif
|
#endif
|
||||||
#elif GDISP_LINEBUF_SIZE != 0 && GDISP_HARDWARE_BITFILLS
|
#elif GDISP_LINEBUF_SIZE != 0 && GDISP_HARDWARE_BITFILLS
|
||||||
if (GC->p.cx) {
|
if (GC->p.cx) {
|
||||||
|
@ -483,7 +479,6 @@ void _gdispInit(void) {
|
||||||
GC->p.cy = 1;
|
GC->p.cy = 1;
|
||||||
GC->p.x1 = 0;
|
GC->p.x1 = 0;
|
||||||
GC->p.y1 = 0;
|
GC->p.y1 = 0;
|
||||||
//GC->p.x2 = GC->p.cx;
|
|
||||||
GC->p.ptr = (void *)GC->linebuf;
|
GC->p.ptr = (void *)GC->linebuf;
|
||||||
gdisp_lld_blit_area(GC);
|
gdisp_lld_blit_area(GC);
|
||||||
}
|
}
|
||||||
|
@ -541,8 +536,8 @@ void gdispClear(color_t color) {
|
||||||
gdisp_lld_stream_start(GC);
|
gdisp_lld_stream_start(GC);
|
||||||
for(; area; area--)
|
for(; area; area--)
|
||||||
gdisp_lld_stream_color(GC);
|
gdisp_lld_stream_color(GC);
|
||||||
#if GDISP_HARDWARE_STREAM_END
|
#if GDISP_HARDWARE_STREAM_STOP
|
||||||
gdisp_lld_stream_end(GC);
|
gdisp_lld_stream_stop(GC);
|
||||||
#endif
|
#endif
|
||||||
#else
|
#else
|
||||||
// Worst is drawing pixels
|
// Worst is drawing pixels
|
||||||
|
@ -607,8 +602,8 @@ void gdispBlitAreaEx(coord_t x, coord_t y, coord_t cx, coord_t cy, coord_t srcx,
|
||||||
gdisp_lld_stream_color(GC);
|
gdisp_lld_stream_color(GC);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#if GDISP_HARDWARE_STREAM_END
|
#if GDISP_HARDWARE_STREAM_STOP
|
||||||
gdisp_lld_stream_end(GC);
|
gdisp_lld_stream_stop(GC);
|
||||||
#endif
|
#endif
|
||||||
#else
|
#else
|
||||||
// Worst is drawing pixels
|
// Worst is drawing pixels
|
||||||
|
@ -1532,8 +1527,8 @@ void gdispBlitAreaEx(coord_t x, coord_t y, coord_t cx, coord_t cy, coord_t srcx,
|
||||||
GC->p.cy = 1;
|
GC->p.cy = 1;
|
||||||
gdisp_lld_stream_start(GC);
|
gdisp_lld_stream_start(GC);
|
||||||
c = gdisp_lld_stream_read(GC);
|
c = gdisp_lld_stream_read(GC);
|
||||||
#if GDISP_HARDWARE_STREAM_END
|
#if GDISP_HARDWARE_STREAM_STOP
|
||||||
gdisp_lld_stream_end(GC);
|
gdisp_lld_stream_stop(GC);
|
||||||
#endif
|
#endif
|
||||||
#else
|
#else
|
||||||
// Worst is "not possible"
|
// Worst is "not possible"
|
||||||
|
@ -1607,8 +1602,8 @@ void gdispBlitAreaEx(coord_t x, coord_t y, coord_t cx, coord_t cy, coord_t srcx,
|
||||||
gdisp_lld_stream_start(GC);
|
gdisp_lld_stream_start(GC);
|
||||||
for(j=0; j < fx; j++)
|
for(j=0; j < fx; j++)
|
||||||
GC->linebuf[j] = gdisp_lld_stream_read(GC);
|
GC->linebuf[j] = gdisp_lld_stream_read(GC);
|
||||||
#if GDISP_HARDWARE_STREAM_END
|
#if GDISP_HARDWARE_STREAM_STOP
|
||||||
gdisp_lld_stream_end(GC);
|
gdisp_lld_stream_stop(GC);
|
||||||
#endif
|
#endif
|
||||||
#elif GDISP_HARDWARE_PIXELREAD
|
#elif GDISP_HARDWARE_PIXELREAD
|
||||||
// Next best is single pixel reads
|
// Next best is single pixel reads
|
||||||
|
@ -1645,8 +1640,8 @@ void gdispBlitAreaEx(coord_t x, coord_t y, coord_t cx, coord_t cy, coord_t srcx,
|
||||||
GC->p.color = GC->linebuf[j];
|
GC->p.color = GC->linebuf[j];
|
||||||
gdisp_lld_stream_color(GC);
|
gdisp_lld_stream_color(GC);
|
||||||
}
|
}
|
||||||
#if GDISP_HARDWARE_STREAM_END
|
#if GDISP_HARDWARE_STREAM_STOP
|
||||||
gdisp_lld_stream_end(GC);
|
gdisp_lld_stream_stop(GC);
|
||||||
#endif
|
#endif
|
||||||
#else
|
#else
|
||||||
// Worst is drawing pixels
|
// Worst is drawing pixels
|
||||||
|
|
Loading…
Add table
Reference in a new issue