From 5af7d6771833a868b0956c49896a53ee68213e9c Mon Sep 17 00:00:00 2001 From: tildearrow Date: Sun, 30 Apr 2023 12:24:14 -0500 Subject: [PATCH] GUI: optimize sample editor? --- src/gui/sampleEdit.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/gui/sampleEdit.cpp b/src/gui/sampleEdit.cpp index 3a8fae4b..2d0cea88 100644 --- a/src/gui/sampleEdit.cpp +++ b/src/gui/sampleEdit.cpp @@ -1171,8 +1171,12 @@ void FurnaceGUI::drawSampleEdit() { if (y1>=availY) y1=availY-1; if (y2<0) y2=0; if (y2>=availY) y2=availY-1; - for (int j=y1; j<=y2; j++) { - data[i+availX*(availY-j-1)]=lineColor; + + const int s1=i+availX*(availY-y1-1); + const int s2=i+availX*(availY-y2-1); + + for (int j=s2; j<=s1; j+=availX) { + data[j]=lineColor; } if (totalAdvance>0) xCoarse++; } while ((totalAdvance--)>0);