Skip to content

Commit 0139a84

Browse files
committed
Make sidebar resizing a bit less CPU intensive
1 parent a668697 commit 0139a84

File tree

2 files changed

+12
-9
lines changed

2 files changed

+12
-9
lines changed

Source/CanvasViewport.h

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -699,13 +699,6 @@ class CanvasViewport final : public Viewport
699699
minimap.updateMinimap(r);
700700

701701
cnv->getParentComponent()->setSize(getWidth(), getHeight());
702-
703-
// This fixes some graphical glitches on macOS and Linux, but causes resize issues on Windows
704-
#if !JUCE_WINDOWS
705-
if(!scaleChanged) {
706-
editor->nvgSurface.renderAll();
707-
}
708-
#endif
709702
}
710703

711704
void resized() override
@@ -742,6 +735,13 @@ class CanvasViewport final : public Viewport
742735

743736
auto const offset = currentCentre - newCentre;
744737
setViewPosition(getViewPosition() + offset);
738+
739+
// This fixes some graphical glitches on macOS and Linux, but causes resize issues on Windows
740+
#if !JUCE_WINDOWS
741+
if(!scaleChanged) {
742+
editor->nvgSurface.renderAll();
743+
}
744+
#endif
745745
}
746746

747747
// Never respond to arrow keys, they have a different meaning

Source/NVGSurface.h

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,8 @@ class NVGImage {
247247
totalWidth = other.totalWidth;
248248
totalHeight = other.totalHeight;
249249
onImageInvalidate = other.onImageInvalidate;
250-
250+
isDirty = false;
251+
251252
other.subImages.clear();
252253
allImages.insert(this);
253254
}
@@ -272,7 +273,8 @@ class NVGImage {
272273
totalWidth = other.totalWidth;
273274
totalHeight = other.totalHeight;
274275
onImageInvalidate = other.onImageInvalidate;
275-
276+
isDirty = false;
277+
276278
other.subImages.clear(); // Important, makes sure the old buffer can't delete this buffer
277279
allImages.insert(this);
278280
}
@@ -416,6 +418,7 @@ class NVGImage {
416418
}
417419
x += textureSizeLimit;
418420
}
421+
isDirty = false;
419422
}
420423

421424
void renderAlphaImage(NVGcontext* nvg, Rectangle<int> b, NVGcolor const col)

0 commit comments

Comments
 (0)