From 59e8a170613b7f10ad50f81e24457fd1fdf2345a Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Fri, 7 Oct 2016 10:13:32 +0200 Subject: [PATCH] CComponentsItem: ensure some dimensions for shadow are not < 0 --- src/gui/components/cc_item.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/gui/components/cc_item.cpp b/src/gui/components/cc_item.cpp index f3be06b96..f26883be7 100644 --- a/src/gui/components/cc_item.cpp +++ b/src/gui/components/cc_item.cpp @@ -82,6 +82,8 @@ void CComponentsItem::paintInit(bool do_save_bg) //and ensure sw is not larger than body dimensions, max x% int sw = (shadow) ? min(shadow_w, min(dx, dy)*50/100) : 0; + /*ensure shadow is never < 0*/ + sw = max(0, sw); //set current needed corner main box radius int box_rad = corner_rad; @@ -131,7 +133,7 @@ void CComponentsItem::paintInit(bool do_save_bg) int sh_cbl_y = sh_cbr_y; //handle general shadow bar dimensions - int sh_bdx = dx-sh_cdx-sh_cdx; + int sh_bdx = max(0, dx-sh_cdx-sh_cdx); /*ensure value is never < 0*/ int sh_rdy = dy-sh_cdy-sh_cdy; //...bar bottom