[N-Gage] Set proper brush style to draw filled rects properly.
[N-Gage] Add persistent buffers to avoid per-frame memory allocations (which are expensive)
[N-Gage] Add support for SDL_TEXTURE_ACCESS_TARGET, fixes#13165
[N-Gage] Update README, add hint that the compiler does not support aggregate initializations for structs (knowing this, avoids a lot of headache during debugging)
[N-Gage] Add basic fast-path optimisations for render operations.
[N-Gage] Fix line drawing.
XInput2 keyboard handling has limitations: system keys that shouldn't be passed through when the keyboard isn't grabbed can be seen, and the text input system needs key events to flow through the X server to function properly (passing synthesized events through the filter function is not sufficient and doesn't work with non-Latin character sets).
The primary bit of information missing from the core X key events that XInput2 provides is the source device, so use the XInput2 slave keyboard device events to store that value, and apply it to core X key events with the same serial. XInput2 events always arrive before core events so this works universally.
- Change active object priority from EPriorityLow to EPriorityStandard
- Process all events in batch before SDL_AppIterate() to reduce input lag
- Remove redundant SDL_PumpEvents() call (already done by SDL_PollEvent)
- Move clean-up logic into ShutdownApp() helper function
- Skip SDL_GetRenderScale call in Copy() fast path
- Cache last clear color to avoid redundant SetBrushColor calls
- Add whole-image bounds pre-check to skip per-pixel checks in rotation
- Simplify color packing in DrawPoints/FillRects to reduce overhead
- Remove redundant null checks
- Use cached texture properties instead of API calls (GetBitmapWidth/Height/Pitch)
- Eliminate duplicate SDL_GetRenderScale() call in Copy()
- Reorder CopyEx() fast paths to check no-transform case first
- Combine operations in NGAGE_ConvertColor() to reduce intermediate steps
- Add reusable line points buffer to eliminate per-call heap allocations in DrawLines.
- Cache last draw color to skip redundant SetPenColor/SetBrushColor calls.
- Pre-compute cardinal angle constants (0°, 90°, 180°, 270°) for CopyEx fast-path.
- Cache color modulation state to avoid redundant LUT rebuilds.
- Add missing break statement in HandleEvent.
- Initialize previously uninitialized lastTime variable in UpdateFPS.
Someone mentioned that Claude sees this file's previous text and adds "look at
AGENTS.md" to it's TODO list instead of treating it as the thing it should do
first.
If everything decides to prefer AGENTS.md at some point, we'll delete this
file.
A symlink would apparently also work, but it would be the only symlink in the
SDL git repo, so it seemed less disruptive to just copy the file over for now.
Apparently Claude Code won't read AGENTS.md by default at this moment, but
since that's the direction we're moving, let's just add the file Claude
currently looks for and tell it that the actual instructions are in AGENTS.md.
I thought these things were supposed to be less complicated that interacting
with humans, lol.
- Replace FixDiv with inverse scale factors in ApplyScale
- Improve incremental DDA in ApplyRotation
- Optimize ApplyColorMod bit manipulation and LUT addressing
- Batch color changes in DrawPoints and FillRects to reduce API overhead
- Add early-exit optimizations to Copy/CopyEx for common cases
- Streamline Flip function by removing unnecessary API calls
- Fix vertex indexing bug in FillRects
- Implement lookup tables for faster color modulation
- Cache 0°/90°/180°/270° rotations for speedup on common angles
- Add dirty rectangle tracking infrastructure
- Process 4 pixels at a time in all transform operations
- Remove SDL_Surface member from NGAGE_TextureData structure and update all functions that currently use
surface->pixels to instead access bitmap->DataAddress() directly. This eliminates the intermediate copy
step (Mem::Copy from surface to bitmap) in rendering operations.
- Eliminate per-frame allocations in Copy/CopyEx methods. These buffers are now allocated once and resized
only when needed.
cursor-shape-v1 version 2 adds dnd_ask and all_resize, but SDL_SystemCursor does not expose matching cursor types yet. Bind the protocol at version 2 now so SDL negotiates the updated interface correctly while keeping the current cursor mapping unchanged.
Some platforms require drawing something to the window for it to be mapped, so create a renderer and redraw on exposure events.
Additionally, add the license to the testtray.c file and clang-format the source.
The various SDL_Tray*DBus structs are supposed to be backend-specific
subclasses of the corresponding SDL_Tray* structs. This is done by making
the first member be a 'parent' of that type, so that, e.g., SDL_TrayDriverDBus
can be cast into an SDL_TrayDriver. However, these '_parent' members were
mistakenly removed in commit ce90105cf8 ("Clean up the tray D-Bus code"), as
they're never directly referenced.
Reinstate these variables, and instead of casting SDL_Tray*DBus to SDL_Tray* on
creation, reference the _parent member directly, so that any tooling will know
the variable is indeed used. In addition, rename _parent to class_parent, to
make its purpose more obvious.
Fixes: ce90105cf8 ("Clean up the tray D-Bus code")
This PR maps buttons 7 and 8 to paddles 2 (left) and 1 (right) respectively, and it also duplicates the mapping but for crc 0x2004, since the CRC of this controller changes if it was hotplugged.
When a window has the pointer grabbed, the X server will grab all master device events, and XInput2 will continue to deliver slave events to the window immediately under the pointer, regardless of grab status. Only send slave pointer events to the focused window, and fall back to the core X events to catch button presses missed when the pointer is over another window.
Previously we weren't doing drawing, but we were enqueuing viewport commands and so forth, which were causing GPU permission errors on iOS. We really don't want to be sending any work to the GPU when we're in the background.