From 1dc05f0777dfa9526c473be2e2114df8f8520ccc Mon Sep 17 00:00:00 2001 From: tildearrow Date: Sun, 19 Mar 2023 19:51:26 -0500 Subject: [PATCH] GUI: use ClipRect instead of clamp in sample edit --- src/gui/sampleEdit.cpp | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/src/gui/sampleEdit.cpp b/src/gui/sampleEdit.cpp index 9200b6829..3a8fae4b1 100644 --- a/src/gui/sampleEdit.cpp +++ b/src/gui/sampleEdit.cpp @@ -1367,6 +1367,7 @@ void FurnaceGUI::drawSampleEdit() { } } + dl->PushClipRect(rectMin,rectMax); if (e->isPreviewingSample()) { if (!statusBar2.empty()) { statusBar2+=" | "; @@ -1380,7 +1381,6 @@ void FurnaceGUI::drawSampleEdit() { end^=start; start^=end; } - ImDrawList* dl=ImGui::GetWindowDrawList(); ImVec2 p1=rectMin; p1.x+=(e->getSamplePreviewPos()-samplePos)/sampleZoom; ImVec4 posColor=uiColors[GUI_COLOR_SAMPLE_NEEDLE]; @@ -1390,8 +1390,8 @@ void FurnaceGUI::drawSampleEdit() { posTrail2.w=0.0f; float trailDistance=(e->getSamplePreviewRate()/100.0f)/sampleZoom; - if (p1.xrectMax.x) p1.x=rectMax.x; + //if (p1.xrectMax.x) p1.x=rectMax.x; ImVec2 p2=p1; p2.y=rectMax.y; @@ -1419,7 +1419,6 @@ void FurnaceGUI::drawSampleEdit() { end^=start; start^=end; } - ImDrawList* dl=ImGui::GetWindowDrawList(); ImVec2 p1=rectMin; p1.x+=(chanPos.pos-samplePos)/sampleZoom; ImVec4 posColor=uiColors[GUI_COLOR_SAMPLE_NEEDLE_PLAYING]; @@ -1429,8 +1428,8 @@ void FurnaceGUI::drawSampleEdit() { posTrail2.w=0.0f; float trailDistance=((float)chanPos.freq/100.0f)/sampleZoom; - if (p1.xrectMax.x) p1.x=rectMax.x; + //if (p1.xrectMax.x) p1.x=rectMax.x; ImVec2 p2=p1; p2.y=rectMax.y; @@ -1446,6 +1445,7 @@ void FurnaceGUI::drawSampleEdit() { dl->AddLine(p1,p2,ImGui::GetColorU32(posColor)); } } + dl->PopClipRect(); if (drawSelection) { int start=sampleSelStart; @@ -1455,7 +1455,6 @@ void FurnaceGUI::drawSampleEdit() { end^=start; start^=end; } - ImDrawList* dl=ImGui::GetWindowDrawList(); ImVec2 p1=rectMin; p1.x+=(start-samplePos)/sampleZoom;