diff --git a/dgl/src/NanoVG.cpp b/dgl/src/NanoVG.cpp index d6c78f1e..beaf2722 100644 --- 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(width), static_cast(height), scaleFactor); + if (fContext != nullptr) + nvgBeginFrame(fContext, static_cast(width), static_cast(height), scaleFactor); } void NanoVG::beginFrame(Widget* const widget) diff --git a/tests/NanoSubWidgets.cpp b/tests/NanoSubWidgets.cpp index 267d5878..1f205407 100644 --- 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"); }