Fix image background color bug
This commit is contained in:
parent
3d8bb4e85e
commit
7f92794b11
1 changed files with 8 additions and 6 deletions
|
@ -25,16 +25,18 @@ static void _destroy(GWindowObject *gh) {
|
||||||
|
|
||||||
static void _redraw(GHandle gh) {
|
static void _redraw(GHandle gh) {
|
||||||
coord_t x, y, w, h, dx, dy;
|
coord_t x, y, w, h, dx, dy;
|
||||||
|
color_t bg;
|
||||||
|
|
||||||
// The default display area
|
// The default display area
|
||||||
x = gh->x;
|
x = gh->x;
|
||||||
y = gh->y;
|
y = gh->y;
|
||||||
w = gh->width;
|
w = gh->width;
|
||||||
h = gh->height;
|
h = gh->height;
|
||||||
|
bg = gwinGetDefaultBgColor();
|
||||||
|
|
||||||
// If the image isn't open just clear the area
|
// If the image isn't open just clear the area
|
||||||
if (!gdispImageIsOpen(&widget(gh)->image)) {
|
if (!gdispImageIsOpen(&widget(gh)->image)) {
|
||||||
gdispFillArea(x, y, w, h, gh->bgcolor);
|
gdispFillArea(x, y, w, h, bg);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -44,8 +46,8 @@ static void _redraw(GHandle gh) {
|
||||||
dx = (gh->width-w)/2;
|
dx = (gh->width-w)/2;
|
||||||
x += dx;
|
x += dx;
|
||||||
if (dx)
|
if (dx)
|
||||||
gdispFillArea(gh->x, y, dx, h, gh->bgcolor);
|
gdispFillArea(gh->x, y, dx, h, bg);
|
||||||
gdispFillArea(x+w, y, gh->width-dx-w, h, gh->bgcolor);
|
gdispFillArea(x+w, y, gh->width-dx-w, h, bg);
|
||||||
dx = 0;
|
dx = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -60,8 +62,8 @@ static void _redraw(GHandle gh) {
|
||||||
dy = (gh->height-h)/2;
|
dy = (gh->height-h)/2;
|
||||||
y += dy;
|
y += dy;
|
||||||
if (dy)
|
if (dy)
|
||||||
gdispFillArea(x, gh->y, w, dy, gh->bgcolor);
|
gdispFillArea(x, gh->y, w, dy, bg);
|
||||||
gdispFillArea(x, y+h, w, gh->height-dy-h, gh->bgcolor);
|
gdispFillArea(x, y+h, w, gh->height-dy-h, bg);
|
||||||
dy = 0;
|
dy = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -71,7 +73,7 @@ static void _redraw(GHandle gh) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Reset the background color in case it has changed
|
// Reset the background color in case it has changed
|
||||||
gdispImageSetBgColor(&widget(gh)->image, gh->bgcolor);
|
gdispImageSetBgColor(&widget(gh)->image, bg);
|
||||||
|
|
||||||
// Display the image
|
// Display the image
|
||||||
gdispImageDraw(&widget(gh)->image, x, y, w, h, dx, dy);
|
gdispImageDraw(&widget(gh)->image, x, y, w, h, dx, dy);
|
||||||
|
|
Loading…
Add table
Reference in a new issue