Skip to content

SDL2_gfx 1.1.0

Latest

Choose a tag to compare

@ferzkopp ferzkopp released this 16 Nov 04:32

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 % 8 bytes on MSVC x64 builds; the
    filters are now portable C.
  • Fixes: text with more than one renderer (use-after-free of the glyph cache), rotozoomSurfaceXY with
    different x/y zoom, 8-bit zoom with mirroring (crash), NaN/huge rotozoom factors, shrinkSurface factor 0,
    rounded boxes with large radii, full-circle arcs, polygons spanning more than 32767 pixels, texturedPolygon
    calling SDL_RenderPresent, semi-transparent primitives blending pixels twice, invisible one-pixel spans on the
    software renderer, framerate delay after 49.7 days, palette of 8-bit rotateSurface90Degrees results, 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 ...Color functions decode the color as 0xRRGGBBAA as documented. 1.0.4 used the
    bytes in memory order (0xAABBGGRR on little-endian machines). Build with
    -DSDL2GFX_LEGACY_COLOR_BYTE_ORDER=ON to keep the old behavior.
  • Call gfxPrimitivesSetFont(NULL, 0, 0) before destroying a renderer that was used for text.
  • texturedPolygon returns 0 on success (it returned 1). SDL_imageFilterShiftRightUint/ShiftLeftUint process
    the whole buffer; NormalizeLinear uses 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) with SDL2_gfx::SDL2_gfx/SDL2_gfx::SDL2_gfx-static, or
    pkg-config SDL2_gfx. See BUILDING.md.

Full list of changes: CHANGELOG.md. Review findings: CODE_REVIEW.md.
Performance measurements: PERFORMANCE.md.