From 3ecced73897ef71ecbd43c69b6f059ec5a38f441 Mon Sep 17 00:00:00 2001 From: Andrew Belt Date: Sat, 30 Oct 2021 06:41:11 -0400 Subject: [PATCH] Add scissor in LedDisplay::drawLayer(). --- include/app/LedDisplay.hpp | 1 + src/app/LedDisplay.cpp | 8 ++++++++ 2 files changed, 9 insertions(+) diff --git a/include/app/LedDisplay.hpp b/include/app/LedDisplay.hpp index 5b6c12ce..f2f41069 100644 --- a/include/app/LedDisplay.hpp +++ b/include/app/LedDisplay.hpp @@ -11,6 +11,7 @@ namespace app { struct LedDisplay : widget::Widget { void draw(const DrawArgs& args) override; + void drawLayer(const DrawArgs& args, int layer) override; }; struct LedDisplaySeparator : widget::Widget { diff --git a/src/app/LedDisplay.cpp b/src/app/LedDisplay.cpp index e3eb752e..a856a490 100644 --- a/src/app/LedDisplay.cpp +++ b/src/app/LedDisplay.cpp @@ -65,6 +65,14 @@ void LedDisplay::draw(const DrawArgs& args) { } +void LedDisplay::drawLayer(const DrawArgs& args, int layer) { + // Draw children inside box + nvgScissor(args.vg, RECT_ARGS(args.clipBox)); + Widget::drawLayer(args, layer); + nvgResetScissor(args.vg); +} + + LedDisplaySeparator::LedDisplaySeparator() { box.size = math::Vec(); }