Support dynamic displays at compile time, don't re-orient pixmaps at initialisation time.

ugfx_release_2.6
inmarket 2015-01-13 14:28:56 +10:00
parent 8745bb81cf
commit b68cfa0c29
3 changed files with 20 additions and 6 deletions

View File

@ -377,6 +377,8 @@ struct GDisplay {
typedef struct GDISPVMT {
GDriverVMT d;
#define GDISP_VFLG_DYNAMICONLY 0x0001 // This display should never be statically initialised
#define GDISP_VFLG_PIXMAP 0x0002 // This is a pixmap display
bool_t (*init)(GDisplay *g);
void (*deinit)(GDisplay *g);
void (*writestart)(GDisplay *g); // Uses p.x,p.y p.cx,p.cy
@ -709,6 +711,11 @@ typedef struct GDISPVMT {
#define GDISP_DRIVER_VMT GDISPVMT_OnlyOne
#endif
// Default the flags if the driver doesn't specify any
#ifndef GDISP_DRIVER_VMT_FLAGS
#define GDISP_DRIVER_VMT_FLAGS 0
#endif
// Routines needed by the general driver VMT
#ifdef __cplusplus
extern "C" {

View File

@ -574,21 +574,25 @@ void _gdispInit(void)
static GDISPVMTLIST dclist[] = {GDISP_DRIVER_LIST};
for(i = 0; i < sizeof(dclist)/sizeof(dclist[0]); i++)
gdriverRegister(&dclist[i]->d, 0);
if (!(dclist[i]->d.flags & GDISP_VFLG_DYNAMICONLY))
gdriverRegister(&dclist[i]->d, 0);
}
#elif GDISP_TOTAL_DISPLAYS > 1
{
unsigned i;
extern GDISPVMTLIST GDISPVMT_OnlyOne;
for(i = 0; i < GDISP_TOTAL_DISPLAYS; i++)
gdriverRegister(&GDISPVMT_OnlyOne->d, 0);
if (!(GDISPVMT_OnlyOne->d.flags & GDISP_VFLG_DYNAMICONLY)) {
for(i = 0; i < GDISP_TOTAL_DISPLAYS; i++)
gdriverRegister(&GDISPVMT_OnlyOne->d, 0);
}
}
#else
{
extern GDriverVMTList GDISPVMT_OnlyOne;
extern GDISPVMTLIST GDISPVMT_OnlyOne;
gdriverRegister(GDISPVMT_OnlyOne, 0);
if (!(GDISPVMT_OnlyOne->d.flags & GDISP_VFLG_DYNAMICONLY))
gdriverRegister(&GDISPVMT_OnlyOne->d, 0);
}
#endif
@ -647,7 +651,9 @@ void _gdispPostInitDriver(GDriver *g) {
// Set orientation, clip
#if defined(GDISP_DEFAULT_ORIENTATION) && GDISP_NEED_CONTROL && GDISP_HARDWARE_CONTROL
gdispGControl(gd, GDISP_CONTROL_ORIENTATION, (void *)GDISP_DEFAULT_ORIENTATION);
// Pixmaps should stay in their created orientation (at least initially)
if (!(gvmt(gd)->flags & GDISP_VFLG_PIXMAP))
gdispGControl(gd, GDISP_CONTROL_ORIENTATION, (void *)GDISP_DEFAULT_ORIENTATION);
#endif
#if GDISP_NEED_VALIDATION || GDISP_NEED_CLIP
gdispGSetClip(gd, 0, 0, gd->g.Width, gd->g.Height);

View File

@ -31,6 +31,7 @@
#define GDISP_HARDWARE_CONTROL TRUE
#define IN_PIXMAP_DRIVER TRUE
#define GDISP_DRIVER_VMT GDISPVMT_pixmap
#define GDISP_DRIVER_VMT_FLAGS (GDISP_VFLG_DYNAMICONLY|GDISP_VFLG_PIXMAP)
// This pseudo driver currently only supports unpacked formats with more than 8 bits per pixel
// that is, we only support GRAY_SCALE and PALETTE with 8 bits per pixel or any unpacked TRUE_COLOR format.