Skip to content

Commit

Permalink
Window no longer draws shadow if shadow size == 0. (#242)
Browse files Browse the repository at this point in the history
  • Loading branch information
nhojb authored and wjakob committed Aug 10, 2017
1 parent 0282c43 commit df5f84d
Showing 1 changed file with 14 additions and 12 deletions.
26 changes: 14 additions & 12 deletions src/window.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down

0 comments on commit df5f84d

Please sign in to comment.