SDL_render_sw_c.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

## Functions

SDL_Renderer * | SW_CreateRendererForSurface (SDL_Surface *surface)

## Function Documentation

## SW_CreateRendererForSurface()

SDL_Renderer* SW_CreateRendererForSurface | ( | SDL_Surface * | surface | ) |

Definition at line 802 of file SDL_render_sw.c.

{
SDL_Renderer *renderer;
SW_RenderData *data;
if (!surface) {
SDL_SetError("Can't create renderer for NULL surface");
return NULL;
}
renderer = (SDL_Renderer *) SDL_calloc(1, sizeof(*renderer));
if (!renderer) {
SDL_OutOfMemory();
return NULL;
}
data = (SW_RenderData *) SDL_calloc(1, sizeof(*data));
if (!data) {
SW_DestroyRenderer(renderer);
SDL_OutOfMemory();
return NULL;
}
data->surface = surface;
data->window = surface;
renderer->WindowEvent = SW_WindowEvent;
renderer->GetOutputSize = SW_GetOutputSize;
renderer->CreateTexture = SW_CreateTexture;
renderer->UpdateTexture = SW_UpdateTexture;
renderer->LockTexture = SW_LockTexture;
renderer->UnlockTexture = SW_UnlockTexture;
renderer->SetRenderTarget = SW_SetRenderTarget;
renderer->QueueSetViewport = SW_QueueSetViewport;
renderer->QueueSetDrawColor = SW_QueueSetViewport; /* SetViewport and SetDrawColor are (currently) no-ops. */
renderer->QueueDrawPoints = SW_QueueDrawPoints;
renderer->QueueDrawLines = SW_QueueDrawPoints; /* lines and points queue vertices the same way. */
renderer->QueueFillRects = SW_QueueFillRects;
renderer->QueueCopy = SW_QueueCopy;
renderer->QueueCopyEx = SW_QueueCopyEx;
renderer->RunCommandQueue = SW_RunCommandQueue;
renderer->RenderReadPixels = SW_RenderReadPixels;
renderer->RenderPresent = SW_RenderPresent;
renderer->DestroyTexture = SW_DestroyTexture;
renderer->DestroyRenderer = SW_DestroyRenderer;
renderer->info = SW_RenderDriver.info;
renderer->driverdata = data;
SW_ActivateRenderer(renderer);
return renderer;
}

References SDL_Renderer::CreateTexture, SDL_Renderer::DestroyRenderer, SDL_Renderer::DestroyTexture, SDL_Renderer::driverdata, SDL_Renderer::GetOutputSize, SDL_Renderer::info, SDL_RenderDriver::info, SDL_Renderer::LockTexture, NULL, SDL_Renderer::QueueCopy, SDL_Renderer::QueueCopyEx, SDL_Renderer::QueueDrawLines, SDL_Renderer::QueueDrawPoints, SDL_Renderer::QueueFillRects, SDL_Renderer::QueueSetDrawColor, SDL_Renderer::QueueSetViewport, renderer, SDL_Renderer::RenderPresent, SDL_Renderer::RenderReadPixels, SDL_Renderer::RunCommandQueue, SDL_calloc, SDL_OutOfMemory, SDL_SetError, SDL_Renderer::SetRenderTarget, SW_ActivateRenderer(), SW_CreateTexture(), SW_DestroyRenderer(), SW_DestroyTexture(), SW_GetOutputSize(), SW_LockTexture(), SW_QueueCopy(), SW_QueueCopyEx(), SW_QueueDrawPoints(), SW_QueueFillRects(), SW_QueueSetViewport(), SW_RenderDriver, SW_RenderPresent(), SW_RenderReadPixels(), SW_RunCommandQueue(), SW_SetRenderTarget(), SW_UnlockTexture(), SW_UpdateTexture(), SW_WindowEvent(), SDL_Renderer::UnlockTexture, SDL_Renderer::UpdateTexture, and SDL_Renderer::WindowEvent.

Referenced by SDL_CreateSoftwareRenderer(), and SW_CreateRenderer().

