Skip to content

Commit df5f84d

Browse files
nhojbwjakob
authored andcommitted
Window no longer draws shadow if shadow size == 0. (#242)
1 parent 0282c43 commit df5f84d

File tree

1 file changed

+14
-12
lines changed

1 file changed

+14
-12
lines changed

src/window.cpp

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -78,19 +78,21 @@ void Window::draw(NVGcontext *ctx) {
7878

7979

8080
/* Draw a drop shadow */
81-
NVGpaint shadowPaint = nvgBoxGradient(
82-
ctx, mPos.x(), mPos.y(), mSize.x(), mSize.y(), cr*2, ds*2,
83-
mTheme->mDropShadow, mTheme->mTransparent);
81+
if (ds > 0) {
82+
NVGpaint shadowPaint = nvgBoxGradient(
83+
ctx, mPos.x(), mPos.y(), mSize.x(), mSize.y(), cr*2, ds*2,
84+
mTheme->mDropShadow, mTheme->mTransparent);
8485

85-
nvgSave(ctx);
86-
nvgResetScissor(ctx);
87-
nvgBeginPath(ctx);
88-
nvgRect(ctx, mPos.x()-ds,mPos.y()-ds, mSize.x()+2*ds, mSize.y()+2*ds);
89-
nvgRoundedRect(ctx, mPos.x(), mPos.y(), mSize.x(), mSize.y(), cr);
90-
nvgPathWinding(ctx, NVG_HOLE);
91-
nvgFillPaint(ctx, shadowPaint);
92-
nvgFill(ctx);
93-
nvgRestore(ctx);
86+
nvgSave(ctx);
87+
nvgResetScissor(ctx);
88+
nvgBeginPath(ctx);
89+
nvgRect(ctx, mPos.x()-ds,mPos.y()-ds, mSize.x()+2*ds, mSize.y()+2*ds);
90+
nvgRoundedRect(ctx, mPos.x(), mPos.y(), mSize.x(), mSize.y(), cr);
91+
nvgPathWinding(ctx, NVG_HOLE);
92+
nvgFillPaint(ctx, shadowPaint);
93+
nvgFill(ctx);
94+
nvgRestore(ctx);
95+
}
9496

9597
if (!mTitle.empty()) {
9698
/* Draw header */

0 commit comments

Comments
 (0)