Go to the documentation of this file.
21 #include "../SDL_internal.h"
32 #if defined(__ANDROID__)
33 # include "../core/android/SDL_android.h"
36 #define SDL_WINDOWRENDERDATA "_SDL_WindowRenderData"
38 #define CHECK_RENDERER_MAGIC(renderer, retval) \
39 SDL_assert(renderer && renderer->magic == &renderer_magic); \
40 if (!renderer || renderer->magic != &renderer_magic) { \
41 SDL_SetError("Invalid renderer"); \
45 #define CHECK_TEXTURE_MAGIC(texture, retval) \
46 SDL_assert(texture && texture->magic == &texture_magic); \
47 if (!texture || texture->magic != &texture_magic) { \
48 SDL_SetError("Invalid texture"); \
53 #define SDL_COMPOSE_BLENDMODE(srcColorFactor, dstColorFactor, colorOperation, \
54 srcAlphaFactor, dstAlphaFactor, alphaOperation) \
55 (SDL_BlendMode)(((Uint32)colorOperation << 0) | \
56 ((Uint32)srcColorFactor << 4) | \
57 ((Uint32)dstColorFactor << 8) | \
58 ((Uint32)alphaOperation << 16) | \
59 ((Uint32)srcAlphaFactor << 20) | \
60 ((Uint32)dstAlphaFactor << 24))
62 #define SDL_BLENDMODE_NONE_FULL \
63 SDL_COMPOSE_BLENDMODE(SDL_BLENDFACTOR_ONE, SDL_BLENDFACTOR_ZERO, SDL_BLENDOPERATION_ADD, \
64 SDL_BLENDFACTOR_ONE, SDL_BLENDFACTOR_ZERO, SDL_BLENDOPERATION_ADD)
66 #define SDL_BLENDMODE_BLEND_FULL \
67 SDL_COMPOSE_BLENDMODE(SDL_BLENDFACTOR_SRC_ALPHA, SDL_BLENDFACTOR_ONE_MINUS_SRC_ALPHA, SDL_BLENDOPERATION_ADD, \
68 SDL_BLENDFACTOR_ONE, SDL_BLENDFACTOR_ONE_MINUS_SRC_ALPHA, SDL_BLENDOPERATION_ADD)
70 #define SDL_BLENDMODE_ADD_FULL \
71 SDL_COMPOSE_BLENDMODE(SDL_BLENDFACTOR_SRC_ALPHA, SDL_BLENDFACTOR_ONE, SDL_BLENDOPERATION_ADD, \
72 SDL_BLENDFACTOR_ZERO, SDL_BLENDFACTOR_ONE, SDL_BLENDOPERATION_ADD)
74 #define SDL_BLENDMODE_MOD_FULL \
75 SDL_COMPOSE_BLENDMODE(SDL_BLENDFACTOR_ZERO, SDL_BLENDFACTOR_SRC_COLOR, SDL_BLENDOPERATION_ADD, \
76 SDL_BLENDFACTOR_ZERO, SDL_BLENDFACTOR_ONE, SDL_BLENDOPERATION_ADD)
78 #define SDL_BLENDMODE_MUL_FULL \
79 SDL_COMPOSE_BLENDMODE(SDL_BLENDFACTOR_DST_COLOR, SDL_BLENDFACTOR_ONE_MINUS_SRC_ALPHA, SDL_BLENDOPERATION_ADD, \
80 SDL_BLENDFACTOR_DST_ALPHA, SDL_BLENDFACTOR_ONE_MINUS_SRC_ALPHA, SDL_BLENDOPERATION_ADD)
82 #if !SDL_RENDER_DISABLED
84 #if SDL_VIDEO_RENDER_D3D
87 #if SDL_VIDEO_RENDER_D3D11
90 #if SDL_VIDEO_RENDER_METAL
93 #if SDL_VIDEO_RENDER_OGL
96 #if SDL_VIDEO_RENDER_OGL_ES2
99 #if SDL_VIDEO_RENDER_OGL_ES
102 #if SDL_VIDEO_RENDER_DIRECTFB
105 #if SDL_VIDEO_RENDER_PSP
108 #if SDL_VIDEO_RENDER_SW
122 SDL_Log(
"Render commands to flush:");
130 SDL_Log(
" %u. set viewport (first=%u, rect={(%d, %d), %dx%d})",
i++,
137 SDL_Log(
" %u. set cliprect (enabled=%s, rect={(%d, %d), %dx%d})",
i++,
144 SDL_Log(
" %u. set draw color (first=%u, r=%d, g=%d, b=%d, a=%d)",
i++,
151 SDL_Log(
" %u. clear (first=%u, r=%d, g=%d, b=%d, a=%d)",
i++,
158 SDL_Log(
" %u. draw points (first=%u, count=%u, r=%d, g=%d, b=%d, a=%d, blend=%d)",
i++,
159 (
unsigned int) cmd->
data.
draw.first,
160 (
unsigned int) cmd->
data.
draw.count,
167 SDL_Log(
" %u. draw lines (first=%u, count=%u, r=%d, g=%d, b=%d, a=%d, blend=%d)",
i++,
168 (
unsigned int) cmd->
data.
draw.first,
169 (
unsigned int) cmd->
data.
draw.count,
176 SDL_Log(
" %u. fill rects (first=%u, count=%u, r=%d, g=%d, b=%d, a=%d, blend=%d)",
i++,
177 (
unsigned int) cmd->
data.
draw.first,
178 (
unsigned int) cmd->
data.
draw.count,
185 SDL_Log(
" %u. copy (first=%u, count=%u, r=%d, g=%d, b=%d, a=%d, blend=%d, tex=%p)",
i++,
186 (
unsigned int) cmd->
data.
draw.first,
187 (
unsigned int) cmd->
data.
draw.count,
195 SDL_Log(
" %u. copyex (first=%u, count=%u, r=%d, g=%d, b=%d, a=%d, blend=%d, tex=%p)",
i++,
196 (
unsigned int) cmd->
data.
draw.first,
197 (
unsigned int) cmd->
data.
draw.count,
268 size_t aligner = (alignment && ((current_offset & (alignment - 1)) != 0)) ? (alignment - (current_offset & (alignment - 1))) : 0;
269 size_t aligned = current_offset + aligner;
273 size_t newsize = current_allocation * 2;
275 while (newsize < needed) {
555 #if !SDL_RENDER_DISABLED
565 #if !SDL_RENDER_DISABLED
567 return SDL_SetError(
"index must be in the range of 0 - %d",
573 return SDL_SetError(
"SDL not built with rendering support");
654 int logical_w, logical_h;
663 if (
event->motion.xrel > 0) {
665 }
else if (
event->motion.xrel < 0) {
668 if (
event->motion.yrel > 0) {
670 }
else if (
event->motion.yrel < 0) {
679 int logical_w, logical_h;
693 int logical_w, logical_h;
706 event->tfinger.x *= (
w - 1);
707 event->tfinger.y *= (
h - 1);
715 event->tfinger.x =
event->tfinger.x / (logical_w - 1);
717 event->tfinger.x = 0.5f;
720 event->tfinger.y =
event->tfinger.y / (logical_h - 1);
722 event->tfinger.y = 0.5f;
767 #if !SDL_RENDER_DISABLED
773 #if defined(__ANDROID__)
783 SDL_SetError(
"Renderer already associated with window");
832 SDL_SetError(
"index must be -1 or in the range of 0 - %d",
868 int output_w, output_h;
891 #if defined(__ANDROID__)
898 #if defined(__ANDROID__)
912 #if !SDL_RENDER_DISABLED && SDL_VIDEO_RENDER_SW
965 return SDL_SetError(
"Renderer doesn't support querying output size");
1060 if (
w <= 0 ||
h <= 0) {
1154 SDL_SetError(
"SDL_CreateTextureFromSurface() passed NULL surface");
1237 if (direct_update) {
1313 if (
r < 255 ||
g < 255 ||
b < 255) {
1411 texture->scaleMode = scaleMode;
1424 *scaleMode =
texture->scaleMode;
1432 const void *
pixels,
int pitch)
1449 void *native_pixels =
NULL;
1450 int native_pitch = 0;
1456 rect->
w,
rect->
h, native_pixels, native_pitch);
1461 const size_t alloclen =
rect->
h * temp_pitch;
1479 const void *
pixels,
int pitch)
1489 void *native_pixels =
NULL;
1490 int native_pitch = 0;
1497 native->
format, native_pixels, native_pitch);
1502 const size_t alloclen =
rect->
h * temp_pitch;
1510 native->
format, temp_pixels, temp_pitch);
1520 const void *
pixels,
int pitch)
1561 const Uint8 *Yplane,
int Ypitch,
1562 const Uint8 *Uplane,
int Upitch,
1563 const Uint8 *Vplane,
int Vpitch)
1584 void *native_pixels =
NULL;
1585 int native_pitch = 0;
1591 rect->
w,
rect->
h, native_pixels, native_pitch);
1596 const size_t alloclen =
rect->
h * temp_pitch;
1613 const Uint8 *Yplane,
int Ypitch,
1614 const Uint8 *Uplane,
int Upitch,
1615 const Uint8 *Vplane,
int Vpitch)
1644 return SDL_SetError(
"Texture format must by YV12 or IYUV");
1682 void **
pixels,
int *pitch)
1690 void **
pixels,
int *pitch)
1702 void **
pixels,
int *pitch)
1709 return SDL_SetError(
"SDL_LockTexture(): texture must be streaming");
1781 void *native_pixels =
NULL;
1782 int native_pitch = 0;
1794 rect.
w,
rect.
h, native_pixels, native_pitch);
1803 void *native_pixels =
NULL;
1804 int native_pitch = 0;
1816 native->
format, native_pixels, native_pitch);
1870 return SDL_SetError(
"Texture was not created with this renderer");
1873 return SDL_SetError(
"Texture not created with SDL_TEXTUREACCESS_TARGET");
1947 int scale_policy = 0;
1958 if (hint && (*hint ==
'1' ||
SDL_strcasecmp(hint,
"overscan") == 0)) {
1959 #if SDL_VIDEO_RENDER_D3D
1967 if (overscan_supported) {
1976 real_aspect = (
float)
w /
h;
1982 if (want_aspect > real_aspect) {
1993 }
else if (
SDL_fabs(want_aspect-real_aspect) < 0.0001) {
1997 }
else if (want_aspect > real_aspect) {
1998 if (scale_policy == 1) {
2019 if (scale_policy == 1) {
2269 fpoint.
x = (float)
x;
2270 fpoint.
y = (float)
y;
2322 return SDL_SetError(
"SDL_RenderDrawPoints(): Passed NULL points");
2392 return SDL_SetError(
"SDL_RenderDrawFPoints(): Passed NULL points");
2466 frect = &frects[nrects++];
2475 frect = &frects[nrects++];
2521 frect = &frects[nrects++];
2530 frect = &frects[nrects++];
2567 return SDL_SetError(
"SDL_RenderDrawLines(): Passed NULL points");
2610 return SDL_SetError(
"SDL_RenderDrawLines(): Passed NULL points");
2648 frect.
x = (float)
rect->
x;
2649 frect.
y = (
float)
rect->
y;
2650 frect.
w = (float)
rect->
w;
2651 frect.
h = (
float)
rect->
h;
2672 frect.
w = (float)
r.w;
2673 frect.
h = (
float)
r.h;
2699 return SDL_SetError(
"SDL_RenderDrawRects(): Passed NULL rects");
2727 return SDL_SetError(
"SDL_RenderDrawRects(): Passed NULL rects");
2755 frect.
x = (float)
rect->
x;
2756 frect.
y = (
float)
rect->
y;
2757 frect.
w = (float)
rect->
w;
2758 frect.
h = (
float)
rect->
h;
2765 frect.
w = (float)
r.w;
2766 frect.
h = (
float)
r.h;
2785 frect.
w = (float)
r.w;
2786 frect.
h = (
float)
r.h;
2804 return SDL_SetError(
"SDL_RenderFillRects(): Passed NULL rects");
2845 return SDL_SetError(
"SDL_RenderFillFRects(): Passed NULL rects");
2884 float Amin, Amax, Bmin, Bmax;
2935 dstfrect.
x = (float) dstrect->
x;
2936 dstfrect.
y = (
float) dstrect->
y;
2937 dstfrect.
w = (float) dstrect->
w;
2938 dstfrect.
h = (
float) dstrect->
h;
2939 pdstfrect = &dstfrect;
2957 return SDL_SetError(
"Texture was not created with this renderer");
2977 real_dstrect.
x = 0.0f;
2978 real_dstrect.
y = 0.0f;
2979 real_dstrect.
w = (float)
r.w;
2980 real_dstrect.
h = (
float)
r.h;
2985 real_dstrect = *dstrect;
3014 dstfrect.
x = (float) dstrect->
x;
3015 dstfrect.
y = (
float) dstrect->
y;
3016 dstfrect.
w = (float) dstrect->
w;
3017 dstfrect.
h = (
float) dstrect->
h;
3018 pdstfrect = &dstfrect;
3022 fcenter.
x = (float) center->
x;
3023 fcenter.
y = (
float) center->
y;
3024 pfcenter = &fcenter;
3048 return SDL_SetError(
"Texture was not created with this renderer");
3051 return SDL_SetError(
"Renderer does not support RenderCopyEx");
3071 real_dstrect = *dstrect;
3076 real_dstrect.
x = 0.0f;
3077 real_dstrect.
y = 0.0f;
3078 real_dstrect.
w = (float)
r.w;
3079 real_dstrect.
h = (
float)
r.h;
3087 real_center = *center;
3089 real_center.
x = real_dstrect.
w / 2.0f;
3090 real_center.
y = real_dstrect.
h / 2.0f;
3133 if (real_rect.
y >
rect->
y) {
3136 if (real_rect.
x >
rect->
x) {
3223 while (cmd !=
NULL) {
3358 srcAlphaFactor, dstAlphaFactor, alphaOperation);
static int QueueCmdSetViewport(SDL_Renderer *renderer)
int SDL_RenderDrawPointF(SDL_Renderer *renderer, float x, float y)
Draw a point on the current rendering target.
int SDL_SetRenderDrawBlendMode(SDL_Renderer *renderer, SDL_BlendMode blendMode)
Set the blend mode used for drawing operations (Fill and Line).
SDL_RenderDriver DirectFB_RenderDriver
#define SDL_UnlockSurface
int SDL_SetRenderTarget(SDL_Renderer *renderer, SDL_Texture *texture)
Set a texture as the current rendering target.
SDL_FORCE_INLINE SDL_bool SDL_FRectEmpty(const SDL_FRect *r)
SDL_Renderer * SW_CreateRendererForSurface(SDL_Surface *surface)
GLint GLint GLsizei GLsizei GLsizei GLint GLenum format
int SDL_RenderDrawLine(SDL_Renderer *renderer, int x1, int y1, int x2, int y2)
Draw a line on the current rendering target.
GLfixed GLfixed GLint GLint GLfixed points
static int RenderDrawPointsWithRectsF(SDL_Renderer *renderer, const SDL_FPoint *fpoints, const int count)
int SDL_RenderDrawRectsF(SDL_Renderer *renderer, const SDL_FRect *rects, int count)
Draw some number of rectangles on the current rendering target.
void SDL_UnlockTexture(SDL_Texture *texture)
Unlock a texture, uploading the changes to video memory, if needed. If SDL_LockTextureToSurface() was...
int(* GL_UnbindTexture)(SDL_Renderer *renderer, SDL_Texture *texture)
int SDL_RenderCopyExF(SDL_Renderer *renderer, SDL_Texture *texture, const SDL_Rect *srcrect, const SDL_FRect *dstrect, const double angle, const SDL_FPoint *center, const SDL_RendererFlip flip)
Copy a portion of the source texture to the current rendering target, rotating it by angle around the...
#define SDL_HINT_RENDER_VSYNC
A variable controlling whether updates to the SDL screen surface should be synchronized with the vert...
SDL_Texture * SDL_CreateTexture(SDL_Renderer *renderer, Uint32 format, int access, int w, int h)
Create a texture for a rendering context.
SDL_Rect clip_rect_backup
#define SDL_small_free(ptr, isstack)
static int FlushRenderCommands(SDL_Renderer *renderer)
#define SDL_HINT_RENDER_BATCHING
A variable controlling whether the 2D render API is compatible or efficient.
int SDL_GL_UnbindTexture(SDL_Texture *texture)
Unbind a texture from the current OpenGL/ES/ES2 context.
GLenum GLenum GLenum GLenum GLenum scale
#define SDL_GetWindowData
int SDL_RenderSetIntegerScale(SDL_Renderer *renderer, SDL_bool enable)
Set whether to force integer scales for resolution-independent rendering.
static SDL_BlendMode blendMode
int SDL_SetTextureAlphaMod(SDL_Texture *texture, Uint8 alpha)
Set an additional alpha value used in render copy operations.
A collection of pixels used in software blitting.
Uint32 render_command_generation
static int SDL_UpdateTextureYUV(SDL_Texture *texture, const SDL_Rect *rect, const void *pixels, int pitch)
void *(* GetMetalLayer)(SDL_Renderer *renderer)
static SDL_INLINE void VerifyDrawQueueFunctions(const SDL_Renderer *renderer)
void SDL_RenderPresent(SDL_Renderer *renderer)
Update the screen with rendering performed.
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)
static SDL_bool IsSupportedBlendMode(SDL_Renderer *renderer, SDL_BlendMode blendMode)
SDL_RenderDriver GLES2_RenderDriver
void * SDL_AllocateRenderVertices(SDL_Renderer *renderer, const size_t numbytes, const size_t alignment, size_t *offset)
void SDL_RenderGetScale(SDL_Renderer *renderer, float *scaleX, float *scaleY)
Get the drawing scale for the current target.
SDL_bool SDL_RenderTargetSupported(SDL_Renderer *renderer)
Determines whether a window supports the use of render targets.
@ SDL_TEXTUREMODULATE_COLOR
int(* RunCommandQueue)(SDL_Renderer *renderer, SDL_RenderCommand *cmd, void *vertices, size_t vertsize)
GLboolean GLboolean GLboolean b
int(* SetRenderTarget)(SDL_Renderer *renderer, SDL_Texture *texture)
GLint GLint GLsizei width
SDL_Renderer * SDL_CreateSoftwareRenderer(SDL_Surface *surface)
Create a 2D software rendering context for a surface.
GLuint GLint GLboolean GLint GLenum access
static const SDL_RenderDriver * render_drivers[]
SDL_bool SDL_RenderGetIntegerScale(SDL_Renderer *renderer)
Get whether integer scales are forced for resolution-independent rendering.
static int SDL_UpdateTextureNative(SDL_Texture *texture, const SDL_Rect *rect, const void *pixels, int pitch)
#define SDL_COMPOSE_BLENDMODE(srcColorFactor, dstColorFactor, colorOperation, srcAlphaFactor, dstAlphaFactor, alphaOperation)
GLuint GLuint GLsizei count
static void SDL_UnlockTextureNative(SDL_Texture *texture)
int SDL_SW_LockYUVTexture(SDL_SW_YUVTexture *swdata, const SDL_Rect *rect, void **pixels, int *pitch)
#define SDL_GetWindowFlags
int SDL_RenderDrawLinesF(SDL_Renderer *renderer, const SDL_FPoint *points, int count)
Draw a series of connected lines on the current rendering target.
struct SDL_RenderCommand * next
SDL_BlendOperation
The blend operation used when combining source and destination pixel components.
int SDL_RenderCopy(SDL_Renderer *renderer, SDL_Texture *texture, const SDL_Rect *srcrect, const SDL_Rect *dstrect)
Copy a portion of the texture to the current rendering target.
#define SDL_HINT_RENDER_SCALE_QUALITY
A variable controlling the scaling quality.
GLdouble GLdouble GLdouble r
#define SDL_ConvertSurface
#define SDL_InvalidParamError(param)
int SDL_GetTextureScaleMode(SDL_Texture *texture, SDL_ScaleMode *scaleMode)
Get the scale mode used for texture scale operations.
#define SDL_WINDOWPOS_UNDEFINED
#define SDL_IntersectRect
static int SDL_UpdateTextureYUVPlanar(SDL_Texture *texture, const SDL_Rect *rect, const Uint8 *Yplane, int Ypitch, const Uint8 *Uplane, int Upitch, const Uint8 *Vplane, int Vpitch)
int SDL_RenderClear(SDL_Renderer *renderer)
Clear the current rendering target with the drawing color.
int SDL_RenderFillRect(SDL_Renderer *renderer, const SDL_Rect *rect)
Fill a rectangle on the current rendering target with the drawing color.
SDL_Rect last_queued_viewport
#define SDL_ISPIXELFORMAT_INDEXED(format)
SDL_bool SDL_RenderIsClipEnabled(SDL_Renderer *renderer)
Get whether clipping is enabled on the given renderer.
void(* WindowEvent)(SDL_Renderer *renderer, const SDL_WindowEvent *event)
int SDL_GetRendererOutputSize(SDL_Renderer *renderer, int *w, int *h)
Get the output size in pixels of a rendering context.
SDL_RenderDriver GLES_RenderDriver
SDL_Texture * SDL_GetRenderTarget(SDL_Renderer *renderer)
Get the current render target or NULL for the default render target.
GLuint GLfloat GLfloat GLfloat x1
GLboolean GLboolean GLboolean GLboolean a
static char renderer_magic
GLfloat GLfloat GLfloat GLfloat h
SDL_RendererFlip
Flip constants for SDL_RenderCopyEx.
#define SDL_small_alloc(type, count, pisstack)
int SDL_LockTexture(SDL_Texture *texture, const SDL_Rect *rect, void **pixels, int *pitch)
Lock a portion of the texture for write-only pixel access.
#define SDL_GetSurfaceBlendMode
int SDL_QueryTexture(SDL_Texture *texture, Uint32 *format, int *access, int *w, int *h)
Query the attributes of a texture.
#define SDL_BLENDMODE_MUL_FULL
static int FlushRenderCommandsIfTextureNeeded(SDL_Texture *texture)
SDL_Renderer * SDL_CreateRenderer(SDL_Window *window, int index, Uint32 flags)
Create a 2D rendering context for a window.
@ SDL_RENDERCMD_SETCLIPRECT
Information on the capabilities of a render driver or context.
void SDL_DestroyRenderer(SDL_Renderer *renderer)
Destroy the rendering context for a window and free associated textures.
int SDL_RenderSetLogicalSize(SDL_Renderer *renderer, int w, int h)
Set device independent resolution for rendering.
int SDL_RenderFillRectsF(SDL_Renderer *renderer, const SDL_FRect *rects, int count)
Fill some number of rectangles on the current rendering target with the drawing color.
int SDL_GetRenderDrawColor(SDL_Renderer *renderer, Uint8 *r, Uint8 *g, Uint8 *b, Uint8 *a)
Get the color used for drawing operations (Rect, Line and Clear).
int SDL_GetNumRenderDrivers(void)
Get the number of 2D rendering drivers available for the current display.
The type used to identify a window.
GLfloat GLfloat GLfloat GLfloat GLfloat maxY
void SDL_RenderGetViewport(SDL_Renderer *renderer, SDL_Rect *rect)
Get the drawing area for the current target.
GLfloat GLfloat GLfloat alpha
SDL_Texture * SDL_CreateTextureFromSurface(SDL_Renderer *renderer, SDL_Surface *surface)
Create a texture from an existing surface.
SDL_Renderer *(* CreateRenderer)(SDL_Window *window, Uint32 flags)
int SDL_RenderFillRectF(SDL_Renderer *renderer, const SDL_FRect *rect)
Fill a rectangle on the current rendering target with the drawing color.
#define SDL_GetWindowSize
int SDL_SW_CopyYUVToRGB(SDL_SW_YUVTexture *swdata, const SDL_Rect *srcrect, Uint32 target_format, int w, int h, void *pixels, int pitch)
static int QueueCmdClear(SDL_Renderer *renderer)
static int SDL_LockTextureNative(SDL_Texture *texture, const SDL_Rect *rect, void **pixels, int *pitch)
int SDL_UpdateYUVTexture(SDL_Texture *texture, const SDL_Rect *rect, const Uint8 *Yplane, int Ypitch, const Uint8 *Uplane, int Upitch, const Uint8 *Vplane, int Vpitch)
Update a rectangle within a planar YV12 or IYUV texture with new pixel data.
int SDL_RenderSetScale(SDL_Renderer *renderer, float scaleX, float scaleY)
Set the drawing scale for rendering on the current target.
#define SDL_GetHintBoolean
SDL_RenderDriver D3D11_RenderDriver
int(* QueueSetDrawColor)(SDL_Renderer *renderer, SDL_RenderCommand *cmd)
int SDL_GL_BindTexture(SDL_Texture *texture, float *texw, float *texh)
Bind the texture to the current OpenGL/ES/ES2 context for use with OpenGL instructions.
The structure that defines a point (floating point)
#define SDL_BLENDMODE_ADD_FULL
struct SDL_RenderCommand::@23::@27 color
void SDL_RenderGetLogicalSize(SDL_Renderer *renderer, int *w, int *h)
Get device independent resolution for rendering.
void Android_ActivityMutex_Lock_Running(void)
SDL_bool last_queued_cliprect_enabled
int SDL_SetTextureScaleMode(SDL_Texture *texture, SDL_ScaleMode scaleMode)
Set the scale mode used for texture scale operations.
GLint GLint GLint GLint GLint x
EGLSurface EGLNativeWindowType * window
#define SDL_SetWindowData
void(* SetTextureScaleMode)(SDL_Renderer *renderer, SDL_Texture *texture, SDL_ScaleMode scaleMode)
SDL_RenderDriver D3D_RenderDriver
SDL_RenderCommand * render_commands_tail
int SDL_UpdateTexture(SDL_Texture *texture, const SDL_Rect *rect, const void *pixels, int pitch)
Update the given texture rectangle with new pixel data.
#define SDL_BLENDMODE_MOD_FULL
@ SDL_TEXTUREACCESS_STATIC
static int QueueCmdFillRects(SDL_Renderer *renderer, const SDL_FRect *rects, const int count)
GLint GLint GLsizei GLsizei height
SDL_bool(* SupportsBlendMode)(SDL_Renderer *renderer, SDL_BlendMode blendMode)
int SDL_CreateWindowAndRenderer(int width, int height, Uint32 window_flags, SDL_Window **window, SDL_Renderer **renderer)
Create a window and default renderer.
@ SDL_RENDERCMD_SETVIEWPORT
static int UpdateLogicalSize(SDL_Renderer *renderer)
int(* QueueDrawLines)(SDL_Renderer *renderer, SDL_RenderCommand *cmd, const SDL_FPoint *points, int count)
@ SDL_RENDERER_PRESENTVSYNC
void * SDL_RenderGetMetalLayer(SDL_Renderer *renderer)
Get the CAMetalLayer associated with the given Metal renderer.
void SDL_DestroyTexture(SDL_Texture *texture)
Destroy the specified texture.
@ SDL_RENDERCMD_DRAW_POINTS
SDL_RenderCommand * render_commands
static int SDL_LockTextureYUV(SDL_Texture *texture, const SDL_Rect *rect, void **pixels, int *pitch)
SDL_BlendFactor
The normalized factor used to multiply pixel components.
#define SDL_GetWindowFromID
void SDL_SW_DestroyYUVTexture(SDL_SW_YUVTexture *swdata)
static SDL_bool SDL_HasIntersectionF(const SDL_FRect *A, const SDL_FRect *B)
SDL_Rect last_queued_cliprect
static int RenderDrawPointsWithRects(SDL_Renderer *renderer, const SDL_Point *points, const int count)
SDL_BlendMode SDL_ComposeCustomBlendMode(SDL_BlendFactor srcColorFactor, SDL_BlendFactor dstColorFactor, SDL_BlendOperation colorOperation, SDL_BlendFactor srcAlphaFactor, SDL_BlendFactor dstAlphaFactor, SDL_BlendOperation alphaOperation)
Create a custom blend mode, which may or may not be supported by a given renderer.
int SDL_RenderReadPixels(SDL_Renderer *renderer, const SDL_Rect *rect, Uint32 format, void *pixels, int pitch)
Read pixels from the current rendering target.
int SDL_GetTextureColorMod(SDL_Texture *texture, Uint8 *r, Uint8 *g, Uint8 *b)
Get the additional color value used in render copy operations.
static SDL_RenderCommand * AllocateRenderCommand(SDL_Renderer *renderer)
static SDL_INLINE int FlushRenderCommandsIfNotBatching(SDL_Renderer *renderer)
static SDL_RenderCommand * PrepQueueCmdDrawTexture(SDL_Renderer *renderer, SDL_Texture *texture, const SDL_RenderCommandType cmdtype)
static void SDL_UnlockTextureYUV(SDL_Texture *texture)
static int RenderDrawLinesWithRectsF(SDL_Renderer *renderer, const SDL_FPoint *points, const int count)
SDL_BlendFactor SDL_GetBlendModeDstAlphaFactor(SDL_BlendMode blendMode)
@ SDL_WINDOWEVENT_SIZE_CHANGED
int(* GL_BindTexture)(SDL_Renderer *renderer, SDL_Texture *texture, float *texw, float *texh)
size_t vertex_data_allocation
static int QueueCmdCopyEx(SDL_Renderer *renderer, SDL_Texture *texture, const SDL_Rect *srcquad, const SDL_FRect *dstrect, const double angle, const SDL_FPoint *center, const SDL_RendererFlip flip)
SDL_RenderCommandType command
int(* QueueSetViewport)(SDL_Renderer *renderer, SDL_RenderCommand *cmd)
@ SDL_PIXELFORMAT_ARGB8888
#define SDL_HINT_RENDER_LOGICAL_SIZE_MODE
A variable controlling the scaling policy for SDL_RenderSetLogicalSize.
static int QueueCmdSetDrawColor(SDL_Renderer *renderer, const Uint8 r, const Uint8 g, const Uint8 b, const Uint8 a)
int SDL_SW_UpdateYUVTexturePlanar(SDL_SW_YUVTexture *swdata, const SDL_Rect *rect, const Uint8 *Yplane, int Ypitch, const Uint8 *Uplane, int Upitch, const Uint8 *Vplane, int Vpitch)
static void GetWindowViewportValues(SDL_Renderer *renderer, int *logical_w, int *logical_h, SDL_Rect *viewport, SDL_FPoint *scale)
int SDL_RenderSetClipRect(SDL_Renderer *renderer, const SDL_Rect *rect)
Set the clip rectangle for the current target.
@ SDL_TEXTUREMODULATE_ALPHA
#define SDL_assert(condition)
int SDL_GetRenderDrawBlendMode(SDL_Renderer *renderer, SDL_BlendMode *blendMode)
Get the blend mode used for drawing operations.
@ SDL_WINDOWEVENT_MINIMIZED
GLint GLint GLsizei GLsizei GLsizei GLint GLenum GLenum const GLvoid * pixels
@ SDL_RENDERCMD_DRAW_LINES
int(* GetOutputSize)(SDL_Renderer *renderer, int *w, int *h)
int SDL_RenderDrawPoint(SDL_Renderer *renderer, int x, int y)
Draw a point on the current rendering target.
GLfloat GLfloat GLfloat GLfloat maxX
#define SDL_OutOfMemory()
int(* CreateTexture)(SDL_Renderer *renderer, SDL_Texture *texture)
union SDL_RenderCommand::@23 data
GLint GLint GLint GLint GLint GLint y
set set set set set set set macro pixldst1 abits if abits op else op endif endm macro pixldst2 abits if abits op else op endif endm macro pixldst4 abits if abits op else op endif endm macro pixldst0 abits op endm macro pixldst3 mem_operand op endm macro pixldst30 mem_operand op endm macro pixldst abits if abits elseif abits elseif abits elseif abits elseif abits pixldst0 abits else pixldst0 abits pixldst0 abits pixldst0 abits pixldst0 abits endif elseif abits else pixldst0 abits pixldst0 abits endif elseif abits else error unsupported bpp
@ SDL_RENDERCMD_FILL_RECTS
void(* DestroyRenderer)(SDL_Renderer *renderer)
int(* LockTexture)(SDL_Renderer *renderer, SDL_Texture *texture, const SDL_Rect *rect, void **pixels, int *pitch)
void *(* GetMetalCommandEncoder)(SDL_Renderer *renderer)
SDL_SW_YUVTexture * SDL_SW_CreateYUVTexture(Uint32 format, int w, int h)
#define SDL_GetSurfaceAlphaMod
#define SDL_arraysize(array)
static SDL_BlendMode SDL_GetLongBlendMode(SDL_BlendMode blendMode)
int(* RenderReadPixels)(SDL_Renderer *renderer, const SDL_Rect *rect, Uint32 format, void *pixels, int pitch)
SDL_BlendFactor SDL_GetBlendModeSrcAlphaFactor(SDL_BlendMode blendMode)
SDL_BlendOperation SDL_GetBlendModeColorOperation(SDL_BlendMode blendMode)
static int QueueCmdSetClipRect(SDL_Renderer *renderer)
void Android_ActivityMutex_Unlock(void)
SDL_RenderDriver SW_RenderDriver
static SDL_Renderer * renderer
static int RenderDrawLinesWithRects(SDL_Renderer *renderer, const SDL_Point *points, const int count)
static int QueueCmdDrawPoints(SDL_Renderer *renderer, const SDL_FPoint *points, const int count)
#define SDL_GetCurrentVideoDriver
#define SDL_ISPIXELFORMAT_FOURCC(format)
SDL_Renderer * SDL_GetRenderer(SDL_Window *window)
Get the renderer associated with a window.
int SDL_LockTextureToSurface(SDL_Texture *texture, const SDL_Rect *rect, SDL_Surface **surface)
Lock a portion of the texture for write-only pixel access. Expose it as a SDL surface.
SDL_BlendFactor SDL_GetBlendModeDstColorFactor(SDL_BlendMode blendMode)
The structure that defines a point (integer)
struct SDL_RenderCommand::@23::@25 cliprect
int SDL_RenderDrawRectF(SDL_Renderer *renderer, const SDL_FRect *rect)
Draw a rectangle on the current rendering target.
@ SDL_RENDERER_TARGETTEXTURE
#define SDL_GetWindowPixelFormat
#define CHECK_TEXTURE_MAGIC(texture, retval)
int SDL_GetTextureAlphaMod(SDL_Texture *texture, Uint8 *alpha)
Get the additional alpha value used in render copy operations.
void(* RenderPresent)(SDL_Renderer *renderer)
#define SDL_BYTESPERPIXEL(X)
int SDL_RenderSetViewport(SDL_Renderer *renderer, const SDL_Rect *rect)
Set the drawing area for rendering on the current target.
int SDL_RenderDrawPoints(SDL_Renderer *renderer, const SDL_Point *points, int count)
Draw multiple points on the current rendering target.
A rectangle, with the origin at the upper left (integer).
SDL_RenderDriver METAL_RenderDriver
static SDL_ScaleMode SDL_GetScaleMode(void)
static SDL_bool IsSupportedFormat(SDL_Renderer *renderer, Uint32 format)
int(* QueueFillRects)(SDL_Renderer *renderer, SDL_RenderCommand *cmd, const SDL_FRect *rects, int count)
int(* UpdateTexture)(SDL_Renderer *renderer, SDL_Texture *texture, const SDL_Rect *rect, const void *pixels, int pitch)
@ SDL_TEXTUREACCESS_TARGET
#define SDL_BLENDMODE_BLEND_FULL
@ SDL_PIXELFORMAT_UNKNOWN
#define SDL_AddEventWatch
static int SDL_RendererEventWatch(void *userdata, SDL_Event *event)
int SDL_RenderDrawLineF(SDL_Renderer *renderer, float x1, float y1, float x2, float y2)
Draw a line on the current rendering target.
A rectangle, with the origin at the upper left (floating point).
GLfixed GLfixed GLfixed y2
#define SDL_CreateRGBSurfaceWithFormatFrom
#define SDL_GetSurfaceColorMod
#define SDL_ConvertPixels
set set set set set set set macro pixldst1 abits if abits op else op endif endm macro pixldst2 abits if abits op else op endif endm macro pixldst4 abits if abits op else op endif endm macro pixldst0 abits op endm macro pixldst3 mem_operand op endm macro pixldst30 mem_operand op endm macro pixldst numbytes
void SDL_RenderGetClipRect(SDL_Renderer *renderer, SDL_Rect *rect)
Get the clip rectangle for the current target.
SDL_bool clipping_enabled
int SDL_RenderCopyF(SDL_Renderer *renderer, SDL_Texture *texture, const SDL_Rect *srcrect, const SDL_FRect *dstrect)
Copy a portion of the texture to the current rendering target.
#define SDL_BLENDMODE_NONE_FULL
SDL_ScaleMode
The scaling mode for a texture.
int SDL_SetTextureColorMod(SDL_Texture *texture, Uint8 r, Uint8 g, Uint8 b)
Set an additional color value used in render copy operations.
#define CHECK_RENDERER_MAGIC(renderer, retval)
static int PrepQueueCmdDraw(SDL_Renderer *renderer, const Uint8 r, const Uint8 g, const Uint8 b, const Uint8 a)
#define SDL_HINT_RENDER_DRIVER
A variable specifying which render driver to use.
int(* QueueDrawPoints)(SDL_Renderer *renderer, SDL_RenderCommand *cmd, const SDL_FPoint *points, int count)
@ SDL_WINDOWEVENT_RESTORED
static SDL_RenderCommand * PrepQueueCmdDrawSolid(SDL_Renderer *renderer, const SDL_RenderCommandType cmdtype)
#define SDL_ISPIXELFORMAT_ALPHA(format)
int SDL_RenderFillRects(SDL_Renderer *renderer, const SDL_Rect *rects, int count)
Fill some number of rectangles on the current rendering target with the drawing color.
#define SDL_Unsupported()
SDL_RenderCommand * render_commands_pool
int SDL_RenderFlush(SDL_Renderer *renderer)
Force the rendering context to flush any pending commands to the underlying rendering API.
int SDL_SetTextureBlendMode(SDL_Texture *texture, SDL_BlendMode blendMode)
Set the blend mode used for texture copy operations.
Uint32 texture_formats[16]
int SDL_GetRenderDriverInfo(int index, SDL_RendererInfo *info)
Get information about a specific 2D rendering driver for the current display.
const SDL_PRINTF_FORMAT_STRING char int const SDL_PRINTF_FORMAT_STRING char int const SDL_PRINTF_FORMAT_STRING char int const SDL_PRINTF_FORMAT_STRING char const char const SDL_SCANF_FORMAT_STRING char return SDL_ThreadFunction const char void return Uint32 return Uint32 void
@ SDL_RENDERCMD_SETDRAWCOLOR
int(* QueueCopy)(SDL_Renderer *renderer, SDL_RenderCommand *cmd, SDL_Texture *texture, const SDL_Rect *srcrect, const SDL_FRect *dstrect)
int SDL_GetTextureBlendMode(SDL_Texture *texture, SDL_BlendMode *blendMode)
Get the blend mode used for texture copy operations.
@ SDL_TEXTUREACCESS_STREAMING
GLenum GLenum GLuint texture
static char texture_magic
static int QueueCmdCopy(SDL_Renderer *renderer, SDL_Texture *texture, const SDL_Rect *srcrect, const SDL_FRect *dstrect)
int SDL_RenderDrawRects(SDL_Renderer *renderer, const SDL_Rect *rects, int count)
Draw some number of rectangles on the current rendering target.
struct SDL_RenderCommand::@23::@24 viewport
EGLSurface EGLint * rects
int SDL_RenderCopyEx(SDL_Renderer *renderer, SDL_Texture *texture, const SDL_Rect *srcrect, const SDL_Rect *dstrect, const double angle, const SDL_Point *center, const SDL_RendererFlip flip)
Copy a portion of the source texture to the current rendering target, rotating it by angle around the...
int SDL_RenderDrawPointsF(SDL_Renderer *renderer, const SDL_FPoint *points, int count)
Draw multiple points on the current rendering target.
@ SDL_PIXELFORMAT_ABGR8888
static SDL_INLINE void DebugLogRenderCommands(const SDL_RenderCommand *cmd)
SDL_BlendOperation SDL_GetBlendModeAlphaOperation(SDL_BlendMode blendMode)
SDL_BlendMode
The blend mode used in SDL_RenderCopy() and drawing operations.
set set set set set set set set set set set set set set set set set set set set *set set set macro pixldst op &r &cond WK op &r &cond WK op &r &cond WK else op &m &cond &ia op &r &cond WK else op &m &cond &ia elseif elseif else error unsupported base if elseif elseif else error unsupported unaligned pixldst unaligned endm macro pixst base base else pixldst base endif endm macro PF ptr
int SDL_RenderDrawRect(SDL_Renderer *renderer, const SDL_Rect *rect)
Draw a rectangle on the current rendering target.
SDL_RenderDriver GL_RenderDriver
struct SDL_RenderCommand::@23::@26 draw
@ SDL_LOG_CATEGORY_RENDER
SDL_BlendFactor SDL_GetBlendModeSrcColorFactor(SDL_BlendMode blendMode)
SDL_bool clipping_enabled_backup
SDL_RenderDriver PSP_RenderDriver
return Display return Display Bool Bool int int int return Display XEvent Bool(*) XPointer return Display return Display Drawable _Xconst char unsigned int unsigned int return Display Pixmap Pixmap XColor XColor unsigned int unsigned int return Display _Xconst char char int char return Display Visual unsigned int int int char unsigned int unsigned int in i)
int SDL_GetRendererInfo(SDL_Renderer *renderer, SDL_RendererInfo *info)
Get information about a rendering context.
int SDL_RenderDrawLines(SDL_Renderer *renderer, const SDL_Point *points, int count)
Draw a series of connected lines on the current rendering target.
void * SDL_RenderGetMetalCommandEncoder(SDL_Renderer *renderer)
Get the Metal command encoder for the current frame.
static int QueueCmdDrawLines(SDL_Renderer *renderer, const SDL_FPoint *points, const int count)
@ SDL_WINDOWEVENT_MAXIMIZED
#define SDL_WINDOWRENDERDATA
static Uint32 GetClosestSupportedFormat(SDL_Renderer *renderer, Uint32 format)
void(* UnlockTexture)(SDL_Renderer *renderer, SDL_Texture *texture)
Uint32 num_texture_formats
#define SDL_DelEventWatch
static SDL_BlendMode SDL_GetShortBlendMode(SDL_BlendMode blendMode)
int SDL_SW_UpdateYUVTexture(SDL_SW_YUVTexture *swdata, const SDL_Rect *rect, const void *pixels, int pitch)
void(* DestroyTexture)(SDL_Renderer *renderer, SDL_Texture *texture)
int(* UpdateTextureYUV)(SDL_Renderer *renderer, SDL_Texture *texture, const SDL_Rect *rect, const Uint8 *Yplane, int Ypitch, const Uint8 *Uplane, int Upitch, const Uint8 *Vplane, int Vpitch)
GLubyte GLubyte GLubyte GLubyte w
int SDL_SetRenderDrawColor(SDL_Renderer *renderer, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
Set the color used for drawing operations (Rect, Line and Clear).