slouken@5154
|
1 |
/*
|
slouken@5535
|
2 |
Simple DirectMedia Layer
|
slouken@9619
|
3 |
Copyright (C) 1997-2015 Sam Lantinga <slouken@libsdl.org>
|
slouken@5154
|
4 |
|
slouken@5535
|
5 |
This software is provided 'as-is', without any express or implied
|
slouken@5535
|
6 |
warranty. In no event will the authors be held liable for any damages
|
slouken@5535
|
7 |
arising from the use of this software.
|
slouken@5154
|
8 |
|
slouken@5535
|
9 |
Permission is granted to anyone to use this software for any purpose,
|
slouken@5535
|
10 |
including commercial applications, and to alter it and redistribute it
|
slouken@5535
|
11 |
freely, subject to the following restrictions:
|
slouken@5154
|
12 |
|
slouken@5535
|
13 |
1. The origin of this software must not be misrepresented; you must not
|
slouken@5535
|
14 |
claim that you wrote the original software. If you use this software
|
slouken@5535
|
15 |
in a product, an acknowledgment in the product documentation would be
|
slouken@5535
|
16 |
appreciated but is not required.
|
slouken@5535
|
17 |
2. Altered source versions must be plainly marked as such, and must not be
|
slouken@5535
|
18 |
misrepresented as being the original software.
|
slouken@5535
|
19 |
3. This notice may not be removed or altered from any source distribution.
|
slouken@5154
|
20 |
*/
|
icculus@8093
|
21 |
#include "../SDL_internal.h"
|
slouken@5154
|
22 |
|
slouken@5154
|
23 |
#ifndef _SDL_sysrender_h
|
slouken@5154
|
24 |
#define _SDL_sysrender_h
|
slouken@5154
|
25 |
|
slouken@5154
|
26 |
#include "SDL_render.h"
|
slouken@5154
|
27 |
#include "SDL_events.h"
|
slouken@5156
|
28 |
#include "SDL_yuv_sw_c.h"
|
slouken@5154
|
29 |
|
slouken@5154
|
30 |
/* The SDL 2D rendering system */
|
slouken@5154
|
31 |
|
slouken@5154
|
32 |
typedef struct SDL_RenderDriver SDL_RenderDriver;
|
slouken@5154
|
33 |
|
slouken@6528
|
34 |
typedef struct
|
slouken@6528
|
35 |
{
|
slouken@6528
|
36 |
float x;
|
slouken@6528
|
37 |
float y;
|
slouken@6528
|
38 |
} SDL_FPoint;
|
slouken@6528
|
39 |
|
slouken@6528
|
40 |
typedef struct
|
slouken@6528
|
41 |
{
|
slouken@6528
|
42 |
float x;
|
slouken@6528
|
43 |
float y;
|
slouken@6528
|
44 |
float w;
|
slouken@6528
|
45 |
float h;
|
slouken@6528
|
46 |
} SDL_FRect;
|
slouken@6528
|
47 |
|
slouken@5154
|
48 |
/* Define the SDL texture structure */
|
slouken@5154
|
49 |
struct SDL_Texture
|
slouken@5154
|
50 |
{
|
slouken@5154
|
51 |
const void *magic;
|
slouken@5154
|
52 |
Uint32 format; /**< The pixel format of the texture */
|
slouken@5154
|
53 |
int access; /**< SDL_TextureAccess */
|
slouken@5154
|
54 |
int w; /**< The width of the texture */
|
slouken@5154
|
55 |
int h; /**< The height of the texture */
|
slouken@5154
|
56 |
int modMode; /**< The texture modulation mode */
|
slouken@5154
|
57 |
SDL_BlendMode blendMode; /**< The texture blend mode */
|
slouken@5154
|
58 |
Uint8 r, g, b, a; /**< Texture modulation values */
|
slouken@5154
|
59 |
|
slouken@5154
|
60 |
SDL_Renderer *renderer;
|
slouken@5154
|
61 |
|
slouken@5156
|
62 |
/* Support for formats not supported directly by the renderer */
|
slouken@5156
|
63 |
SDL_Texture *native;
|
slouken@5156
|
64 |
SDL_SW_YUVTexture *yuv;
|
slouken@5156
|
65 |
void *pixels;
|
slouken@5156
|
66 |
int pitch;
|
slouken@5156
|
67 |
SDL_Rect locked_rect;
|
slouken@5156
|
68 |
|
slouken@5154
|
69 |
void *driverdata; /**< Driver specific texture representation */
|
slouken@5154
|
70 |
|
slouken@5154
|
71 |
SDL_Texture *prev;
|
slouken@5154
|
72 |
SDL_Texture *next;
|
slouken@5154
|
73 |
};
|
slouken@5154
|
74 |
|
slouken@5154
|
75 |
/* Define the SDL renderer structure */
|
slouken@5154
|
76 |
struct SDL_Renderer
|
slouken@5154
|
77 |
{
|
slouken@5154
|
78 |
const void *magic;
|
slouken@5154
|
79 |
|
slouken@5154
|
80 |
void (*WindowEvent) (SDL_Renderer * renderer, const SDL_WindowEvent *event);
|
slouken@7239
|
81 |
int (*GetOutputSize) (SDL_Renderer * renderer, int *w, int *h);
|
slouken@5154
|
82 |
int (*CreateTexture) (SDL_Renderer * renderer, SDL_Texture * texture);
|
slouken@5154
|
83 |
int (*SetTextureColorMod) (SDL_Renderer * renderer,
|
slouken@5154
|
84 |
SDL_Texture * texture);
|
slouken@5154
|
85 |
int (*SetTextureAlphaMod) (SDL_Renderer * renderer,
|
slouken@5154
|
86 |
SDL_Texture * texture);
|
slouken@5154
|
87 |
int (*SetTextureBlendMode) (SDL_Renderer * renderer,
|
slouken@5154
|
88 |
SDL_Texture * texture);
|
slouken@5154
|
89 |
int (*UpdateTexture) (SDL_Renderer * renderer, SDL_Texture * texture,
|
slouken@5154
|
90 |
const SDL_Rect * rect, const void *pixels,
|
slouken@5154
|
91 |
int pitch);
|
slouken@7759
|
92 |
int (*UpdateTextureYUV) (SDL_Renderer * renderer, SDL_Texture * texture,
|
slouken@7759
|
93 |
const SDL_Rect * rect,
|
slouken@7759
|
94 |
const Uint8 *Yplane, int Ypitch,
|
slouken@7759
|
95 |
const Uint8 *Uplane, int Upitch,
|
slouken@7759
|
96 |
const Uint8 *Vplane, int Vpitch);
|
slouken@5154
|
97 |
int (*LockTexture) (SDL_Renderer * renderer, SDL_Texture * texture,
|
slouken@5156
|
98 |
const SDL_Rect * rect, void **pixels, int *pitch);
|
slouken@5154
|
99 |
void (*UnlockTexture) (SDL_Renderer * renderer, SDL_Texture * texture);
|
slouken@6247
|
100 |
int (*SetRenderTarget) (SDL_Renderer * renderer, SDL_Texture * texture);
|
slouken@5297
|
101 |
int (*UpdateViewport) (SDL_Renderer * renderer);
|
slouken@7141
|
102 |
int (*UpdateClipRect) (SDL_Renderer * renderer);
|
slouken@5154
|
103 |
int (*RenderClear) (SDL_Renderer * renderer);
|
slouken@6528
|
104 |
int (*RenderDrawPoints) (SDL_Renderer * renderer, const SDL_FPoint * points,
|
slouken@5154
|
105 |
int count);
|
slouken@6528
|
106 |
int (*RenderDrawLines) (SDL_Renderer * renderer, const SDL_FPoint * points,
|
slouken@5154
|
107 |
int count);
|
slouken@6528
|
108 |
int (*RenderFillRects) (SDL_Renderer * renderer, const SDL_FRect * rects,
|
slouken@5154
|
109 |
int count);
|
slouken@5154
|
110 |
int (*RenderCopy) (SDL_Renderer * renderer, SDL_Texture * texture,
|
slouken@6528
|
111 |
const SDL_Rect * srcrect, const SDL_FRect * dstrect);
|
gabomdq@6320
|
112 |
int (*RenderCopyEx) (SDL_Renderer * renderer, SDL_Texture * texture,
|
slouken@6528
|
113 |
const SDL_Rect * srcquad, const SDL_FRect * dstrect,
|
slouken@6528
|
114 |
const double angle, const SDL_FPoint *center, const SDL_RendererFlip flip);
|
slouken@5154
|
115 |
int (*RenderReadPixels) (SDL_Renderer * renderer, const SDL_Rect * rect,
|
slouken@5154
|
116 |
Uint32 format, void * pixels, int pitch);
|
slouken@5154
|
117 |
void (*RenderPresent) (SDL_Renderer * renderer);
|
slouken@5154
|
118 |
void (*DestroyTexture) (SDL_Renderer * renderer, SDL_Texture * texture);
|
slouken@5154
|
119 |
|
slouken@5154
|
120 |
void (*DestroyRenderer) (SDL_Renderer * renderer);
|
slouken@5154
|
121 |
|
gabomdq@6414
|
122 |
int (*GL_BindTexture) (SDL_Renderer * renderer, SDL_Texture *texture, float *texw, float *texh);
|
gabomdq@6414
|
123 |
int (*GL_UnbindTexture) (SDL_Renderer * renderer, SDL_Texture *texture);
|
gabomdq@6414
|
124 |
|
slouken@5154
|
125 |
/* The current renderer info */
|
slouken@5154
|
126 |
SDL_RendererInfo info;
|
slouken@5154
|
127 |
|
slouken@5154
|
128 |
/* The window associated with the renderer */
|
slouken@5154
|
129 |
SDL_Window *window;
|
slouken@6260
|
130 |
SDL_bool hidden;
|
slouken@5154
|
131 |
|
slouken@6530
|
132 |
/* The logical resolution for rendering */
|
slouken@6530
|
133 |
int logical_w;
|
slouken@6530
|
134 |
int logical_h;
|
slouken@6581
|
135 |
int logical_w_backup;
|
slouken@6581
|
136 |
int logical_h_backup;
|
slouken@6530
|
137 |
|
slouken@5297
|
138 |
/* The drawable area within the window */
|
slouken@5297
|
139 |
SDL_Rect viewport;
|
slouken@6246
|
140 |
SDL_Rect viewport_backup;
|
slouken@5297
|
141 |
|
slouken@7141
|
142 |
/* The clip rectangle within the window */
|
slouken@7141
|
143 |
SDL_Rect clip_rect;
|
slouken@7141
|
144 |
SDL_Rect clip_rect_backup;
|
slouken@7141
|
145 |
|
jorgenpt@8728
|
146 |
/* Wether or not the clipping rectangle is used. */
|
jorgenpt@8728
|
147 |
SDL_bool clipping_enabled;
|
jorgenpt@8728
|
148 |
SDL_bool clipping_enabled_backup;
|
jorgenpt@8728
|
149 |
|
slouken@6528
|
150 |
/* The render output coordinate scale */
|
slouken@6528
|
151 |
SDL_FPoint scale;
|
slouken@6528
|
152 |
SDL_FPoint scale_backup;
|
slouken@6528
|
153 |
|
slouken@5154
|
154 |
/* The list of textures */
|
slouken@5154
|
155 |
SDL_Texture *textures;
|
slouken@6246
|
156 |
SDL_Texture *target;
|
slouken@5154
|
157 |
|
slouken@5154
|
158 |
Uint8 r, g, b, a; /**< Color for drawing operations values */
|
slouken@5154
|
159 |
SDL_BlendMode blendMode; /**< The drawing blend mode */
|
slouken@5154
|
160 |
|
slouken@5154
|
161 |
void *driverdata;
|
slouken@5154
|
162 |
};
|
slouken@5154
|
163 |
|
slouken@5154
|
164 |
/* Define the SDL render driver structure */
|
slouken@5154
|
165 |
struct SDL_RenderDriver
|
slouken@5154
|
166 |
{
|
slouken@5154
|
167 |
SDL_Renderer *(*CreateRenderer) (SDL_Window * window, Uint32 flags);
|
slouken@5154
|
168 |
|
slouken@5154
|
169 |
/* Info about the renderer capabilities */
|
slouken@5154
|
170 |
SDL_RendererInfo info;
|
slouken@5154
|
171 |
};
|
slouken@5154
|
172 |
|
slouken@5226
|
173 |
#if !SDL_RENDER_DISABLED
|
slouken@5226
|
174 |
|
slouken@5154
|
175 |
#if SDL_VIDEO_RENDER_D3D
|
slouken@5154
|
176 |
extern SDL_RenderDriver D3D_RenderDriver;
|
slouken@5154
|
177 |
#endif
|
dludwig@8400
|
178 |
#if SDL_VIDEO_RENDER_D3D11
|
dludwig@8400
|
179 |
extern SDL_RenderDriver D3D11_RenderDriver;
|
dludwig@8400
|
180 |
#endif
|
slouken@5154
|
181 |
#if SDL_VIDEO_RENDER_OGL
|
slouken@5154
|
182 |
extern SDL_RenderDriver GL_RenderDriver;
|
slouken@5154
|
183 |
#endif
|
slouken@5209
|
184 |
#if SDL_VIDEO_RENDER_OGL_ES2
|
slouken@5209
|
185 |
extern SDL_RenderDriver GLES2_RenderDriver;
|
slouken@5209
|
186 |
#endif
|
slouken@5154
|
187 |
#if SDL_VIDEO_RENDER_OGL_ES
|
slouken@5201
|
188 |
extern SDL_RenderDriver GLES_RenderDriver;
|
slouken@5201
|
189 |
#endif
|
slouken@5199
|
190 |
#if SDL_VIDEO_RENDER_DIRECTFB
|
slouken@5199
|
191 |
extern SDL_RenderDriver DirectFB_RenderDriver;
|
slouken@5199
|
192 |
#endif
|
kimonline@7009
|
193 |
#if SDL_VIDEO_RENDER_PSP
|
kimonline@7009
|
194 |
extern SDL_RenderDriver PSP_RenderDriver;
|
kimonline@7009
|
195 |
#endif
|
slouken@5154
|
196 |
extern SDL_RenderDriver SW_RenderDriver;
|
slouken@5154
|
197 |
|
slouken@5226
|
198 |
#endif /* !SDL_RENDER_DISABLED */
|
slouken@5226
|
199 |
|
slouken@5154
|
200 |
#endif /* _SDL_sysrender_h */
|
slouken@5154
|
201 |
|
slouken@5154
|
202 |
/* vi: set ts=4 sw=4 expandtab: */
|