From df5f84d13cdf994240b9d83f9add2319a9146714 Mon Sep 17 00:00:00 2001 From: John Buckley Date: Thu, 10 Aug 2017 10:29:02 +0100 Subject: [PATCH] Window no longer draws shadow if shadow size == 0. (#242) --- src/window.cpp | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/src/window.cpp b/src/window.cpp index 2aaf48050a..c7a5cc8350 100644 --- a/src/window.cpp +++ b/src/window.cpp @@ -78,19 +78,21 @@ void Window::draw(NVGcontext *ctx) { /* Draw a drop shadow */ - NVGpaint shadowPaint = nvgBoxGradient( - ctx, mPos.x(), mPos.y(), mSize.x(), mSize.y(), cr*2, ds*2, - mTheme->mDropShadow, mTheme->mTransparent); + if (ds > 0) { + NVGpaint shadowPaint = nvgBoxGradient( + ctx, mPos.x(), mPos.y(), mSize.x(), mSize.y(), cr*2, ds*2, + mTheme->mDropShadow, mTheme->mTransparent); - nvgSave(ctx); - nvgResetScissor(ctx); - nvgBeginPath(ctx); - nvgRect(ctx, mPos.x()-ds,mPos.y()-ds, mSize.x()+2*ds, mSize.y()+2*ds); - nvgRoundedRect(ctx, mPos.x(), mPos.y(), mSize.x(), mSize.y(), cr); - nvgPathWinding(ctx, NVG_HOLE); - nvgFillPaint(ctx, shadowPaint); - nvgFill(ctx); - nvgRestore(ctx); + nvgSave(ctx); + nvgResetScissor(ctx); + nvgBeginPath(ctx); + nvgRect(ctx, mPos.x()-ds,mPos.y()-ds, mSize.x()+2*ds, mSize.y()+2*ds); + nvgRoundedRect(ctx, mPos.x(), mPos.y(), mSize.x(), mSize.y(), cr); + nvgPathWinding(ctx, NVG_HOLE); + nvgFillPaint(ctx, shadowPaint); + nvgFill(ctx); + nvgRestore(ctx); + } if (!mTitle.empty()) { /* Draw header */