Commit Graph

11992 Commits

Author SHA1 Message Date
Mikko Mononen
e10209ff37 DrawList: fixed too many detailed line textures being created.
Fixed issue where were creating detailed line textures up to detailed witdh + 1
Changed IM_DRAWLIST_TEX_LINES_DETAILED_WIDTH_MAX to IM_DRAWLIST_TEX_LINES_DETAILED_WIDTH_COUNT which no accounts for all the detailed line textures.
2026-09-07 16:24:11 +02:00
Mikko Mononen
e64d17a31d DrawList: fixed rendering issues on small and degenerate shapes.
The "does stroke cover the whole shape" used to be overly pessimistic to stroking artifacts. This was due to the fringe, where the geometry would mess up before visually closing the shape.
Fixed the issue by adding max inner offest for the AddPolyline(), which limits the inner offset and also adjusts the texture coords.
Second part of the fix was to calculate the pass the max inner offset from the common shapes (circle, ngon, ellipse, rect).
While this does not fix all the ellipse rendering issues, it limits the issue a lot.
e.g. AddRect() w/ size=5, thickness=2 used to trigger AddRectFilled() fallback because threshold was pessimistic to prevent the AddPolyline() issues.
2026-09-07 16:24:11 +02:00
Mikko Mononen
e62f0d7d52 DrawList: fixed overdraw issue for filled baked corner rendering.
Require all corners to fit inside the rect to avoid overdraw (or fallback to path rendering).
eg. AddRectFilled() w/ size=10, rounding=8 or 10 would break.
2026-09-07 16:24:10 +02:00
thedmd
a5ea8a0030 DrawList: fixed passing large thickness value (e.g. 1e20f) to thickness crashing the code. 2026-09-07 16:24:10 +02:00
ocornut
da87a009b8 DrawList: fixed AddRectFilled() path for minimum dimension. 2026-09-07 16:24:10 +02:00
ocornut
248d2763dd DrawList: baking half-texel in TexUvLines[] now that AddPolylineLegacy() was removed. 2026-09-07 16:24:10 +02:00
ocornut
508f6cda02 DrawList: ImDrawFlags_AALineEnds also requires ImDrawFlags_AALine, which makes it easier for widgets to opt-in AAEnds. 2026-09-07 16:24:10 +02:00
ocornut
c1c720ef3a DrawList: fixed using ImDrawFlags_UseTexForRoundCorners when ImFontAtlasFlags_NoBakedRoundCorners has also been set. 2026-09-07 16:24:10 +02:00
ocornut
faa223c22d DrawList: fixed dropping prim flags in some paths (most for ImDrawFlags_AAXXX flags). 2026-09-07 16:24:09 +02:00
Mikko Mononen
66d1c1484d DrawList: fixed filled rect baked AA.
Always add 1px to the fill side of the rounded corner to prevent the corner AA to bleed into the rectangle edges.
2026-09-07 16:24:09 +02:00
ocornut
fdbaed8d3a DrawList: Comments. Atlas's NoBakedLines automatically disable AA at Style level. Fix passing non-Legacy stroke mask to PushDrawFlag(). Demo: Custom Rendering: use LiveEdit everywhere. 2026-09-07 16:24:09 +02:00
ocornut
d7e6f0102c TabBar: simpify TabItem rendering using stroke flags.
May tend toward using _StrokeInside more but _StrokeCenterBiased is closer to current behavior.
2026-09-07 16:24:09 +02:00
ocornut
bdbb6a4e9a Checkbox, Menus: check marks use anti-aliased ends.
Currently not a satisfying resolution.
2026-09-07 16:24:08 +02:00
ocornut
ebc5dcf69c DrawList: support altering RoundCorners flags in scope as an undocumented trick/hack. (9489)
Not documented because it could become troublesome if treated as a guaranteed styling feature.
2026-09-07 16:24:08 +02:00
ocornut
c0a7aa3430 DrawList: removed AddPolylineLegacy(), AddConvexPolyFilledLegacy(). 2026-09-07 16:24:08 +02:00
ocornut
1897798b05 DrawList: removed g_LEGACY_STROKES. 2026-09-07 16:24:08 +02:00
ocornut
5338d4da33 DrawList: moved no-AA handling into _SelectFringeTexture(). 2026-09-07 16:24:07 +02:00
ocornut
21f35d1c64 DrawList: tweak _SelectFringeTexture(). move more-unlikely screen_thickness tests within already-unlikely block. re-add removed asserts. 2026-09-07 16:24:07 +02:00
ocornut
9b53a8fc90 Docs: update changelog. 2026-09-07 16:24:07 +02:00
ocornut
c0e859572a DrawList: moved _GetStrokePos() to a local inline function. 2026-09-07 16:24:07 +02:00
ocornut
f36bffe2d7 DrawList: added PushDrawFlag(), PopDrawFlag(), ImSmallStack_<> 2026-09-07 16:24:07 +02:00
ocornut
ca1ccc6bcc DrawList: consistently support scope flags (ImDrawFlags::Flags) + primitive flags.
ImDrawFlags_AAEnds and ImDrawFlags_StrokeLegacy ok. (the most important ones).
ImDrawFlags_UseTexForRoundCorners ok.
ImDrawFlags_AAFill, ImDrawFlags_AAStrokes: for primitives: only for selected ones taking flags params. Haven't added the flag to all functions because it feels like a fringe use case.
ImDrawFlags_TextNoPixelSnap supported in RenderText(), per-prim (9417)
2026-09-07 16:24:06 +02:00
ocornut
bf51f04dbc Demo: amend test bed to exercices more flags. 2026-09-07 16:24:06 +02:00
ocornut
2309b9018d DrawList: comment about ImFontAtlasFlags_NoBakedLines. 2026-09-07 16:24:06 +02:00
ocornut
55234f7dcf (Breaking) Obsoleted style.AntiAliasedLinesUseTex which now only makes sense for legacy strokes. Added style.AntiAliasedLineEnds. 2026-09-07 16:24:06 +02:00
ocornut
6d73d52c3b (Breaking) DrawList: removed ImDrawListFlags_in favor of using ImDrawFlags. 2026-09-07 16:24:05 +02:00
ocornut
f5da056195 DrawList: new ImDrawFlags API (yet unused in this commit) 2026-09-07 16:24:05 +02:00
ocornut
e1a77843e6 DrawList: inverted ImDrawFlags_NoAAEnds into ImDrawFlags_AAEnds. 2026-09-07 16:24:05 +02:00
ocornut
02c3ba796a DrawList: fixed warnings, added macro to facilitate visualizing rounded corner texture usage. 2026-09-07 16:24:05 +02:00
Mikko Mononen
9c6b0aa8b6 DrawList: Optimize AddNgon()
- test overestimate before testing more expensive details when testing if stroked ngon is actualy filled
- Note: not a common function, but the test harness is using this to draw a triangle, which makes it show up in profiling
2026-09-07 16:24:05 +02:00
Mikko Mononen
d3f1dc8053 DrawList: Optimize AddRectFilled()
- detect and draw non-rounded non-AA rect with less branches and calculations
- improves new AddRectFilled() overhead from 30% to 5-10%
2026-09-07 16:24:05 +02:00
Mikko Mononen
70f9ef0649 DrawList: Optimize _SelectFringeTexture()
- store inverse line thickness in the spare texture uv component (same v was stord twice) to avoid division in _SelectFringeTexture
2026-09-07 16:24:05 +02:00
ocornut
82c2b2c500 DrawList: surround _GetStrokePos() in IM_MSVC_RUNTIME_CHECKS_OFF macro. 2026-09-07 16:24:05 +02:00
ocornut
3d94f04196 ImFontAtlas: moved TexUv buffers and configurable defines to internals. 2026-09-07 16:24:04 +02:00
Mikko Mononen
3f2b49facb DrawList: Added some comments and amended existing ones 2026-09-07 16:24:04 +02:00
Mikko Mononen
b45c3cd7ad DrawList: Revert texture selection to simple round() in _SelectFringeTexture
- revert texture selection to use just (inlined) round()
- the values were tuned to hide texture selection pops on small thickness
- since we're using super sampling for the problematic range, the tweaks are not necessayr anymore
2026-09-07 16:24:04 +02:00
Mikko Mononen
e1c20644ac DrawList: No AA ends when line AA is disabled 2026-09-07 16:24:04 +02:00
Mikko Mononen
bd0f8bf544 DrawList: merged _AddPolyline back into AddPolyline.
- AddPolyline used to call different versions of _AddPolyline, the separation is not needed anymore, one less function call in debug mode
2026-09-07 16:24:04 +02:00
Mikko Mononen
6fa4cda363 DrawList: removed vertex offset overflow (for 16-bit ImDrawIdx support) handling.
This seems unnecessary for now.
2026-09-07 16:24:04 +02:00
Mikko Mononen
7a9a7a874e DrawList: restored non-AA rendering mode.
- the ImDrawListFlags_AntiAliasedFill and ImDrawListFlags_AntiAliasedLines flags work again
- added non-AA rendering for polyline and convex poly filled
- do not use corner textures when AA is not used
- Add missing no-AA for single line case
2026-09-07 16:24:04 +02:00
Mikko Mononen
2fe9792b6d DrawList: fixed overdraw of transparent rounded rectangles
- transition earlier to _AddRectTinyRounding() to avoid overdraw issues
2026-09-07 16:24:04 +02:00
Mikko Mononen
967ae9d240 DrawList: fixed baked corners to better match polyline corners
- added CalcArcStepAndCount() to calculate the step size consistently
- _AddRectTinyRounding: fixed stem placement with thin lines (clamping was needed for an older version of the function)
- _AddRectTinyRounding: fixed texture coordinates (uses if inner/outer were reversed)
- use polygon instead of circle when calculating baked corner rounds (the circle was more accurate but looked different size comparet to polyline)
2026-09-07 16:24:04 +02:00
Mikko Mononen
cdfcf0ea11 DrawList: added macro to have consistent check for rounding
- use macro to test if rounding value is worthy
- changed threshold to be a bit smaller (for smoother handling of small radius), and relative to fringe
2026-09-07 16:24:03 +02:00
Mikko Mononen
861c165d9f Demo: added rounding slider+animate to allow better test range of rounding values. 2026-09-07 16:24:03 +02:00
Mikko Mononen
a79ac2d93a DrawList: increase detailed line textures from 3px to 4px to better hide the texture change.
+ amend: align #defines.
2026-09-07 16:24:03 +02:00
Mikko Mononen
fb0bf39054 DrawList: fixed reserve counts in _AddPolyline(). 2026-09-07 16:24:03 +02:00
ocornut
52241f3206 DrawList: Debug build optimizations: add non-template ImMin/ImMax/ImClamp for int/float to avoid missing out on IM_MSVC_RUNTIME_CHECKS_OFF. 2026-09-07 16:24:03 +02:00
ocornut
c45034a249 DrawList: Debug build optimizations: disable over zealous stack checks in PrimReserve, PrimUnreserve, PrimRect, PrimRectUV, PrimQuadUV, _CalculateCenterBiasedOffset, ImAlphaMultiply, _SelectFringeTexture
+ Undo inlined PrimRect() in AddRectFilled().
2026-09-07 16:24:03 +02:00
Mikko Mononen
bfb1c1aaa1 DrawList: added vertex offset 16-bit ImDrawIdx support for _AddPolyline 2026-09-07 16:24:03 +02:00
Mikko Mononen
50be4ac081 DrawList: improved worst case vertex count for AddConvexPolyFilled, convex polys can have only 2 bevels verts. 2026-09-07 16:24:03 +02:00