Added macros JUSTIFYMASK_HORIZONTAL, JUSTIFYMASK_VERTICAL to replace macros JUSTIFYMASK_LEFTRIGHT, JUSTIFYMASK_TOPBOTTOM

This commit is contained in:
inmarket 2018-07-08 13:25:20 +10:00
parent cbf1d4dfa0
commit d9258efd4d
3 changed files with 13 additions and 10 deletions

View File

@ -27,6 +27,7 @@ CHANGE: Added type gFont to replace V2.x font_t
CHANGE: Added type gPowermode to replace V2.x powermode_t, and values gPowerXXX replace powerXXX
CHANGE: Added type gJustify to replace V2.x justify_t, and values gJustifyXXX replace justifyXXX
CHANGE: Added type gFontmetric to replace V2.x fontmetric_t, and values gFontXXX replace fontXXX
CHANGE: Added macros JUSTIFYMASK_HORIZONTAL, JUSTIFYMASK_VERTICAL to replace macros JUSTIFYMASK_LEFTRIGHT, JUSTIFYMASK_TOPBOTTOM
FIX: Added gfxRealloc() to Qt port
FIX: Fixed UC1610 driver private area initialisation
FIX: Fixed ST7735 driver and added kapacuk changes

View File

@ -3478,7 +3478,7 @@ void gdispGDrawBox(GDisplay *g, gCoord x, gCoord y, gCoord cx, gCoord cy, gColor
totalHeight = font->height;
// Select the anchor position
switch((justify & JUSTIFYMASK_TOPBOTTOM)) {
switch((justify & JUSTIFYMASK_VERTICAL)) {
case gJustifyTop:
break;
case gJustifyBottom:
@ -3488,7 +3488,7 @@ void gdispGDrawBox(GDisplay *g, gCoord x, gCoord y, gCoord cx, gCoord cy, gColor
y += (cy+1 - totalHeight)/2;
break;
}
switch((justify & JUSTIFYMASK_LEFTRIGHT)) {
switch((justify & JUSTIFYMASK_HORIZONTAL)) {
case gJustifyCenter:
x += (cx + 1) / 2;
break;
@ -3504,14 +3504,14 @@ void gdispGDrawBox(GDisplay *g, gCoord x, gCoord y, gCoord cx, gCoord cy, gColor
g->t.color = color;
#if GDISP_NEED_TEXT_WORDWRAP
if (!(justify & gJustifyNoWordWrap)) {
g->t.lrj = (justify & JUSTIFYMASK_LEFTRIGHT);
g->t.lrj = (justify & JUSTIFYMASK_HORIZONTAL);
g->t.wrapx = x;
g->t.wrapy = y;
mf_wordwrap(font, cx, str, mf_drawline_callback, g);
} else
#endif
mf_render_aligned(font, x, y, (justify & JUSTIFYMASK_LEFTRIGHT), str, 0, drawcharglyph, g);
mf_render_aligned(font, x, y, (justify & JUSTIFYMASK_HORIZONTAL), str, 0, drawcharglyph, g);
autoflush(g);
MUTEX_EXIT(g);
@ -3567,7 +3567,7 @@ void gdispGDrawBox(GDisplay *g, gCoord x, gCoord y, gCoord cx, gCoord cy, gColor
totalHeight = font->height;
// Select the anchor position
switch((justify & JUSTIFYMASK_TOPBOTTOM)) {
switch((justify & JUSTIFYMASK_VERTICAL)) {
case gJustifyTop:
break;
case gJustifyBottom:
@ -3577,7 +3577,7 @@ void gdispGDrawBox(GDisplay *g, gCoord x, gCoord y, gCoord cx, gCoord cy, gColor
y += (cy+1 - totalHeight)/2;
break;
}
switch((justify & JUSTIFYMASK_LEFTRIGHT)) {
switch((justify & JUSTIFYMASK_HORIZONTAL)) {
case gJustifyCenter:
x += (cx + 1) / 2;
break;
@ -3594,14 +3594,14 @@ void gdispGDrawBox(GDisplay *g, gCoord x, gCoord y, gCoord cx, gCoord cy, gColor
g->t.bgcolor = bgcolor;
#if GDISP_NEED_TEXT_WORDWRAP
if (!(justify & gJustifyNoWordWrap)) {
g->t.lrj = (justify & JUSTIFYMASK_LEFTRIGHT);
g->t.lrj = (justify & JUSTIFYMASK_HORIZONTAL);
g->t.wrapx = x;
g->t.wrapy = y;
mf_wordwrap(font, cx, str, mf_fillline_callback, g);
} else
#endif
mf_render_aligned(font, x, y, (justify & JUSTIFYMASK_LEFTRIGHT), str, 0, fillcharglyph, g);
mf_render_aligned(font, x, y, (justify & JUSTIFYMASK_HORIZONTAL), str, 0, fillcharglyph, g);
}
autoflush(g);

View File

@ -69,8 +69,8 @@ typedef enum gJustify {
gJustifyPad = 0x00, /**< Pad the text box (the default) */
gJustifyNoPad = 0x04 /**< No padding the text box */
} gJustify;
#define JUSTIFYMASK_LEFTRIGHT (gJustifyLeft|gJustifyCenter|gJustifyRight)
#define JUSTIFYMASK_TOPBOTTOM (gJustifyTop|gJustifyMiddle|gJustifyBottom)
#define JUSTIFYMASK_HORIZONTAL (gJustifyLeft|gJustifyCenter|gJustifyRight)
#define JUSTIFYMASK_VERTICAL (gJustifyTop|gJustifyMiddle|gJustifyBottom)
/**
* @enum gFontmetric
@ -1251,6 +1251,8 @@ void gdispGDrawBox(GDisplay *g, gCoord x, gCoord y, gCoord cx, gCoord cy, gColor
#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