Support dynamic displays at compile time, don't re-orient pixmaps at initialisation time.
This commit is contained in:
parent
8745bb81cf
commit
b68cfa0c29
3 changed files with 20 additions and 6 deletions
|
@ -377,6 +377,8 @@ struct GDisplay {
|
||||||
|
|
||||||
typedef struct GDISPVMT {
|
typedef struct GDISPVMT {
|
||||||
GDriverVMT d;
|
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);
|
bool_t (*init)(GDisplay *g);
|
||||||
void (*deinit)(GDisplay *g);
|
void (*deinit)(GDisplay *g);
|
||||||
void (*writestart)(GDisplay *g); // Uses p.x,p.y p.cx,p.cy
|
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
|
#define GDISP_DRIVER_VMT GDISPVMT_OnlyOne
|
||||||
#endif
|
#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
|
// Routines needed by the general driver VMT
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
|
|
|
@ -574,21 +574,25 @@ void _gdispInit(void)
|
||||||
static GDISPVMTLIST dclist[] = {GDISP_DRIVER_LIST};
|
static GDISPVMTLIST dclist[] = {GDISP_DRIVER_LIST};
|
||||||
|
|
||||||
for(i = 0; i < sizeof(dclist)/sizeof(dclist[0]); i++)
|
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
|
#elif GDISP_TOTAL_DISPLAYS > 1
|
||||||
{
|
{
|
||||||
unsigned i;
|
unsigned i;
|
||||||
extern GDISPVMTLIST GDISPVMT_OnlyOne;
|
extern GDISPVMTLIST GDISPVMT_OnlyOne;
|
||||||
|
|
||||||
for(i = 0; i < GDISP_TOTAL_DISPLAYS; i++)
|
if (!(GDISPVMT_OnlyOne->d.flags & GDISP_VFLG_DYNAMICONLY)) {
|
||||||
gdriverRegister(&GDISPVMT_OnlyOne->d, 0);
|
for(i = 0; i < GDISP_TOTAL_DISPLAYS; i++)
|
||||||
|
gdriverRegister(&GDISPVMT_OnlyOne->d, 0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
#else
|
#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
|
#endif
|
||||||
|
|
||||||
|
@ -647,7 +651,9 @@ void _gdispPostInitDriver(GDriver *g) {
|
||||||
|
|
||||||
// Set orientation, clip
|
// Set orientation, clip
|
||||||
#if defined(GDISP_DEFAULT_ORIENTATION) && GDISP_NEED_CONTROL && GDISP_HARDWARE_CONTROL
|
#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
|
#endif
|
||||||
#if GDISP_NEED_VALIDATION || GDISP_NEED_CLIP
|
#if GDISP_NEED_VALIDATION || GDISP_NEED_CLIP
|
||||||
gdispGSetClip(gd, 0, 0, gd->g.Width, gd->g.Height);
|
gdispGSetClip(gd, 0, 0, gd->g.Width, gd->g.Height);
|
||||||
|
|
|
@ -31,6 +31,7 @@
|
||||||
#define GDISP_HARDWARE_CONTROL TRUE
|
#define GDISP_HARDWARE_CONTROL TRUE
|
||||||
#define IN_PIXMAP_DRIVER TRUE
|
#define IN_PIXMAP_DRIVER TRUE
|
||||||
#define GDISP_DRIVER_VMT GDISPVMT_pixmap
|
#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
|
// 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.
|
// that is, we only support GRAY_SCALE and PALETTE with 8 bits per pixel or any unpacked TRUE_COLOR format.
|
||||||
|
|
Loading…
Add table
Reference in a new issue