Browse Source

Less annoying nanovg error logs when it fails to initialize

pull/316/head
falkTX 3 years ago
parent
commit
33a661fe0e
2 changed files with 6 additions and 3 deletions
  1. +2
    -2
      dgl/src/NanoVG.cpp
  2. +4
    -1
      tests/NanoSubWidgets.cpp

+ 2
- 2
dgl/src/NanoVG.cpp View File

@@ -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)


+ 4
- 1
tests/NanoSubWidgets.cpp View File

@@ -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");
}



Loading…
Cancel
Save