diff --git a/docs/CHANGELOG.txt b/docs/CHANGELOG.txt index be4c80ca0..b070d0c2a 100644 --- a/docs/CHANGELOG.txt +++ b/docs/CHANGELOG.txt @@ -93,8 +93,8 @@ HOW TO UPDATE? but the artifacts should be more localized. The new implementation attempted to favor simple implementation and robustness over the corner case accuracy. - Added anti-aliasing ends, most noticeable for thick lines. - - Added `ImDrawFlags_AAEnds` flag to enable anti-aliased line ends. Enabling AA Ends by - default would be more "correct", but it is slower and increase vertex/index data. + - Added `ImDrawFlags_AALineEnds` flag to enable anti-aliased line ends. Enabling AA Ends + by default would be more "correct", but it is slower and increase vertex/index data. - Added `ImDrawFlags_MiterOnly` flag to disable using beveled corner (closer to legacy rendering, slightly faster, but corners sharpers than 90 degrees may expand far out). Automatically used by AddRect(), AddCircle(), AddNgon(), AddEllipse() etc functions @@ -141,6 +141,14 @@ HOW TO UPDATE? - All closed shapes with thickness=1.0f will appear identical. - The difference for thickness>1.0f shapes may be minimal since very large strokes were not well supported for widgets, but stroke will default inside widgets. +- (Breaking) Merged `ImDrawListFlags` into `ImDrawFlags`. + `ImDrawListFlags` was very rarely used directly. Keep inline redirection (will obsolete). + - `ImDrawListFlags_AntiAliasedLines` -> `ImDrawFlags_AALines` + - `ImDrawListFlags_AntiAliasedFill` -> `ImDrawFlags_AAFill` + - `ImDrawListFlags_AntiAliasedLinesUseTex` -> `ImDrawFlags_UseTexForStrokeLegacy` + - `ImDrawListFlags_AllowVtxOffset` -> `ImDrawFlags_UseVtxOffset` + - `ImDrawListFlags_TextNoPixelSnap` -> `ImDrawFlags_TextNoPixelSnap` + Unifying them allows easily using them for both per-primitives and scope alterations. - Tweaked line rendering in various locations to avoid blurryness: - Windows: title-bar and menu-bar border (when thickness>1.0f). - Tables: borders (when thickness>1.0f). @@ -152,7 +160,6 @@ HOW TO UPDATE? filled shapes; Added an option to animation thickness; Added new shapes to showcase new rendering features that previously hit limitations. - Breaking Changes: - Style: obsoleted `style.CurveTessellationTol (default 1.25)` which was in Pixels² unit in diff --git a/imgui.cpp b/imgui.cpp index 9208b74be..aeb05b8ac 100644 --- a/imgui.cpp +++ b/imgui.cpp @@ -396,6 +396,14 @@ IMPLEMENTING SUPPORT for ImGuiBackendFlags_RendererHasTextures: When you are not sure about an old symbol or function name, try using the Search/Find function of your IDE to look for comments or references in all imgui files. You can read releases logs https://github.com/ocornut/imgui/releases for more details. + 2026/06/XX (1.XXXX) - merged ImDrawListFlags into ImDrawFlags. obsoleted ImDrawListFlags (which were rarely used directly): + - ImDrawListFlags_AntiAliasedLines -> ImDrawFlags_AALines, + - ImDrawListFlags_AntiAliasedFill -> ImDrawFlags_AAFill, + - ImDrawListFlags_AntiAliasedLinesUseTex -> ImDrawFlags_UseTexForStrokeLegacy + - ImDrawListFlags_AllowVtxOffset -> ImDrawFlags_UseVtxOffset, + - ImDrawListFlags_TextNoPixelSnap -> ImDrawFlags_TextNoPixelSnap, + unifying them allows easily using them for both per-primitives alterations and scope alterations. + (Docking/Viewport Branch) - 2026/XX/XX (1.XXXX) - when multi-viewports are enabled, all positions will be in your natural OS coordinates space. It means that: - reference to hard-coded positions such as in SetNextWindowPos(ImVec2(0,0)) are probably not what you want anymore. @@ -5774,17 +5782,17 @@ static void SetupDrawListSharedData() g.DrawListSharedData.ClipRectFullscreen = virtual_space.ToVec4(); g.DrawListSharedData.CurveTessellationMaxError = g.Style.CurveTessellationMaxError; g.DrawListSharedData.SetCircleTessellationMaxError(g.Style.CircleTessellationMaxError); - g.DrawListSharedData.InitialFlags = ImDrawListFlags_None; - if (g.Style.AntiAliasedLines) - g.DrawListSharedData.InitialFlags |= ImDrawListFlags_AntiAliasedLines; - if (g.Style.AntiAliasedLinesUseTex && !(g.IO.Fonts->Flags & ImFontAtlasFlags_NoBakedLines)) - g.DrawListSharedData.InitialFlags |= ImDrawListFlags_AntiAliasedLinesUseTex; - if (!(g.IO.Fonts->Flags & ImFontAtlasFlags_NoBakedRoundCorners)) - g.DrawListSharedData.InitialFlags |= ImDrawListFlags_RoundCornersUseTex; + g.DrawListSharedData.InitialDrawFlags = ImDrawFlags_None; if (g.Style.AntiAliasedFill) - g.DrawListSharedData.InitialFlags |= ImDrawListFlags_AntiAliasedFill; + g.DrawListSharedData.InitialDrawFlags |= ImDrawFlags_AAFill; + if (g.Style.AntiAliasedLines) + g.DrawListSharedData.InitialDrawFlags |= ImDrawFlags_AALines; + if (g.Style.AntiAliasedLinesUseTex && !(g.IO.Fonts->Flags & ImFontAtlasFlags_NoBakedLines)) + g.DrawListSharedData.InitialDrawFlags |= ImDrawFlags_UseTexForStrokeLegacy; + if (!(g.IO.Fonts->Flags & ImFontAtlasFlags_NoBakedRoundCorners)) + g.DrawListSharedData.InitialDrawFlags |= ImDrawFlags_UseTexForRoundCorners; if (g.IO.BackendFlags & ImGuiBackendFlags_RendererHasVtxOffset) - g.DrawListSharedData.InitialFlags |= ImDrawListFlags_AllowVtxOffset; + g.DrawListSharedData.InitialDrawFlags |= ImDrawFlags_UseVtxOffset; } void ImGui::NewFrame() @@ -23568,8 +23576,8 @@ void ImGui::DebugNodeDrawList(ImGuiWindow* window, ImGuiViewportP* viewport, con Selectable(buf, false); if (fg_draw_list && IsItemHovered()) { - ImDrawListFlags backup_flags = fg_draw_list->Flags; - fg_draw_list->Flags &= ~ImDrawListFlags_AntiAliasedLines; // Disable AA on triangle outlines is more readable for very large and thin triangles. + ImDrawFlags backup_flags = fg_draw_list->Flags; + fg_draw_list->Flags &= ~ImDrawFlags_AALines; // Disable AA on triangle outlines is more readable for very large and thin triangles. fg_draw_list->AddPolyline(triangle, 3, IM_COL32(255, 255, 0, 255), 1.0f, ImDrawFlags_Closed); fg_draw_list->Flags = backup_flags; } @@ -23587,8 +23595,8 @@ void ImGui::DebugNodeDrawCmdShowMeshAndBoundingBox(ImDrawList* out_draw_list, co // Draw wire-frame version of all triangles ImRect clip_rect = draw_cmd->ClipRect; ImRect vtxs_rect(FLT_MAX, FLT_MAX, -FLT_MAX, -FLT_MAX); - ImDrawListFlags backup_flags = out_draw_list->Flags; - out_draw_list->Flags &= ~ImDrawListFlags_AntiAliasedLines; // Disable AA on triangle outlines is more readable for very large and thin triangles. + ImDrawFlags backup_flags = out_draw_list->Flags; + out_draw_list->Flags &= ~ImDrawFlags_AALines; // Disable AA on triangle outlines is more readable for very large and thin triangles. for (unsigned int idx_n = draw_cmd->IdxOffset, idx_end = draw_cmd->IdxOffset + draw_cmd->ElemCount; idx_n < idx_end; ) { ImDrawIdx* idx_buffer = (draw_list->IdxBuffer.Size > 0) ? draw_list->IdxBuffer.Data : NULL; // We don't hold on those pointers past iterations as ->AddPolyline() may invalidate them if out_draw_list==draw_list diff --git a/imgui.h b/imgui.h index ebd79ec94..68df37803 100644 --- a/imgui.h +++ b/imgui.h @@ -51,7 +51,7 @@ Index of this file: // [SECTION] Misc data structures (ImGuiInputTextCallbackData, ImGuiSizeCallbackData, ImGuiWindowClass, ImGuiPayload) // [SECTION] Helpers (ImGuiOnceUponAFrame, ImGuiTextFilter, ImGuiTextBuffer, ImGuiStorage, ImGuiListClipper, Math Operators, ImColor) // [SECTION] Multi-Select API flags and structures (ImGuiMultiSelectFlags, ImGuiMultiSelectIO, ImGuiSelectionRequest, ImGuiSelectionBasicStorage, ImGuiSelectionExternalStorage) -// [SECTION] Drawing API (ImDrawCallback, ImDrawCmd, ImDrawIdx, ImDrawVert, ImDrawChannel, ImDrawListSplitter, ImDrawFlags, ImDrawListFlags, ImDrawList, ImDrawData) +// [SECTION] Drawing API (ImDrawCallback, ImDrawCmd, ImDrawIdx, ImDrawVert, ImDrawChannel, ImDrawListSplitter, ImDrawFlags, ImDrawList, ImDrawData) // [SECTION] Texture API (ImTextureFormat, ImTextureStatus, ImTextureRect, ImTextureData) // [SECTION] Font API (ImFontConfig, ImFontGlyph, ImFontGlyphRangesBuilder, ImFontAtlasFlags, ImFontAtlas, ImFontBaked, ImFont) // [SECTION] Viewports (ImGuiViewportFlags, ImGuiViewport) @@ -240,7 +240,6 @@ typedef int ImGuiTableBgTarget; // -> enum ImGuiTableBgTarget_ // Enum: A // - In Visual Studio w/ Visual Assist installed: Alt+G ("VAssistX.GoToImplementation") can also follow symbols inside comments. // - In VS Code, CLion, etc.: Ctrl+Click can follow symbols inside comments. typedef int ImDrawFlags; // -> enum ImDrawFlags_ // Flags: for ImDrawList functions -typedef int ImDrawListFlags; // -> enum ImDrawListFlags_ // Flags: for ImDrawList instance typedef int ImDrawTextFlags; // -> enum ImDrawTextFlags_ // Internal, do not use! typedef int ImFontFlags; // -> enum ImFontFlags_ // Flags: for ImFont typedef int ImFontAtlasFlags; // -> enum ImFontAtlasFlags_ // Flags: for ImFontAtlas @@ -3314,7 +3313,7 @@ struct ImGuiSelectionExternalStorage }; //----------------------------------------------------------------------------- -// [SECTION] Drawing API (ImDrawCmd, ImDrawIdx, ImDrawVert, ImDrawChannel, ImDrawListSplitter, ImDrawListFlags, ImDrawList, ImDrawData) +// [SECTION] Drawing API (ImDrawCmd, ImDrawIdx, ImDrawVert, ImDrawChannel, ImDrawListSplitter, ImDrawFlags, ImDrawList, ImDrawData) // Hold a series of drawing commands. The user provides a renderer for ImDrawData which essentially contains an array of ImDrawList. //----------------------------------------------------------------------------- @@ -3474,19 +3473,6 @@ enum ImDrawFlags_ ImDrawFlags_InvalidMask_ = ~0x7FFFFFF0, // [Internal] == 0x8000000F. Reserved to detect misuses. }; -// Flags for ImDrawList instance. Those are set automatically by ImGui:: functions from ImGuiIO settings, and generally not manipulated directly. -// It is however possible to temporarily alter flags between calls to ImDrawList:: functions. -enum ImDrawListFlags_ -{ - ImDrawListFlags_None = 0, - ImDrawListFlags_AntiAliasedLines = 1 << 0, // Enable anti-aliased lines/borders (*2 the number of triangles for 1.0f wide line or lines thin enough to be drawn using textures, otherwise *3 the number of triangles) - ImDrawListFlags_AntiAliasedLinesUseTex = 1 << 1, // Enable anti-aliased lines/borders using textures when possible. Require backend to render with bilinear filtering (NOT point/nearest filtering). - ImDrawListFlags_AntiAliasedFill = 1 << 2, // Enable anti-aliased edge around filled shapes (rounded rectangles, circles). - ImDrawListFlags_AllowVtxOffset = 1 << 3, // Can emit 'VtxOffset > 0' to allow large meshes. Set when 'ImGuiBackendFlags_RendererHasVtxOffset' is enabled. - ImDrawListFlags_TextNoPixelSnap = 1 << 4, // Disable automatically snapping AddText() calls to pixel boundaries. - ImDrawListFlags_RoundCornersUseTex = 1 << 5, // Enable using textures instead of strokes to draw rounded corners/circles where possible. Set when `ImFontAtlasFlags_NoBakedRoundCorners` is enabled in the font atlas. -}; - // Draw command list // This is the low-level list of polygons that ImGui:: functions are filling. At the end of the frame, // all command lists are passed to your ImGuiIO::RenderDrawListFn function for rendering. @@ -3502,7 +3488,7 @@ struct ImDrawList ImVector CmdBuffer; // Draw commands. Typically 1 command = 1 GPU draw call, unless the command is a callback. ImVector IdxBuffer; // Index buffer. Each command consume ImDrawCmd::ElemCount of those ImVector VtxBuffer; // Vertex buffer. - ImDrawListFlags Flags; // Flags, you may poke into these to adjust anti-aliasing settings per-primitive. + ImDrawFlags Flags; // Flags, you may poke into these to adjust anti-aliasing settings per-primitive. // [Internal, used while building lists] unsigned int _VtxCurrentIdx; // [Internal] generally == VtxBuffer.Size unless we are past 64K vertices, in which case this gets reset to 0. @@ -4548,6 +4534,19 @@ namespace ImGui #define ImDrawCallback_ResetRenderState (ImDrawCallback)(-8) // OBSOLETED in 1.92.8: Use ImGui::GetPlatformIO().DrawCallback_ResetRenderState + +// -- RENAMED in 1.93.0: Merged ImDrawListFlags into ImDrawFlags. +typedef ImDrawFlags ImDrawListFlags; +enum ImDrawListFlags_ +{ + ImDrawListFlags_None = ImDrawFlags_None, + ImDrawListFlags_AntiAliasedFill = ImDrawFlags_AAFill, + ImDrawListFlags_AntiAliasedLines = ImDrawFlags_AALines, + ImDrawListFlags_AntiAliasedLinesUseTex = ImDrawFlags_UseTexForStrokeLegacy,// Only apply to StrokeLegacy mode! + ImDrawListFlags_AllowVtxOffset = ImDrawFlags_UseVtxOffset, + ImDrawListFlags_TextNoPixelSnap = ImDrawFlags_TextNoPixelSnap, +}; + //-- OBSOLETED in 1.92.0: ImFontAtlasCustomRect becomes ImTextureRect // - ImFontAtlasCustomRect::X,Y --> ImTextureRect::x,y // - ImFontAtlasCustomRect::Width,Height --> ImTextureRect::w,h diff --git a/imgui_demo.cpp b/imgui_demo.cpp index f8af2a616..fbbc1d829 100644 --- a/imgui_demo.cpp +++ b/imgui_demo.cpp @@ -10466,17 +10466,19 @@ static void ShowExampleAppCustomRendering(bool* p_open) ImGui::CheckboxFlags("SquareCap", &other_flags, ImDrawFlags_SquareCap); ImGui::SameLine(); ImGui::CheckboxFlags("AALineEnds", &other_flags, ImDrawFlags_AALineEnds); ImGui::Spacing(); - const ImDrawFlags flags = stroke_flags | other_flags; // FIXME: Clarify how this is exposed, consider changing Demo code to simply alter Style.s - static ImDrawListFlags draw_list_flags = ImDrawListFlags_AntiAliasedLines | ImDrawListFlags_AntiAliasedFill | ImDrawListFlags_RoundCornersUseTex; - ImGui::Text("DrawList Flags:"); - ImGui::CheckboxFlags("AntiAliasedLines", &draw_list_flags, ImDrawListFlags_AntiAliasedLines); ImGui::SameLine(); - ImGui::CheckboxFlags("AntiAliasedFill", &draw_list_flags, ImDrawListFlags_AntiAliasedFill); ImGui::SameLine(); - ImGui::CheckboxFlags("RoundCornersUseTex", &draw_list_flags, ImDrawListFlags_RoundCornersUseTex); - ImDrawListFlags backup_draw_list_flags = draw_list->Flags; - draw_list->Flags &= ~(ImDrawListFlags_AntiAliasedLines | ImDrawListFlags_AntiAliasedFill | ImDrawListFlags_RoundCornersUseTex); - draw_list->Flags |= draw_list_flags; + const ImDrawFlags scope_flags_mask = ImDrawFlags_AllowedInScope_; + static ImDrawFlags scope_flags = scope_flags_mask; // All + ImGui::Text("AA Flags:"); + ImGui::CheckboxFlags("AAFill", &scope_flags, ImDrawFlags_AAFill); ImGui::SameLine(); + ImGui::CheckboxFlags("AALines", &scope_flags, ImDrawFlags_AALines); ImGui::SameLine(); + ImGui::CheckboxFlags("AALineEnds", &scope_flags, ImDrawFlags_AALineEnds); + ImGui::CheckboxFlags("UseTexForRoundCorners", &scope_flags, ImDrawFlags_UseTexForRoundCorners); + ImGui::CheckboxFlags("UseTexForStrokeLegacy", &scope_flags, ImDrawFlags_UseTexForStrokeLegacy); ImGui::SameLine(); + ImDrawFlags backup_draw_list_flags = draw_list->Flags; + draw_list->Flags = (draw_list->Flags & ~scope_flags_mask) | scope_flags; + const ImDrawFlags flags = stroke_flags | other_flags; ImVec2 start_pos = ImGui::GetCursorScreenPos(); const float pi = 3.141592f; diff --git a/imgui_draw.cpp b/imgui_draw.cpp index 6f1c6d594..fa8b25c99 100644 --- a/imgui_draw.cpp +++ b/imgui_draw.cpp @@ -467,7 +467,8 @@ void ImDrawList::_ResetForNewFrame() CmdBuffer.resize(0); IdxBuffer.resize(0); VtxBuffer.resize(0); - Flags = _Data->InitialFlags; + Flags = _Data->InitialDrawFlags; + IM_ASSERT((Flags & ~ImDrawFlags_AllowedInScope_) == 0); memset(&_CmdHeader, 0, sizeof(_CmdHeader)); _VtxCurrentIdx = 0; _VtxWritePtr = NULL; @@ -486,7 +487,7 @@ void ImDrawList::_ClearFreeMemory() CmdBuffer.clear(); IdxBuffer.clear(); VtxBuffer.clear(); - Flags = ImDrawListFlags_None; + Flags = ImDrawFlags_None; _VtxCurrentIdx = 0; _VtxWritePtr = NULL; _IdxWritePtr = NULL; @@ -742,7 +743,7 @@ void ImDrawList::PrimReserve(int idx_count, int vtx_count) { // Large mesh support (when enabled) IM_ASSERT_PARANOID(idx_count >= 0 && vtx_count >= 0); - if (sizeof(ImDrawIdx) == 2 && (_VtxCurrentIdx + vtx_count >= (1 << 16)) && (Flags & ImDrawListFlags_AllowVtxOffset)) + if (sizeof(ImDrawIdx) == 2 && (_VtxCurrentIdx + vtx_count >= (1 << 16)) && (Flags & ImDrawFlags_UseVtxOffset)) { // FIXME: In theory we should be testing that vtx_count <64k here. // In practice, RenderText() relies on reserving ahead for a worst case scenario so it is currently useful for us @@ -969,7 +970,7 @@ void ImDrawList::AddPolyline(const ImVec2* points, const int points_count, ImU32 ImVec4 tex_uvs; float fringe; - if (Flags & ImDrawListFlags_AntiAliasedLines) + if (Flags & ImDrawFlags_AALines) { _SelectFringeTexture(screen_thickness, &tex_uvs, &fringe); } @@ -1311,7 +1312,7 @@ void ImDrawList::AddPolylineLegacy(const ImVec2* points, const int points_count, // Read more details near AddRect() + see "API BREAKING CHANGES" section for 1.82, 1.90 and 1.92.8. IM_ASSERT_USER_ERROR_RET((flags & ImDrawFlags_InvalidMask_) == 0, "Incorrect parameter. Did you swap 'thickness' and 'flags'?"); - if (Flags & ImDrawListFlags_AntiAliasedLines) + if (Flags & ImDrawFlags_AALines) { // Anti-aliased stroke const float AA_SIZE = _FringeScale; @@ -1325,9 +1326,9 @@ void ImDrawList::AddPolylineLegacy(const ImVec2* points, const int points_count, // Do we want to draw this line using a texture? // - For now, only draw integer-width lines using textures to avoid issues with the way scaling occurs, could be improved. // - If AA_SIZE is not 1.0f we cannot use the texture path. - const bool use_texture = (Flags & ImDrawListFlags_AntiAliasedLinesUseTex) && (integer_thickness < IM_DRAWLIST_TEX_LINES_WIDTH_MAX) && (fractional_thickness <= 0.00001f) && (AA_SIZE == 1.0f); + const bool use_texture = (Flags & ImDrawFlags_UseTexForStrokeLegacy) && (integer_thickness < IM_DRAWLIST_TEX_LINES_WIDTH_MAX) && (fractional_thickness <= 0.00001f) && (AA_SIZE == 1.0f); - // We should never hit this, because NewFrame() doesn't set ImDrawListFlags_AntiAliasedLinesUseTex unless ImFontAtlasFlags_NoBakedLines is off + // We should never hit this, because NewFrame() doesn't set ImDrawFlags_UseTexForStrokeLegacy unless ImFontAtlasFlags_NoBakedLines is off IM_ASSERT_PARANOID(!use_texture || !(_Data->Font->OwnerAtlas->Flags & ImFontAtlasFlags_NoBakedLines)); const int idx_count = use_texture ? (count * 6) : (thick_line ? count * 18 : count * 12); @@ -1571,7 +1572,7 @@ void ImDrawList::AddConvexPolyFilled(const ImVec2* points, const int points_coun }*/ const ImVec2 uv = _Data->TexUvWhitePixel; - if (Flags & ImDrawListFlags_AntiAliasedFill) + if (Flags & ImDrawFlags_AAFill) { const float half_aa = _FringeScale * 0.5f; ImU32 col_trans = col & ~IM_COL32_A_MASK; @@ -1759,7 +1760,7 @@ void ImDrawList::AddConvexPolyFilledLegacy(const ImVec2* points, const int point const ImVec2 uv = _Data->TexUvWhitePixel; - if (Flags & ImDrawListFlags_AntiAliasedFill) + if (Flags & ImDrawFlags_AAFill) { // Anti-aliased Fill const float AA_SIZE = _FringeScale; @@ -2206,7 +2207,7 @@ void ImDrawList::_AddLine(const ImVec2& p1, const ImVec2& p2, ImU32 col, float t ImVec4 tex_uvs; float fringe; - if (Flags & ImDrawListFlags_AntiAliasedLines) + if (Flags & ImDrawFlags_AALines) { _SelectFringeTexture(screen_thickness, &tex_uvs, &fringe); } @@ -2580,7 +2581,7 @@ void ImDrawList::_AddRectTinyRounding(const ImVec2& p_min, const ImVec2& p_max, ImVec4 tex_uvs; float fringe; - if (Flags & ImDrawListFlags_AntiAliasedLines) + if (Flags & ImDrawFlags_AALines) { _SelectFringeTexture(screen_thickness, &tex_uvs, &fringe); } @@ -2718,7 +2719,7 @@ void ImDrawList::AddRect(const ImVec2& p_min, const ImVec2& p_max, ImU32 col, fl if (g_LEGACY_STROKES || stroke_pos == ImDrawFlags_StrokeLegacy) IM_UNLIKELY { - if (Flags & ImDrawListFlags_AntiAliasedLines) + if (Flags & ImDrawFlags_AALines) PathRect(ImVec2(p_min.x + 0.50f, p_min.y + 0.50f), ImVec2(p_max.x - 0.50f, p_max.y - 0.50f), rounding, flags); else PathRect(ImVec2(p_min.x + 0.50f, p_min.y + 0.50f), ImVec2(p_max.x - 0.49f, p_max.y - 0.49f), rounding, flags); // Better looking lower-right corner and rounded non-AA shapes. @@ -2804,7 +2805,7 @@ void ImDrawList::AddRect(const ImVec2& p_min, const ImVec2& p_max, ImU32 col, fl return; } // Textured corners are baked with AA, do not use them if no-AA is requested. - const bool allow_tex_corners = (Flags & (ImDrawListFlags_RoundCornersUseTex | ImDrawListFlags_AntiAliasedLines)) == (ImDrawListFlags_RoundCornersUseTex | ImDrawListFlags_AntiAliasedLines); + const bool allow_tex_corners = (Flags & (ImDrawFlags_AALines | ImDrawFlags_UseTexForRoundCorners)) == (ImDrawFlags_AALines | ImDrawFlags_UseTexForRoundCorners); if (allow_tex_corners && s_thickness < IM_DRAWLIST_TEX_CORNERS_THICKNESS_MAX && s_rounding <= IM_DRAWLIST_TEX_CORNERS_ROUNDING_MAX) { // Pixel aligned rect with round corners rendered using baked textures. @@ -2950,7 +2951,7 @@ void ImDrawList::AddRectFilled(const ImVec2& p_min, const ImVec2& p_max, ImU32 c return; } // Textured corners are baked with AA, do not use them if no-AA is requested. - const bool allow_tex_corners = (Flags & (ImDrawListFlags_RoundCornersUseTex | ImDrawListFlags_AntiAliasedFill)) == (ImDrawListFlags_RoundCornersUseTex | ImDrawListFlags_AntiAliasedFill); + const bool allow_tex_corners = (Flags & (ImDrawFlags_AAFill | ImDrawFlags_UseTexForRoundCorners)) == (ImDrawFlags_AAFill | ImDrawFlags_UseTexForRoundCorners); if (allow_tex_corners && s_rounding <= IM_DRAWLIST_TEX_CORNERS_ROUNDING_MAX) { IM_ASSERT_PARANOID(!(_Data->Font->OwnerAtlas->Flags & ImFontAtlasFlags_NoBakedRoundCorners)); @@ -3587,7 +3588,7 @@ void ImDrawList::AddConcavePolyFilled(const ImVec2* points, const int points_cou const ImVec2 uv = _Data->TexUvWhitePixel; ImTriangulator triangulator; unsigned int triangle[3]; - if (Flags & ImDrawListFlags_AntiAliasedFill) + if (Flags & ImDrawFlags_AAFill) { // Anti-aliased Fill const float AA_SIZE = _FringeScale; @@ -3844,7 +3845,7 @@ void ImGui::AddDrawListToDrawDataEx(ImDrawData* draw_data, ImVector // May trigger for you if you are using PrimXXX functions incorrectly. IM_ASSERT(draw_list->VtxBuffer.Size == 0 || draw_list->_VtxWritePtr == draw_list->VtxBuffer.Data + draw_list->VtxBuffer.Size); IM_ASSERT(draw_list->IdxBuffer.Size == 0 || draw_list->_IdxWritePtr == draw_list->IdxBuffer.Data + draw_list->IdxBuffer.Size); - if (!(draw_list->Flags & ImDrawListFlags_AllowVtxOffset)) + if (!(draw_list->Flags & ImDrawFlags_UseVtxOffset)) IM_ASSERT((int)draw_list->_VtxCurrentIdx == draw_list->VtxBuffer.Size); // Check that draw_list doesn't use more vertices than indexable (default ImDrawIdx = unsigned short = 2 bytes = 64K vertices per ImDrawList = per window) @@ -7641,7 +7642,7 @@ void ImFont::RenderChar(ImDrawList* draw_list, float size, const ImVec2& pos, Im float scale = (size >= 0.0f) ? (size / baked->Size) : 1.0f; float x = pos.x; float y = pos.y; - if ((draw_list->Flags & ImDrawListFlags_TextNoPixelSnap) == 0) + if ((draw_list->Flags & ImDrawFlags_TextNoPixelSnap) == 0) { x = IM_TRUNC(x); y = IM_TRUNC(y); @@ -7683,7 +7684,7 @@ begin: float y = pos.y; if (y > clip_rect.w) return; - if ((draw_list->Flags & ImDrawListFlags_TextNoPixelSnap) == 0) + if ((draw_list->Flags & ImDrawFlags_TextNoPixelSnap) == 0) { x = IM_TRUNC(x); y = IM_TRUNC(y); diff --git a/imgui_internal.h b/imgui_internal.h index 483de4c3a..6bc659f82 100644 --- a/imgui_internal.h +++ b/imgui_internal.h @@ -954,7 +954,7 @@ struct IMGUI_API ImDrawListSharedData ImDrawFlags OverrideStrokePos; // Override default StrokePos when not specified by an individual primitive. == 0 or ImDrawFlags_StrokeLegacy only. float CurveTessellationMaxError; // Tessellation tolerance when using PathBezierCurveTo() float CircleTessellationMaxError; // Number of circle segments to use per pixel of radius for AddCircle() etc - ImDrawListFlags InitialFlags; // Initial flags at the beginning of the frame (it is possible to alter flags on a per-drawlist basis afterwards) + ImDrawFlags InitialDrawFlags; // Initial flags at the beginning of the frame (it is possible to alter flags on a per-drawlist basis afterwards) ImVec4 ClipRectFullscreen; // Value for PushClipRectFullscreen() ImVector TempBuffer; // Temporary write buffer ImVector DrawLists; // All draw lists associated to this ImDrawListSharedData