projects
/
rocksndiamonds.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
7d3c23a
)
added check to ensure that decoration does not overlap gadget border
author
Holger Schemel
<info@artsoft.org>
Thu, 20 Oct 2016 21:30:57 +0000
(23:30 +0200)
committer
Holger Schemel
<info@artsoft.org>
Thu, 20 Oct 2016 21:30:57 +0000
(23:30 +0200)
src/libgame/gadgets.c
patch
|
blob
|
history
diff --git
a/src/libgame/gadgets.c
b/src/libgame/gadgets.c
index 75d0a8558970bcb8b2da5ba4f74ec5c4a25e85c2..b21ecdca09607e9afb25eb4dec7f1fb8ad302e19 100644
(file)
--- a/
src/libgame/gadgets.c
+++ b/
src/libgame/gadgets.c
@@
-231,15
+231,24
@@
static void DrawGadget(struct GadgetInfo *gi, boolean pressed, boolean direct)
case GD_TYPE_NORMAL_BUTTON:
case GD_TYPE_CHECK_BUTTON:
case GD_TYPE_RADIO_BUTTON:
case GD_TYPE_NORMAL_BUTTON:
case GD_TYPE_CHECK_BUTTON:
case GD_TYPE_RADIO_BUTTON:
+
BlitBitmapOnBackground(gd->bitmap, drawto,
gd->x, gd->y, gi->width, gi->height,
gi->x, gi->y);
BlitBitmapOnBackground(gd->bitmap, drawto,
gd->x, gd->y, gi->width, gi->height,
gi->x, gi->y);
+
if (gi->deco.design.bitmap)
if (gi->deco.design.bitmap)
+ {
+ // make sure that decoration does not overlap gadget border
+ int deco_x = gi->deco.x + (pressed ? gi->deco.xshift : 0);
+ int deco_y = gi->deco.y + (pressed ? gi->deco.yshift : 0);
+ int deco_width = MIN(gi->deco.width, gi->width - deco_x);
+ int deco_height = MIN(gi->deco.height, gi->height - deco_y);
+
BlitBitmap(gi->deco.design.bitmap, drawto,
gi->deco.design.x, gi->deco.design.y,
BlitBitmap(gi->deco.design.bitmap, drawto,
gi->deco.design.x, gi->deco.design.y,
- gi->deco.width, gi->deco.height,
- gi->x + gi->deco.x + (pressed ? gi->deco.xshift : 0),
- gi->y + gi->deco.y + (pressed ? gi->deco.yshift : 0));
+ deco_width, deco_height, gi->x + deco_x, gi->y + deco_y);
+ }
+
break;
case GD_TYPE_TEXT_BUTTON:
break;
case GD_TYPE_TEXT_BUTTON: