From: Holger Schemel Date: Thu, 20 Oct 2016 21:30:57 +0000 (+0200) Subject: added check to ensure that decoration does not overlap gadget border X-Git-Tag: 4.0.0.0~32 X-Git-Url: https://git.artsoft.org/?a=commitdiff_plain;h=1477a6b1b3a60b5a3b5ef82eb1e61b7df0984249;p=rocksndiamonds.git added check to ensure that decoration does not overlap gadget border --- diff --git a/src/libgame/gadgets.c b/src/libgame/gadgets.c index 75d0a855..b21ecdca 100644 --- 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: + BlitBitmapOnBackground(gd->bitmap, drawto, gd->x, gd->y, gi->width, gi->height, gi->x, gi->y); + 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, - 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: