DPF

DISTRHO Plugin Framework
Log | Files | Refs | Submodules | README | LICENSE

commit 33a661fe0e64cf14f4cd9832286b3010c70315fe
parent 11c532346a6a5a08e64d60312db808620c70a264
Author: falkTX <falktx@falktx.com>
Date:   Fri, 27 Aug 2021 16:27:02 +0100

Less annoying nanovg error logs when it fails to initialize

Diffstat:
Mdgl/src/NanoVG.cpp | 4++--
Mtests/NanoSubWidgets.cpp | 5++++-
2 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/dgl/src/NanoVG.cpp b/dgl/src/NanoVG.cpp @@ -280,12 +280,12 @@ NanoVG::~NanoVG() void NanoVG::beginFrame(const uint width, const uint height, const float scaleFactor) { - if (fContext == nullptr) return; DISTRHO_SAFE_ASSERT_RETURN(scaleFactor > 0.0f,); DISTRHO_SAFE_ASSERT_RETURN(! fInFrame,); fInFrame = true; - nvgBeginFrame(fContext, static_cast<int>(width), static_cast<int>(height), scaleFactor); + if (fContext != nullptr) + nvgBeginFrame(fContext, static_cast<int>(width), static_cast<int>(height), scaleFactor); } void NanoVG::beginFrame(Widget* const widget) diff --git a/tests/NanoSubWidgets.cpp b/tests/NanoSubWidgets.cpp @@ -132,8 +132,11 @@ public: { const uint targetWidth = 400; const uint targetHeight = 400; + const double scaleFactor = getScaleFactor(); - setSize(targetWidth, targetHeight); + setGeometryConstraints(targetWidth, targetHeight, true); + setResizable(true); + setSize(targetWidth * scaleFactor, targetHeight * scaleFactor); setTitle("NanoVG SubWidgets test"); }