diff --git a/src/gui/newPattern.cpp b/src/gui/newPattern.cpp index e196a803c..98d8f7afd 100644 --- a/src/gui/newPattern.cpp +++ b/src/gui/newPattern.cpp @@ -29,6 +29,8 @@ #include "../utfutils.h" #include +#define MAX_PARTICLES 8192 + #define SETUP_ORDER_ALPHA \ if (ord==curOrder) { \ ImGui::GetStyle().Alpha=origAlpha; \ @@ -1976,6 +1978,7 @@ void FurnaceGUI::drawPatternNew() { if (partPos.xwinMax.x || partPos.y>winMax.y) continue; + if (particles.size()>MAX_PARTICLES) particles.erase(particles.begin()); particles.push_back(Particle( color, partIcon, @@ -2009,6 +2012,7 @@ void FurnaceGUI::drawPatternNew() { ); if (!(partPos.xwinMax.x || partPos.y>winMax.y)) { + if (particles.size()>MAX_PARTICLES) particles.erase(particles.begin()); particles.push_back(Particle( pitchGrad, (ch->portaNote<=ch->note)?ICON_FA_CHEVRON_DOWN:ICON_FA_CHEVRON_UP, @@ -2066,6 +2070,7 @@ void FurnaceGUI::drawPatternNew() { ); if (!(partPos.xwinMax.x || partPos.y>winMax.y)) { + if (particles.size()>MAX_PARTICLES) particles.erase(particles.begin()); particles.push_back(Particle( pitchGrad, ICON_FA_GLASS, @@ -2083,7 +2088,8 @@ void FurnaceGUI::drawPatternNew() { } // particle simulation - ImDrawList* fdl=ImGui::GetForegroundDrawList(); + ImDrawList* fdl=ImGui::GetWindowDrawList(); + fdl->PushClipRectFullScreen(); if (!particles.empty()) WAKE_UP; fdl->AddCallback(_pushPartBlend,this); for (size_t i=0; iAddCallback(_popPartBlend,this); + fdl->PopClipRect(); } ImGui::PopFont(); diff --git a/src/gui/pattern.cpp b/src/gui/pattern.cpp index d4f440c8f..24760c8db 100644 --- a/src/gui/pattern.cpp +++ b/src/gui/pattern.cpp @@ -29,6 +29,8 @@ #include "../utfutils.h" #include +#define MAX_PARTICLES 8192 + struct DelayedLabel { float posCenter, posY; ImVec2 textSize; @@ -1802,6 +1804,7 @@ void FurnaceGUI::drawPattern() { if (partPos.xwinMax.x || partPos.y>winMax.y) continue; + if (particles.size()>MAX_PARTICLES) particles.erase(particles.begin()); particles.push_back(Particle( color, partIcon, @@ -1835,6 +1838,7 @@ void FurnaceGUI::drawPattern() { ); if (!(partPos.xwinMax.x || partPos.y>winMax.y)) { + if (particles.size()>MAX_PARTICLES) particles.erase(particles.begin()); particles.push_back(Particle( pitchGrad, (ch->portaNote<=ch->note)?ICON_FA_CHEVRON_DOWN:ICON_FA_CHEVRON_UP, @@ -1892,6 +1896,7 @@ void FurnaceGUI::drawPattern() { ); if (!(partPos.xwinMax.x || partPos.y>winMax.y)) { + if (particles.size()>MAX_PARTICLES) particles.erase(particles.begin()); particles.push_back(Particle( pitchGrad, ICON_FA_GLASS, @@ -1909,7 +1914,8 @@ void FurnaceGUI::drawPattern() { } // particle simulation - ImDrawList* fdl=ImGui::GetForegroundDrawList(); + ImDrawList* fdl=ImGui::GetWindowDrawList(); + fdl->PushClipRectFullScreen(); if (!particles.empty()) WAKE_UP; fdl->AddCallback(_pushPartBlend,this); for (size_t i=0; iAddCallback(_popPartBlend,this); + fdl->PopClipRect(); } ImGui::PopStyleColor(3);