Add support for a portrait and landscape orientation modes.
This commit is contained in:
parent
53408e2cb3
commit
daa4e8bbd7
2 changed files with 13 additions and 1 deletions
|
@ -62,8 +62,10 @@ typedef enum fontmetric { fontHeight, fontDescendersHeight, fontLineSpacing, fon
|
||||||
typedef const struct mf_font_s* font_t;
|
typedef const struct mf_font_s* font_t;
|
||||||
/**
|
/**
|
||||||
* @brief Type for the screen orientation.
|
* @brief Type for the screen orientation.
|
||||||
|
* @note GDISP_ROTATE_LANDSCAPE and GDISP_ROTATE_PORTRAIT are internally converted to the
|
||||||
|
* most appropriate other orientation.
|
||||||
*/
|
*/
|
||||||
typedef enum orientation { GDISP_ROTATE_0=0, GDISP_ROTATE_90=90, GDISP_ROTATE_180=180, GDISP_ROTATE_270=270 } orientation_t;
|
typedef enum orientation { GDISP_ROTATE_0=0, GDISP_ROTATE_90=90, GDISP_ROTATE_180=180, GDISP_ROTATE_270=270, GDISP_ROTATE_PORTRAIT=1000, GDISP_ROTATE_LANDSCAPE=1001 } orientation_t;
|
||||||
/**
|
/**
|
||||||
* @brief Type for the available power modes for the screen.
|
* @brief Type for the available power modes for the screen.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -2367,6 +2367,16 @@ void gdispGBlitArea(GDisplay *g, coord_t x, coord_t y, coord_t cx, coord_t cy, c
|
||||||
MUTEX_ENTER(g);
|
MUTEX_ENTER(g);
|
||||||
g->p.x = what;
|
g->p.x = what;
|
||||||
g->p.ptr = value;
|
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 ? GDISP_ROTATE_0 : GDISP_ROTATE_90;
|
||||||
|
break;
|
||||||
|
case GDISP_ROTATE_PORTRAIT:
|
||||||
|
g->p.ptr = g->g.Width >= g->g.Height ? GDISP_ROTATE_90 : GDISP_ROTATE_0;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
gdisp_lld_control(g);
|
gdisp_lld_control(g);
|
||||||
#if GDISP_NEED_CLIP || GDISP_NEED_VALIDATION
|
#if GDISP_NEED_CLIP || GDISP_NEED_VALIDATION
|
||||||
if (what == GDISP_CONTROL_ORIENTATION) {
|
if (what == GDISP_CONTROL_ORIENTATION) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue