mirror of
https://github.com/Drezil/imgui.git
synced 2025-07-07 21:39:54 +02:00
Backends: Metal: Fixed a crash when clipping rect larger than framebuffer is submitted. (#4464)
Backends: Normalize clipping rect handling across backends. + Squashed amends.
This commit is contained in:
@ -171,9 +171,15 @@ void ImGui_ImplAllegro5_RenderDrawData(ImDrawData* draw_data)
|
||||
}
|
||||
else
|
||||
{
|
||||
// Draw
|
||||
// Project scissor/clipping rectangles into framebuffer space
|
||||
ImVec2 clip_min(pcmd->ClipRect.x - clip_off.x, pcmd->ClipRect.y - clip_off.y);
|
||||
ImVec2 clip_max(pcmd->ClipRect.z - clip_off.x, pcmd->ClipRect.w - clip_off.y);
|
||||
if (clip_max.x < clip_min.x || clip_max.y < clip_min.y)
|
||||
continue;
|
||||
|
||||
// Apply scissor/clipping rectangle, Draw
|
||||
ALLEGRO_BITMAP* texture = (ALLEGRO_BITMAP*)pcmd->GetTexID();
|
||||
al_set_clipping_rectangle(pcmd->ClipRect.x - clip_off.x, pcmd->ClipRect.y - clip_off.y, pcmd->ClipRect.z - pcmd->ClipRect.x, pcmd->ClipRect.w - pcmd->ClipRect.y);
|
||||
al_set_clipping_rectangle(clip_min.x, clip_min.y, clip_max.x, clip_max.y);
|
||||
al_draw_prim(&vertices[0], bd->VertexDecl, texture, idx_offset, idx_offset + pcmd->ElemCount, ALLEGRO_PRIM_TRIANGLE_LIST);
|
||||
}
|
||||
idx_offset += pcmd->ElemCount;
|
||||
|
Reference in New Issue
Block a user