SDL_sysrender.h
Go to the documentation of this file.
/*
Simple DirectMedia Layer
Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
*/
#include "../SDL_internal.h"
#ifndef _SDL_sysrender_h
#define _SDL_sysrender_h
#include "SDL_render.h"
#include "SDL_events.h"
#include "SDL_yuv_sw_c.h"
/* The SDL 2D rendering system */
typedef struct SDL_RenderDriver SDL_RenderDriver;
typedef struct
{
float x;
float y;
} SDL_FPoint;
typedef struct
{
float x;
float y;
float w;
float h;
} SDL_FRect;
/* Define the SDL texture structure */
struct SDL_Texture
{
const void *magic;
Uint32 format; /**< The pixel format of the texture */
int access; /**< SDL_TextureAccess */
int w; /**< The width of the texture */
int h; /**< The height of the texture */
int modMode; /**< The texture modulation mode */
SDL_BlendMode blendMode; /**< The texture blend mode */
Uint8 r, g, b, a; /**< Texture modulation values */
SDL_Renderer *renderer;
/* Support for formats not supported directly by the renderer */
SDL_Texture *native;
SDL_SW_YUVTexture *yuv;
void *pixels;
int pitch;
SDL_Rect locked_rect;
void *driverdata; /**< Driver specific texture representation */
SDL_Texture *prev;
SDL_Texture *next;
};
/* Define the SDL renderer structure */
struct SDL_Renderer
{
const void *magic;
void (*WindowEvent) (SDL_Renderer * renderer, const SDL_WindowEvent *event);
int (*GetOutputSize) (SDL_Renderer * renderer, int *w, int *h);
int (*CreateTexture) (SDL_Renderer * renderer, SDL_Texture * texture);
int (*SetTextureColorMod) (SDL_Renderer * renderer,
SDL_Texture * texture);
int (*SetTextureAlphaMod) (SDL_Renderer * renderer,
SDL_Texture * texture);
int (*SetTextureBlendMode) (SDL_Renderer * renderer,
SDL_Texture * texture);
int (*UpdateTexture) (SDL_Renderer * renderer, SDL_Texture * texture,
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);
int (*LockTexture) (SDL_Renderer * renderer, SDL_Texture * texture,
const SDL_Rect * rect, void **pixels, int *pitch);
void (*UnlockTexture) (SDL_Renderer * renderer, SDL_Texture * texture);
int (*SetRenderTarget) (SDL_Renderer * renderer, SDL_Texture * texture);
int (*UpdateViewport) (SDL_Renderer * renderer);
int (*UpdateClipRect) (SDL_Renderer * renderer);
int (*RenderClear) (SDL_Renderer * renderer);
int (*RenderDrawPoints) (SDL_Renderer * renderer, const SDL_FPoint * points,
int count);
int (*RenderDrawLines) (SDL_Renderer * renderer, const SDL_FPoint * points,
int count);
int (*RenderFillRects) (SDL_Renderer * renderer, const SDL_FRect * rects,
int count);
int (*RenderCopy) (SDL_Renderer * renderer, SDL_Texture * texture,
const SDL_Rect * srcrect, const SDL_FRect * dstrect);
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);
int (*RenderReadPixels) (SDL_Renderer * renderer, const SDL_Rect * rect,
Uint32 format, void * pixels, int pitch);
void (*RenderPresent) (SDL_Renderer * renderer);
void (*DestroyTexture) (SDL_Renderer * renderer, SDL_Texture * texture);
void (*DestroyRenderer) (SDL_Renderer * renderer);
int (*GL_BindTexture) (SDL_Renderer * renderer, SDL_Texture *texture, float *texw, float *texh);
int (*GL_UnbindTexture) (SDL_Renderer * renderer, SDL_Texture *texture);
/* The current renderer info */
SDL_RendererInfo info;
/* The window associated with the renderer */
SDL_Window *window;
SDL_bool hidden;
/* The logical resolution for rendering */
int logical_w;
int logical_h;
int logical_w_backup;
int logical_h_backup;
/* The drawable area within the window */
SDL_Rect viewport;
SDL_Rect viewport_backup;
/* The clip rectangle within the window */
SDL_Rect clip_rect;
SDL_Rect clip_rect_backup;
/* Wether or not the clipping rectangle is used. */
SDL_bool clipping_enabled;
SDL_bool clipping_enabled_backup;
/* The render output coordinate scale */
SDL_FPoint scale;
SDL_FPoint scale_backup;
/* The list of textures */
SDL_Texture *textures;
SDL_Texture *target;
Uint8 r, g, b, a; /**< Color for drawing operations values */
SDL_BlendMode blendMode; /**< The drawing blend mode */
void *driverdata;
};
/* Define the SDL render driver structure */
struct SDL_RenderDriver
{
SDL_Renderer *(*CreateRenderer) (SDL_Window * window, Uint32 flags);
/* Info about the renderer capabilities */
SDL_RendererInfo info;
};
#if !SDL_RENDER_DISABLED
#if SDL_VIDEO_RENDER_D3D
extern SDL_RenderDriver D3D_RenderDriver;
#endif
#if SDL_VIDEO_RENDER_D3D11
extern SDL_RenderDriver D3D11_RenderDriver;
#endif
#if SDL_VIDEO_RENDER_OGL
extern SDL_RenderDriver GL_RenderDriver;
#endif
#if SDL_VIDEO_RENDER_OGL_ES2
extern SDL_RenderDriver GLES2_RenderDriver;
#endif
#if SDL_VIDEO_RENDER_OGL_ES
extern SDL_RenderDriver GLES_RenderDriver;
#endif
#if SDL_VIDEO_RENDER_DIRECTFB
extern SDL_RenderDriver DirectFB_RenderDriver;
#endif
#if SDL_VIDEO_RENDER_PSP
extern SDL_RenderDriver PSP_RenderDriver;
#endif
extern SDL_RenderDriver SW_RenderDriver;
#endif /* !SDL_RENDER_DISABLED */
#endif /* _SDL_sysrender_h */
/* vi: set ts=4 sw=4 expandtab: */
SDL_Texture::pixels
void * pixels
Definition: SDL_sysrender.h:65
SDL_Texture::blendMode
SDL_BlendMode blendMode
Definition: SDL_sysrender.h:57
SDL_FRect::w
float w
Definition: SDL_sysrender.h:44
SDL_Texture::pitch
int pitch
Definition: SDL_sysrender.h:66
SDL_render.h
Uint32
uint32_t Uint32
An unsigned 32-bit integer type.
Definition: SDL_stdinc.h:157
SDL_Renderer::info
SDL_RendererInfo info
Definition: SDL_sysrender.h:126
SDL_Renderer::clip_rect_backup
SDL_Rect clip_rect_backup
Definition: SDL_sysrender.h:144
SDL_BlendMode
SDL_BlendMode
The blend mode used in SDL_RenderCopy() and drawing operations.
Definition: SDL_blendmode.h:40
SDL_Texture::g
Uint8 g
Definition: SDL_sysrender.h:58
count
GLuint GLuint GLsizei count
Definition: SDL_opengl.h:1564
rect
SDL_Rect rect
Definition: testrelative.c:27
window
SDL_Window * window
Definition: testautomation_render.c:26
SDL_Renderer::hidden
SDL_bool hidden
Definition: SDL_sysrender.h:130
texture
GLenum GLenum GLuint texture
Definition: SDL_opengl_glext.h:1178
SDL_Renderer::driverdata
void * driverdata
Definition: SDL_sysrender.h:161
SDL_events.h
SDL_Renderer::scale
SDL_FPoint scale
Definition: SDL_sysrender.h:151
SDL_Renderer::logical_h
int logical_h
Definition: SDL_sysrender.h:134
SDL_Renderer
Definition: SDL_sysrender.h:76
SDL_Texture::locked_rect
SDL_Rect locked_rect
Definition: SDL_sysrender.h:67
SDL_Renderer::clip_rect
SDL_Rect clip_rect
Definition: SDL_sysrender.h:143
SDL_Renderer::textures
SDL_Texture * textures
Definition: SDL_sysrender.h:155
SDL_FRect::y
float y
Definition: SDL_sysrender.h:43
SDL_Renderer::window
SDL_Window * window
Definition: SDL_sysrender.h:129
SDL_RenderDriver::info
SDL_RendererInfo info
Definition: SDL_sysrender.h:170
SDL_Texture::a
Uint8 a
Definition: SDL_sysrender.h:58
points
GLfixed GLfixed GLint GLint GLfixed points
Definition: SDL_opengl_glext.h:4558
SDL_Texture
Definition: SDL_sysrender.h:49
SDL_SW_YUVTexture
Definition: SDL_yuv_sw_c.h:27
SDL_Renderer::scale_backup
SDL_FPoint scale_backup
Definition: SDL_sysrender.h:152
SDL_bool
SDL_bool
Definition: SDL_stdinc.h:126
SDL_Texture::next
SDL_Texture * next
Definition: SDL_sysrender.h:72
SDL_Texture::prev
SDL_Texture * prev
Definition: SDL_sysrender.h:71
SW_RenderDriver
SDL_RenderDriver SW_RenderDriver
Definition: SDL_render_sw.c:78
SDL_Renderer::target
SDL_Texture * target
Definition: SDL_sysrender.h:156
SDL_Renderer::logical_w_backup
int logical_w_backup
Definition: SDL_sysrender.h:135
Uint8
uint8_t Uint8
An unsigned 8-bit integer type.
Definition: SDL_stdinc.h:139
event
struct _cl_event * event
Definition: SDL_opengl_glext.h:2649
SDL_Renderer::logical_h_backup
int logical_h_backup
Definition: SDL_sysrender.h:136
SDL_Texture::yuv
SDL_SW_YUVTexture * yuv
Definition: SDL_sysrender.h:64
SDL_Renderer::blendMode
SDL_BlendMode blendMode
Definition: SDL_sysrender.h:159
SDL_Texture::w
int w
Definition: SDL_sysrender.h:54
SDL_FRect::h
float h
Definition: SDL_sysrender.h:45
SDL_RendererFlip
SDL_RendererFlip
Flip constants for SDL_RenderCopyEx.
Definition: SDL_render.h:111
SDL_WindowEvent
Window state change event data (event.window.*)
Definition: SDL_events.h:171
SDL_Texture::b
Uint8 b
Definition: SDL_sysrender.h:58
SDL_RendererInfo
Information on the capabilities of a render driver or context.
Definition: SDL_render.h:78
SDL_RenderDriver
Definition: SDL_sysrender.h:165
void
SDL_PRINTF_FORMAT_STRING const char int SDL_PRINTF_FORMAT_STRING const char int SDL_PRINTF_FORMAT_STRING const char int SDL_PRINTF_FORMAT_STRING const char const char SDL_SCANF_FORMAT_STRING const char return SDL_ThreadFunction const char void return Uint32 return Uint32 void
Definition: SDL_dynapi_procs.h:93
SDL_Texture::renderer
SDL_Renderer * renderer
Definition: SDL_sysrender.h:60
SDL_yuv_sw_c.h
SDL_Renderer::viewport
SDL_Rect viewport
Definition: SDL_sysrender.h:139
SDL_Window
The type used to identify a window.
Definition: SDL_sysvideo.h:71
rects
SDL_Rect rects[MAX_RECTS]
Definition: testintersections.c:129
angle
GLfloat angle
Definition: SDL_opengl_glext.h:6097
SDL_Renderer::magic
const void * magic
Definition: SDL_sysrender.h:78
SDL_Texture::format
Uint32 format
Definition: SDL_sysrender.h:52
SDL_Texture::modMode
int modMode
Definition: SDL_sysrender.h:56
SDL_Texture::driverdata
void * driverdata
Definition: SDL_sysrender.h:69
flags
GLbitfield flags
Definition: SDL_opengl_glext.h:1480
SDL_Renderer::logical_w
int logical_w
Definition: SDL_sysrender.h:133
SDL_Texture::native
SDL_Texture * native
Definition: SDL_sysrender.h:63
SDL_Renderer::r
Uint8 r
Definition: SDL_sysrender.h:158
SDL_FRect::x
float x
Definition: SDL_sysrender.h:42
SDL_Renderer::viewport_backup
SDL_Rect viewport_backup
Definition: SDL_sysrender.h:140
SDL_Texture::magic
const void * magic
Definition: SDL_sysrender.h:51
SDL_Renderer::clipping_enabled_backup
SDL_bool clipping_enabled_backup
Definition: SDL_sysrender.h:148
SDL_Texture::access
int access
Definition: SDL_sysrender.h:53
UpdateTexture
void UpdateTexture(SDL_Texture *texture, int frame)
Definition: teststreaming.c:70
SDL_FPoint::x
float x
Definition: SDL_sysrender.h:36
SDL_Renderer::clipping_enabled
SDL_bool clipping_enabled
Definition: SDL_sysrender.h:147
SDL_FRect
Definition: SDL_sysrender.h:40
SDL_FPoint
Definition: SDL_sysrender.h:34
SDL_Rect
A rectangle, with the origin at the upper left.
Definition: SDL_rect.h:64
SDL_Texture::h
int h
Definition: SDL_sysrender.h:55
SDL_FPoint::y
float y
Definition: SDL_sysrender.h:37
SDL_Texture::r
Uint8 r
Definition: SDL_sysrender.h:58