diff --git a/imgui.h b/imgui.h index 788f74c9c797..4faa291b8c6a 100644 --- a/imgui.h +++ b/imgui.h @@ -1984,6 +1984,7 @@ struct ImDrawList ImVector _TextureIdStack; // [Internal] ImVector _Path; // [Internal] current path building ImDrawListSplitter _Splitter; // [Internal] for channels api + float _FringeScale; // [Internal] anti-alias fringe is scaled by this value, this helps to keep things sharp while zooming at vertex buffer content // If you want to create ImDrawList instances, pass them ImGui::GetDrawListSharedData() or create and use your own ImDrawListSharedData (so you can use ImDrawList without ImGui) ImDrawList(const ImDrawListSharedData* shared_data) { _Data = shared_data; _OwnerName = NULL; Clear(); } diff --git a/imgui_draw.cpp b/imgui_draw.cpp index 2dfccf07750d..b4419091b8cb 100644 --- a/imgui_draw.cpp +++ b/imgui_draw.cpp @@ -390,6 +390,7 @@ void ImDrawList::Clear() _TextureIdStack.resize(0); _Path.resize(0); _Splitter.Clear(); + _FringeScale = 1.0f; } void ImDrawList::ClearFreeMemory() @@ -632,11 +633,11 @@ void ImDrawList::AddPolyline(const ImVec2* points, const int points_count, ImU32 if (!closed) count = points_count-1; - const bool thick_line = (thickness > 1.0f); + const bool thick_line = (thickness > _FringeScale); if (Flags & ImDrawListFlags_AntiAliasedLines) { // Anti-aliased stroke - const float AA_SIZE = 1.0f; + const float AA_SIZE = 1.0f * _FringeScale; const ImU32 col_trans = col & ~IM_COL32_A_MASK; const int idx_count = thick_line ? count*18 : count*12; @@ -820,7 +821,7 @@ void ImDrawList::AddConvexPolyFilled(const ImVec2* points, const int points_coun if (Flags & ImDrawListFlags_AntiAliasedFill) { // Anti-aliased Fill - const float AA_SIZE = 1.0f; + const float AA_SIZE = 1.0f * _FringeScale; const ImU32 col_trans = col & ~IM_COL32_A_MASK; const int idx_count = (points_count-2)*3 + points_count*6; const int vtx_count = (points_count*2);