Commit Graph

11943 Commits

Author SHA1 Message Date
ocornut
b5ef1d837d 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-08-06 18:12:07 +02:00
ocornut
1c71e07fa0 TabBar: simpify TabItem rendering using stroke flags.
May tend toward using _StrokeInside more but _StrokeCenterBiased is closer to current behavior.
2026-08-06 18:12:07 +02:00
ocornut
9aec6df4fd Checkbox, Menus: check marks use anti-aliased ends.
Currently not a satisfying resolution.
2026-08-06 18:12:07 +02:00
ocornut
b67ced86c0 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-08-06 18:12:07 +02:00
ocornut
691ea3ff6d DrawList: removed AddPolylineLegacy(), AddConvexPolyFilledLegacy(). 2026-08-06 18:12:07 +02:00
ocornut
5f7012f7ac DrawList: removed g_LEGACY_STROKES. 2026-08-06 18:12:07 +02:00
ocornut
fe8acacdde DrawList: moved no-AA handling into _SelectFringeTexture(). 2026-08-06 18:12:06 +02:00
ocornut
4110aa1184 DrawList: tweak _SelectFringeTexture(). move more-unlikely screen_thickness tests within already-unlikely block. re-add removed asserts. 2026-08-06 18:12:06 +02:00
ocornut
b3aee2d810 Docs: update changelog. 2026-08-06 18:12:06 +02:00
ocornut
4694b50924 DrawList: moved _GetStrokePos() to a local inline function. 2026-08-06 18:12:06 +02:00
ocornut
fb9fd9a250 DrawList: added PushDrawFlag(), PopDrawFlag(), ImSmallStack_<> 2026-08-06 18:12:06 +02:00
ocornut
59014d15e7 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-08-06 18:12:05 +02:00
ocornut
e925e453ee Demo: amend test bed to exercices more flags. 2026-08-06 18:12:05 +02:00
ocornut
7a54e76cd1 DrawList: comment about ImFontAtlasFlags_NoBakedLines. 2026-08-06 18:12:05 +02:00
ocornut
d482fe328e (Breaking) Obsoleted style.AntiAliasedLinesUseTex which now only makes sense for legacy strokes. Added style.AntiAliasedLineEnds. 2026-08-06 18:12:05 +02:00
ocornut
c52b050489 (Breaking) DrawList: removed ImDrawListFlags_in favor of using ImDrawFlags. 2026-08-06 18:12:05 +02:00
ocornut
2c5adecc11 DrawList: new ImDrawFlags API (yet unused in this commit) 2026-08-06 18:12:04 +02:00
ocornut
873afffd8f DrawList: inverted ImDrawFlags_NoAAEnds into ImDrawFlags_AAEnds. 2026-08-06 18:12:04 +02:00
ocornut
f474f9cced DrawList: fixed warnings, added macro to facilitate visualizing rounded corner texture usage. 2026-08-06 18:12:04 +02:00
Mikko Mononen
b35777c58d 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-08-06 18:12:04 +02:00
Mikko Mononen
c8867c72dc 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-08-06 18:12:04 +02:00
Mikko Mononen
9549b6ff7e DrawList: Optimize _SelectFringeTexture()
- store inverse line thickness in the spare texture uv component (same v was stord twice) to avoid division in _SelectFringeTexture
2026-08-06 18:12:04 +02:00
ocornut
9e2b8914c9 DrawList: surround _GetStrokePos() in IM_MSVC_RUNTIME_CHECKS_OFF macro. 2026-08-06 18:12:04 +02:00
ocornut
f9030f92af ImFontAtlas: moved TexUv buffers and configurable defines to internals. 2026-08-06 18:12:03 +02:00
Mikko Mononen
8c2d1befc6 DrawList: Added some comments and amended existing ones 2026-08-06 18:12:02 +02:00
Mikko Mononen
21930ad65c 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-08-05 21:24:56 +02:00
Mikko Mononen
fe6094886f DrawList: No AA ends when line AA is disabled 2026-08-05 21:24:56 +02:00
Mikko Mononen
4da24b1283 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-08-05 21:24:56 +02:00
Mikko Mononen
c4350c537e DrawList: removed vertex offset overflow (for 16-bit ImDrawIdx support) handling.
This seems unnecessary for now.
2026-08-05 21:24:56 +02:00
Mikko Mononen
34fdedfc53 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-08-05 21:24:56 +02:00
Mikko Mononen
589c83aab9 DrawList: fixed overdraw of transparent rounded rectangles
- transition earlier to _AddRectTinyRounding() to avoid overdraw issues
2026-08-05 21:24:56 +02:00
Mikko Mononen
7a717a297c 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-08-05 21:24:56 +02:00
Mikko Mononen
475c5dadcd 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-08-05 21:24:56 +02:00
Mikko Mononen
f25ae01030 Demo: added rounding slider+animate to allow better test range of rounding values. 2026-08-05 21:24:55 +02:00
Mikko Mononen
0ac31424b7 DrawList: increase detailed line textures from 3px to 4px to better hide the texture change.
+ amend: align #defines.
2026-08-05 21:24:55 +02:00
Mikko Mononen
13fd81acae DrawList: fixed reserve counts in _AddPolyline(). 2026-08-05 21:24:55 +02:00
ocornut
06909e07d7 DrawList: Debug build optimizations: add non-template ImMin/ImMax/ImClamp for int/float to avoid missing out on IM_MSVC_RUNTIME_CHECKS_OFF. 2026-08-05 21:24:55 +02:00
ocornut
3cdeeb29ea DrawList: Debug build optimizations: disable over zealous stack checks in PrimReserve, PrimUnreserve, PrimRect, PrimRectUV, PrimQuadUV, _CalculateCenterBiasedOffset, ImAlphaMultiply, _SelectFringeTexture
+ Undo inlined PrimRect() in AddRectFilled().
2026-08-05 21:24:55 +02:00
Mikko Mononen
6753fbdfa2 DrawList: added vertex offset 16-bit ImDrawIdx support for _AddPolyline 2026-08-05 21:24:55 +02:00
Mikko Mononen
e6dad84769 DrawList: improved worst case vertex count for AddConvexPolyFilled, convex polys can have only 2 bevels verts. 2026-08-05 21:24:55 +02:00
Mikko Mononen
065c6c0d0a DrawList: fixed indices when AllowVtxOffset is on
- fix shape closing indices for AddPolyline and _AddRectTinyRounding
2026-08-05 21:24:55 +02:00
Mikko Mononen
2974c9155f DrawList: Optimization: added specialized 2 point polyline _AddLine(). 2026-08-05 21:24:55 +02:00
Mikko Mononen
b6d59d69aa DrawList: added _InvFringeScale to use in cases of 1/_FringeScale. 2026-08-05 21:24:54 +02:00
Mikko Mononen
35e6c8ba15 DrawList: minor render optimizations.
- Use inline array + AddPolyline/AddConvexPolyFilled for triangle and quad
- do less computation for detecting small shape rendering
- add IM_UNLIKELY for very unlikely branches
2026-08-05 21:24:54 +02:00
Mikko Mononen
ed6f9fcfd1 DrawList: debug build optimizations.
- changed truncated tests to use macro, and inline the computation in debug builds (~15% was spent on calling the functions)
- inlined the common rectangle cases in AddRect() for debug build speed up
2026-08-05 21:24:54 +02:00
ocornut
e0530d81e1 DrawList: amends/review legacy stroke paths + minor tweaks. 2026-08-05 21:24:54 +02:00
ocornut
98f25f94aa DrawList: renamed ImDrawFlags_StrokeCenterAligned to ImDrawFlags_StrokeCenterBiased. 2026-08-05 21:24:54 +02:00
Mikko Mononen
19ff3b31d8 DrawList: Fixed vertex count calculation in_AddRectTinyRounding() 2026-08-05 21:24:54 +02:00
ocornut
87ff0ff8c2 DrawList: skip PathLineTo/PathStroke calls for common AddLine() functions. (4091)
Rough numbers
Debug x64, 100k lines: 91.5->80 ms, 87->75.5 ms (NoAAEnds), 87->76 ms (Legacy)
Release x64, 300 lines: 25.2->25 ms, 22.2->18.3 ms (NoAAEnds), 22.2->19.3 ms (Legacy)
2026-08-05 21:24:54 +02:00
Mikko Mononen
9f9fe6908b DrawList: fixed out of bounds access of baked corner based on thickness 2026-08-05 21:24:53 +02:00