Repository navigation
SDL2_gfx 1.1.0
First release of SDL2_gfx since 1.0.4 (2018), now developed on GitHub (https://github.com/ferzkopp/SDL2_gfx). The
API is unchanged and the library keeps the soname libSDL2_gfx-1.0.so.0. SDL3 users: SDL3_gfx 2.0.0 has the same
API and draws the same pixels.
Highlights
- Much faster with hardware renderers: primitives batch their SDL draw calls (one call per primitive instead of
one per pixel or span). With Direct3D 11, anti-aliased polygons are about 100x, filled polygons 50x, circles,
ellipses and arcs 20-30x faster; outlines are also about 10x faster with the software renderer. - Image filters work on x64: every filter processed only the last
length % 8bytes on MSVC x64 builds; the
filters are now portable C. - Fixes: text with more than one renderer (use-after-free of the glyph cache),
rotozoomSurfaceXYwith
different x/y zoom, 8-bit zoom with mirroring (crash), NaN/huge rotozoom factors,shrinkSurfacefactor 0,
rounded boxes with large radii, full-circle arcs, polygons spanning more than 32767 pixels,texturedPolygon
callingSDL_RenderPresent, semi-transparent primitives blending pixels twice, invisible one-pixel spans on the
software renderer, framerate delay after 49.7 days, palette of 8-bitrotateSurface90Degreesresults, ellipses
with radii above about 1000 and anti-aliased lines longer than 32767 pixels (wrong shape), rotozoom with very
small zoom factors or sources wider than 32767 pixels. - Tested on Windows (MSVC, Direct3D/OpenGL) and Linux (GCC, clang with AddressSanitizer and
UndefinedBehaviorSanitizer, OpenGL), with golden-image tests and fuzzing. - Thread-safe polygon fills; only visible rows are processed.
Upgrade notes
- Behavior change: the
...Colorfunctions decode the color as0xRRGGBBAAas documented. 1.0.4 used the
bytes in memory order (0xAABBGGRRon little-endian machines). Build with
-DSDL2GFX_LEGACY_COLOR_BYTE_ORDER=ONto keep the old behavior. - Call
gfxPrimitivesSetFont(NULL, 0, 0)before destroying a renderer that was used for text. texturedPolygonreturns 0 on success (it returned 1).SDL_imageFilterShiftRightUint/ShiftLeftUintprocess
the whole buffer;NormalizeLinearuses the exact scale factor. The MMX functions are deprecated no-ops.- Linux/macOS: only the functions declared in the headers are exported.
- The build system is CMake:
find_package(SDL2_gfx)withSDL2_gfx::SDL2_gfx/SDL2_gfx::SDL2_gfx-static, or
pkg-configSDL2_gfx. See BUILDING.md.
Full list of changes: CHANGELOG.md. Review findings: CODE_REVIEW.md.
Performance measurements: PERFORMANCE.md.