Changed texture-based rounded rectangle edges to draw using thin polygons
Rearranged data for texture-based rounded rectangles to reduce allocations and pre-calculate parametric coordinate
Made max texture-based corner size a constant
Added API for drawing n-gons
Added support in circle API to auto-calculate suitable segment count
Combined filled/outline arc textures into one texture rectangle per radius
Made rounded rectangles/circles draw using (moderately) tight-fitting geometry to minimise fill-rate usage
Hooked up texture-based rounded rectangle/circle code to main render path, with fallback to stroke system
Made AddCircleFilled/AddCircle explicitly not draw circles of radius 0 or less (to avoid inconsistency between them)
Fixed bug in PrimReserve() where releasing more vertices/indices than you used would try and immediately render the entire buffer
This is (kind of) an OpenGL-only function, which should be avoided when SDL2 isn't using OpenGL.
The only alternative that is recommended is SDL_GetRendererOutputSize, which limits this fix to the SDL_Renderer backend. Still, I think it's better than nothing.
I say that SDL_GL_GetDrawableSize is "kind of" OpenGL-only because it does technically work even when SDL2 isn't using OpenGL.
It's just that it becomes a shim to SDL_GetWindowSize, which is not suitable for high-DPI usage because it reflects the size of the window in screen coordinates, not actual pixels, so it really should be avoided when not using OpenGL.
SDL_PIXELFORMAT_RGBA32 is intended for byte arrays where the channels
are specifically in the RGBA order. However, this is not what
GetTexDataAsRGBA32 does: rather, it constructs an array where each
pixel is an unsigned int in ABGR order. On little-endian platforms,
this does indeed result in an RGBA byte order, however, on big-endian
platforms, this results in an ABGR byte order, which does not match
the PIXELFORMAT enum.
What should be used is the SDL_PIXELFORMAT_ABGR8888 enum, which
specifies that the pixels are in native-endian ABGR, which they are.
Builds have failed on Xcode versions that do not yet support `@available` or do not have new APIs (that are unavailable on target OS version) defined at all. Using true build time version checks fixes these issues.
This is bit of a weird edge case adding weight to ImDrawCmd merging, if we could rework the mess in RenderDimmedBackgroundBehindWindow() we may be able to undo some of that.