mirror of
https://github.com/VincentWei/MiniGUI.git
synced 2025-12-15 08:55:35 +08:00
set pdc->bkmode correctly before calling _gdi_draw_one_glyph()
This commit is contained in:
@@ -144,11 +144,12 @@ static BOOL cb_drawtextex2 (void* context, Glyph32 glyph_value,
|
|||||||
|
|
||||||
case ACHAR_BASIC_VOWEL:
|
case ACHAR_BASIC_VOWEL:
|
||||||
if (!ctxt->only_extent) {
|
if (!ctxt->only_extent) {
|
||||||
// int bkmode = ctxt->pdc->bkmode;
|
int bkmode = ctxt->pdc->bkmode;
|
||||||
|
ctxt->pdc->bkmode = BM_TRANSPARENT;
|
||||||
_gdi_draw_one_glyph (ctxt->pdc, glyph_value,
|
_gdi_draw_one_glyph (ctxt->pdc, glyph_value,
|
||||||
(ctxt->pdc->ta_flags & TA_X_MASK) != TA_RIGHT,
|
(ctxt->pdc->ta_flags & TA_X_MASK) != TA_RIGHT,
|
||||||
ctxt->x, ctxt->y, &adv_x, &adv_y);
|
ctxt->x, ctxt->y, &adv_x, &adv_y);
|
||||||
// ctxt->pdc->bkmode = bkmode;
|
ctxt->pdc->bkmode = bkmode;
|
||||||
adv_x = adv_y = 0;
|
adv_x = adv_y = 0;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -161,9 +162,12 @@ static BOOL cb_drawtextex2 (void* context, Glyph32 glyph_value,
|
|||||||
ctxt->x, ctxt->y, &adv_x, &adv_y, &bbox);
|
ctxt->x, ctxt->y, &adv_x, &adv_y, &bbox);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
int bkmode = ctxt->pdc->bkmode;
|
||||||
|
ctxt->pdc->bkmode = ctxt->pdc->bkmode_set;
|
||||||
ctxt->advance += _gdi_draw_one_glyph (ctxt->pdc, glyph_value,
|
ctxt->advance += _gdi_draw_one_glyph (ctxt->pdc, glyph_value,
|
||||||
(ctxt->pdc->ta_flags & TA_X_MASK) != TA_RIGHT,
|
(ctxt->pdc->ta_flags & TA_X_MASK) != TA_RIGHT,
|
||||||
ctxt->x, ctxt->y, &adv_x, &adv_y);
|
ctxt->x, ctxt->y, &adv_x, &adv_y);
|
||||||
|
ctxt->pdc->bkmode = bkmode;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -559,7 +559,6 @@ static void _glyph_draw_pixels (PDC pdc, int x, int y, gal_pixel pixel, int w)
|
|||||||
|
|
||||||
pdc->cur_pixel = old_color;
|
pdc->cur_pixel = old_color;
|
||||||
}
|
}
|
||||||
pdc->cur_pixel = old_color;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#include "../newgal/blit.h"
|
#include "../newgal/blit.h"
|
||||||
@@ -1151,8 +1150,7 @@ static void _dc_ft2subpixel_scan_line(PDC pdc, int xpos, int ypos,
|
|||||||
rgba_cur.g, rgba_cur.b);
|
rgba_cur.g, rgba_cur.b);
|
||||||
|
|
||||||
if (pdc->cur_pixel != pixel) {
|
if (pdc->cur_pixel != pixel) {
|
||||||
_glyph_draw_pixel (pdc,
|
_glyph_draw_pixel (pdc, x+xpos, ypos, pdc->cur_pixel);
|
||||||
x+xpos, ypos, pdc->cur_pixel);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2691,15 +2689,14 @@ int _gdi_draw_null_glyph (PDC pdc, int advance, BOOL direction,
|
|||||||
|
|
||||||
if (WITHOUT_DRAWING (pdc)) goto end;
|
if (WITHOUT_DRAWING (pdc)) goto end;
|
||||||
|
|
||||||
pdc->cur_pixel = pdc->bkcolor;
|
if (!IntersectRect(&pdc->rc_output, &rc_back, &pdc->rc_output))
|
||||||
pdc->cur_ban = NULL;
|
|
||||||
pdc->step = 1;
|
|
||||||
|
|
||||||
if(!IntersectRect(&pdc->rc_output, &rc_back, &pdc->rc_output))
|
|
||||||
goto end;
|
goto end;
|
||||||
|
|
||||||
ENTER_DRAWING(pdc);
|
ENTER_DRAWING(pdc);
|
||||||
|
|
||||||
|
pdc->cur_pixel = pdc->bkcolor;
|
||||||
|
pdc->cur_ban = NULL;
|
||||||
|
pdc->step = 1;
|
||||||
draw_back_area (pdc, area, &gal_rc, 0, 0, flag);
|
draw_back_area (pdc, area, &gal_rc, 0, 0, flag);
|
||||||
|
|
||||||
LEAVE_DRAWING (pdc);
|
LEAVE_DRAWING (pdc);
|
||||||
@@ -2968,7 +2965,7 @@ int GUIAPI DrawGlyph (HDC hdc, int x, int y, Glyph32 glyph_value,
|
|||||||
int* adv_x, int* adv_y)
|
int* adv_x, int* adv_y)
|
||||||
{
|
{
|
||||||
int my_adv_x, my_adv_y;
|
int my_adv_x, my_adv_y;
|
||||||
int advance;
|
int advance, bkmode;
|
||||||
PDC pdc;
|
PDC pdc;
|
||||||
|
|
||||||
if (glyph_value == INV_GLYPH_VALUE)
|
if (glyph_value == INV_GLYPH_VALUE)
|
||||||
@@ -2982,9 +2979,12 @@ int GUIAPI DrawGlyph (HDC hdc, int x, int y, Glyph32 glyph_value,
|
|||||||
/* convert to the start point on baseline. */
|
/* convert to the start point on baseline. */
|
||||||
_gdi_get_baseline_point (pdc, &x, &y);
|
_gdi_get_baseline_point (pdc, &x, &y);
|
||||||
|
|
||||||
|
bkmode = pdc->bkmode;
|
||||||
|
pdc->bkmode = pdc->bkmode_set;
|
||||||
advance = _gdi_draw_one_glyph (pdc, glyph_value,
|
advance = _gdi_draw_one_glyph (pdc, glyph_value,
|
||||||
(pdc->ta_flags & TA_X_MASK) != TA_RIGHT,
|
(pdc->ta_flags & TA_X_MASK) != TA_RIGHT,
|
||||||
x, y, &my_adv_x, &my_adv_y);
|
x, y, &my_adv_x, &my_adv_y);
|
||||||
|
pdc->bkmode = bkmode;
|
||||||
|
|
||||||
if (adv_x) *adv_x = my_adv_x;
|
if (adv_x) *adv_x = my_adv_x;
|
||||||
if (adv_y) *adv_y = my_adv_y;
|
if (adv_y) *adv_y = my_adv_y;
|
||||||
@@ -2996,9 +2996,10 @@ int GUIAPI DrawGlyphStrings(HDC hdc, Glyph32* glyphs, int nr_glyphs,
|
|||||||
const POINT* pts)
|
const POINT* pts)
|
||||||
{
|
{
|
||||||
int count = 0;
|
int count = 0;
|
||||||
int i;
|
int i, bkmode;
|
||||||
PDC pdc = dc_HDC2PDC(hdc);
|
PDC pdc = dc_HDC2PDC(hdc);
|
||||||
|
|
||||||
|
bkmode = pdc->bkmode;
|
||||||
for (i = 0; i < nr_glyphs; i++) {
|
for (i = 0; i < nr_glyphs; i++) {
|
||||||
int x, y;
|
int x, y;
|
||||||
int my_adv_x, my_adv_y;
|
int my_adv_x, my_adv_y;
|
||||||
@@ -3019,10 +3020,12 @@ int GUIAPI DrawGlyphStrings(HDC hdc, Glyph32* glyphs, int nr_glyphs,
|
|||||||
/* convert to the start point on baseline. */
|
/* convert to the start point on baseline. */
|
||||||
_gdi_get_baseline_point (pdc, &x, &y);
|
_gdi_get_baseline_point (pdc, &x, &y);
|
||||||
|
|
||||||
|
pdc->bkmode = pdc->bkmode_set;
|
||||||
_gdi_draw_one_glyph (pdc, gv,
|
_gdi_draw_one_glyph (pdc, gv,
|
||||||
(pdc->ta_flags & TA_X_MASK) != TA_RIGHT,
|
(pdc->ta_flags & TA_X_MASK) != TA_RIGHT,
|
||||||
x, y, &my_adv_x, &my_adv_y);
|
x, y, &my_adv_x, &my_adv_y);
|
||||||
}
|
}
|
||||||
|
pdc->bkmode = bkmode;
|
||||||
|
|
||||||
return count;
|
return count;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -175,9 +175,12 @@ static BOOL cb_tabbedtextout (void* context, Glyph32 glyph_value,
|
|||||||
ctxt->x, ctxt->y, &adv_x, &adv_y, &bbox);
|
ctxt->x, ctxt->y, &adv_x, &adv_y, &bbox);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
int bkmode = ctxt->pdc->bkmode;
|
||||||
|
ctxt->pdc->bkmode = ctxt->pdc->bkmode_set;
|
||||||
ctxt->advance += _gdi_draw_one_glyph (ctxt->pdc, glyph_value,
|
ctxt->advance += _gdi_draw_one_glyph (ctxt->pdc, glyph_value,
|
||||||
(ctxt->pdc->ta_flags & TA_X_MASK) != TA_RIGHT,
|
(ctxt->pdc->ta_flags & TA_X_MASK) != TA_RIGHT,
|
||||||
ctxt->x, ctxt->y, &adv_x, &adv_y);
|
ctxt->x, ctxt->y, &adv_x, &adv_y);
|
||||||
|
ctxt->pdc->bkmode = bkmode;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -224,11 +227,14 @@ static BOOL cb_tabbedtextoutex (void* context, Glyph32 glyph_value,
|
|||||||
/* use some tabs to move current x. */
|
/* use some tabs to move current x. */
|
||||||
if (ctxt->advance >= tab_pos) {
|
if (ctxt->advance >= tab_pos) {
|
||||||
while (ctxt->advance >= tab_pos)
|
while (ctxt->advance >= tab_pos)
|
||||||
tab_pos += (ctxt->nr_tab >= ctxt->nTabs) ? ctxt->tab_width : ctxt->pTabPos[ctxt->nr_tab++];
|
tab_pos += (ctxt->nr_tab >= ctxt->nTabs) ?
|
||||||
|
ctxt->tab_width : ctxt->pTabPos[ctxt->nr_tab++];
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
tab_pos += (ctxt->nr_tab >= ctxt->nTabs) ? ctxt->tab_width : ctxt->pTabPos[ctxt->nr_tab++];
|
tab_pos += (ctxt->nr_tab >= ctxt->nTabs) ?
|
||||||
|
ctxt->tab_width : ctxt->pTabPos[ctxt->nr_tab++];
|
||||||
}
|
}
|
||||||
|
|
||||||
_gdi_draw_null_glyph (ctxt->pdc, tab_pos - ctxt->advance,
|
_gdi_draw_null_glyph (ctxt->pdc, tab_pos - ctxt->advance,
|
||||||
(ctxt->pdc->ta_flags & TA_X_MASK) != TA_RIGHT,
|
(ctxt->pdc->ta_flags & TA_X_MASK) != TA_RIGHT,
|
||||||
ctxt->x, ctxt->y, &adv_x, &adv_y);
|
ctxt->x, ctxt->y, &adv_x, &adv_y);
|
||||||
@@ -237,19 +243,27 @@ static BOOL cb_tabbedtextoutex (void* context, Glyph32 glyph_value,
|
|||||||
ctxt->nTabOrig = tab_pos;
|
ctxt->nTabOrig = tab_pos;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ACHAR_BASIC_VOWEL:
|
case ACHAR_BASIC_VOWEL: {
|
||||||
|
int bkmode = ctxt->pdc->bkmode;
|
||||||
|
ctxt->pdc->bkmode = BM_TRANSPARENT;
|
||||||
_gdi_draw_one_glyph (ctxt->pdc, glyph_value,
|
_gdi_draw_one_glyph (ctxt->pdc, glyph_value,
|
||||||
(ctxt->pdc->ta_flags & TA_X_MASK) != TA_RIGHT,
|
(ctxt->pdc->ta_flags & TA_X_MASK) != TA_RIGHT,
|
||||||
ctxt->x, ctxt->y, &adv_x, &adv_y);
|
ctxt->x, ctxt->y, &adv_x, &adv_y);
|
||||||
|
ctxt->pdc->bkmode = bkmode;
|
||||||
adv_x = adv_y = 0;
|
adv_x = adv_y = 0;
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
default:
|
default: {
|
||||||
|
int bkmode = ctxt->pdc->bkmode;
|
||||||
|
ctxt->pdc->bkmode = ctxt->pdc->bkmode_set;
|
||||||
ctxt->advance += _gdi_draw_one_glyph (ctxt->pdc, glyph_value,
|
ctxt->advance += _gdi_draw_one_glyph (ctxt->pdc, glyph_value,
|
||||||
(ctxt->pdc->ta_flags & TA_X_MASK) != TA_RIGHT,
|
(ctxt->pdc->ta_flags & TA_X_MASK) != TA_RIGHT,
|
||||||
ctxt->x, ctxt->y, &adv_x, &adv_y);
|
ctxt->x, ctxt->y, &adv_x, &adv_y);
|
||||||
|
ctxt->pdc->bkmode = bkmode;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
ctxt->x += adv_x;
|
ctxt->x += adv_x;
|
||||||
ctxt->y += adv_y;
|
ctxt->y += adv_y;
|
||||||
|
|||||||
@@ -179,10 +179,14 @@ static BOOL cb_textout (void* context, Glyph32 glyph_value,
|
|||||||
ctxt->advance += _gdi_get_glyph_advance (ctxt->pdc, glyph_value,
|
ctxt->advance += _gdi_get_glyph_advance (ctxt->pdc, glyph_value,
|
||||||
(ctxt->pdc->ta_flags & TA_X_MASK) != TA_RIGHT,
|
(ctxt->pdc->ta_flags & TA_X_MASK) != TA_RIGHT,
|
||||||
0, 0, &adv_x, &adv_y, NULL);
|
0, 0, &adv_x, &adv_y, NULL);
|
||||||
else
|
else {
|
||||||
|
int bkmode = ctxt->pdc->bkmode;
|
||||||
|
ctxt->pdc->bkmode = ctxt->pdc->bkmode_set;
|
||||||
ctxt->advance += _gdi_draw_one_glyph (ctxt->pdc, glyph_value,
|
ctxt->advance += _gdi_draw_one_glyph (ctxt->pdc, glyph_value,
|
||||||
(ctxt->pdc->ta_flags & TA_X_MASK) != TA_RIGHT,
|
(ctxt->pdc->ta_flags & TA_X_MASK) != TA_RIGHT,
|
||||||
ctxt->x, ctxt->y, &adv_x, &adv_y);
|
ctxt->x, ctxt->y, &adv_x, &adv_y);
|
||||||
|
ctxt->pdc->bkmode = bkmode;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ctxt->x += adv_x;
|
ctxt->x += adv_x;
|
||||||
@@ -342,9 +346,12 @@ static BOOL cb_textout_omitted (void* context, Glyph32 glyph_value, unsigned int
|
|||||||
if((ctxt->advance + glyph_advance) > ctxt->max_extent)
|
if((ctxt->advance + glyph_advance) > ctxt->max_extent)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
|
int bkmode = ctxt->pdc->bkmode;
|
||||||
|
ctxt->pdc->bkmode = ctxt->pdc->bkmode_set;
|
||||||
ctxt->advance += _gdi_draw_one_glyph (ctxt->pdc, glyph_value,
|
ctxt->advance += _gdi_draw_one_glyph (ctxt->pdc, glyph_value,
|
||||||
(ctxt->pdc->ta_flags & TA_X_MASK) != TA_RIGHT,
|
(ctxt->pdc->ta_flags & TA_X_MASK) != TA_RIGHT,
|
||||||
ctxt->x, ctxt->y, &adv_x, &adv_y);
|
ctxt->x, ctxt->y, &adv_x, &adv_y);
|
||||||
|
ctxt->pdc->bkmode = bkmode;
|
||||||
}
|
}
|
||||||
|
|
||||||
ctxt->x += adv_x;
|
ctxt->x += adv_x;
|
||||||
|
|||||||
Reference in New Issue
Block a user