1030 Commits

Author SHA1 Message Date
Mikko Mononen
5782f4e0ee DrawList: path rendering optimizations.
- added ImRsqrtPrecise() which adds Newton-Raphson iteration for more precision
- change calculation of miter_scale_factor so that it does not have a branch
- renamed IM_POLYLINE_APPEND_* macros to IM_APPEND_* and also use them in fill convex poly
- changed the convex poly miter calculation to match the polyline to make debugging and changes easier
- split the convex poly to separate loop when ImDrawFlags_MiterOnly is specified for less branches in common case

# Conflicts:
#	imgui_draw.cpp
2026-10-07 18:53:50 +02:00
Mikko Mononen
c2e029fb98 DrawList: added stroke position to path rendering.
- added generic stroke position to all path rendering
- removed stroke folding in favor of limiting the miter width (simplifies the geometry cases)
- removed fractional stroke rendering in favor of using the integer sized rendering for everything
  - the rationale is that the in-between sizes are a bit blurry anyways, and the error we get from scaling is visually acceptable
- added stroke position option for the demo
- updated the degenerate shape handling
- remove AddLine() stroke pos handling
- removed up commented out code.
2026-10-07 18:53:50 +02:00
Mikko Mononen
d1d2f5aead DrawList: use dedicated larger texture for fractional thickness lines. 2026-10-07 18:53:50 +02:00
Mikko Mononen
ea2e5c79c0 DrawList: added square cap rendering.
- Added square cap rendering to the DrawPolyline, which can be turned on by ImDrawFlags_SquareCap
- Added draw flags to AddBezierCubic() and AddBezierQuadratic()
2026-10-07 18:53:50 +02:00
Mikko Mononen
858b2b2952 DrawList: added more robust AddConvexPolyFilled(). (#2183, #7972)
- add bevel handling for sharp corners
- add limit to the miter distance to avoid inner shape spikes
- add support for ImDrawFlags_MiterOnly to keep well behaved rendering fast
2026-10-07 18:53:50 +02:00
Mikko Mononen
049f1a799a DrawList: added special case rendering for the stroked rects when the raounding radius gets really small compared to the stroke thickness. 2026-10-07 18:53:50 +02:00
Mikko Mononen
6c7b083e0e DrawList: improved handling of rounded stroked rectangles, where rounding is less than stroke thickness. 2026-10-07 18:53:50 +02:00
Mikko Mononen
a5b8a920c3 DrawList: added better handling for rendering degenerate geometry. (#2183, #7972)
- Add ImDrawFlags_MiterOnly which is used to indicate that a path contains simple geometry and can be rendered using mitered corners
- Added handling of degenerated shapes for stroked rectangle, circle, ngon, and ellipse
- Render shapes filled when outline covers the whole shape
- Clamp very small circles and ngons, and use alpha fade below one pixel
- Added correct offset for ellipse
2026-10-07 18:53:50 +02:00
Mikko Mononen
c98d220e6f DrawList: added improved polyline rendering. (#2183, #7972)
- added 2 variants of polyline rendering
- one handles integer-sized thickness using one strip of triangles along the line
- second handles any thickness using 2 strips of triangles long the line
2026-10-07 18:53:50 +02:00
ocornut
60a934afd9 DrawList: fixed build/warnings + added pretty theorical support for _StrokeLegacy in AddLineV/AddLineH
(Squash) Various zealous warning fixes.
2026-10-07 18:53:50 +02:00
Mikko Mononen
442834a428 DrawList: changed CenterPixelAligned growth to be smoother, added stroke pos to AddLine()
- changed vertical AddLine() to be consistent with AddLineV()
- changed CenterPixelAligned growth to be smoother
- added (temporary) specialized stroke pos support for AddLine()
2026-10-07 18:53:50 +02:00
ocornut
5a5a16da4d DrawList: added _GetStrokePos() helper indirection, made flags=0 select default at runtime. 2026-10-07 18:53:50 +02:00
ocornut
2361f61526 DrawList: fixed is_truncated checks in AddRect() and AddRectFilled(). 2026-10-07 18:53:50 +02:00
Mikko Mononen
789f0d7140 DrawList: optimize non-AA non-rounded case of AddRect() 2026-10-07 18:53:50 +02:00
Mikko Mononen
9199934a7f DrawList: added ImDrawFlags_StrokeCenterPixelAligned
- added ImDrawFlags_StrokeCenterPixelAligned which center aligns stroke so that outside of the stroke is pixel aligned
- fixed AddRect() non-rounded pixel aligned case to use correnct min/max
- fixed AddRect() default case to not adjust rounding for non-rounded rects
- fixed lineV() centered offset
- renamed ImDrawFlags_StrokeCenterPixelAligned to ImDrawFlags_StrokeCenterAligned.
- reduced debug build indirections.
2026-10-07 18:53:50 +02:00
ocornut
80096045d9 DrawList: AddRect: avoid altering rounding on StrokeOutside when initial value if 0 + comments 2026-10-07 18:53:50 +02:00
ocornut
b9707d72ab DrawList: Textured Round Corners: use macros + rename locals. (#1962)
Squashed: Rename macros to IM_APPEND_VTX(), IM_APPEND_TRI()
2026-10-07 18:53:49 +02:00
Mikko Mononen
237a498c2d DrawList: Textured Round Corners: Added flags to disable textured rounded corners (#1962)
- added ImFontAtlasFlags_NoBakedRoundCorners which controls if rounded corners should be baked to texture
- added ImDrawListFlags_RoundCornersUseTex which controls if we should try to use textured roudned corners
- fixed how _FringeScaleIsInteger is calculated (we want to detect integer pixel scale)
- fixed how _FringeScale is used with textured rounded corners
2026-10-07 18:53:49 +02:00
Mikko Mononen
2665220409 DrawList: Textured Round Corners: implemented faster render path for stroked rectangles. (#1962)
- added check to render simpler geometry when (stroked) rectangle has integer coords
- render non.rounded with 4 non-AA rectangles
- added textures for corners of 1-3 thickness and 1-16 rounding
- use textured corners when possible, or fallback to generic one
2026-10-07 18:53:49 +02:00
Mikko Mononen
ae06573c9a DrawList: Textured Round Corners: first version. (#1962) 2026-10-07 18:53:49 +02:00
ocornut
43d829885e DrawList: added ImDrawFlags_StrokeLegacy support to AddLine(). 2026-10-07 18:53:49 +02:00
Mikko Mononen
f73d8f4029 DrawList: added StrokePos flags: ImDrawFlags_StrokeInside, ImDrawFlags_StrokeOutside, ImDrawFlags_StrokeCenter, ImDrawFlags_StrokeLegacy. (#9504) 2026-10-07 18:53:49 +02:00
Mikko Mononen
6335dfb19c (Breaking) DrawList: removed half pixel offset from ImDrawList::AddLine(). (#9504) 2026-10-07 18:53:48 +02:00
ocornut
7263a23f1b Fonts: added ImFont::AddRemapCodepointToGlyphIndex(). (#9559, #5647, #609, #5748, #8466) 2026-09-30 18:41:31 +02:00
ocornut
dfa3c0c0bb (Breaking) Fonts: rename AddRemapChar() to AddRemapCodepoint(). (#609, #5748, #9559) 2026-09-30 18:39:11 +02:00
ocornut
09d740ba32 (Breaking) Fonts: refactor ImFontLoader to allow loading from glyph_index. (#9559, #5647)
cc #9540, #8466, #8465
2026-09-30 18:39:11 +02:00
ocornut
46ff5a7aab Fonts: shallow refactor of ImFontBaked_BuildLoadGlyph() mostly to reduce an upcoming diff. (#9559) 2026-09-29 22:10:14 +02:00
ocornut
5c6a86a9d2 imgui_freetype: fixed ExtraSizeScale (used by embedded ProggyForever) leading to non-pixel aligned vertical offset. (#9348, #9233) + Added ImRoundPositive64(), ImRoundSigned64(). 2026-09-25 14:22:08 +02:00
ocornut
f09485d7be Style: inverted ImGuiCol_TitleBgXXX colors for StyleColorsLight().
So that the selected window title bar appears brighter.
2026-09-18 16:05:56 +02:00
ocornut
f562ab8e32 DrawList: reworked assert in PushTexture() to allow convenience grace period of using texture already queued for destroy during the same frame. (#9528, #8465)
Amend 131f5c57ab
2026-09-01 16:22:14 +02:00
ocornut
ebc7307db5 ColorButton, RenderColorRectWithAlphaCheckerboard: fixed issues/inconsistencies with checkerboard rendering when combining color alpha and global style alpha. (#9511)
Cleanup hacks in ColorButton(). Amend d851775c80a, e9ff7162b.
2026-08-31 18:04:03 +02:00
ocornut
fd74775a0d ColorButton: fixed double style alpha multiply. Remove call to GetColorU32() in RenderColorRectWithAlphaCheckerboard() for consistency. (#9511)
The main fix is the change from GetColorU32() to ColorConvertFloat4ToU32() in calling code.
The change from GetColorU32() to manual multiply in RenderColorRectWithAlphaCheckerboard() is merely for consistency with other ::Render calls.
2026-08-31 17:29:10 +02:00
ocornut
19ead810d2 ColorButton, ColorEdit, ColorPicker: cancel-out alpha caused by BeginDisabled() so disabled color buttons have the same color. (#9511) 2026-08-31 17:29:10 +02:00
ocornut
5de45fb1d9 Trim trailing white spaces. Changes some NULL to nullptr. 2026-08-07 16:00:53 +02:00
ocornut
2de0a07cd4 Fixed PVS Studio false positive. 2026-08-04 14:33:31 +02:00
ocornut
5108603789 DrawList: apply current pixel density to DrawList's fringe scale. Added ImDrawList::_SetPixelDensity(). Reword FontRasterizerDensity as CurrentPixelDensity.
Amend 94a4322.

# Conflicts:
#	imgui.cpp
#	imgui.h
#	imgui_draw.cpp
#	imgui_internal.h
2026-08-04 13:15:05 +02:00
ocornut
fdc1152281 (Breaking) Style: obsoleted style.CurveTessellationTol in favor of style.CurveTesselationMaxError.
cc #3127, #3664, #3665
2026-08-03 17:05:44 +02:00
ocornut
b647af2100 Fonts: AddFontDefault() uses framebuffer scale.
If running before DisplaySize is set, assume a different default on Apple.
2026-08-03 15:01:23 +02:00
ocornut
ebd752a0ec Version 1.93.0 WIP 2026-08-03 14:42:56 +02:00
ocornut
f1cc2ae15e Version 1.92.9b 2026-07-31 16:14:42 +02:00
ocornut
e47e6b0d9d Fonts: made GetDefaultCompressedFontDataProggyClean()/GetDefaultCompressedFontDataProggyForever() undocumented non-static. (#9493) 2026-07-30 16:03:42 +02:00
ocornut
a9e7a8c880 ImDrawData: fixed a regression in 1.92.9 where legacy ImDrawData::CmdListsCount was always 0. 2026-07-26 15:42:48 +02:00
ocornut
01380c5797 Version 1.92.9 2026-07-25 13:28:06 +02:00
ocornut
f31f98f4cd ImDrawData: fixed late initialized field. (Amend 6f41d13)
Would effectively be initialized on use but best to clear on constructor.
2026-07-23 17:56:02 +02:00
ocornut
b335bf4328 Added ImTextureData::QueueUserData for staged-rendering texture queues e.g. imgui_threaded_rendering.h. (#8597, #9136) 2026-07-22 15:14:45 +02:00
ocornut
548389359c (Breaking) ImDrawData: marked draw_data->CmdListsCount as obsolete. Use draw_data->CmdLists.Size.
# Conflicts:
#	docs/CHANGELOG.txt
#	imgui.cpp
2026-07-20 16:58:45 +02:00
ocornut
6acba3b47d ImDrawListSharedData: rename CircleSegmentMaxError to CircleTessellationMaxError. Remove misleading ArcFastRadiusCutoff assignment.
cc 051ce0765, f107693d9 (3808)
2026-06-04 13:51:57 +02:00
ocornut
14278db024 Fonts: better document the fact that ImFontAtlas::Clear()/ClearFonts() functions are unlikely to be useful nowadays + fix tex->Updates[] ever-growing if ClearFonts() is called between frames. 2026-06-03 15:27:02 +02:00
ocornut
3b99fc4883 ColorButton: small rendering tweak/optimization for the alpha checkerboard.
Inverting the pattern means that for our typical 3x3 grid we don't need to draw 1+4 rounded rectangles, only 1.
This also fix the slightly rounding mismatch when switching from a=255 to a<255 paths.
2026-06-01 14:23:29 +02:00
ocornut
cac16b0d16 DrawList: rename ImDrawListFlags_NoTextPixelSnap -> ImDrawListFlags_TextNoPixelSnap. (#3437, #9417, #2291)
Amend 1d33ea9
2026-05-29 18:39:17 +02:00