Mercurial > sdl-ios-xcode
annotate src/video/photon/SDL_photon_render.c @ 3294:470d0a416aa7
Fixed bug #714
fuzzyTew@gmail.com 2009-03-14 15:18:45 PDT
patch to change HAVE_ICONV to HAVE_ICONV_H
There are two separate iconv checks in configure -- one for the header file and
one for the library. include/SDL_stdinc.h uses the library define to see
whether or not it should reference the types defined in the header, which
naturally breaks if the library exists and the header does not.
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Mon, 21 Sep 2009 11:04:01 +0000 |
parents | 7f684f249ec9 |
children | dd105b317335 |
rev | line source |
---|---|
3092
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1 /* |
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2 SDL - Simple DirectMedia Layer |
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3 Copyright (C) 1997-2009 Sam Lantinga |
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4 |
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5 This library is free software; you can redistribute it and/or |
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6 modify it under the terms of the GNU Lesser General Public |
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7 License as published by the Free Software Foundation; either |
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
8 version 2.1 of the License, or (at your option) any later version. |
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
9 |
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
10 This library is distributed in the hope that it will be useful, |
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
11 but WITHOUT ANY WARRANTY; without even the implied warranty of |
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
13 Lesser General Public License for more details. |
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
14 |
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
15 You should have received a copy of the GNU Lesser General Public |
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
16 License along with this library; if not, write to the Free Software |
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
17 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
18 |
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
19 Sam Lantinga |
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
20 slouken@libsdl.org |
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
21 |
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
22 QNX Photon GUI SDL driver |
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
23 Copyright (C) 2009 Mike Gorchak |
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
24 (mike@malva.ua, lestat@i.com.ua) |
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
25 */ |
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
26 |
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
27 #include "SDL_config.h" |
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
28 |
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
29 #include "../SDL_pixels_c.h" |
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
30 #include "../SDL_yuv_sw_c.h" |
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
31 |
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
32 #include "SDL_video.h" |
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
33 |
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
34 #include "SDL_photon_render.h" |
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
35 #include "SDL_photon.h" |
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
36 |
3139 | 37 static SDL_Renderer *photon_createrenderer(SDL_Window * window, Uint32 flags); |
38 static int photon_displaymodechanged(SDL_Renderer * renderer); | |
39 static int photon_activaterenderer(SDL_Renderer * renderer); | |
40 static int photon_createtexture(SDL_Renderer * renderer, | |
41 SDL_Texture * texture); | |
42 static int photon_querytexturepixels(SDL_Renderer * renderer, | |
43 SDL_Texture * texture, void **pixels, | |
44 int *pitch); | |
45 static int photon_settexturepalette(SDL_Renderer * renderer, | |
46 SDL_Texture * texture, | |
47 const SDL_Color * colors, int firstcolor, | |
48 int ncolors); | |
49 static int photon_gettexturepalette(SDL_Renderer * renderer, | |
50 SDL_Texture * texture, SDL_Color * colors, | |
51 int firstcolor, int ncolors); | |
52 static int photon_settexturecolormod(SDL_Renderer * renderer, | |
53 SDL_Texture * texture); | |
54 static int photon_settexturealphamod(SDL_Renderer * renderer, | |
55 SDL_Texture * texture); | |
56 static int photon_settextureblendmode(SDL_Renderer * renderer, | |
57 SDL_Texture * texture); | |
58 static int photon_settexturescalemode(SDL_Renderer * renderer, | |
59 SDL_Texture * texture); | |
60 static int photon_updatetexture(SDL_Renderer * renderer, | |
61 SDL_Texture * texture, const SDL_Rect * rect, | |
62 const void *pixels, int pitch); | |
63 static int photon_locktexture(SDL_Renderer * renderer, SDL_Texture * texture, | |
64 const SDL_Rect * rect, int markDirty, | |
65 void **pixels, int *pitch); | |
66 static void photon_unlocktexture(SDL_Renderer * renderer, | |
67 SDL_Texture * texture); | |
68 static void photon_dirtytexture(SDL_Renderer * renderer, | |
69 SDL_Texture * texture, int numrects, | |
70 const SDL_Rect * rects); | |
71 static int photon_renderpoint(SDL_Renderer * renderer, int x, int y); | |
72 static int photon_renderline(SDL_Renderer * renderer, int x1, int y1, int x2, | |
73 int y2); | |
74 static int photon_renderfill(SDL_Renderer * renderer, const SDL_Rect * rect); | |
75 static int photon_rendercopy(SDL_Renderer * renderer, SDL_Texture * texture, | |
76 const SDL_Rect * srcrect, | |
77 const SDL_Rect * dstrect); | |
78 static void photon_renderpresent(SDL_Renderer * renderer); | |
79 static void photon_destroytexture(SDL_Renderer * renderer, | |
80 SDL_Texture * texture); | |
81 static void photon_destroyrenderer(SDL_Renderer * renderer); | |
3092
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
82 |
3139 | 83 SDL_RenderDriver photon_renderdriver = { |
3092
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
84 photon_createrenderer, |
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
85 { |
3139 | 86 "photon", |
87 (SDL_RENDERER_SINGLEBUFFER | SDL_RENDERER_PRESENTCOPY | | |
88 SDL_RENDERER_PRESENTFLIP2 | SDL_RENDERER_PRESENTFLIP3 | | |
89 SDL_RENDERER_PRESENTVSYNC | SDL_RENDERER_PRESENTDISCARD | | |
90 SDL_RENDERER_ACCELERATED), | |
91 (SDL_TEXTUREMODULATE_NONE | SDL_TEXTUREMODULATE_COLOR | | |
92 SDL_TEXTUREMODULATE_ALPHA), | |
93 (SDL_BLENDMODE_NONE | SDL_BLENDMODE_MASK | | |
94 SDL_BLENDMODE_BLEND | SDL_BLENDMODE_ADD | SDL_BLENDMODE_MOD), | |
95 (SDL_TEXTURESCALEMODE_NONE | SDL_TEXTURESCALEMODE_SLOW), | |
96 13, | |
97 { | |
98 SDL_PIXELFORMAT_INDEX8, | |
99 SDL_PIXELFORMAT_RGB555, | |
100 SDL_PIXELFORMAT_RGB565, | |
101 SDL_PIXELFORMAT_RGB888, | |
102 SDL_PIXELFORMAT_BGR888, | |
103 SDL_PIXELFORMAT_ARGB8888, | |
104 SDL_PIXELFORMAT_RGBA8888, | |
105 SDL_PIXELFORMAT_ABGR8888, | |
106 SDL_PIXELFORMAT_BGRA8888, | |
107 SDL_PIXELFORMAT_YV12, | |
108 SDL_PIXELFORMAT_YUY2, | |
109 SDL_PIXELFORMAT_UYVY, | |
110 SDL_PIXELFORMAT_YVYU}, | |
111 0, | |
112 0} | |
3092
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
113 }; |
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
114 |
3139 | 115 static SDL_Renderer * |
116 photon_createrenderer(SDL_Window * window, Uint32 flags) | |
3092
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
117 { |
3139 | 118 SDL_VideoDisplay *display = SDL_GetDisplayFromWindow(window); |
119 SDL_DisplayData *didata = (SDL_DisplayData *) display->driverdata; | |
120 SDL_WindowData *wdata = (SDL_WindowData *) window->driverdata; | |
121 SDL_Renderer *renderer = NULL; | |
122 SDL_RenderData *rdata = NULL; | |
3092
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
123 |
3139 | 124 /* Allocate new renderer structure */ |
125 renderer = (SDL_Renderer *) SDL_calloc(1, sizeof(SDL_Renderer)); | |
126 if (renderer == NULL) { | |
127 SDL_OutOfMemory(); | |
128 return NULL; | |
129 } | |
3092
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
130 |
3139 | 131 /* Allocate renderer data */ |
132 rdata = (SDL_RenderData *) SDL_calloc(1, sizeof(SDL_RenderData)); | |
133 if (rdata == NULL) { | |
134 SDL_free(renderer); | |
135 SDL_OutOfMemory(); | |
136 return NULL; | |
137 } | |
3092
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
138 |
3139 | 139 renderer->DisplayModeChanged = photon_displaymodechanged; |
140 renderer->ActivateRenderer = photon_activaterenderer; | |
141 renderer->CreateTexture = photon_createtexture; | |
142 renderer->QueryTexturePixels = photon_querytexturepixels; | |
143 renderer->SetTexturePalette = photon_settexturepalette; | |
144 renderer->GetTexturePalette = photon_gettexturepalette; | |
145 renderer->SetTextureAlphaMod = photon_settexturealphamod; | |
146 renderer->SetTextureColorMod = photon_settexturecolormod; | |
147 renderer->SetTextureBlendMode = photon_settextureblendmode; | |
148 renderer->SetTextureScaleMode = photon_settexturescalemode; | |
149 renderer->UpdateTexture = photon_updatetexture; | |
150 renderer->LockTexture = photon_locktexture; | |
151 renderer->UnlockTexture = photon_unlocktexture; | |
152 renderer->DirtyTexture = photon_dirtytexture; | |
153 renderer->RenderPoint = photon_renderpoint; | |
154 renderer->RenderLine = photon_renderline; | |
155 renderer->RenderFill = photon_renderfill; | |
156 renderer->RenderCopy = photon_rendercopy; | |
157 renderer->RenderPresent = photon_renderpresent; | |
158 renderer->DestroyTexture = photon_destroytexture; | |
159 renderer->DestroyRenderer = photon_destroyrenderer; | |
160 renderer->info = photon_renderdriver.info; | |
161 renderer->window = window->id; | |
162 renderer->driverdata = rdata; | |
3092
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
163 |
3139 | 164 /* Set render acceleration flag in case it is accelerated */ |
165 if ((didata->caps & SDL_PHOTON_ACCELERATED) == SDL_PHOTON_ACCELERATED) { | |
166 renderer->info.flags = SDL_RENDERER_ACCELERATED; | |
167 } else { | |
168 renderer->info.flags &= ~(SDL_RENDERER_ACCELERATED); | |
169 } | |
3092
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
170 |
3139 | 171 rdata->window = window; |
3092
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
172 |
3139 | 173 /* Check if upper level requested synchronization on vsync signal */ |
174 if ((flags & SDL_RENDERER_PRESENTVSYNC) == SDL_RENDERER_PRESENTVSYNC) { | |
175 rdata->enable_vsync = SDL_TRUE; | |
176 } else { | |
177 rdata->enable_vsync = SDL_FALSE; | |
178 } | |
3092
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
179 |
3139 | 180 /* Check what buffer copy/flip scheme is requested */ |
181 rdata->surfaces_count = 0; | |
182 if ((flags & SDL_RENDERER_SINGLEBUFFER) == SDL_RENDERER_SINGLEBUFFER) { | |
183 if ((flags & SDL_RENDERER_PRESENTDISCARD) == | |
184 SDL_RENDERER_PRESENTDISCARD) { | |
185 renderer->info.flags |= | |
186 SDL_RENDERER_SINGLEBUFFER | SDL_RENDERER_PRESENTDISCARD; | |
187 } else { | |
188 renderer->info.flags |= | |
189 SDL_RENDERER_SINGLEBUFFER | SDL_RENDERER_PRESENTCOPY; | |
190 } | |
191 rdata->surfaces_count = 1; | |
192 rdata->surface_visible_idx = 0; | |
193 rdata->surface_render_idx = 0; | |
194 } else { | |
195 if ((flags & SDL_RENDERER_PRESENTFLIP2) == SDL_RENDERER_PRESENTFLIP2) { | |
196 renderer->info.flags |= SDL_RENDERER_PRESENTFLIP2; | |
197 rdata->surfaces_count = 2; | |
198 rdata->surface_visible_idx = 0; | |
199 rdata->surface_render_idx = 1; | |
200 } else { | |
201 if ((flags & SDL_RENDERER_PRESENTFLIP3) == | |
202 SDL_RENDERER_PRESENTFLIP3) { | |
203 renderer->info.flags |= SDL_RENDERER_PRESENTFLIP3; | |
204 rdata->surfaces_count = 3; | |
205 rdata->surface_visible_idx = 0; | |
206 rdata->surface_render_idx = 1; | |
207 } else { | |
208 renderer->info.flags |= | |
209 SDL_RENDERER_SINGLEBUFFER | SDL_RENDERER_PRESENTCOPY; | |
210 rdata->surfaces_count = 1; | |
211 rdata->surface_visible_idx = 0; | |
212 rdata->surface_render_idx = 0; | |
213 } | |
214 } | |
215 } | |
3092
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
216 |
3139 | 217 return renderer; |
3092
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
218 } |
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
219 |
3139 | 220 void |
221 photon_addrenderdriver(_THIS) | |
3092
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
222 { |
3139 | 223 uint32_t it; |
3092
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
224 |
3139 | 225 for (it = 0; it < _this->num_displays; it++) { |
226 SDL_AddRenderDriver(it, &photon_renderdriver); | |
227 } | |
3092
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
228 } |
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
229 |
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
230 /****************************************************************************/ |
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
231 /* SDL render interface */ |
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
232 /****************************************************************************/ |
3139 | 233 static int |
234 photon_displaymodechanged(SDL_Renderer * renderer) | |
3092
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
235 { |
3139 | 236 SDL_RenderData *rdata = (SDL_RenderData *) renderer->driverdata; |
3092
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
237 |
3139 | 238 /* Remove all allocated surfaces, they are no more valid */ |
3092
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
239 |
3139 | 240 /* TODO: Add video mode change detection and new parameters detection */ |
3092
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
241 |
3139 | 242 return 0; |
3092
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
243 } |
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
244 |
3139 | 245 static int |
246 photon_activaterenderer(SDL_Renderer * renderer) | |
3092
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
247 { |
3139 | 248 SDL_RenderData *rdata = (SDL_RenderData *) renderer->driverdata; |
249 SDL_VideoDisplay *display = SDL_GetDisplayFromWindow(rdata->window); | |
250 SDL_DisplayData *didata = (SDL_DisplayData *) display->driverdata; | |
3092
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
251 |
3139 | 252 return 0; |
3092
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
253 } |
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
254 |
3139 | 255 static int |
256 photon_createtexture(SDL_Renderer * renderer, SDL_Texture * texture) | |
3092
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
257 { |
3139 | 258 SDL_RenderData *renderdata = (SDL_RenderData *) renderer->driverdata; |
259 SDL_Window *window = SDL_GetWindowFromID(renderer->window); | |
260 SDL_VideoDisplay *display = SDL_GetDisplayFromWindow(window); | |
261 SDL_TextureData *tdata = NULL; | |
3092
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
262 |
3139 | 263 /* Allocate texture driver data */ |
264 tdata = (SDL_TextureData *) SDL_calloc(1, sizeof(SDL_TextureData)); | |
265 if (tdata == NULL) { | |
266 SDL_OutOfMemory(); | |
267 return -1; | |
268 } | |
3092
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
269 |
3139 | 270 /* Set texture driver data */ |
271 texture->driverdata = tdata; | |
3092
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
272 |
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
273 } |
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
274 |
3139 | 275 static int |
276 photon_querytexturepixels(SDL_Renderer * renderer, SDL_Texture * texture, | |
277 void **pixels, int *pitch) | |
278 { | |
279 } | |
280 | |
281 static int | |
282 photon_settexturepalette(SDL_Renderer * renderer, SDL_Texture * texture, | |
283 const SDL_Color * colors, int firstcolor, | |
284 int ncolors) | |
3092
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
285 { |
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
286 } |
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
287 |
3139 | 288 static int |
289 photon_gettexturepalette(SDL_Renderer * renderer, SDL_Texture * texture, | |
290 SDL_Color * colors, int firstcolor, int ncolors) | |
3092
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
291 { |
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
292 } |
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
293 |
3139 | 294 static int |
295 photon_settexturecolormod(SDL_Renderer * renderer, SDL_Texture * texture) | |
3092
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
296 { |
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
297 } |
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
298 |
3139 | 299 static int |
300 photon_settexturealphamod(SDL_Renderer * renderer, SDL_Texture * texture) | |
3092
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
301 { |
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
302 } |
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
303 |
3139 | 304 static int |
305 photon_settextureblendmode(SDL_Renderer * renderer, SDL_Texture * texture) | |
3092
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
306 { |
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
307 } |
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
308 |
3139 | 309 static int |
310 photon_settexturescalemode(SDL_Renderer * renderer, SDL_Texture * texture) | |
3092
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
311 { |
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
312 } |
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
313 |
3139 | 314 static int |
315 photon_updatetexture(SDL_Renderer * renderer, SDL_Texture * texture, | |
316 const SDL_Rect * rect, const void *pixels, int pitch) | |
3092
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
317 { |
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
318 } |
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
319 |
3139 | 320 static int |
321 photon_locktexture(SDL_Renderer * renderer, SDL_Texture * texture, | |
322 const SDL_Rect * rect, int markDirty, void **pixels, | |
323 int *pitch) | |
3092
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
324 { |
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
325 } |
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
326 |
3139 | 327 static void |
328 photon_unlocktexture(SDL_Renderer * renderer, SDL_Texture * texture) | |
3092
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
329 { |
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
330 } |
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
331 |
3139 | 332 static void |
333 photon_dirtytexture(SDL_Renderer * renderer, SDL_Texture * texture, | |
334 int numrects, const SDL_Rect * rects) | |
3092
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
335 { |
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
336 } |
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
337 |
3139 | 338 static int |
339 photon_renderpoint(SDL_Renderer * renderer, int x, int y) | |
3092
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
340 { |
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
341 } |
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
342 |
3139 | 343 static int |
344 photon_renderline(SDL_Renderer * renderer, int x1, int y1, int x2, int y2) | |
3092
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
345 { |
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
346 } |
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
347 |
3139 | 348 static int |
349 photon_renderfill(SDL_Renderer * renderer, const SDL_Rect * rect) | |
3092
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
350 { |
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
351 } |
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
352 |
3139 | 353 static int |
354 photon_rendercopy(SDL_Renderer * renderer, SDL_Texture * texture, | |
355 const SDL_Rect * srcrect, const SDL_Rect * dstrect) | |
3092
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
356 { |
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
357 } |
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
358 |
3139 | 359 static void |
360 photon_renderpresent(SDL_Renderer * renderer) | |
3092
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
361 { |
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
362 } |
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
363 |
3139 | 364 static void |
365 photon_destroytexture(SDL_Renderer * renderer, SDL_Texture * texture) | |
3092
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
366 { |
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
367 } |
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
368 |
3139 | 369 static void |
370 photon_destroyrenderer(SDL_Renderer * renderer) | |
3092
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
371 { |
3139 | 372 SDL_RenderData *rdata = (SDL_RenderData *) renderer->driverdata; |
373 uint32_t it; | |
3092
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
374 |
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
375 } |
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
376 |
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
377 /* vi: set ts=4 sw=4 expandtab: */ |