aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorinmarket <andrewh@inmarket.com.au>2015-01-13 14:28:56 +1000
committerinmarket <andrewh@inmarket.com.au>2015-01-13 14:28:56 +1000
commitb68cfa0c2978eff6eb4362d94da3b53f9b37e6b9 (patch)
tree79dc833f4d27c92140d6d2001e5b8dc3a8f0ff06 /src
parent8745bb81cf22cf85330f2878474a6e3d29c3bb02 (diff)
downloaduGFX-b68cfa0c2978eff6eb4362d94da3b53f9b37e6b9.tar.gz
uGFX-b68cfa0c2978eff6eb4362d94da3b53f9b37e6b9.tar.bz2
uGFX-b68cfa0c2978eff6eb4362d94da3b53f9b37e6b9.zip
Support dynamic displays at compile time, don't re-orient pixmaps at initialisation time.
Diffstat (limited to 'src')
-rw-r--r--src/gdisp/driver.h7
-rw-r--r--src/gdisp/gdisp_gdisp.c18
-rw-r--r--src/gdisp/gdisp_pixmap.c1
3 files changed, 20 insertions, 6 deletions
diff --git a/src/gdisp/driver.h b/src/gdisp/driver.h
index db626a69..efcb2872 100644
--- a/src/gdisp/driver.h
+++ b/src/gdisp/driver.h
@@ -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" {
diff --git a/src/gdisp/gdisp_gdisp.c b/src/gdisp/gdisp_gdisp.c
index 74fb0883..00003e2f 100644
--- a/src/gdisp/gdisp_gdisp.c
+++ b/src/gdisp/gdisp_gdisp.c
@@ -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);
diff --git a/src/gdisp/gdisp_pixmap.c b/src/gdisp/gdisp_pixmap.c
index 19757757..d088a57b 100644
--- a/src/gdisp/gdisp_pixmap.c
+++ b/src/gdisp/gdisp_pixmap.c
@@ -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.