We are currently migrating Bugzilla to GitHub issues.
Any changes made to the bug tracker now will be lost, so please do not post new bugs or make changes to them.
When we're done, all bug URLs will redirect to their equivalent location on the new bug tracker.

Bug 3825 - provide access to SDL_Surface of already-created software renderer(s)
Summary: provide access to SDL_Surface of already-created software renderer(s)
Status: NEW
Alias: None
Product: SDL
Classification: Unclassified
Component: render (show other bugs)
Version: HG 2.0
Hardware: All All
: P2 normal
Assignee: Sam Lantinga
QA Contact: Sam Lantinga
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-09-13 17:22 UTC by David Ludwig
Modified: 2017-09-13 18:00 UTC (History)
1 user (show)

See Also:


Attachments
possible implementation, #1 (3.56 KB, text/plain)
2017-09-13 17:22 UTC, David Ludwig
Details

Note You need to log in before you can comment on or make changes to this bug.
Description David Ludwig 2017-09-13 17:22:36 UTC
Created attachment 2932 [details]
possible implementation, #1

If and when a software SDL_Renderer is created, there does not appear to be any means to get its inner SDL_Surface, once the renderer has been created.  An SDL_Surface can be passed into SDL_CreateSoftwareRenderer, and that SDL_Surface may be used later on, however, if one is created through other means, such as a user setting the SDL_RENDER_DRIVER environment variable, there is no public API to retrieve this surface.

Proposal: add an API to retrieve the SDL_Surface of an existing software SDL_Renderer.

Attached is a potential implementation of such a function.  The function itself is:

SDL_Surface * SDL_GetSoftwareRendererSurface(SDL_Renderer * renderer);

This function will return NULL for non-software renderers, or on error.  If the renderer is a software renderer, it'll return its SDL_Surface.
Comment 1 David Ludwig 2017-09-13 17:48:06 UTC
To note, the use case I am looking into here, involves:

1. an SDL_Renderer being created, with users, potentially, adjusting what type of renderer is used
2. if and when a software renderer is being used, have an app use custom routines to scale images, to the destination surface