Skip to content

Commit 71f586f

Browse files
committed
Fix various graphical gliches, fix window resize issues when settings panel is open
1 parent 269f271 commit 71f586f

File tree

3 files changed

+8
-63
lines changed

3 files changed

+8
-63
lines changed

Source/NVGSurface.cpp

Lines changed: 7 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -203,19 +203,6 @@ void NVGSurface::updateBufferSize()
203203
}
204204
}
205205

206-
#ifdef NANOVG_GL_IMPLEMENTATION
207-
void NVGSurface::timerCallback()
208-
{
209-
updateBounds(newBounds);
210-
if (getBounds() == newBounds) {
211-
stopTimer();
212-
// The editor will be full of junk from the buffer, so clear it
213-
if (renderThroughImage)
214-
editor->repaint();
215-
}
216-
}
217-
#endif
218-
219206
void NVGSurface::lookAndFeelChanged()
220207
{
221208
if (makeContextActive()) {
@@ -257,24 +244,10 @@ float NVGSurface::getRenderScale() const
257244

258245
void NVGSurface::updateBounds(Rectangle<int> bounds)
259246
{
260-
#ifdef NANOVG_GL_IMPLEMENTATION
261-
if (!makeContextActive()) {
262-
newBounds = bounds;
263-
setBounds(newBounds);
264-
return;
265-
}
266-
267-
newBounds = bounds;
268-
if (hresize)
269-
setBounds(bounds.withHeight(getHeight()));
270-
else
271-
setBounds(bounds.withWidth(getWidth()));
272-
273-
resizing = true;
247+
setBounds(bounds);
274248

249+
#ifdef NANOVG_GL_IMPLEMENTATION
275250
updateWindowContextVisibility();
276-
#else
277-
setBounds(bounds);
278251
#endif
279252
}
280253

@@ -310,19 +283,13 @@ void NVGSurface::renderAll()
310283

311284
void NVGSurface::render()
312285
{
313-
#if NANOVG_GL_IMPLEMENTATION
314-
if (!resizing) {
315-
#endif
316-
if (renderThroughImage) {
317-
auto const startTime = Time::getMillisecondCounter();
318-
if (startTime - lastRenderTime < 32) {
319-
return; // When rendering through juce::image, limit framerate to 30 fps
320-
}
321-
lastRenderTime = startTime;
286+
if (renderThroughImage) {
287+
auto const startTime = Time::getMillisecondCounter();
288+
if (startTime - lastRenderTime < 32) {
289+
return; // When rendering through juce::image, limit framerate to 30 fps
322290
}
323-
#if NANOVG_GL_IMPLEMENTATION
291+
lastRenderTime = startTime;
324292
}
325-
#endif
326293

327294
if (!getPeer()) {
328295
return;
@@ -393,14 +360,6 @@ void NVGSurface::render()
393360

394361
if (renderThroughImage) {
395362
renderFrameToImage(backupRenderImage, invalidArea);
396-
#if NANOVG_GL_IMPLEMENTATION
397-
if (resizing) {
398-
hresize = !hresize;
399-
resizing = false;
400-
}
401-
if (getBounds() != newBounds)
402-
startTimerHz(60);
403-
#endif
404363
} else {
405364
needsBufferSwap = true;
406365
}
@@ -413,12 +372,6 @@ void NVGSurface::render()
413372

414373
#ifdef NANOVG_GL_IMPLEMENTATION
415374
glContext->swapBuffers();
416-
if (resizing) {
417-
hresize = !hresize;
418-
resizing = false;
419-
}
420-
if (getBounds() != newBounds)
421-
startTimerHz(60);
422375
#endif
423376
needsBufferSwap = false;
424377
}

Source/NVGSurface.h

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ class NVGSurface final :
2929
public UIViewComponent
3030
#else
3131
public Component
32-
, public Timer
3332
#endif
3433
{
3534
public:
@@ -46,10 +45,6 @@ class NVGSurface final :
4645

4746
void detachContext();
4847

49-
#ifdef NANOVG_GL_IMPLEMENTATION
50-
void timerCallback() override;
51-
#endif
52-
5348
void lookAndFeelChanged() override;
5449

5550
Rectangle<int> getInvalidArea() const { return invalidArea; }
@@ -136,9 +131,6 @@ class NVGSurface final :
136131
uint32 lastRenderTime;
137132

138133
#if NANOVG_GL_IMPLEMENTATION
139-
bool hresize = false;
140-
bool resizing = false;
141-
Rectangle<int> newBounds;
142134
std::unique_ptr<OpenGLContext> glContext;
143135
#endif
144136

0 commit comments

Comments
 (0)