[N-Gage] Correct SDL_FLIP_HORIZONTAL for sprite sheet textures
- ApplyFlip: swap toward midpoint when dest == source to avoid
overwriting pixels before they are read
- CopyEx: restore original bitmap pixels after BitBlt so the texture
is not permanently mutated across frames
- CopyEx: extract srcrect sub-region before transforming so flip/
rotate/scale operate on the correct pixels, not the full texture
[N-Gage] Use scratch bitmap in CopyEx to avoid mutating source texture.
Replace the write-then-restore pattern on the source texture with a
persistent iScratchBitmap. The transform pipeline operates entirely
within iPixelBufferA/B; the final result is copied into iScratchBitmap
and BitBlt reads from there. The source texture is never written to.
[N-Gage] Fix Copy() for render-target textures by using direct BitBlt
Bypass pixel readback for SDL_TEXTUREACCESS_TARGET textures in CRenderer::Copy().
Reading raw pixels via DataAddress() on a server-side bitmap is unreliable; use
BitBlt directly instead.
[N-Gage] Implement color-key masking using Symbian's BitBltMasked.
This implementation works fine, but relies on a platform specific property. This isn't ideal.
Todo: Add SDL_PIXELFORMAT_ARGB4444 to the N-Gage's rendering back-end.
[N-Gage] Avoid using BitBltMasked to improve performance. Much better!
Write only non-color-key source pixels directly into the destination bitmap
preserving existing destination pixels wherever the color key matches.
This replaces BitBltMasked and avoids the cost of building an EGray2 mask.
[N-Gage] Remove redundant function call since we're not using BitBltMasked() anymore.
[N-Gage] Remove SDL_PROP_TEXTURE_NGAGE_COLOR_KEY_NUMBER
- Promote SDL_PIXELFORMAT_XRGB4444 to SDL_PIXELFORMAT_ARGB4444 instead.
- Remove now unused functions.
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.
Fixes a crash when calling SDL_RenderGeometryRaw() with both `texture`
and `uv` set to `NULL`, and with geometry that is laid out in a way
that passes the quad checks.
This reverts commit 3ee29f2e7a, among other
changes. This means getting a scary warning on the javascript console in
Emscripten by default, but this is easily fixed by setting a GL swap
interval at startup or creating a 2D renderer with the appropriate property
(or call to SDL_SetRenderVSync()).
Fixes#14625.
015cc6a broke texture format selection for this kind of surface if the
renderer's first texture format doesn't happen to have an alpha
channel. This happens for on-screen software renderers on Windows,
whose preferred format is the window's own `SDL_PIXELFORMAT_XRGB8888`.
This fixed check also cover the intent behind 015cc6a, assuming that
indexed and alpha formats are mutually exclusive.
On Android, if you create a window with SDL_WINDOW_OPENGL, you can't create a Vulkan surface. The error message has been improved to reflect this, and the error is propagated back up to the application.
Also added warn level logging if the renderer couldn't be created.
SDL_CreateGPURenderer() now allows passing in an existing GPU device and passing in a NULL window to create an offscreen renderer.
Also renamed SDL_SetRenderGPUState() to SDL_SetGPURenderState().
Each texture gets its own palette, the palette is updated when it is rendered if necessary, rendering is flushed if a texture render is already queued up.
Trying to share palettes and handle the different cases of queued rendering and changing palettes in the middle of the frame ends up being very complicated, so we'll keep it simple for now.
SDL supports the following use cases:
* Normal operation with fast parameter checks (default):
SDL_SetHint(SDL_HINT_INVALID_PARAM_CHECKS, "1");
* Object parameters are checked for use-after-free issues:
SDL_SetHint(SDL_HINT_INVALID_PARAM_CHECKS, "2");
* Enable full validation, plus assert on invalid parameters:
#define SDL_ASSERT_INVALID_PARAMS
* Disable all parameter validation:
#define SDL_DISABLE_INVALID_PARAMS
This still logs backend choices, but we might use it for other things. For
example, what Android device is being used, or all the devices we enumerated,
etc.
Ideally this eventually logs all the stuff we often have to ask followup
questions about.