SW_DestroyTexture
static void SW_DestroyTexture(SDL_Renderer *renderer, SDL_Texture *texture)
Definition: SDL_render_sw.c:785
SDL_Renderer::QueueCopyEx
int(* QueueCopyEx)(SDL_Renderer *renderer, SDL_RenderCommand *cmd, SDL_Texture *texture, const SDL_Rect *srcquad, const SDL_FRect *dstrect, const double angle, const SDL_FPoint *center, const SDL_RendererFlip flip)
Definition: SDL_sysrender.h:140
SDL_Renderer::RunCommandQueue
int(* RunCommandQueue)(SDL_Renderer *renderer, SDL_RenderCommand *cmd, void *vertices, size_t vertsize)
Definition: SDL_sysrender.h:143
NULL
#define NULL
Definition: begin_code.h:167
surface
EGLSurface surface
Definition: eglext.h:248
SDL_Renderer::SetRenderTarget
int(* SetRenderTarget)(SDL_Renderer *renderer, SDL_Texture *texture)
Definition: SDL_sysrender.h:155
SW_QueueDrawPoints
static int SW_QueueDrawPoints(SDL_Renderer *renderer, SDL_RenderCommand *cmd, const SDL_FPoint *points, int count)
Definition: SDL_render_sw.c:202
SW_RenderDriver
SDL_RenderDriver SW_RenderDriver
Definition: SDL_render_sw.c:866
SW_QueueCopy
static int SW_QueueCopy(SDL_Renderer *renderer, SDL_RenderCommand *cmd, SDL_Texture *texture, const SDL_Rect *srcrect, const SDL_FRect *dstrect)
Definition: SDL_render_sw.c:265
SDL_Renderer::WindowEvent
void(* WindowEvent)(SDL_Renderer *renderer, const SDL_WindowEvent *event)
Definition: SDL_sysrender.h:126
SW_RenderReadPixels
static int SW_RenderReadPixels(SDL_Renderer *renderer, const SDL_Rect *rect, Uint32 format, void *pixels, int pitch)
Definition: SDL_render_sw.c:744
data
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: SDL_opengl.h:1974
SW_QueueFillRects
static int SW_QueueFillRects(SDL_Renderer *renderer, SDL_RenderCommand *cmd, const SDL_FRect *rects, int count)
Definition: SDL_render_sw.c:231
SDL_Renderer
Definition: SDL_sysrender.h:122
SDL_Renderer::QueueSetDrawColor
int(* QueueSetDrawColor)(SDL_Renderer *renderer, SDL_RenderCommand *cmd)
Definition: SDL_sysrender.h:131
SDL_Renderer::driverdata
void * driverdata
Definition: SDL_sysrender.h:232
SW_SetRenderTarget
static int SW_SetRenderTarget(SDL_Renderer *renderer, SDL_Texture *texture)
Definition: SDL_render_sw.c:183
SDL_Renderer::QueueDrawLines
int(* QueueDrawLines)(SDL_Renderer *renderer, SDL_RenderCommand *cmd, const SDL_FPoint *points, int count)
Definition: SDL_sysrender.h:134
SW_GetOutputSize
static int SW_GetOutputSize(SDL_Renderer *renderer, int *w, int *h)
Definition: SDL_render_sw.c:83
SW_RenderData
Definition: SDL_render_sw.c:47
SDL_Renderer::QueueSetViewport
int(* QueueSetViewport)(SDL_Renderer *renderer, SDL_RenderCommand *cmd)
Definition: SDL_sysrender.h:130
SW_UpdateTexture
static int SW_UpdateTexture(SDL_Renderer *renderer, SDL_Texture *texture, const SDL_Rect *rect, const void *pixels, int pitch)
Definition: SDL_render_sw.c:139
SDL_Renderer::GetOutputSize
int(* GetOutputSize)(SDL_Renderer *renderer, int *w, int *h)
Definition: SDL_sysrender.h:127
SDL_OutOfMemory
#define SDL_OutOfMemory()
Definition: SDL_error.h:52
SDL_Renderer::CreateTexture
int(* CreateTexture)(SDL_Renderer *renderer, SDL_Texture *texture)
Definition: SDL_sysrender.h:129
SDL_Renderer::DestroyRenderer
void(* DestroyRenderer)(SDL_Renderer *renderer)
Definition: SDL_sysrender.h:161
SDL_Renderer::LockTexture
int(* LockTexture)(SDL_Renderer *renderer, SDL_Texture *texture, const SDL_Rect *rect, void **pixels, int *pitch)
Definition: SDL_sysrender.h:152
SW_QueueCopyEx
static int SW_QueueCopyEx(SDL_Renderer *renderer, SDL_RenderCommand *cmd, SDL_Texture *texture, const SDL_Rect *srcrect, const SDL_FRect *dstrect, const double angle, const SDL_FPoint *center, const SDL_RendererFlip flip)
Definition: SDL_render_sw.c:302
SDL_calloc
#define SDL_calloc
Definition: SDL_dynapi_overrides.h:375
SW_DestroyRenderer
static void SW_DestroyRenderer(SDL_Renderer *renderer)
Definition: SDL_render_sw.c:793
SDL_Renderer::RenderReadPixels
int(* RenderReadPixels)(SDL_Renderer *renderer, const SDL_Rect *rect, Uint32 format, void *pixels, int pitch)
Definition: SDL_sysrender.h:156
renderer
static SDL_Renderer * renderer
Definition: testaudiocapture.c:21
SDL_Renderer::info
SDL_RendererInfo info
Definition: SDL_sysrender.h:170
SDL_SetError
#define SDL_SetError
Definition: SDL_dynapi_overrides.h:30
SDL_Renderer::RenderPresent
void(* RenderPresent)(SDL_Renderer *renderer)
Definition: SDL_sysrender.h:158
SW_ActivateRenderer
static SDL_Surface * SW_ActivateRenderer(SDL_Renderer *renderer)
Definition: SDL_render_sw.c:55
SDL_Renderer::QueueFillRects
int(* QueueFillRects)(SDL_Renderer *renderer, SDL_RenderCommand *cmd, const SDL_FRect *rects, int count)
Definition: SDL_sysrender.h:136
SDL_Renderer::UpdateTexture
int(* UpdateTexture)(SDL_Renderer *renderer, SDL_Texture *texture, const SDL_Rect *rect, const void *pixels, int pitch)
Definition: SDL_sysrender.h:144
SW_RunCommandQueue
static int SW_RunCommandQueue(SDL_Renderer *renderer, SDL_RenderCommand *cmd, void *vertices, size_t vertsize)
Definition: SDL_render_sw.c:607
SW_QueueSetViewport
static int SW_QueueSetViewport(SDL_Renderer *renderer, SDL_RenderCommand *cmd)
Definition: SDL_render_sw.c:196
SDL_RenderDriver::info
SDL_RendererInfo info
Definition: SDL_sysrender.h:241
SW_LockTexture
static int SW_LockTexture(SDL_Renderer *renderer, SDL_Texture *texture, const SDL_Rect *rect, void **pixels, int *pitch)
Definition: SDL_render_sw.c:165
SDL_Renderer::QueueDrawPoints
int(* QueueDrawPoints)(SDL_Renderer *renderer, SDL_RenderCommand *cmd, const SDL_FPoint *points, int count)
Definition: SDL_sysrender.h:132
SW_WindowEvent
static void SW_WindowEvent(SDL_Renderer *renderer, const SDL_WindowEvent *event)
Definition: SDL_render_sw.c:72
SDL_Renderer::QueueCopy
int(* QueueCopy)(SDL_Renderer *renderer, SDL_RenderCommand *cmd, SDL_Texture *texture, const SDL_Rect *srcrect, const SDL_FRect *dstrect)
Definition: SDL_sysrender.h:138
SW_CreateTexture
static int SW_CreateTexture(SDL_Renderer *renderer, SDL_Texture *texture)
Definition: SDL_render_sw.c:107
SW_RenderPresent
static void SW_RenderPresent(SDL_Renderer *renderer)
Definition: SDL_render_sw.c:775
SW_UnlockTexture
static void SW_UnlockTexture(SDL_Renderer *renderer, SDL_Texture *texture)
Definition: SDL_render_sw.c:178
SDL_Renderer::UnlockTexture
void(* UnlockTexture)(SDL_Renderer *renderer, SDL_Texture *texture)
Definition: SDL_sysrender.h:154
SDL_Renderer::DestroyTexture
void(* DestroyTexture)(SDL_Renderer *renderer, SDL_Texture *texture)
Definition: SDL_sysrender.h:159