Demo: Custom Rendering: Fixed clipping rectangle extruding out of parent window.

This commit is contained in:
omar 2017-11-14 22:21:38 +01:00
parent 852ece3a0e
commit 0858c3d7cb

View File

@ -2327,7 +2327,7 @@ static void ShowExampleAppCustomRendering(bool* p_open)
points.pop_back();
}
}
draw_list->PushClipRect(canvas_pos, ImVec2(canvas_pos.x+canvas_size.x, canvas_pos.y+canvas_size.y)); // clip lines within the canvas (if we resize it, etc.)
draw_list->PushClipRect(canvas_pos, ImVec2(canvas_pos.x+canvas_size.x, canvas_pos.y+canvas_size.y), true); // clip lines within the canvas (if we resize it, etc.)
for (int i = 0; i < points.Size - 1; i += 2)
draw_list->AddLine(ImVec2(canvas_pos.x + points[i].x, canvas_pos.y + points[i].y), ImVec2(canvas_pos.x + points[i+1].x, canvas_pos.y + points[i+1].y), IM_COL32(255,255,0,255), 2.0f);
draw_list->PopClipRect();