21 #include "../SDL_internal.h" 33 #define SDL_WINDOWRENDERDATA "_SDL_WindowRenderData" 35 #define CHECK_RENDERER_MAGIC(renderer, retval) \ 36 if (!renderer || renderer->magic != &renderer_magic) { \ 37 SDL_SetError("Invalid renderer"); \ 41 #define CHECK_TEXTURE_MAGIC(texture, retval) \ 42 if (!texture || texture->magic != &texture_magic) { \ 43 SDL_SetError("Invalid texture"); \ 48 #if !SDL_RENDER_DISABLED 50 #if SDL_VIDEO_RENDER_D3D 53 #if SDL_VIDEO_RENDER_D3D11 56 #if SDL_VIDEO_RENDER_OGL 59 #if SDL_VIDEO_RENDER_OGL_ES2 62 #if SDL_VIDEO_RENDER_OGL_ES 65 #if SDL_VIDEO_RENDER_DIRECTFB 66 &DirectFB_RenderDriver,
68 #if SDL_VIDEO_RENDER_PSP 83 #if !SDL_RENDER_DISABLED 93 #if !SDL_RENDER_DISABLED 95 return SDL_SetError(
"index must be in the range of 0 - %d",
101 return SDL_SetError(
"SDL not built with rendering support");
112 if (window == renderer->
window) {
173 event->motion.x = (int)(event->
motion.
x / renderer->
scale.
x);
174 event->motion.y = (int)(event->
motion.
y / renderer->
scale.
y);
192 event->button.x = (int)(event->
button.
x / renderer->
scale.
x);
193 event->button.y = (int)(event->
button.
y / renderer->
scale.
y);
205 width, height, window_flags);
222 #if !SDL_RENDER_DISABLED 233 SDL_SetError(
"Renderer already associated with window");
248 for (index = 0; index <
n; ++
index) {
260 for (index = 0; index <
n; ++
index) {
263 if ((driver->
info.
flags & flags) == flags) {
279 SDL_SetError(
"index must be -1 or in the range of 0 - %d",
306 "Created renderer: %s", renderer->
info.
name);
318 #if !SDL_RENDER_DISABLED 348 *info = renderer->
info;
361 }
else if (renderer->
window) {
366 return SDL_SetError(
"Renderer doesn't support querying output size");
427 if (w <= 0 || h <= 0) {
515 SDL_SetError(
"SDL_CreateTextureFromSurface() passed NULL surface");
536 surface->
w, surface->
h);
598 *format = texture->
format;
601 *access = texture->
access;
620 if (r < 255 || g < 255 || b < 255) {
720 const void *
pixels,
int pitch)
731 full_rect.
w = texture->
w;
732 full_rect.
h = texture->
h;
740 if (
SDL_LockTexture(native, rect, &native_pixels, &native_pitch) < 0) {
744 rect->
w, rect->
h, native_pixels, native_pitch);
757 rect->
w, rect->
h, temp_pixels, temp_pitch);
766 const void *
pixels,
int pitch)
775 if (
SDL_LockTexture(native, rect, &native_pixels, &native_pitch) < 0) {
779 texture->
format, pixels, pitch,
780 native->
format, native_pixels, native_pitch);
793 texture->
format, pixels, pitch,
794 native->
format, temp_pixels, temp_pitch);
803 const void *
pixels,
int pitch)
820 full_rect.
w = texture->
w;
821 full_rect.
h = texture->
h;
825 if ((rect->
w == 0) || (rect->
h == 0)) {
827 }
else if (texture->
yuv) {
829 }
else if (texture->
native) {
833 return renderer->
UpdateTexture(renderer, texture, rect, pixels, pitch);
839 const Uint8 *Yplane,
int Ypitch,
840 const Uint8 *Uplane,
int Upitch,
841 const Uint8 *Vplane,
int Vpitch)
852 full_rect.
w = texture->
w;
853 full_rect.
h = texture->
h;
861 if (
SDL_LockTexture(native, rect, &native_pixels, &native_pitch) < 0) {
865 rect->
w, rect->
h, native_pixels, native_pitch);
878 rect->
w, rect->
h, temp_pixels, temp_pitch);
886 const Uint8 *Yplane,
int Ypitch,
887 const Uint8 *Uplane,
int Upitch,
888 const Uint8 *Vplane,
int Vpitch)
916 return SDL_SetError(
"Texture format must by YV12 or IYUV");
922 full_rect.
w = texture->
w;
923 full_rect.
h = texture->
h;
934 return renderer->
UpdateTextureYUV(renderer, texture, rect, Yplane, Ypitch, Uplane, Upitch, Vplane, Vpitch);
943 void **
pixels,
int *pitch)
950 void **
pixels,
int *pitch)
954 rect->
y * texture->
pitch +
956 *pitch = texture->
pitch;
962 void **
pixels,
int *pitch)
970 return SDL_SetError(
"SDL_LockTexture(): texture must be streaming");
976 full_rect.
w = texture->
w;
977 full_rect.
h = texture->
h;
983 }
else if (texture->
native) {
987 return renderer->
LockTexture(renderer, texture, rect, pixels, pitch);
995 void *native_pixels =
NULL;
996 int native_pitch = 0;
1001 rect.
w = texture->
w;
1002 rect.
h = texture->
h;
1004 if (
SDL_LockTexture(native, &rect, &native_pixels, &native_pitch) < 0) {
1008 rect.
w, rect.
h, native_pixels, native_pitch);
1016 void *native_pixels =
NULL;
1017 int native_pitch = 0;
1020 rect->
y * texture->
pitch +
1022 int pitch = texture->
pitch;
1024 if (
SDL_LockTexture(native, rect, &native_pixels, &native_pitch) < 0) {
1028 texture->
format, pixels, pitch,
1029 native->
format, native_pixels, native_pitch);
1045 }
else if (texture->
native) {
1068 if (texture == renderer->
target) {
1076 if (renderer != texture->
renderer) {
1077 return SDL_SetError(
"Texture was not created with this renderer");
1080 return SDL_SetError(
"Texture not created with SDL_TEXTUREACCESS_TARGET");
1084 texture = texture->
native;
1088 if (texture && !renderer->
target) {
1110 renderer->
scale.
x = 1.0f;
1111 renderer->
scale.
y = 1.0f;
1156 real_aspect = (
float)w /
h;
1162 if (want_aspect > real_aspect) {
1163 scale = (float)(w / renderer->
logical_w);
1168 viewport.
x = (w - viewport.
w) / 2;
1170 viewport.
y = (
h - viewport.
h) / 2;
1173 }
else if (
SDL_fabs(want_aspect-real_aspect) < 0.0001) {
1177 }
else if (want_aspect > real_aspect) {
1183 viewport.
y = (
h - viewport.
h) / 2;
1191 viewport.
x = (w - viewport.
w) / 2;
1328 renderer->
scale.
x = scaleX;
1329 renderer->
scale.
y = scaleY;
1339 *scaleX = renderer->
scale.
x;
1342 *scaleY = renderer->
scale.
y;
1432 for (i = 0; i <
count; ++
i) {
1433 frects[
i].
x = points[
i].
x * renderer->
scale.
x;
1434 frects[
i].
y = points[
i].
y * renderer->
scale.
y;
1457 return SDL_SetError(
"SDL_RenderDrawPoints(): Passed NULL points");
1468 if (renderer->
scale.
x != 1.0f || renderer->
scale.
y != 1.0f) {
1476 for (i = 0; i <
count; ++
i) {
1477 fpoints[
i].
x = points[
i].
x * renderer->
scale.
x;
1478 fpoints[
i].
y = points[
i].
y * renderer->
scale.
y;
1517 for (i = 0; i < count-1; ++
i) {
1518 if (points[i].
x == points[i+1].
x) {
1519 int minY =
SDL_min(points[i].
y, points[i+1].y);
1520 int maxY =
SDL_max(points[i].y, points[i+1].y);
1522 frect = &frects[nrects++];
1523 frect->
x = points[
i].
x * renderer->
scale.
x;
1524 frect->
y = minY * renderer->
scale.
y;
1526 frect->
h = (maxY - minY + 1) * renderer->
scale.
y;
1527 }
else if (points[i].
y == points[i+1].
y) {
1528 int minX =
SDL_min(points[i].
x, points[i+1].x);
1529 int maxX =
SDL_max(points[i].x, points[i+1].x);
1531 frect = &frects[nrects++];
1532 frect->
x = minX * renderer->
scale.
x;
1533 frect->
y = points[
i].
y * renderer->
scale.
y;
1534 frect->
w = (maxX - minX + 1) * renderer->
scale.
x;
1538 fpoints[0].
x = points[
i].
x * renderer->
scale.
x;
1539 fpoints[0].
y = points[
i].
y * renderer->
scale.
y;
1540 fpoints[1].
x = points[i+1].
x * renderer->
scale.
x;
1541 fpoints[1].
y = points[i+1].
y * renderer->
scale.
y;
1567 return SDL_SetError(
"SDL_RenderDrawLines(): Passed NULL points");
1578 if (renderer->
scale.
x != 1.0f || renderer->
scale.
y != 1.0f) {
1586 for (i = 0; i <
count; ++
i) {
1587 fpoints[
i].
x = points[
i].
x * renderer->
scale.
x;
1588 fpoints[
i].
y = points[
i].
y * renderer->
scale.
y;
1614 points[0].
x = rect->
x;
1615 points[0].
y = rect->
y;
1616 points[1].
x = rect->
x+rect->
w-1;
1617 points[1].
y = rect->
y;
1618 points[2].
x = rect->
x+rect->
w-1;
1619 points[2].
y = rect->
y+rect->
h-1;
1620 points[3].
x = rect->
x;
1621 points[3].
y = rect->
y+rect->
h-1;
1622 points[4].
x = rect->
x;
1623 points[4].
y = rect->
y;
1636 return SDL_SetError(
"SDL_RenderDrawRects(): Passed NULL rects");
1647 for (i = 0; i <
count; ++
i) {
1658 SDL_Rect full_rect = { 0, 0, 0, 0 };
1683 return SDL_SetError(
"SDL_RenderFillRects(): Passed NULL rects");
1698 for (i = 0; i <
count; ++
i) {
1699 frects[
i].
x = rects[
i].
x * renderer->
scale.
x;
1700 frects[
i].
y = rects[
i].
y * renderer->
scale.
y;
1701 frects[
i].
w = rects[
i].
w * renderer->
scale.
x;
1702 frects[
i].
h = rects[
i].
h * renderer->
scale.
y;
1716 SDL_Rect real_srcrect = { 0, 0, 0, 0 };
1717 SDL_Rect real_dstrect = { 0, 0, 0, 0 };
1723 if (renderer != texture->
renderer) {
1724 return SDL_SetError(
"Texture was not created with this renderer");
1734 real_srcrect.
w = texture->
w;
1735 real_srcrect.
h = texture->
h;
1749 real_dstrect = *dstrect;
1753 texture = texture->
native;
1756 frect.
x = real_dstrect.
x * renderer->
scale.
x;
1757 frect.
y = real_dstrect.
y * renderer->
scale.
y;
1758 frect.
w = real_dstrect.
w * renderer->
scale.
x;
1759 frect.
h = real_dstrect.
h * renderer->
scale.
y;
1761 return renderer->
RenderCopy(renderer, texture, &real_srcrect, &frect);
1770 SDL_Rect real_srcrect = { 0, 0, 0, 0 };
1771 SDL_Rect real_dstrect = { 0, 0, 0, 0 };
1776 if (flip ==
SDL_FLIP_NONE && (
int)(angle/360) == angle/360) {
1783 if (renderer != texture->
renderer) {
1784 return SDL_SetError(
"Texture was not created with this renderer");
1787 return SDL_SetError(
"Renderer does not support RenderCopyEx");
1797 real_srcrect.
w = texture->
w;
1798 real_srcrect.
h = texture->
h;
1807 real_dstrect = *dstrect;
1815 texture = texture->
native;
1819 real_center = *center;
1821 real_center.
x = real_dstrect.
w/2;
1822 real_center.
y = real_dstrect.
h/2;
1825 frect.
x = real_dstrect.
x * renderer->
scale.
x;
1826 frect.
y = real_dstrect.
y * renderer->
scale.
y;
1827 frect.
w = real_dstrect.
w * renderer->
scale.
x;
1828 frect.
h = real_dstrect.
h * renderer->
scale.
y;
1830 fcenter.
x = real_center.
x * renderer->
scale.
x;
1831 fcenter.
y = real_center.
y * renderer->
scale.
y;
1833 return renderer->
RenderCopyEx(renderer, texture, &real_srcrect, &frect, angle, &fcenter, flip);
1860 if (real_rect.
y > rect->
y) {
1861 pixels = (
Uint8 *)pixels + pitch * (real_rect.
y - rect->
y);
1863 if (real_rect.
x > rect->
x) {
1865 pixels = (
Uint8 *)pixels + bpp * (real_rect.
x - rect->
x);
1870 format, pixels, pitch);
1893 if (texture == renderer->
target) {
1899 if (texture->
next) {
1902 if (texture->
prev) {
int SDL_CreateWindowAndRenderer(int width, int height, Uint32 window_flags, SDL_Window **window, SDL_Renderer **renderer)
Create a window and default renderer.
int(* RenderDrawLines)(SDL_Renderer *renderer, const SDL_FPoint *points, int count)
GLenum GLenum GLenum GLenum GLenum scale
SDL_MouseMotionEvent motion
#define SDL_DelEventWatch
GLint GLint GLsizei GLsizei GLsizei GLint GLenum format
#define SDL_GetWindowData
int(* RenderDrawPoints)(SDL_Renderer *renderer, const SDL_FPoint *points, int count)
int(* LockTexture)(SDL_Renderer *renderer, SDL_Texture *texture, const SDL_Rect *rect, void **pixels, int *pitch)
#define SDL_HasIntersection
GLuint GLfloat GLfloat GLfloat x1
SDL_SW_YUVTexture * SDL_SW_CreateYUVTexture(Uint32 format, int w, int h)
#define SDL_UnlockSurface
GLdouble GLdouble GLdouble r
static Uint32 GetClosestSupportedFormat(SDL_Renderer *renderer, Uint32 format)
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_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.
GLint GLint GLsizei width
#define SDL_HINT_RENDER_VSYNC
A variable controlling whether updates to the SDL screen surface should be synchronized with the vert...
int(* RenderReadPixels)(SDL_Renderer *renderer, const SDL_Rect *rect, Uint32 format, void *pixels, int pitch)
int SDL_SetRenderDrawBlendMode(SDL_Renderer *renderer, SDL_BlendMode blendMode)
Set the blend mode used for drawing operations (Fill and Line).
int SDL_GetRendererInfo(SDL_Renderer *renderer, SDL_RendererInfo *info)
Get information about a rendering context.
SDL_Rect clip_rect_backup
#define SDL_ISPIXELFORMAT_INDEXED(format)
GLint GLint GLint GLint GLint x
SDL_BlendMode
The blend mode used in SDL_RenderCopy() and drawing operations.
#define SDL_ConvertSurface
GLuint GLuint GLsizei count
static SDL_Window * window
GLenum GLenum GLuint texture
SDL_Texture * SDL_GetRenderTarget(SDL_Renderer *renderer)
Get the current render target or NULL for the default render target.
GLfixed GLfixed GLfixed y2
The structure that defines a point.
A collection of pixels used in software blitting.
Uint32 texture_formats[16]
#define SDL_GetWindowFlags
int SDL_SW_LockYUVTexture(SDL_SW_YUVTexture *swdata, const SDL_Rect *rect, void **pixels, int *pitch)
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).
#define SDL_BYTESPERPIXEL(X)
int(* RenderFillRects)(SDL_Renderer *renderer, const SDL_FRect *rects, int count)
GLint GLint GLsizei GLsizei GLsizei GLint GLenum GLenum const GLvoid * pixels
static int SDL_UpdateTextureNative(SDL_Texture *texture, const SDL_Rect *rect, const void *pixels, int pitch)
int SDL_RenderDrawPoint(SDL_Renderer *renderer, int x, int y)
Draw a point on the current rendering target.
#define SDL_WINDOWPOS_UNDEFINED
#define SDL_ISPIXELFORMAT_ALPHA(format)
static int RenderDrawPointsWithRects(SDL_Renderer *renderer, const SDL_Point *points, int count)
uint32_t Uint32
An unsigned 32-bit integer type.
#define SDL_InvalidParamError(param)
int SDL_RenderSetViewport(SDL_Renderer *renderer, const SDL_Rect *rect)
Set the drawing area for rendering on the current target.
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
GLint GLint GLsizei GLsizei height
void SDL_RenderPresent(SDL_Renderer *renderer)
Update the screen with rendering performed.
int SDL_RenderReadPixels(SDL_Renderer *renderer, const SDL_Rect *rect, Uint32 format, void *pixels, int pitch)
Read pixels from the current rendering target.
#define SDL_IntersectRect
static char texture_magic
void SDL_RenderGetLogicalSize(SDL_Renderer *renderer, int *w, int *h)
Get device independent resolution for rendering.
int SDL_GetRendererOutputSize(SDL_Renderer *renderer, int *w, int *h)
Get the output size in pixels of a rendering context.
static int SDL_LockTextureYUV(SDL_Texture *texture, const SDL_Rect *rect, void **pixels, int *pitch)
int(* RenderClear)(SDL_Renderer *renderer)
GLfloat GLfloat GLfloat alpha
GLuint GLint GLboolean GLint GLenum access
static int RenderDrawLinesWithRects(SDL_Renderer *renderer, const SDL_Point *points, int count)
int SDL_RenderFillRect(SDL_Renderer *renderer, const SDL_Rect *rect)
Fill a rectangle on the current rendering target with the drawing color.
void(* DestroyRenderer)(SDL_Renderer *renderer)
GLfixed GLfixed GLint GLint GLfixed points
int(* GetOutputSize)(SDL_Renderer *renderer, int *w, int *h)
int(* SetTextureBlendMode)(SDL_Renderer *renderer, SDL_Texture *texture)
int SDL_QueryTexture(SDL_Texture *texture, Uint32 *format, int *access, int *w, int *h)
Query the attributes of a texture.
#define SDL_GetHintBoolean
#define SDL_GetSurfaceBlendMode
SDL_Renderer * SW_CreateRendererForSurface(SDL_Surface *surface)
static void SDL_UnlockTextureNative(SDL_Texture *texture)
static SDL_BlendMode blendMode
int SDL_GetTextureBlendMode(SDL_Texture *texture, SDL_BlendMode *blendMode)
Get the blend mode used for texture copy operations.
#define SDL_SetWindowData
SDL_Renderer * SDL_CreateSoftwareRenderer(SDL_Surface *surface)
Create a 2D software rendering context for a surface.
int(* UpdateTexture)(SDL_Renderer *renderer, SDL_Texture *texture, const SDL_Rect *rect, const void *pixels, int pitch)
int SDL_SW_UpdateYUVTexture(SDL_SW_YUVTexture *swdata, const SDL_Rect *rect, const void *pixels, int pitch)
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)
#define SDL_GetWindowSize
int SDL_SetTextureBlendMode(SDL_Texture *texture, SDL_BlendMode blendMode)
Set the blend mode used for texture copy operations.
int(* SetTextureColorMod)(SDL_Renderer *renderer, SDL_Texture *texture)
void * SDL_calloc(size_t nmemb, size_t size)
#define CHECK_RENDERER_MAGIC(renderer, retval)
void SDL_DestroyTexture(SDL_Texture *texture)
Destroy the specified texture.
void SDL_DestroyRenderer(SDL_Renderer *renderer)
Destroy the rendering context for a window and free associated textures.
SDL_RenderDriver SW_RenderDriver
GLint GLint GLint GLint GLint GLint y
int SDL_RenderDrawRects(SDL_Renderer *renderer, const SDL_Rect *rects, int count)
Draw some number of rectangles on the current rendering target.
static SDL_Renderer * renderer
int SDL_RenderDrawPoints(SDL_Renderer *renderer, const SDL_Point *points, int count)
Draw multiple points on the current rendering target.
uint8_t Uint8
An unsigned 8-bit integer type.
#define SDL_stack_alloc(type, count)
void SDL_UnlockTexture(SDL_Texture *texture)
Unlock a texture, uploading the changes to video memory, if needed.
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.
int SDL_GetRenderDrawBlendMode(SDL_Renderer *renderer, SDL_BlendMode *blendMode)
Get the blend mode used for drawing operations.
SDL_Texture * SDL_CreateTextureFromSurface(SDL_Renderer *renderer, SDL_Surface *surface)
Create a texture from an existing surface.
int SDL_RenderSetIntegerScale(SDL_Renderer *renderer, SDL_bool enable)
Set whether to force integer scales for resolution-independent rendering.
int(* GL_BindTexture)(SDL_Renderer *renderer, SDL_Texture *texture, float *texw, float *texh)
void(* UnlockTexture)(SDL_Renderer *renderer, SDL_Texture *texture)
SDL_Renderer *(* CreateRenderer)(SDL_Window *window, Uint32 flags)
int SDL_RenderDrawRect(SDL_Renderer *renderer, const SDL_Rect *rect)
Draw a rectangle on the current rendering target.
int SDL_GetNumRenderDrivers(void)
Get the number of 2D rendering drivers available for the current display.
void SDL_SW_DestroyYUVTexture(SDL_SW_YUVTexture *swdata)
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(* SetRenderTarget)(SDL_Renderer *renderer, SDL_Texture *texture)
int(* UpdateViewport)(SDL_Renderer *renderer)
#define SDL_GetWindowFromID
int SDL_GetTextureColorMod(SDL_Texture *texture, Uint8 *r, Uint8 *g, Uint8 *b)
Get the additional color value used in render copy operations.
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.
SDL_bool SDL_RenderGetIntegerScale(SDL_Renderer *renderer)
Get whether integer scales are forced for resolution-independent rendering.
SDL_bool SDL_RenderTargetSupported(SDL_Renderer *renderer)
Determines whether a window supports the use of render targets.
int(* GL_UnbindTexture)(SDL_Renderer *renderer, SDL_Texture *texture)
static int UpdateLogicalSize(SDL_Renderer *renderer)
#define SDL_GetSurfaceAlphaMod
SDL_RendererFlip
Flip constants for SDL_RenderCopyEx.
static int SDL_UpdateTextureYUV(SDL_Texture *texture, const SDL_Rect *rect, const void *pixels, int pitch)
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(* RenderCopy)(SDL_Renderer *renderer, SDL_Texture *texture, const SDL_Rect *srcrect, const SDL_FRect *dstrect)
int SDL_RenderSetScale(SDL_Renderer *renderer, float scaleX, float scaleY)
Set the drawing scale for rendering on the current target.
int SDL_SetTextureAlphaMod(SDL_Texture *texture, Uint8 alpha)
Set an additional alpha value used in render copy operations.
void SDL_RenderGetClipRect(SDL_Renderer *renderer, SDL_Rect *rect)
Get the clip rectangle for the current target.
#define SDL_assert(condition)
int SDL_UpdateTexture(SDL_Texture *texture, const SDL_Rect *rect, const void *pixels, int pitch)
Update the given texture rectangle with new pixel data.
int SDL_RenderClear(SDL_Renderer *renderer)
Clear the current rendering target with the drawing color.
SDL_bool SDL_RenderIsClipEnabled(SDL_Renderer *renderer)
Get whether clipping is enabled on the given renderer.
#define SDL_OutOfMemory()
Information on the capabilities of a render driver or context.
static const SDL_RenderDriver * render_drivers[]
#define SDL_WINDOWRENDERDATA
static SDL_bool IsSupportedFormat(SDL_Renderer *renderer, Uint32 format)
SDL_Renderer * SDL_CreateRenderer(SDL_Window *window, int index, Uint32 flags)
Create a 2D rendering context for a window.
int(* RenderCopyEx)(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)
#define SDL_GetSurfaceColorMod
#define CHECK_TEXTURE_MAGIC(texture, retval)
#define SDL_AddEventWatch
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)
int SDL_RenderDrawLines(SDL_Renderer *renderer, const SDL_Point *points, int count)
Draw a series of connected lines on the current rendering target.
int(* SetTextureAlphaMod)(SDL_Renderer *renderer, SDL_Texture *texture)
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.
The type used to identify a window.
SDL_Rect rects[MAX_RECTS]
#define SDL_GetWindowPixelFormat
SDL_Renderer * SDL_GetRenderer(SDL_Window *window)
Get the renderer associated with a window.
void SDL_RenderGetViewport(SDL_Renderer *renderer, SDL_Rect *rect)
Get the drawing area for the current target.
int SDL_SW_CopyYUVToRGB(SDL_SW_YUVTexture *swdata, const SDL_Rect *srcrect, Uint32 target_format, int w, int h, void *pixels, int pitch)
#define SDL_HINT_RENDER_DRIVER
A variable specifying which render driver to use.
void(* WindowEvent)(SDL_Renderer *renderer, const SDL_WindowEvent *event)
void SDL_RenderGetScale(SDL_Renderer *renderer, float *scaleX, float *scaleY)
Get the drawing scale for the current target.
int SDL_SetTextureColorMod(SDL_Texture *texture, Uint8 r, Uint8 g, Uint8 b)
Set an additional color value used in render copy operations.
SDL_MouseButtonEvent button
Uint32 num_texture_formats
int SDL_RenderSetClipRect(SDL_Renderer *renderer, const SDL_Rect *rect)
Set the clip rectangle for the current target.
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...
#define SDL_arraysize(array)
static char renderer_magic
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).
GLubyte GLubyte GLubyte GLubyte w
#define SDL_ConvertPixels
void(* DestroyTexture)(SDL_Renderer *renderer, SDL_Texture *texture)
int(* CreateTexture)(SDL_Renderer *renderer, SDL_Texture *texture)
void(* RenderPresent)(SDL_Renderer *renderer)
#define SDL_ISPIXELFORMAT_FOURCC(format)
#define SDL_stack_free(data)
int SDL_RenderSetLogicalSize(SDL_Renderer *renderer, int w, int h)
Set device independent resolution for rendering.
GLboolean GLboolean GLboolean GLboolean a
int SDL_SetRenderTarget(SDL_Renderer *renderer, SDL_Texture *texture)
Set a texture as the current rendering target.
int SDL_RenderDrawLine(SDL_Renderer *renderer, int x1, int y1, int x2, int y2)
Draw a line on the current rendering target.
int(* UpdateClipRect)(SDL_Renderer *renderer)
static void SDL_UnlockTextureYUV(SDL_Texture *texture)
GLboolean GLboolean GLboolean b
SDL_bool clipping_enabled_backup
#define SDL_Unsupported()
SDL_Texture * SDL_CreateTexture(SDL_Renderer *renderer, Uint32 format, int access, int w, int h)
Create a texture for a rendering context.
int SDL_GetTextureAlphaMod(SDL_Texture *texture, Uint8 *alpha)
Get the additional alpha value used in render copy operations.
GLfloat GLfloat GLfloat GLfloat h
SDL_bool clipping_enabled
static int SDL_RendererEventWatch(void *userdata, SDL_Event *event)
A rectangle, with the origin at the upper left.
int SDL_GL_UnbindTexture(SDL_Texture *texture)
Unbind a texture from the current OpenGL/ES/ES2 context.
static int SDL_LockTextureNative(SDL_Texture *texture, const SDL_Rect *rect, void **pixels, int *pitch)
int SDL_GetRenderDriverInfo(int index, SDL_RendererInfo *info)
Get information about a specific 2D rendering driver for the current display.