aboutsummaryrefslogtreecommitdiffstats
path: root/src/gdisp
diff options
context:
space:
mode:
Diffstat (limited to 'src/gdisp')
-rw-r--r--src/gdisp/gdisp.c12
-rw-r--r--src/gdisp/gdisp.h89
-rw-r--r--src/gdisp/gdisp_driver.h2
-rw-r--r--src/gdisp/gdisp_options.h2
-rw-r--r--src/gdisp/gdisp_pixmap.c36
5 files changed, 74 insertions, 67 deletions
diff --git a/src/gdisp/gdisp.c b/src/gdisp/gdisp.c
index b1180b92..d8f58da6 100644
--- a/src/gdisp/gdisp.c
+++ b/src/gdisp/gdisp.c
@@ -712,7 +712,7 @@ unsigned gdispGetDisplayCount(void) {
gCoord gdispGGetWidth(GDisplay *g) { return g->g.Width; }
gCoord gdispGGetHeight(GDisplay *g) { return g->g.Height; }
gPowermode gdispGGetPowerMode(GDisplay *g) { return g->g.Powermode; }
-orientation_t gdispGGetOrientation(GDisplay *g) { return g->g.Orientation; }
+gOrientation gdispGGetOrientation(GDisplay *g) { return g->g.Orientation; }
uint8_t gdispGGetBacklight(GDisplay *g) { return g->g.Backlight; }
uint8_t gdispGGetContrast(GDisplay *g) { return g->g.Contrast; }
@@ -2874,12 +2874,12 @@ void gdispGBlitArea(GDisplay *g, gCoord x, gCoord y, gCoord cx, gCoord cy, gCoor
g->p.x = what;
g->p.ptr = value;
if (what == GDISP_CONTROL_ORIENTATION) {
- switch ((orientation_t) value) {
- case GDISP_ROTATE_LANDSCAPE:
- g->p.ptr = g->g.Width >= g->g.Height ? (void *)GDISP_ROTATE_0 : (void *)GDISP_ROTATE_90;
+ switch ((gOrientation) value) {
+ case gOrientationLandscape:
+ g->p.ptr = g->g.Width >= g->g.Height ? (void *)gOrientation0 : (void *)gOrientation90;
break;
- case GDISP_ROTATE_PORTRAIT:
- g->p.ptr = g->g.Width >= g->g.Height ? (void *)GDISP_ROTATE_90 : (void *)GDISP_ROTATE_0;
+ case gOrientationPortrait:
+ g->p.ptr = g->g.Width >= g->g.Height ? (void *)gOrientation90 : (void *)gOrientation0;
break;
default:
break;
diff --git a/src/gdisp/gdisp.h b/src/gdisp/gdisp.h
index 8a573456..39493257 100644
--- a/src/gdisp/gdisp.h
+++ b/src/gdisp/gdisp.h
@@ -93,19 +93,19 @@ typedef enum gFontmetric {
typedef const struct mf_font_s* gFont;
/**
- * @enum orientation
+ * @enum gOrientation
* @brief Type for the screen orientation.
- * @note GDISP_ROTATE_LANDSCAPE and GDISP_ROTATE_PORTRAIT are internally converted to the
+ * @note gOrientationLandscape and gOrientationPortrait are internally converted to the
* most appropriate other orientation.
*/
-typedef enum orientation {
- GDISP_ROTATE_0 = 0, /**< Don't rotate. This is the displays native orientation. */
- GDISP_ROTATE_90 = 90, /**< Rotate by 90 degrees absolute to the native rotation. */
- GDISP_ROTATE_180 = 180, /**< Rotate by 180 degrees absolute to the native rotation. */
- GDISP_ROTATE_270 = 270, /**< Rotate by 270 degrees absolute to the native rotation. */
- GDISP_ROTATE_PORTRAIT = 1000, /**< Put the display into portrait mode. */
- GDISP_ROTATE_LANDSCAPE = 1001 /**< Put the display into landscape mode. */
-} orientation_t;
+typedef enum gOrientation {
+ gOrientation0 = 0, /**< Don't rotate. This is the displays native orientation. */
+ gOrientation90 = 90, /**< Rotate by 90 degrees absolute to the native rotation. */
+ gOrientation180 = 180, /**< Rotate by 180 degrees absolute to the native rotation. */
+ gOrientation270 = 270, /**< Rotate by 270 degrees absolute to the native rotation. */
+ gOrientationPortrait = 1000, /**< Put the display into portrait mode. */
+ gOrientationLandscape = 1001 /**< Put the display into landscape mode. */
+} gOrientation;
/**
* @enum gPowermode
@@ -334,7 +334,7 @@ gPowermode gdispGGetPowerMode(GDisplay *g);
*
* @api
*/
-orientation_t gdispGGetOrientation(GDisplay *g);
+gOrientation gdispGGetOrientation(GDisplay *g);
#define gdispGetOrientation() gdispGGetOrientation(GDISP)
/**
@@ -1230,38 +1230,45 @@ void gdispGDrawBox(GDisplay *g, gCoord x, gCoord y, gCoord cx, gCoord cy, gColor
/* V2 compatibility */
#if GFX_COMPAT_V2
- typedef gColor color_t;
- typedef gPixel pixel_t;
- typedef gCoord coord_t;
- typedef gPoint point, point_t;
- typedef gFont font_t;
- typedef gPowermode powermode_t;
- #define powerOff gPowerOff
- #define powerDeepSleep gPowerDeepSleep
- #define powerSleep gPowerSleep
- #define powerOn gPowerOn
- typedef gJustify justify_t;
- #define justifyLeft gJustifyLeft
- #define justifyCenter gJustifyCenter
- #define justifyRight gJustifyRight
- #define justifyTop gJustifyTop
- #define justifyMiddle gJustifyMiddle
- #define justifyBottom gJustifyBottom
- #define justifyWordWrap gJustifyWordWrap
- #define justifyNoWordWrap gJustifyNoWordWrap
- #define justifyPad gJustifyPad
- #define justifyNoPad gJustifyNoPad
+ typedef gColor color_t;
+ typedef gPixel pixel_t;
+ typedef gCoord coord_t;
+ typedef gPoint point, point_t;
+ typedef gFont font_t;
+ typedef gPowermode powermode_t;
+ #define powerOff gPowerOff
+ #define powerDeepSleep gPowerDeepSleep
+ #define powerSleep gPowerSleep
+ #define powerOn gPowerOn
+ typedef gOrientation orientation_t;
+ #define GDISP_ROTATE_0 gOrientation0
+ #define GDISP_ROTATE_90 gOrientation90
+ #define GDISP_ROTATE_180 gOrientation180
+ #define GDISP_ROTATE_270 gOrientation270
+ #define GDISP_ROTATE_PORTRAIT gOrientationPortrait
+ #define GDISP_ROTATE_LANDSCAPE gOrientationLandscape
+ typedef gJustify justify_t;
+ #define justifyLeft gJustifyLeft
+ #define justifyCenter gJustifyCenter
+ #define justifyRight gJustifyRight
+ #define justifyTop gJustifyTop
+ #define justifyMiddle gJustifyMiddle
+ #define justifyBottom gJustifyBottom
+ #define justifyWordWrap gJustifyWordWrap
+ #define justifyNoWordWrap gJustifyNoWordWrap
+ #define justifyPad gJustifyPad
+ #define justifyNoPad gJustifyNoPad
#define JUSTIFYMASK_LEFTRIGHT JUSTIFYMASK_HORIZONTAL
#define JUSTIFYMASK_TOPBOTTOM JUSTIFYMASK_VERTICAL
- typedef gFontmetric fontmetric_t;
- #define fontHeight gFontHeight
- #define fontDescendersHeight gFontDescendersHeight
- #define fontLineSpacing gFontLineSpacing
- #define fontCharPadding gFontCharPadding
- #define fontMinWidth gFontMinWidth
- #define fontMaxWidth gFontMaxWidth
- #define fontBaselineX gFontBaselineX
- #define fontBaselineY gFontBaselineY
+ typedef gFontmetric fontmetric_t;
+ #define fontHeight gFontHeight
+ #define fontDescendersHeight gFontDescendersHeight
+ #define fontLineSpacing gFontLineSpacing
+ #define fontCharPadding gFontCharPadding
+ #define fontMinWidth gFontMinWidth
+ #define fontMaxWidth gFontMaxWidth
+ #define fontBaselineX gFontBaselineX
+ #define fontBaselineY gFontBaselineY
#endif
#endif /* GFX_USE_GDISP */
diff --git a/src/gdisp/gdisp_driver.h b/src/gdisp/gdisp_driver.h
index 7d0d7ef3..40a07c12 100644
--- a/src/gdisp/gdisp_driver.h
+++ b/src/gdisp/gdisp_driver.h
@@ -320,7 +320,7 @@ struct GDisplay {
struct GDISPControl {
gCoord Width;
gCoord Height;
- orientation_t Orientation;
+ gOrientation Orientation;
gPowermode Powermode;
uint8_t Backlight;
uint8_t Contrast;
diff --git a/src/gdisp/gdisp_options.h b/src/gdisp/gdisp_options.h
index 7398d381..d624a763 100644
--- a/src/gdisp/gdisp_options.h
+++ b/src/gdisp/gdisp_options.h
@@ -230,7 +230,7 @@
* @note GDISP_NEED_CONTROL must also be set (and the hardware must support it)
* @note If not specified then displays default to the native hardware orientation
*/
- // #define GDISP_DEFAULT_ORIENTATION GDISP_ROTATE_LANDSCAPE
+ // #define GDISP_DEFAULT_ORIENTATION gOrientationLandscape
/**
* @brief The size of pixel buffer (in pixels) used for optimization.
* @details Set to zero to guarantee disabling of the buffer.
diff --git a/src/gdisp/gdisp_pixmap.c b/src/gdisp/gdisp_pixmap.c
index e65e6e71..92075646 100644
--- a/src/gdisp/gdisp_pixmap.c
+++ b/src/gdisp/gdisp_pixmap.c
@@ -122,7 +122,7 @@ LLDSPEC gBool gdisp_lld_init(GDisplay *g) {
g->g.Height = ((gCoord *)((pixmap *)g->priv)->pixels)[1];
g->g.Backlight = 100;
g->g.Contrast = 50;
- g->g.Orientation = GDISP_ROTATE_0;
+ g->g.Orientation = gOrientation0;
g->g.Powermode = gPowerOn;
g->board = 0;
@@ -138,17 +138,17 @@ LLDSPEC void gdisp_lld_draw_pixel(GDisplay *g) {
#if GDISP_NEED_CONTROL
switch(g->g.Orientation) {
- case GDISP_ROTATE_0:
+ case gOrientation0:
default:
pos = g->p.y * g->g.Width + g->p.x;
break;
- case GDISP_ROTATE_90:
+ case gOrientation90:
pos = (g->g.Width-g->p.x-1) * g->g.Height + g->p.y;
break;
- case GDISP_ROTATE_180:
+ case gOrientation180:
pos = (g->g.Height-g->p.y-1) * g->g.Width + g->g.Width-g->p.x-1;
break;
- case GDISP_ROTATE_270:
+ case gOrientation270:
pos = g->p.x * g->g.Height + g->g.Height-g->p.y-1;
break;
}
@@ -164,17 +164,17 @@ LLDSPEC gColor gdisp_lld_get_pixel_color(GDisplay *g) {
#if GDISP_NEED_CONTROL
switch(g->g.Orientation) {
- case GDISP_ROTATE_0:
+ case gOrientation0:
default:
pos = g->p.y * g->g.Width + g->p.x;
break;
- case GDISP_ROTATE_90:
+ case gOrientation90:
pos = (g->g.Width-g->p.x-1) * g->g.Height + g->p.y;
break;
- case GDISP_ROTATE_180:
+ case gOrientation180:
pos = (g->g.Height-g->p.y-1) * g->g.Width + g->g.Width-g->p.x-1;
break;
- case GDISP_ROTATE_270:
+ case gOrientation270:
pos = g->p.x * g->g.Height + g->g.Height-g->p.y-1;
break;
}
@@ -189,12 +189,12 @@ LLDSPEC gColor gdisp_lld_get_pixel_color(GDisplay *g) {
LLDSPEC void gdisp_lld_control(GDisplay *g) {
switch(g->p.x) {
case GDISP_CONTROL_ORIENTATION:
- if (g->g.Orientation == (orientation_t)g->p.ptr)
+ if (g->g.Orientation == (gOrientation)g->p.ptr)
return;
- switch((orientation_t)g->p.ptr) {
- case GDISP_ROTATE_0:
- case GDISP_ROTATE_180:
- if (g->g.Orientation == GDISP_ROTATE_90 || g->g.Orientation == GDISP_ROTATE_270) {
+ switch((gOrientation)g->p.ptr) {
+ case gOrientation0:
+ case gOrientation180:
+ if (g->g.Orientation == gOrientation90 || g->g.Orientation == gOrientation270) {
gCoord tmp;
tmp = g->g.Width;
@@ -202,9 +202,9 @@ LLDSPEC gColor gdisp_lld_get_pixel_color(GDisplay *g) {
g->g.Height = tmp;
}
break;
- case GDISP_ROTATE_90:
- case GDISP_ROTATE_270:
- if (g->g.Orientation == GDISP_ROTATE_0 || g->g.Orientation == GDISP_ROTATE_180) {
+ case gOrientation90:
+ case gOrientation270:
+ if (g->g.Orientation == gOrientation0 || g->g.Orientation == gOrientation180) {
gCoord tmp;
tmp = g->g.Width;
@@ -215,7 +215,7 @@ LLDSPEC gColor gdisp_lld_get_pixel_color(GDisplay *g) {
default:
return;
}
- g->g.Orientation = (orientation_t)g->p.ptr;
+ g->g.Orientation = (gOrientation)g->p.ptr;
return;
}
}