Mercurial > sdl-ios-xcode
annotate src/video/photon/SDL_photon_render.c @ 3387:05499ec8c022
Initial support for fullscreen application modes.
author | Mike Gorchak <lestat@i.com.ua> |
---|---|
date | Mon, 12 Oct 2009 19:47:01 +0000 |
parents | fff074de9675 |
children | d6b79fc83362 |
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); | |
3375
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
71 static int photon_setdrawcolor(SDL_Renderer * renderer); |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
72 static int photon_setdrawblendmode(SDL_Renderer * renderer); |
3139 | 73 static int photon_renderpoint(SDL_Renderer * renderer, int x, int y); |
74 static int photon_renderline(SDL_Renderer * renderer, int x1, int y1, int x2, | |
75 int y2); | |
76 static int photon_renderfill(SDL_Renderer * renderer, const SDL_Rect * rect); | |
77 static int photon_rendercopy(SDL_Renderer * renderer, SDL_Texture * texture, | |
78 const SDL_Rect * srcrect, | |
79 const SDL_Rect * dstrect); | |
80 static void photon_renderpresent(SDL_Renderer * renderer); | |
81 static void photon_destroytexture(SDL_Renderer * renderer, | |
82 SDL_Texture * texture); | |
83 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
|
84 |
3375
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
85 static int _photon_recreate_surfaces(SDL_Renderer * renderer); |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
86 |
3139 | 87 SDL_RenderDriver photon_renderdriver = { |
3092
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
88 photon_createrenderer, |
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
89 { |
3139 | 90 "photon", |
91 (SDL_RENDERER_SINGLEBUFFER | SDL_RENDERER_PRESENTCOPY | | |
92 SDL_RENDERER_PRESENTFLIP2 | SDL_RENDERER_PRESENTFLIP3 | | |
93 SDL_RENDERER_PRESENTVSYNC | SDL_RENDERER_PRESENTDISCARD | | |
94 SDL_RENDERER_ACCELERATED), | |
3386
fff074de9675
Photon SDL renderer almost finished, the double/tripple buffering is left only.
Mike Gorchak <lestat@i.com.ua>
parents:
3384
diff
changeset
|
95 (SDL_TEXTUREMODULATE_NONE | SDL_TEXTUREMODULATE_ALPHA), |
fff074de9675
Photon SDL renderer almost finished, the double/tripple buffering is left only.
Mike Gorchak <lestat@i.com.ua>
parents:
3384
diff
changeset
|
96 (SDL_BLENDMODE_NONE | SDL_BLENDMODE_MASK | SDL_BLENDMODE_BLEND | |
fff074de9675
Photon SDL renderer almost finished, the double/tripple buffering is left only.
Mike Gorchak <lestat@i.com.ua>
parents:
3384
diff
changeset
|
97 SDL_BLENDMODE_ADD | SDL_BLENDMODE_MOD), |
3375
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
98 (SDL_TEXTURESCALEMODE_NONE | SDL_TEXTURESCALEMODE_SLOW | |
3384
04af265172f9
Continue working on 2D support in Photon.
Mike Gorchak <lestat@i.com.ua>
parents:
3383
diff
changeset
|
99 SDL_TEXTURESCALEMODE_FAST), |
3375
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
100 10, |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
101 {SDL_PIXELFORMAT_INDEX8, |
3139 | 102 SDL_PIXELFORMAT_RGB555, |
103 SDL_PIXELFORMAT_RGB565, | |
3375
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
104 SDL_PIXELFORMAT_RGB24, |
3139 | 105 SDL_PIXELFORMAT_RGB888, |
106 SDL_PIXELFORMAT_ARGB8888, | |
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; | |
3375
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
153 renderer->SetDrawColor = photon_setdrawcolor; |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
154 renderer->SetDrawBlendMode = photon_setdrawblendmode; |
3139 | 155 renderer->RenderPoint = photon_renderpoint; |
156 renderer->RenderLine = photon_renderline; | |
157 renderer->RenderFill = photon_renderfill; | |
158 renderer->RenderCopy = photon_rendercopy; | |
159 renderer->RenderPresent = photon_renderpresent; | |
160 renderer->DestroyTexture = photon_destroytexture; | |
161 renderer->DestroyRenderer = photon_destroyrenderer; | |
162 renderer->info = photon_renderdriver.info; | |
163 renderer->window = window->id; | |
164 renderer->driverdata = rdata; | |
3092
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
165 |
3387
05499ec8c022
Initial support for fullscreen application modes.
Mike Gorchak <lestat@i.com.ua>
parents:
3386
diff
changeset
|
166 /* Copy direct_mode status */ |
05499ec8c022
Initial support for fullscreen application modes.
Mike Gorchak <lestat@i.com.ua>
parents:
3386
diff
changeset
|
167 rdata->direct_mode=didata->direct_mode; |
05499ec8c022
Initial support for fullscreen application modes.
Mike Gorchak <lestat@i.com.ua>
parents:
3386
diff
changeset
|
168 |
3139 | 169 /* Set render acceleration flag in case it is accelerated */ |
170 if ((didata->caps & SDL_PHOTON_ACCELERATED) == SDL_PHOTON_ACCELERATED) { | |
171 renderer->info.flags = SDL_RENDERER_ACCELERATED; | |
172 } else { | |
3384
04af265172f9
Continue working on 2D support in Photon.
Mike Gorchak <lestat@i.com.ua>
parents:
3383
diff
changeset
|
173 renderer->info.flags = 0; |
3139 | 174 } |
3092
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
175 |
3139 | 176 /* Check if upper level requested synchronization on vsync signal */ |
177 if ((flags & SDL_RENDERER_PRESENTVSYNC) == SDL_RENDERER_PRESENTVSYNC) { | |
3387
05499ec8c022
Initial support for fullscreen application modes.
Mike Gorchak <lestat@i.com.ua>
parents:
3386
diff
changeset
|
178 if (rdata->direct_mode==SDL_TRUE) |
05499ec8c022
Initial support for fullscreen application modes.
Mike Gorchak <lestat@i.com.ua>
parents:
3386
diff
changeset
|
179 { |
05499ec8c022
Initial support for fullscreen application modes.
Mike Gorchak <lestat@i.com.ua>
parents:
3386
diff
changeset
|
180 /* We can control vsync only in direct mode */ |
05499ec8c022
Initial support for fullscreen application modes.
Mike Gorchak <lestat@i.com.ua>
parents:
3386
diff
changeset
|
181 rdata->enable_vsync = SDL_TRUE; |
05499ec8c022
Initial support for fullscreen application modes.
Mike Gorchak <lestat@i.com.ua>
parents:
3386
diff
changeset
|
182 renderer->info.flags |= SDL_RENDERER_PRESENTVSYNC; |
05499ec8c022
Initial support for fullscreen application modes.
Mike Gorchak <lestat@i.com.ua>
parents:
3386
diff
changeset
|
183 } |
05499ec8c022
Initial support for fullscreen application modes.
Mike Gorchak <lestat@i.com.ua>
parents:
3386
diff
changeset
|
184 else |
05499ec8c022
Initial support for fullscreen application modes.
Mike Gorchak <lestat@i.com.ua>
parents:
3386
diff
changeset
|
185 { |
05499ec8c022
Initial support for fullscreen application modes.
Mike Gorchak <lestat@i.com.ua>
parents:
3386
diff
changeset
|
186 rdata->enable_vsync = SDL_FALSE; |
05499ec8c022
Initial support for fullscreen application modes.
Mike Gorchak <lestat@i.com.ua>
parents:
3386
diff
changeset
|
187 } |
3139 | 188 } else { |
189 rdata->enable_vsync = SDL_FALSE; | |
190 } | |
3092
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
191 |
3139 | 192 /* Check what buffer copy/flip scheme is requested */ |
193 rdata->surfaces_count = 0; | |
194 if ((flags & SDL_RENDERER_SINGLEBUFFER) == SDL_RENDERER_SINGLEBUFFER) { | |
195 if ((flags & SDL_RENDERER_PRESENTDISCARD) == | |
196 SDL_RENDERER_PRESENTDISCARD) { | |
197 renderer->info.flags |= | |
198 SDL_RENDERER_SINGLEBUFFER | SDL_RENDERER_PRESENTDISCARD; | |
199 } else { | |
200 renderer->info.flags |= | |
201 SDL_RENDERER_SINGLEBUFFER | SDL_RENDERER_PRESENTCOPY; | |
202 } | |
203 rdata->surfaces_count = 1; | |
204 rdata->surface_visible_idx = 0; | |
205 rdata->surface_render_idx = 0; | |
206 } else { | |
207 if ((flags & SDL_RENDERER_PRESENTFLIP2) == SDL_RENDERER_PRESENTFLIP2) { | |
208 renderer->info.flags |= SDL_RENDERER_PRESENTFLIP2; | |
209 rdata->surfaces_count = 2; | |
210 rdata->surface_visible_idx = 0; | |
211 rdata->surface_render_idx = 1; | |
212 } else { | |
213 if ((flags & SDL_RENDERER_PRESENTFLIP3) == | |
214 SDL_RENDERER_PRESENTFLIP3) { | |
215 renderer->info.flags |= SDL_RENDERER_PRESENTFLIP3; | |
216 rdata->surfaces_count = 3; | |
217 rdata->surface_visible_idx = 0; | |
218 rdata->surface_render_idx = 1; | |
219 } else { | |
220 renderer->info.flags |= | |
221 SDL_RENDERER_SINGLEBUFFER | SDL_RENDERER_PRESENTCOPY; | |
222 rdata->surfaces_count = 1; | |
223 rdata->surface_visible_idx = 0; | |
224 rdata->surface_render_idx = 0; | |
225 } | |
226 } | |
227 } | |
3092
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
228 |
3384
04af265172f9
Continue working on 2D support in Photon.
Mike Gorchak <lestat@i.com.ua>
parents:
3383
diff
changeset
|
229 /* Create new graphics context for the renderer */ |
3375
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
230 if (rdata->gc==NULL) |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
231 { |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
232 rdata->gc=PgCreateGC(0); |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
233 PgDefaultGC(rdata->gc); |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
234 } |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
235 |
3383
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
236 /* Setup textures supported by current renderer instance */ |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
237 renderer->info.num_texture_formats=1; |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
238 renderer->info.texture_formats[0]=didata->current_mode.format; |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
239 |
3384
04af265172f9
Continue working on 2D support in Photon.
Mike Gorchak <lestat@i.com.ua>
parents:
3383
diff
changeset
|
240 /* Initialize surfaces */ |
04af265172f9
Continue working on 2D support in Photon.
Mike Gorchak <lestat@i.com.ua>
parents:
3383
diff
changeset
|
241 _photon_recreate_surfaces(renderer); |
04af265172f9
Continue working on 2D support in Photon.
Mike Gorchak <lestat@i.com.ua>
parents:
3383
diff
changeset
|
242 |
04af265172f9
Continue working on 2D support in Photon.
Mike Gorchak <lestat@i.com.ua>
parents:
3383
diff
changeset
|
243 /* Set current scale blitting capabilities */ |
04af265172f9
Continue working on 2D support in Photon.
Mike Gorchak <lestat@i.com.ua>
parents:
3383
diff
changeset
|
244 if (rdata->surfaces_type==SDL_PHOTON_SURFTYPE_OFFSCREEN) |
04af265172f9
Continue working on 2D support in Photon.
Mike Gorchak <lestat@i.com.ua>
parents:
3383
diff
changeset
|
245 { |
04af265172f9
Continue working on 2D support in Photon.
Mike Gorchak <lestat@i.com.ua>
parents:
3383
diff
changeset
|
246 renderer->info.scale_modes=SDL_TEXTURESCALEMODE_NONE | SDL_TEXTURESCALEMODE_SLOW; |
3386
fff074de9675
Photon SDL renderer almost finished, the double/tripple buffering is left only.
Mike Gorchak <lestat@i.com.ua>
parents:
3384
diff
changeset
|
247 if ((didata->mode_2dcaps & SDL_VIDEO_PHOTON_CAP_SCALED_BLIT)==SDL_VIDEO_PHOTON_CAP_SCALED_BLIT) |
3384
04af265172f9
Continue working on 2D support in Photon.
Mike Gorchak <lestat@i.com.ua>
parents:
3383
diff
changeset
|
248 { |
04af265172f9
Continue working on 2D support in Photon.
Mike Gorchak <lestat@i.com.ua>
parents:
3383
diff
changeset
|
249 /* This video mode supports hardware scaling */ |
04af265172f9
Continue working on 2D support in Photon.
Mike Gorchak <lestat@i.com.ua>
parents:
3383
diff
changeset
|
250 renderer->info.scale_modes|=SDL_TEXTURESCALEMODE_FAST; |
04af265172f9
Continue working on 2D support in Photon.
Mike Gorchak <lestat@i.com.ua>
parents:
3383
diff
changeset
|
251 } |
04af265172f9
Continue working on 2D support in Photon.
Mike Gorchak <lestat@i.com.ua>
parents:
3383
diff
changeset
|
252 } |
04af265172f9
Continue working on 2D support in Photon.
Mike Gorchak <lestat@i.com.ua>
parents:
3383
diff
changeset
|
253 else |
04af265172f9
Continue working on 2D support in Photon.
Mike Gorchak <lestat@i.com.ua>
parents:
3383
diff
changeset
|
254 { |
04af265172f9
Continue working on 2D support in Photon.
Mike Gorchak <lestat@i.com.ua>
parents:
3383
diff
changeset
|
255 /* PhImage blit functions do not support scaling */ |
04af265172f9
Continue working on 2D support in Photon.
Mike Gorchak <lestat@i.com.ua>
parents:
3383
diff
changeset
|
256 renderer->info.scale_modes=SDL_TEXTURESCALEMODE_NONE; |
04af265172f9
Continue working on 2D support in Photon.
Mike Gorchak <lestat@i.com.ua>
parents:
3383
diff
changeset
|
257 } |
04af265172f9
Continue working on 2D support in Photon.
Mike Gorchak <lestat@i.com.ua>
parents:
3383
diff
changeset
|
258 |
3139 | 259 return renderer; |
3092
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
260 } |
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
261 |
3139 | 262 void |
263 photon_addrenderdriver(_THIS) | |
3092
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
264 { |
3139 | 265 uint32_t it; |
3092
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
266 |
3139 | 267 for (it = 0; it < _this->num_displays; it++) { |
268 SDL_AddRenderDriver(it, &photon_renderdriver); | |
269 } | |
3092
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
270 } |
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
271 |
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
272 /****************************************************************************/ |
3375
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
273 /* Render helper functions */ |
3092
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
274 /****************************************************************************/ |
3375
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
275 |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
276 static int _photon_recreate_surfaces(SDL_Renderer * renderer) |
3092
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
277 { |
3139 | 278 SDL_RenderData *rdata = (SDL_RenderData *) renderer->driverdata; |
3375
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
279 SDL_VideoDisplay *display = NULL; |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
280 SDL_DisplayData *didata = NULL; |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
281 SDL_Window *window = NULL; |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
282 SDL_WindowData *wdata = NULL; |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
283 SDL_VideoData *phdata = NULL; |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
284 uint32_t allocate_task=SDL_PHOTON_SURFTYPE_UNKNOWN; |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
285 int32_t status; |
3092
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
286 |
3375
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
287 /* Obtain window and display structures */ |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
288 window=SDL_GetWindowFromID(renderer->window); |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
289 wdata=(SDL_WindowData*)window->driverdata; |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
290 display=SDL_GetDisplayFromWindow(window); |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
291 didata=(SDL_DisplayData *) display->driverdata; |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
292 phdata=(SDL_VideoData *) display->device->driverdata; |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
293 |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
294 /* Check if it is OpenGL ES window */ |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
295 if ((window->flags & SDL_WINDOW_OPENGL) == SDL_WINDOW_OPENGL) { |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
296 /* If so, do not waste surfaces */ |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
297 rdata->surfaces_type=SDL_PHOTON_SURFTYPE_UNKNOWN; |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
298 return 0; |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
299 } |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
300 |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
301 if (rdata->surfaces_type==SDL_PHOTON_SURFTYPE_UNKNOWN) |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
302 { |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
303 /* Try to allocate offscreen surfaces */ |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
304 allocate_task=SDL_PHOTON_SURFTYPE_OFFSCREEN; |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
305 } |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
306 else |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
307 { |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
308 uint32_t it; |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
309 |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
310 if (rdata->surfaces_type==SDL_PHOTON_SURFTYPE_OFFSCREEN) |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
311 { |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
312 /* Create offscreen surfaces */ |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
313 allocate_task=SDL_PHOTON_SURFTYPE_OFFSCREEN; |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
314 |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
315 /* Destroy current surfaces */ |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
316 for (it=0; it<SDL_PHOTON_MAX_SURFACES; it++) |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
317 { |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
318 if (rdata->osurfaces[it] != NULL) |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
319 { |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
320 PhDCRelease(rdata->osurfaces[it]); |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
321 rdata->osurfaces[it] = NULL; |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
322 } |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
323 } |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
324 } |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
325 else |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
326 { |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
327 if (rdata->surfaces_type==SDL_PHOTON_SURFTYPE_PHIMAGE) |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
328 { |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
329 /* Create shared phimage surfaces */ |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
330 allocate_task=SDL_PHOTON_SURFTYPE_PHIMAGE; |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
331 |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
332 /* Destroy current surfaces */ |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
333 for (it=0; it<SDL_PHOTON_MAX_SURFACES; it++) |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
334 { |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
335 if (rdata->pcontexts[it]!=NULL) |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
336 { |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
337 PmMemReleaseMC(rdata->pcontexts[it]); |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
338 rdata->pcontexts[it]=NULL; |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
339 } |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
340 if (rdata->psurfaces[it]!=NULL) |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
341 { |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
342 if (rdata->psurfaces[it]->palette!=NULL) |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
343 { |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
344 SDL_free(rdata->psurfaces[it]->palette); |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
345 rdata->psurfaces[it]->palette=NULL; |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
346 } |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
347 /* Destroy shared memory for PhImage_t */ |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
348 PgShmemDestroy(rdata->psurfaces[it]->image); |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
349 rdata->psurfaces[it]->image=NULL; |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
350 SDL_free(rdata->psurfaces[it]); |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
351 rdata->psurfaces[it]=NULL; |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
352 } |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
353 } |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
354 } |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
355 } |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
356 } |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
357 |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
358 /* Check if current device is not the same as target */ |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
359 if (phdata->current_device_id != didata->device_id) { |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
360 /* Set target device as default for Pd and Pg functions */ |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
361 status = PdSetTargetDevice(NULL, phdata->rid[didata->device_id]); |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
362 if (status != 0) { |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
363 SDL_SetError("Photon: Can't set default target device\n"); |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
364 return -1; |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
365 } |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
366 phdata->current_device_id = didata->device_id; |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
367 } |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
368 |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
369 switch (allocate_task) |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
370 { |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
371 case SDL_PHOTON_SURFTYPE_OFFSCREEN: |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
372 { |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
373 int32_t it; |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
374 int32_t jt; |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
375 |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
376 /* Try the hardware accelerated offscreen surfaces first */ |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
377 for (it=0; it<rdata->surfaces_count; it++) |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
378 { |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
379 rdata->osurfaces[it]=PdCreateOffscreenContext(0, window->w, window->h, |
3383
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
380 Pg_OSC_MEM_LINEAR_ACCESSIBLE | Pg_OSC_MEM_PAGE_ALIGN | |
3375
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
381 /* in case if 2D acceleration is available use it */ |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
382 Pg_OSC_MEM_2D_WRITABLE | Pg_OSC_MEM_2D_READABLE); |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
383 /* If we can't create an offscreen surface, then fallback to software */ |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
384 if (rdata->osurfaces[it]==NULL) |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
385 { |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
386 /* Destroy previously allocated surface(s) */ |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
387 for (jt = it - 1; jt > 0; jt--) |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
388 { |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
389 PhDCRelease(rdata->osurfaces[jt]); |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
390 rdata->osurfaces[jt] = NULL; |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
391 } |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
392 break; |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
393 } |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
394 } |
3092
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
395 |
3375
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
396 /* Check if all required surfaces have been created */ |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
397 if (rdata->osurfaces[0]!=NULL) |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
398 { |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
399 rdata->surfaces_type=SDL_PHOTON_SURFTYPE_OFFSCREEN; |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
400 /* exit from switch if surfaces have been created */ |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
401 break; |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
402 } |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
403 else |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
404 { |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
405 /* else fall through to software phimage surface allocation */ |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
406 } |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
407 } |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
408 /* fall through */ |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
409 case SDL_PHOTON_SURFTYPE_PHIMAGE: |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
410 { |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
411 int32_t it; |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
412 int32_t jt; |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
413 uint32_t image_pfmt=photon_sdl_to_image_pixelformat(didata->current_mode.format); |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
414 |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
415 /* Try to allocate the software surfaces in shared memory */ |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
416 for (it=0; it<rdata->surfaces_count; it++) |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
417 { |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
418 /* If this surface with palette, create a palette space */ |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
419 if (image_pfmt==Pg_IMAGE_PALETTE_BYTE) |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
420 { |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
421 rdata->psurfaces[it]=PhCreateImage(NULL, window->w, window->h, |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
422 image_pfmt, NULL, 256, 1); |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
423 } |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
424 else |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
425 { |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
426 rdata->psurfaces[it]=PhCreateImage(NULL, window->w, window->h, |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
427 image_pfmt, NULL, 0, 1); |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
428 } |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
429 |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
430 if (rdata->psurfaces[it]!=NULL) |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
431 { |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
432 PhPoint_t translation={0, 0}; |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
433 PhDim_t dimension={window->w, window->h}; |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
434 |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
435 /* Create memory context for PhImage_t */ |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
436 rdata->pcontexts[it]=PmMemCreateMC(rdata->psurfaces[it], &dimension, &translation); |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
437 } |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
438 |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
439 if ((rdata->psurfaces[it]==NULL) || (rdata->pcontexts[it]==NULL)) |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
440 { |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
441 /* Destroy previously allocated surface(s) */ |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
442 for (jt = it - 1; jt > 0; jt--) |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
443 { |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
444 if (rdata->pcontexts[jt]!=NULL) |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
445 { |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
446 PmMemReleaseMC(rdata->pcontexts[it]); |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
447 rdata->pcontexts[jt]=NULL; |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
448 } |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
449 if (rdata->psurfaces[jt]!=NULL) |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
450 { |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
451 if (rdata->psurfaces[jt]->palette!=NULL) |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
452 { |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
453 SDL_free(rdata->psurfaces[jt]->palette); |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
454 rdata->psurfaces[jt]->palette=NULL; |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
455 } |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
456 /* Destroy shared memory for PhImage_t */ |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
457 PgShmemDestroy(rdata->psurfaces[jt]->image); |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
458 rdata->psurfaces[jt]->image=NULL; |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
459 SDL_free(rdata->psurfaces[jt]); |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
460 rdata->psurfaces[jt] = NULL; |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
461 } |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
462 } |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
463 break; |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
464 } |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
465 } |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
466 |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
467 /* Check if all required surfaces have been created */ |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
468 if (rdata->psurfaces[0]!=NULL) |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
469 { |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
470 rdata->surfaces_type=SDL_PHOTON_SURFTYPE_PHIMAGE; |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
471 } |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
472 else |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
473 { |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
474 rdata->surfaces_type=SDL_PHOTON_SURFTYPE_UNKNOWN; |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
475 } |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
476 } |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
477 break; |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
478 case SDL_PHOTON_SURFTYPE_UNKNOWN: |
3383
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
479 default: |
3375
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
480 { |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
481 /* do nothing with surface allocation */ |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
482 rdata->surfaces_type=SDL_PHOTON_SURFTYPE_UNKNOWN; |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
483 } |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
484 break; |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
485 } |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
486 |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
487 /* Check if one of two allocation scheme was successful */ |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
488 if (rdata->surfaces_type==SDL_PHOTON_SURFTYPE_UNKNOWN) |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
489 { |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
490 SDL_SetError("Photon: primary surface(s) allocation failure"); |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
491 return -1; |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
492 } |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
493 |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
494 /* Store current surface dimensions */ |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
495 rdata->window_width=window->w; |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
496 rdata->window_height=window->h; |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
497 |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
498 /* If current copy/flip scheme is single buffer, then set initial parameters */ |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
499 if ((renderer->info.flags & SDL_RENDERER_SINGLEBUFFER)==SDL_RENDERER_SINGLEBUFFER) |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
500 { |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
501 rdata->surface_visible_idx = 0; |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
502 rdata->surface_render_idx = 0; |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
503 } |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
504 |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
505 /* If current copy/flip scheme is double buffer, then set initial parameters */ |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
506 if ((renderer->info.flags & SDL_RENDERER_PRESENTFLIP2)==SDL_RENDERER_PRESENTFLIP2) |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
507 { |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
508 rdata->surface_visible_idx = 0; |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
509 rdata->surface_render_idx = 1; |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
510 } |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
511 |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
512 /* If current copy/flip scheme is triple buffer, then set initial parameters */ |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
513 if ((renderer->info.flags & SDL_RENDERER_PRESENTFLIP3)==SDL_RENDERER_PRESENTFLIP3) |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
514 { |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
515 rdata->surface_visible_idx = 0; |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
516 rdata->surface_render_idx = 1; |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
517 } |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
518 |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
519 switch (rdata->surfaces_type) |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
520 { |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
521 case SDL_PHOTON_SURFTYPE_OFFSCREEN: |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
522 PgSetGCCx(rdata->osurfaces[rdata->surface_render_idx], rdata->gc); |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
523 break; |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
524 case SDL_PHOTON_SURFTYPE_PHIMAGE: |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
525 PgSetGCCx(rdata->pcontexts[rdata->surface_render_idx], rdata->gc); |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
526 break; |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
527 case SDL_PHOTON_SURFTYPE_UNKNOWN: |
3383
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
528 default: |
3375
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
529 break; |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
530 } |
3092
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
531 |
3139 | 532 return 0; |
3092
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
533 } |
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
534 |
3375
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
535 int _photon_update_rectangles(SDL_Renderer* renderer, PhRect_t* rect) |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
536 { |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
537 SDL_RenderData *rdata = (SDL_RenderData *) renderer->driverdata; |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
538 SDL_Window *window = window=SDL_GetWindowFromID(renderer->window); |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
539 SDL_WindowData *wdata = (SDL_WindowData *) window->driverdata; |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
540 PhPoint_t src_point; |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
541 |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
542 /* If currently single buffer is in use, we have to flush all data */ |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
543 if (rdata->surface_render_idx==rdata->surface_visible_idx) |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
544 { |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
545 /* Flush all undrawn graphics data to surface */ |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
546 switch (rdata->surfaces_type) |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
547 { |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
548 case SDL_PHOTON_SURFTYPE_OFFSCREEN: |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
549 PgFlushCx(rdata->osurfaces[rdata->surface_visible_idx]); |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
550 PgWaitHWIdle(); |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
551 break; |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
552 case SDL_PHOTON_SURFTYPE_PHIMAGE: |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
553 PmMemFlush(rdata->pcontexts[rdata->surface_visible_idx], rdata->psurfaces[rdata->surface_visible_idx]); |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
554 break; |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
555 case SDL_PHOTON_SURFTYPE_UNKNOWN: |
3383
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
556 default: |
3375
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
557 return; |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
558 } |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
559 } |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
560 |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
561 PgSetRegionCx(PhDCGetCurrent(), PtWidgetRid(wdata->window)); |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
562 |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
563 src_point.x = rect->ul.x; |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
564 src_point.y = rect->ul.y; |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
565 |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
566 switch (rdata->surfaces_type) |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
567 { |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
568 case SDL_PHOTON_SURFTYPE_OFFSCREEN: |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
569 PgContextBlit(rdata->osurfaces[rdata->surface_visible_idx], rect, NULL, rect); |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
570 break; |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
571 case SDL_PHOTON_SURFTYPE_PHIMAGE: |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
572 PgDrawPhImageRectv(&src_point, rdata->psurfaces[rdata->surface_visible_idx], rect, 0); |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
573 break; |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
574 case SDL_PHOTON_SURFTYPE_UNKNOWN: |
3383
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
575 default: |
3375
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
576 break; |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
577 } |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
578 } |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
579 |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
580 /****************************************************************************/ |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
581 /* SDL render interface */ |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
582 /****************************************************************************/ |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
583 |
3139 | 584 static int |
585 photon_activaterenderer(SDL_Renderer * renderer) | |
3092
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
586 { |
3375
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
587 SDL_RenderData *rdata = (SDL_RenderData *) renderer->driverdata; |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
588 SDL_Window *window = SDL_GetWindowFromID(renderer->window); |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
589 SDL_WindowData *wdata = (SDL_WindowData *)window->driverdata; |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
590 |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
591 if ((rdata->window_width!=window->w) || (rdata->window_height!=window->h)) |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
592 { |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
593 return _photon_recreate_surfaces(renderer); |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
594 } |
3092
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
595 |
3375
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
596 switch (rdata->surfaces_type) |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
597 { |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
598 case SDL_PHOTON_SURFTYPE_OFFSCREEN: |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
599 PgSetGCCx(rdata->osurfaces[rdata->surface_render_idx], rdata->gc); |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
600 break; |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
601 case SDL_PHOTON_SURFTYPE_PHIMAGE: |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
602 PgSetGCCx(rdata->pcontexts[rdata->surface_render_idx], rdata->gc); |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
603 break; |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
604 case SDL_PHOTON_SURFTYPE_UNKNOWN: |
3383
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
605 default: |
3375
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
606 break; |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
607 } |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
608 |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
609 return 0; |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
610 } |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
611 |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
612 static int |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
613 photon_displaymodechanged(SDL_Renderer * renderer) |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
614 { |
3387
05499ec8c022
Initial support for fullscreen application modes.
Mike Gorchak <lestat@i.com.ua>
parents:
3386
diff
changeset
|
615 SDL_RenderData *rdata = (SDL_RenderData *) renderer->driverdata; |
05499ec8c022
Initial support for fullscreen application modes.
Mike Gorchak <lestat@i.com.ua>
parents:
3386
diff
changeset
|
616 SDL_Window *window = SDL_GetWindowFromID(renderer->window); |
05499ec8c022
Initial support for fullscreen application modes.
Mike Gorchak <lestat@i.com.ua>
parents:
3386
diff
changeset
|
617 SDL_VideoDisplay *display = SDL_GetDisplayFromWindow(window); |
05499ec8c022
Initial support for fullscreen application modes.
Mike Gorchak <lestat@i.com.ua>
parents:
3386
diff
changeset
|
618 SDL_DisplayData *didata = (SDL_DisplayData *) display->driverdata; |
05499ec8c022
Initial support for fullscreen application modes.
Mike Gorchak <lestat@i.com.ua>
parents:
3386
diff
changeset
|
619 |
05499ec8c022
Initial support for fullscreen application modes.
Mike Gorchak <lestat@i.com.ua>
parents:
3386
diff
changeset
|
620 /* Copy direct_mode status */ |
05499ec8c022
Initial support for fullscreen application modes.
Mike Gorchak <lestat@i.com.ua>
parents:
3386
diff
changeset
|
621 rdata->direct_mode=didata->direct_mode; |
05499ec8c022
Initial support for fullscreen application modes.
Mike Gorchak <lestat@i.com.ua>
parents:
3386
diff
changeset
|
622 |
05499ec8c022
Initial support for fullscreen application modes.
Mike Gorchak <lestat@i.com.ua>
parents:
3386
diff
changeset
|
623 /* Update the surfaces */ |
3375
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
624 return _photon_recreate_surfaces(renderer); |
3092
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
625 } |
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
626 |
3139 | 627 static int |
628 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
|
629 { |
3383
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
630 SDL_RenderData *rdata = (SDL_RenderData *) renderer->driverdata; |
3139 | 631 SDL_Window *window = SDL_GetWindowFromID(renderer->window); |
632 SDL_VideoDisplay *display = SDL_GetDisplayFromWindow(window); | |
3383
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
633 SDL_DisplayData *didata = (SDL_DisplayData *) display->driverdata; |
3139 | 634 SDL_TextureData *tdata = NULL; |
3383
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
635 uint32_t it; |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
636 |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
637 /* Check, if it is not initialized */ |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
638 if (rdata->surfaces_type==SDL_PHOTON_SURFTYPE_UNKNOWN) |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
639 { |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
640 SDL_SetError("Photon: can't create texture for OpenGL ES window"); |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
641 return -1; |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
642 } |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
643 |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
644 /* Check if requested texture format is supported */ |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
645 for (it=0; it<renderer->info.num_texture_formats; it++) |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
646 { |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
647 if (renderer->info.texture_formats[it]==texture->format) |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
648 { |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
649 break; |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
650 } |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
651 } |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
652 if (it==renderer->info.num_texture_formats) |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
653 { |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
654 SDL_SetError("Photon: requested texture format is not supported"); |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
655 return -1; |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
656 } |
3092
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
657 |
3139 | 658 /* Allocate texture driver data */ |
659 tdata = (SDL_TextureData *) SDL_calloc(1, sizeof(SDL_TextureData)); | |
660 if (tdata == NULL) { | |
661 SDL_OutOfMemory(); | |
662 return -1; | |
663 } | |
3092
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
664 |
3139 | 665 /* Set texture driver data */ |
666 texture->driverdata = tdata; | |
3383
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
667 |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
668 /* Try offscreen allocation only in case if displayable buffers are also offscreen */ |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
669 if (rdata->surfaces_type==SDL_PHOTON_SURFTYPE_OFFSCREEN) |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
670 { |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
671 /* Try to allocate offscreen memory first */ |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
672 tdata->osurface=PdCreateOffscreenContext(0, texture->w, texture->h, |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
673 Pg_OSC_MEM_LINEAR_ACCESSIBLE | Pg_OSC_MEM_PAGE_ALIGN | |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
674 /* in case if 2D acceleration is available use it */ |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
675 Pg_OSC_MEM_2D_WRITABLE | Pg_OSC_MEM_2D_READABLE); |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
676 } |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
677 |
3384
04af265172f9
Continue working on 2D support in Photon.
Mike Gorchak <lestat@i.com.ua>
parents:
3383
diff
changeset
|
678 /* Check if offscreen allocation has been failed or not performed */ |
3383
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
679 if (tdata->osurface==NULL) |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
680 { |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
681 PhPoint_t translation={0, 0}; |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
682 PhDim_t dimension={texture->w, texture->h}; |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
683 uint32_t image_pfmt=photon_sdl_to_image_pixelformat(didata->current_mode.format); |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
684 |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
685 /* Allocate photon image */ |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
686 if (image_pfmt==Pg_IMAGE_PALETTE_BYTE) |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
687 { |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
688 tdata->psurface=PhCreateImage(NULL, texture->w, texture->h, |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
689 image_pfmt, NULL, 256, 1); |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
690 } |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
691 else |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
692 { |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
693 tdata->psurface=PhCreateImage(NULL, texture->w, texture->h, |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
694 image_pfmt, NULL, 0, 1); |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
695 } |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
696 |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
697 if (tdata->psurface==NULL) |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
698 { |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
699 return -1; |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
700 } |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
701 |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
702 /* Create memory context for PhImage_t */ |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
703 tdata->pcontext=PmMemCreateMC(tdata->psurface, &dimension, &translation); |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
704 if (tdata->pcontext==NULL) |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
705 { |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
706 /* Destroy PhImage */ |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
707 if (tdata->psurface!=NULL) |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
708 { |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
709 if (tdata->psurface->palette!=NULL) |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
710 { |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
711 SDL_free(tdata->psurface->palette); |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
712 tdata->psurface->palette=NULL; |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
713 } |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
714 /* Destroy shared memory for PhImage_t */ |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
715 PgShmemDestroy(tdata->psurface->image); |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
716 tdata->psurface->image=NULL; |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
717 SDL_free(tdata->psurface); |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
718 tdata->psurface=NULL; |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
719 } |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
720 } |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
721 tdata->surface_type=SDL_PHOTON_SURFTYPE_PHIMAGE; |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
722 } |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
723 else |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
724 { |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
725 tdata->surface_type=SDL_PHOTON_SURFTYPE_OFFSCREEN; |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
726 } |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
727 |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
728 return 0; |
3092
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
729 } |
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
730 |
3139 | 731 static int |
732 photon_querytexturepixels(SDL_Renderer * renderer, SDL_Texture * texture, | |
733 void **pixels, int *pitch) | |
734 { | |
3383
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
735 SDL_RenderData *rdata = (SDL_RenderData *) renderer->driverdata; |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
736 SDL_TextureData* tdata=(SDL_TextureData*)texture->driverdata; |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
737 |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
738 /* Check, if it is not initialized */ |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
739 if (rdata->surfaces_type==SDL_PHOTON_SURFTYPE_UNKNOWN) |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
740 { |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
741 SDL_SetError("Photon: can't query texture pixels for OpenGL ES window"); |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
742 return -1; |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
743 } |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
744 |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
745 /* Clear outcoming parameters */ |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
746 *pixels=NULL; |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
747 *pitch=0; |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
748 |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
749 switch (tdata->surface_type) |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
750 { |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
751 case SDL_PHOTON_SURFTYPE_OFFSCREEN: |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
752 *pixels=(void*)PdGetOffscreenContextPtr(tdata->osurface); |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
753 *pitch=tdata->osurface->pitch; |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
754 break; |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
755 case SDL_PHOTON_SURFTYPE_PHIMAGE: |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
756 *pixels=(void*)tdata->psurface->image; |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
757 *pitch=tdata->psurface->bpl; |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
758 break; |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
759 default: |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
760 break; |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
761 } |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
762 |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
763 return 0; |
3139 | 764 } |
765 | |
766 static int | |
767 photon_settexturepalette(SDL_Renderer * renderer, SDL_Texture * texture, | |
768 const SDL_Color * colors, int firstcolor, | |
769 int ncolors) | |
3092
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
770 { |
3383
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
771 SDL_RenderData *rdata = (SDL_RenderData *) renderer->driverdata; |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
772 SDL_TextureData* tdata=(SDL_TextureData*)texture->driverdata; |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
773 |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
774 /* Check, if it is not initialized */ |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
775 if (rdata->surfaces_type==SDL_PHOTON_SURFTYPE_UNKNOWN) |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
776 { |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
777 SDL_SetError("Photon: can't set texture palette for OpenGL ES window"); |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
778 return -1; |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
779 } |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
780 |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
781 if (texture->format!=SDL_PIXELFORMAT_INDEX8) |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
782 { |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
783 SDL_SetError("Photon: can't set palette for non-paletted texture"); |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
784 return -1; |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
785 } |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
786 |
3386
fff074de9675
Photon SDL renderer almost finished, the double/tripple buffering is left only.
Mike Gorchak <lestat@i.com.ua>
parents:
3384
diff
changeset
|
787 SDL_Unsupported(); |
3383
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
788 return -1; |
3092
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
789 } |
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
790 |
3139 | 791 static int |
792 photon_gettexturepalette(SDL_Renderer * renderer, SDL_Texture * texture, | |
793 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
|
794 { |
3383
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
795 SDL_RenderData *rdata = (SDL_RenderData *) renderer->driverdata; |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
796 SDL_TextureData* tdata=(SDL_TextureData*)texture->driverdata; |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
797 |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
798 /* Check, if it is not initialized */ |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
799 if (rdata->surfaces_type==SDL_PHOTON_SURFTYPE_UNKNOWN) |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
800 { |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
801 SDL_SetError("Photon: can't return texture palette for OpenGL ES window"); |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
802 return -1; |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
803 } |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
804 |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
805 if (texture->format!=SDL_PIXELFORMAT_INDEX8) |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
806 { |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
807 SDL_SetError("Photon: can't return palette for non-paletted texture"); |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
808 return -1; |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
809 } |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
810 |
3386
fff074de9675
Photon SDL renderer almost finished, the double/tripple buffering is left only.
Mike Gorchak <lestat@i.com.ua>
parents:
3384
diff
changeset
|
811 SDL_Unsupported(); |
3383
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
812 return -1; |
3092
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
813 } |
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
814 |
3139 | 815 static int |
816 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
|
817 { |
3386
fff074de9675
Photon SDL renderer almost finished, the double/tripple buffering is left only.
Mike Gorchak <lestat@i.com.ua>
parents:
3384
diff
changeset
|
818 SDL_Unsupported(); |
3383
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
819 return -1; |
3092
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
820 } |
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
821 |
3139 | 822 static int |
823 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
|
824 { |
3386
fff074de9675
Photon SDL renderer almost finished, the double/tripple buffering is left only.
Mike Gorchak <lestat@i.com.ua>
parents:
3384
diff
changeset
|
825 SDL_RenderData *rdata = (SDL_RenderData *) renderer->driverdata; |
fff074de9675
Photon SDL renderer almost finished, the double/tripple buffering is left only.
Mike Gorchak <lestat@i.com.ua>
parents:
3384
diff
changeset
|
826 |
fff074de9675
Photon SDL renderer almost finished, the double/tripple buffering is left only.
Mike Gorchak <lestat@i.com.ua>
parents:
3384
diff
changeset
|
827 /* Check, if it is not initialized */ |
fff074de9675
Photon SDL renderer almost finished, the double/tripple buffering is left only.
Mike Gorchak <lestat@i.com.ua>
parents:
3384
diff
changeset
|
828 if (rdata->surfaces_type==SDL_PHOTON_SURFTYPE_UNKNOWN) |
fff074de9675
Photon SDL renderer almost finished, the double/tripple buffering is left only.
Mike Gorchak <lestat@i.com.ua>
parents:
3384
diff
changeset
|
829 { |
fff074de9675
Photon SDL renderer almost finished, the double/tripple buffering is left only.
Mike Gorchak <lestat@i.com.ua>
parents:
3384
diff
changeset
|
830 SDL_SetError("Photon: can't set texture blend mode for OpenGL ES window"); |
fff074de9675
Photon SDL renderer almost finished, the double/tripple buffering is left only.
Mike Gorchak <lestat@i.com.ua>
parents:
3384
diff
changeset
|
831 return -1; |
fff074de9675
Photon SDL renderer almost finished, the double/tripple buffering is left only.
Mike Gorchak <lestat@i.com.ua>
parents:
3384
diff
changeset
|
832 } |
fff074de9675
Photon SDL renderer almost finished, the double/tripple buffering is left only.
Mike Gorchak <lestat@i.com.ua>
parents:
3384
diff
changeset
|
833 |
fff074de9675
Photon SDL renderer almost finished, the double/tripple buffering is left only.
Mike Gorchak <lestat@i.com.ua>
parents:
3384
diff
changeset
|
834 /* Check if current renderer instance supports alpha modulation */ |
fff074de9675
Photon SDL renderer almost finished, the double/tripple buffering is left only.
Mike Gorchak <lestat@i.com.ua>
parents:
3384
diff
changeset
|
835 if ((renderer->info.mod_modes & SDL_TEXTUREMODULATE_ALPHA)!=SDL_TEXTUREMODULATE_ALPHA) |
fff074de9675
Photon SDL renderer almost finished, the double/tripple buffering is left only.
Mike Gorchak <lestat@i.com.ua>
parents:
3384
diff
changeset
|
836 { |
fff074de9675
Photon SDL renderer almost finished, the double/tripple buffering is left only.
Mike Gorchak <lestat@i.com.ua>
parents:
3384
diff
changeset
|
837 SDL_Unsupported(); |
fff074de9675
Photon SDL renderer almost finished, the double/tripple buffering is left only.
Mike Gorchak <lestat@i.com.ua>
parents:
3384
diff
changeset
|
838 return -1; |
fff074de9675
Photon SDL renderer almost finished, the double/tripple buffering is left only.
Mike Gorchak <lestat@i.com.ua>
parents:
3384
diff
changeset
|
839 } |
fff074de9675
Photon SDL renderer almost finished, the double/tripple buffering is left only.
Mike Gorchak <lestat@i.com.ua>
parents:
3384
diff
changeset
|
840 |
fff074de9675
Photon SDL renderer almost finished, the double/tripple buffering is left only.
Mike Gorchak <lestat@i.com.ua>
parents:
3384
diff
changeset
|
841 return 0; |
3092
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
842 } |
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
843 |
3139 | 844 static int |
845 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
|
846 { |
3383
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
847 SDL_RenderData *rdata = (SDL_RenderData *) renderer->driverdata; |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
848 |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
849 /* Check, if it is not initialized */ |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
850 if (rdata->surfaces_type==SDL_PHOTON_SURFTYPE_UNKNOWN) |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
851 { |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
852 SDL_SetError("Photon: can't set texture blend mode for OpenGL ES window"); |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
853 return -1; |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
854 } |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
855 |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
856 switch (texture->blendMode) |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
857 { |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
858 case SDL_BLENDMODE_NONE: |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
859 case SDL_BLENDMODE_MASK: |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
860 case SDL_BLENDMODE_BLEND: |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
861 case SDL_BLENDMODE_ADD: |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
862 case SDL_BLENDMODE_MOD: |
3386
fff074de9675
Photon SDL renderer almost finished, the double/tripple buffering is left only.
Mike Gorchak <lestat@i.com.ua>
parents:
3384
diff
changeset
|
863 return 0; |
3383
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
864 default: |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
865 SDL_Unsupported(); |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
866 texture->blendMode = SDL_BLENDMODE_NONE; |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
867 return -1; |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
868 } |
3092
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
869 } |
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
870 |
3139 | 871 static int |
872 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
|
873 { |
3384
04af265172f9
Continue working on 2D support in Photon.
Mike Gorchak <lestat@i.com.ua>
parents:
3383
diff
changeset
|
874 SDL_RenderData *rdata = (SDL_RenderData *) renderer->driverdata; |
04af265172f9
Continue working on 2D support in Photon.
Mike Gorchak <lestat@i.com.ua>
parents:
3383
diff
changeset
|
875 |
04af265172f9
Continue working on 2D support in Photon.
Mike Gorchak <lestat@i.com.ua>
parents:
3383
diff
changeset
|
876 switch (texture->scaleMode) |
04af265172f9
Continue working on 2D support in Photon.
Mike Gorchak <lestat@i.com.ua>
parents:
3383
diff
changeset
|
877 { |
04af265172f9
Continue working on 2D support in Photon.
Mike Gorchak <lestat@i.com.ua>
parents:
3383
diff
changeset
|
878 case SDL_TEXTURESCALEMODE_NONE: |
04af265172f9
Continue working on 2D support in Photon.
Mike Gorchak <lestat@i.com.ua>
parents:
3383
diff
changeset
|
879 return 0; |
04af265172f9
Continue working on 2D support in Photon.
Mike Gorchak <lestat@i.com.ua>
parents:
3383
diff
changeset
|
880 case SDL_TEXTURESCALEMODE_FAST: |
04af265172f9
Continue working on 2D support in Photon.
Mike Gorchak <lestat@i.com.ua>
parents:
3383
diff
changeset
|
881 if ((renderer->info.scale_modes & SDL_TEXTURESCALEMODE_FAST)==SDL_TEXTURESCALEMODE_FAST) |
04af265172f9
Continue working on 2D support in Photon.
Mike Gorchak <lestat@i.com.ua>
parents:
3383
diff
changeset
|
882 { |
04af265172f9
Continue working on 2D support in Photon.
Mike Gorchak <lestat@i.com.ua>
parents:
3383
diff
changeset
|
883 return 0; |
04af265172f9
Continue working on 2D support in Photon.
Mike Gorchak <lestat@i.com.ua>
parents:
3383
diff
changeset
|
884 } |
04af265172f9
Continue working on 2D support in Photon.
Mike Gorchak <lestat@i.com.ua>
parents:
3383
diff
changeset
|
885 else |
04af265172f9
Continue working on 2D support in Photon.
Mike Gorchak <lestat@i.com.ua>
parents:
3383
diff
changeset
|
886 { |
04af265172f9
Continue working on 2D support in Photon.
Mike Gorchak <lestat@i.com.ua>
parents:
3383
diff
changeset
|
887 SDL_Unsupported(); |
04af265172f9
Continue working on 2D support in Photon.
Mike Gorchak <lestat@i.com.ua>
parents:
3383
diff
changeset
|
888 texture->scaleMode = SDL_TEXTURESCALEMODE_FAST; |
04af265172f9
Continue working on 2D support in Photon.
Mike Gorchak <lestat@i.com.ua>
parents:
3383
diff
changeset
|
889 return -1; |
04af265172f9
Continue working on 2D support in Photon.
Mike Gorchak <lestat@i.com.ua>
parents:
3383
diff
changeset
|
890 } |
04af265172f9
Continue working on 2D support in Photon.
Mike Gorchak <lestat@i.com.ua>
parents:
3383
diff
changeset
|
891 break; |
04af265172f9
Continue working on 2D support in Photon.
Mike Gorchak <lestat@i.com.ua>
parents:
3383
diff
changeset
|
892 case SDL_TEXTURESCALEMODE_SLOW: |
04af265172f9
Continue working on 2D support in Photon.
Mike Gorchak <lestat@i.com.ua>
parents:
3383
diff
changeset
|
893 if ((renderer->info.scale_modes & SDL_TEXTURESCALEMODE_SLOW)==SDL_TEXTURESCALEMODE_SLOW) |
04af265172f9
Continue working on 2D support in Photon.
Mike Gorchak <lestat@i.com.ua>
parents:
3383
diff
changeset
|
894 { |
04af265172f9
Continue working on 2D support in Photon.
Mike Gorchak <lestat@i.com.ua>
parents:
3383
diff
changeset
|
895 return 0; |
04af265172f9
Continue working on 2D support in Photon.
Mike Gorchak <lestat@i.com.ua>
parents:
3383
diff
changeset
|
896 } |
04af265172f9
Continue working on 2D support in Photon.
Mike Gorchak <lestat@i.com.ua>
parents:
3383
diff
changeset
|
897 else |
04af265172f9
Continue working on 2D support in Photon.
Mike Gorchak <lestat@i.com.ua>
parents:
3383
diff
changeset
|
898 { |
04af265172f9
Continue working on 2D support in Photon.
Mike Gorchak <lestat@i.com.ua>
parents:
3383
diff
changeset
|
899 SDL_Unsupported(); |
04af265172f9
Continue working on 2D support in Photon.
Mike Gorchak <lestat@i.com.ua>
parents:
3383
diff
changeset
|
900 texture->scaleMode = SDL_TEXTURESCALEMODE_SLOW; |
04af265172f9
Continue working on 2D support in Photon.
Mike Gorchak <lestat@i.com.ua>
parents:
3383
diff
changeset
|
901 return -1; |
04af265172f9
Continue working on 2D support in Photon.
Mike Gorchak <lestat@i.com.ua>
parents:
3383
diff
changeset
|
902 } |
04af265172f9
Continue working on 2D support in Photon.
Mike Gorchak <lestat@i.com.ua>
parents:
3383
diff
changeset
|
903 break; |
04af265172f9
Continue working on 2D support in Photon.
Mike Gorchak <lestat@i.com.ua>
parents:
3383
diff
changeset
|
904 case SDL_TEXTURESCALEMODE_BEST: |
04af265172f9
Continue working on 2D support in Photon.
Mike Gorchak <lestat@i.com.ua>
parents:
3383
diff
changeset
|
905 SDL_Unsupported(); |
04af265172f9
Continue working on 2D support in Photon.
Mike Gorchak <lestat@i.com.ua>
parents:
3383
diff
changeset
|
906 texture->scaleMode = SDL_TEXTURESCALEMODE_SLOW; |
04af265172f9
Continue working on 2D support in Photon.
Mike Gorchak <lestat@i.com.ua>
parents:
3383
diff
changeset
|
907 return -1; |
04af265172f9
Continue working on 2D support in Photon.
Mike Gorchak <lestat@i.com.ua>
parents:
3383
diff
changeset
|
908 default: |
04af265172f9
Continue working on 2D support in Photon.
Mike Gorchak <lestat@i.com.ua>
parents:
3383
diff
changeset
|
909 SDL_Unsupported(); |
04af265172f9
Continue working on 2D support in Photon.
Mike Gorchak <lestat@i.com.ua>
parents:
3383
diff
changeset
|
910 texture->scaleMode = SDL_TEXTURESCALEMODE_NONE; |
04af265172f9
Continue working on 2D support in Photon.
Mike Gorchak <lestat@i.com.ua>
parents:
3383
diff
changeset
|
911 return -1; |
04af265172f9
Continue working on 2D support in Photon.
Mike Gorchak <lestat@i.com.ua>
parents:
3383
diff
changeset
|
912 } |
04af265172f9
Continue working on 2D support in Photon.
Mike Gorchak <lestat@i.com.ua>
parents:
3383
diff
changeset
|
913 |
3386
fff074de9675
Photon SDL renderer almost finished, the double/tripple buffering is left only.
Mike Gorchak <lestat@i.com.ua>
parents:
3384
diff
changeset
|
914 SDL_Unsupported(); |
3383
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
915 return -1; |
3092
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
916 } |
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
917 |
3139 | 918 static int |
919 photon_updatetexture(SDL_Renderer * renderer, SDL_Texture * texture, | |
920 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
|
921 { |
3383
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
922 SDL_RenderData *rdata = (SDL_RenderData *) renderer->driverdata; |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
923 SDL_TextureData* tdata=(SDL_TextureData*)texture->driverdata; |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
924 |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
925 uint8_t* src=(uint8_t*)pixels; |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
926 uint8_t* dst; |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
927 uint32_t dst_pitch; |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
928 uint32_t it; |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
929 uint32_t copy_length; |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
930 |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
931 /* Check, if it is not initialized */ |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
932 if (rdata->surfaces_type==SDL_PHOTON_SURFTYPE_UNKNOWN) |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
933 { |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
934 SDL_SetError("Photon: can't update texture for OpenGL ES window"); |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
935 return -1; |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
936 } |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
937 |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
938 switch (tdata->surface_type) |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
939 { |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
940 case SDL_PHOTON_SURFTYPE_OFFSCREEN: |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
941 dst=(uint8_t*)PdGetOffscreenContextPtr(tdata->osurface); |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
942 dst_pitch=tdata->osurface->pitch; |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
943 if (dst==NULL) |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
944 { |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
945 SDL_SetError("Photon: can't get pointer to texture surface"); |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
946 return -1; |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
947 } |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
948 break; |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
949 case SDL_PHOTON_SURFTYPE_PHIMAGE: |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
950 dst=(uint8_t*)tdata->psurface->image; |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
951 dst_pitch=tdata->psurface->bpl; |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
952 if (dst==NULL) |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
953 { |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
954 SDL_SetError("Photon: can't get pointer to texture surface"); |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
955 return -1; |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
956 } |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
957 break; |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
958 default: |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
959 SDL_SetError("Photon: invalid internal surface type"); |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
960 return -1; |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
961 } |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
962 |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
963 dst+=rect->y * dst_pitch + rect->x * SDL_BYTESPERPIXEL(texture->format); |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
964 copy_length=rect->w * SDL_BYTESPERPIXEL(texture->format); |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
965 for (it = 0; it < rect->h; it++) |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
966 { |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
967 SDL_memcpy(dst, src, copy_length); |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
968 src+=pitch; |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
969 dst+=dst_pitch; |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
970 } |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
971 |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
972 return 0; |
3092
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
973 } |
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
974 |
3139 | 975 static int |
976 photon_locktexture(SDL_Renderer * renderer, SDL_Texture * texture, | |
977 const SDL_Rect * rect, int markDirty, void **pixels, | |
978 int *pitch) | |
3092
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
979 { |
3383
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
980 SDL_RenderData *rdata = (SDL_RenderData *) renderer->driverdata; |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
981 SDL_TextureData* tdata=(SDL_TextureData*)texture->driverdata; |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
982 |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
983 /* Check, if it is not initialized */ |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
984 if (rdata->surfaces_type==SDL_PHOTON_SURFTYPE_UNKNOWN) |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
985 { |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
986 SDL_SetError("Photon: can't lock texture for OpenGL ES window"); |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
987 return -1; |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
988 } |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
989 |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
990 /* Clear outcoming parameters */ |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
991 *pixels=NULL; |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
992 *pitch=0; |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
993 |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
994 switch (tdata->surface_type) |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
995 { |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
996 case SDL_PHOTON_SURFTYPE_OFFSCREEN: |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
997 *pixels=(void*)((uint8_t*)PdGetOffscreenContextPtr(tdata->osurface) + |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
998 rect->y * tdata->osurface->pitch + |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
999 rect->x * SDL_BYTESPERPIXEL(texture->format)); |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1000 *pitch=tdata->osurface->pitch; |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1001 break; |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1002 case SDL_PHOTON_SURFTYPE_PHIMAGE: |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1003 *pixels=(void*)((uint8_t*)tdata->psurface->image + |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1004 rect->y * tdata->osurface->pitch + |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1005 rect->x * SDL_BYTESPERPIXEL(texture->format)); |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1006 *pitch=tdata->psurface->bpl; |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1007 break; |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1008 default: |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1009 break; |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1010 } |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1011 |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1012 return 0; |
3092
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1013 } |
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1014 |
3139 | 1015 static void |
1016 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
|
1017 { |
3383
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1018 SDL_RenderData *rdata = (SDL_RenderData *) renderer->driverdata; |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1019 |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1020 /* Check, if it is not initialized */ |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1021 if (rdata->surfaces_type==SDL_PHOTON_SURFTYPE_UNKNOWN) |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1022 { |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1023 SDL_SetError("Photon: can't unlock texture for OpenGL ES window"); |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1024 return; |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1025 } |
3092
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1026 } |
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1027 |
3139 | 1028 static void |
1029 photon_dirtytexture(SDL_Renderer * renderer, SDL_Texture * texture, | |
1030 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
|
1031 { |
3386
fff074de9675
Photon SDL renderer almost finished, the double/tripple buffering is left only.
Mike Gorchak <lestat@i.com.ua>
parents:
3384
diff
changeset
|
1032 SDL_RenderData *rdata = (SDL_RenderData *) renderer->driverdata; |
fff074de9675
Photon SDL renderer almost finished, the double/tripple buffering is left only.
Mike Gorchak <lestat@i.com.ua>
parents:
3384
diff
changeset
|
1033 |
3384
04af265172f9
Continue working on 2D support in Photon.
Mike Gorchak <lestat@i.com.ua>
parents:
3383
diff
changeset
|
1034 /* Check, if it is not initialized */ |
04af265172f9
Continue working on 2D support in Photon.
Mike Gorchak <lestat@i.com.ua>
parents:
3383
diff
changeset
|
1035 if (rdata->surfaces_type==SDL_PHOTON_SURFTYPE_UNKNOWN) |
04af265172f9
Continue working on 2D support in Photon.
Mike Gorchak <lestat@i.com.ua>
parents:
3383
diff
changeset
|
1036 { |
04af265172f9
Continue working on 2D support in Photon.
Mike Gorchak <lestat@i.com.ua>
parents:
3383
diff
changeset
|
1037 SDL_SetError("Photon: can't update dirty texture for OpenGL ES window"); |
04af265172f9
Continue working on 2D support in Photon.
Mike Gorchak <lestat@i.com.ua>
parents:
3383
diff
changeset
|
1038 return; |
04af265172f9
Continue working on 2D support in Photon.
Mike Gorchak <lestat@i.com.ua>
parents:
3383
diff
changeset
|
1039 } |
3092
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1040 } |
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1041 |
3139 | 1042 static int |
3375
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
1043 photon_setdrawcolor(SDL_Renderer * renderer) |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
1044 { |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
1045 SDL_RenderData *rdata = (SDL_RenderData *) renderer->driverdata; |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
1046 |
3383
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1047 /* Check, if it is not initialized */ |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1048 if (rdata->surfaces_type==SDL_PHOTON_SURFTYPE_UNKNOWN) |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1049 { |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1050 SDL_SetError("Photon: can't set draw color for OpenGL ES window"); |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1051 return -1; |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1052 } |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1053 |
3375
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
1054 switch (rdata->surfaces_type) |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
1055 { |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
1056 case SDL_PHOTON_SURFTYPE_OFFSCREEN: |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
1057 case SDL_PHOTON_SURFTYPE_PHIMAGE: |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
1058 PgSetFillColorCx(rdata->gc, PgRGB(renderer->r, renderer->g, renderer->b)); |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
1059 PgSetStrokeColorCx(rdata->gc, PgRGB(renderer->r, renderer->g, renderer->b)); |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
1060 break; |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
1061 case SDL_PHOTON_SURFTYPE_UNKNOWN: |
3383
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1062 default: |
3375
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
1063 break; |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
1064 } |
3383
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1065 |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1066 return 0; |
3375
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
1067 } |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
1068 |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
1069 static int |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
1070 photon_setdrawblendmode(SDL_Renderer * renderer) |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
1071 { |
3383
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1072 /* TODO */ |
3386
fff074de9675
Photon SDL renderer almost finished, the double/tripple buffering is left only.
Mike Gorchak <lestat@i.com.ua>
parents:
3384
diff
changeset
|
1073 SDL_Unsupported(); |
3383
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1074 return -1; |
3375
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
1075 } |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
1076 |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
1077 static int |
3139 | 1078 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
|
1079 { |
3375
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
1080 SDL_RenderData *rdata = (SDL_RenderData *) renderer->driverdata; |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
1081 |
3383
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1082 /* Check, if it is not initialized */ |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1083 if (rdata->surfaces_type==SDL_PHOTON_SURFTYPE_UNKNOWN) |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1084 { |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1085 SDL_SetError("Photon: can't render point in OpenGL ES window"); |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1086 return -1; |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1087 } |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1088 |
3375
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
1089 switch (rdata->surfaces_type) |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
1090 { |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
1091 case SDL_PHOTON_SURFTYPE_OFFSCREEN: |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
1092 PgDrawIPixelCx(rdata->osurfaces[rdata->surface_render_idx], x, y); |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
1093 break; |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
1094 case SDL_PHOTON_SURFTYPE_PHIMAGE: |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
1095 PgDrawIPixelCx(rdata->pcontexts[rdata->surface_render_idx], x, y); |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
1096 break; |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
1097 case SDL_PHOTON_SURFTYPE_UNKNOWN: |
3383
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1098 default: |
3375
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
1099 break; |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
1100 } |
3383
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1101 |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1102 return 0; |
3092
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1103 } |
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1104 |
3139 | 1105 static int |
1106 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
|
1107 { |
3375
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
1108 SDL_RenderData *rdata = (SDL_RenderData *) renderer->driverdata; |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
1109 |
3383
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1110 /* Check, if it is not initialized */ |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1111 if (rdata->surfaces_type==SDL_PHOTON_SURFTYPE_UNKNOWN) |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1112 { |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1113 SDL_SetError("Photon: can't render line in OpenGL ES window"); |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1114 return -1; |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1115 } |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1116 |
3375
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
1117 switch (rdata->surfaces_type) |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
1118 { |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
1119 case SDL_PHOTON_SURFTYPE_OFFSCREEN: |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
1120 PgDrawILineCx(rdata->osurfaces[rdata->surface_render_idx], x1, y1, x2, y2); |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
1121 break; |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
1122 case SDL_PHOTON_SURFTYPE_PHIMAGE: |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
1123 PgDrawILineCx(rdata->pcontexts[rdata->surface_render_idx], x1, y1, x2, y2); |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
1124 break; |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
1125 case SDL_PHOTON_SURFTYPE_UNKNOWN: |
3383
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1126 default: |
3375
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
1127 break; |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
1128 } |
3383
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1129 |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1130 return 0; |
3092
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1131 } |
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1132 |
3139 | 1133 static int |
1134 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
|
1135 { |
3375
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
1136 SDL_RenderData *rdata = (SDL_RenderData *) renderer->driverdata; |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
1137 |
3383
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1138 /* Check, if it is not initialized */ |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1139 if (rdata->surfaces_type==SDL_PHOTON_SURFTYPE_UNKNOWN) |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1140 { |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1141 SDL_SetError("Photon: can't render filled box in OpenGL ES window"); |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1142 return -1; |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1143 } |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1144 |
3375
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
1145 switch (rdata->surfaces_type) |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
1146 { |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
1147 case SDL_PHOTON_SURFTYPE_OFFSCREEN: |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
1148 PgDrawIRectCx(rdata->osurfaces[rdata->surface_render_idx], rect->x, rect->y, rect->w+rect->x-1, rect->h+rect->y-1, Pg_DRAW_FILL); |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
1149 break; |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
1150 case SDL_PHOTON_SURFTYPE_PHIMAGE: |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
1151 PgDrawIRectCx(rdata->pcontexts[rdata->surface_render_idx], rect->x, rect->y, rect->w+rect->x-1, rect->h+rect->y-1, Pg_DRAW_FILL); |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
1152 break; |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
1153 case SDL_PHOTON_SURFTYPE_UNKNOWN: |
3383
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1154 default: |
3375
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
1155 break; |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
1156 } |
3092
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1157 } |
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1158 |
3139 | 1159 static int |
1160 photon_rendercopy(SDL_Renderer * renderer, SDL_Texture * texture, | |
1161 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
|
1162 { |
3383
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1163 SDL_RenderData *rdata = (SDL_RenderData *) renderer->driverdata; |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1164 SDL_TextureData* tdata=(SDL_TextureData*)texture->driverdata; |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1165 |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1166 PhRect_t src_rect; |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1167 PhRect_t dst_rect; |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1168 PhPoint_t dst_point; |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1169 |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1170 /* Check, if it is not initialized */ |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1171 if (rdata->surfaces_type==SDL_PHOTON_SURFTYPE_UNKNOWN) |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1172 { |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1173 SDL_SetError("Photon: can't blit textures in OpenGL ES window"); |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1174 return -1; |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1175 } |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1176 |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1177 /* Switch on requested graphics context modifiers */ |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1178 switch(texture->blendMode) |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1179 { |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1180 case SDL_BLENDMODE_MASK: |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1181 /* Enable and set chroma key */ |
3386
fff074de9675
Photon SDL renderer almost finished, the double/tripple buffering is left only.
Mike Gorchak <lestat@i.com.ua>
parents:
3384
diff
changeset
|
1182 PgSetChromaCx(rdata->gc, PgRGB(255, 255, 255), Pg_CHROMA_SRC_MATCH | Pg_CHROMA_NODRAW); |
3383
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1183 PgChromaOnCx(rdata->gc); |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1184 break; |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1185 case SDL_BLENDMODE_BLEND: |
3386
fff074de9675
Photon SDL renderer almost finished, the double/tripple buffering is left only.
Mike Gorchak <lestat@i.com.ua>
parents:
3384
diff
changeset
|
1186 /* Enable and set chroma key and alpha blending */ |
fff074de9675
Photon SDL renderer almost finished, the double/tripple buffering is left only.
Mike Gorchak <lestat@i.com.ua>
parents:
3384
diff
changeset
|
1187 PgSetChromaCx(rdata->gc, PgRGB(255, 255, 255), Pg_CHROMA_SRC_MATCH | Pg_CHROMA_NODRAW); |
fff074de9675
Photon SDL renderer almost finished, the double/tripple buffering is left only.
Mike Gorchak <lestat@i.com.ua>
parents:
3384
diff
changeset
|
1188 PgChromaOnCx(rdata->gc); |
fff074de9675
Photon SDL renderer almost finished, the double/tripple buffering is left only.
Mike Gorchak <lestat@i.com.ua>
parents:
3384
diff
changeset
|
1189 PgSetAlphaCx(rdata->gc, Pg_ALPHA_OP_SRC_GLOBAL | Pg_BLEND_SRC_As | Pg_BLEND_DST_1mAs, NULL, NULL, texture->a, 0); |
fff074de9675
Photon SDL renderer almost finished, the double/tripple buffering is left only.
Mike Gorchak <lestat@i.com.ua>
parents:
3384
diff
changeset
|
1190 PgAlphaOnCx(rdata->gc); |
fff074de9675
Photon SDL renderer almost finished, the double/tripple buffering is left only.
Mike Gorchak <lestat@i.com.ua>
parents:
3384
diff
changeset
|
1191 break; |
fff074de9675
Photon SDL renderer almost finished, the double/tripple buffering is left only.
Mike Gorchak <lestat@i.com.ua>
parents:
3384
diff
changeset
|
1192 case SDL_BLENDMODE_ADD: |
fff074de9675
Photon SDL renderer almost finished, the double/tripple buffering is left only.
Mike Gorchak <lestat@i.com.ua>
parents:
3384
diff
changeset
|
1193 /* Enable and set chroma key and alpha blending */ |
fff074de9675
Photon SDL renderer almost finished, the double/tripple buffering is left only.
Mike Gorchak <lestat@i.com.ua>
parents:
3384
diff
changeset
|
1194 PgSetChromaCx(rdata->gc, PgRGB(255, 255, 255), Pg_CHROMA_SRC_MATCH | Pg_CHROMA_NODRAW); |
fff074de9675
Photon SDL renderer almost finished, the double/tripple buffering is left only.
Mike Gorchak <lestat@i.com.ua>
parents:
3384
diff
changeset
|
1195 PgChromaOnCx(rdata->gc); |
fff074de9675
Photon SDL renderer almost finished, the double/tripple buffering is left only.
Mike Gorchak <lestat@i.com.ua>
parents:
3384
diff
changeset
|
1196 PgSetAlphaCx(rdata->gc, Pg_ALPHA_OP_SRC_GLOBAL | Pg_BLEND_SRC_As | Pg_BLEND_DST_1, NULL, NULL, texture->a, 0); |
fff074de9675
Photon SDL renderer almost finished, the double/tripple buffering is left only.
Mike Gorchak <lestat@i.com.ua>
parents:
3384
diff
changeset
|
1197 PgAlphaOnCx(rdata->gc); |
fff074de9675
Photon SDL renderer almost finished, the double/tripple buffering is left only.
Mike Gorchak <lestat@i.com.ua>
parents:
3384
diff
changeset
|
1198 break; |
fff074de9675
Photon SDL renderer almost finished, the double/tripple buffering is left only.
Mike Gorchak <lestat@i.com.ua>
parents:
3384
diff
changeset
|
1199 case SDL_BLENDMODE_MOD: |
fff074de9675
Photon SDL renderer almost finished, the double/tripple buffering is left only.
Mike Gorchak <lestat@i.com.ua>
parents:
3384
diff
changeset
|
1200 /* Enable and set alpha blending */ |
fff074de9675
Photon SDL renderer almost finished, the double/tripple buffering is left only.
Mike Gorchak <lestat@i.com.ua>
parents:
3384
diff
changeset
|
1201 PgSetAlphaCx(rdata->gc, Pg_BLEND_SRC_0 | Pg_BLEND_DST_S, NULL, NULL, 0, 0); |
fff074de9675
Photon SDL renderer almost finished, the double/tripple buffering is left only.
Mike Gorchak <lestat@i.com.ua>
parents:
3384
diff
changeset
|
1202 PgAlphaOnCx(rdata->gc); |
3383
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1203 break; |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1204 case SDL_BLENDMODE_NONE: |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1205 default: |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1206 /* Do nothing */ |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1207 break; |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1208 } |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1209 |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1210 /* Set source blit area */ |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1211 src_rect.ul.x = srcrect->x; |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1212 src_rect.ul.y = srcrect->y; |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1213 src_rect.lr.x = srcrect->x + srcrect->w - 1; |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1214 src_rect.lr.y = srcrect->y + srcrect->h - 1; |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1215 |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1216 /* Set destination blit area */ |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1217 dst_rect.ul.x = dstrect->x; |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1218 dst_rect.ul.y = dstrect->y; |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1219 dst_rect.lr.x = dstrect->x + dstrect->w - 1; |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1220 dst_rect.lr.y = dstrect->y + dstrect->h - 1; |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1221 |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1222 /* Set destination point */ |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1223 dst_point.x = dstrect->x; |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1224 dst_point.y = dstrect->y; |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1225 |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1226 /* Do blit */ |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1227 switch (rdata->surfaces_type) |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1228 { |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1229 case SDL_PHOTON_SURFTYPE_OFFSCREEN: |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1230 /* two possible combinations */ |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1231 switch (tdata->surface_type) |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1232 { |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1233 case SDL_PHOTON_SURFTYPE_OFFSCREEN: |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1234 /* easiest full accelerated combination: offscreen->offscreen */ |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1235 PgContextBlitCx(rdata->osurfaces[rdata->surface_render_idx], tdata->osurface, |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1236 &src_rect, rdata->osurfaces[rdata->surface_render_idx], &dst_rect); |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1237 break; |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1238 case SDL_PHOTON_SURFTYPE_PHIMAGE: |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1239 /* not accelerated combination: PhImage->offscreen */ |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1240 /* scaling is not supported in this method */ |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1241 PgDrawPhImageRectCxv(rdata->osurfaces[rdata->surface_render_idx], &dst_point, |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1242 tdata->psurface, &src_rect, 0); |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1243 break; |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1244 default: |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1245 break; |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1246 } |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1247 break; |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1248 case SDL_PHOTON_SURFTYPE_PHIMAGE: |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1249 /* two possible combinations */ |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1250 switch (tdata->surface_type) |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1251 { |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1252 case SDL_PHOTON_SURFTYPE_OFFSCREEN: |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1253 /* not supported combination: offscreen->PhImage */ |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1254 return -1; |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1255 case SDL_PHOTON_SURFTYPE_PHIMAGE: |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1256 /* not accelerated combination, but fast: PhImage->PhImage */ |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1257 /* scaling is not supported in this method */ |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1258 PgDrawPhImageRectCxv(rdata->pcontexts[rdata->surface_render_idx], &dst_point, tdata->psurface, &src_rect, 0); |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1259 break; |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1260 default: |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1261 break; |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1262 } |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1263 break; |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1264 } |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1265 |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1266 /* Switch off graphics context modifiers */ |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1267 switch(texture->blendMode) |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1268 { |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1269 case SDL_BLENDMODE_MASK: |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1270 /* Disable chroma key */ |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1271 PgChromaOffCx(rdata->gc); |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1272 break; |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1273 case SDL_BLENDMODE_BLEND: |
3386
fff074de9675
Photon SDL renderer almost finished, the double/tripple buffering is left only.
Mike Gorchak <lestat@i.com.ua>
parents:
3384
diff
changeset
|
1274 /* Disable chroma key and alpha blending */ |
fff074de9675
Photon SDL renderer almost finished, the double/tripple buffering is left only.
Mike Gorchak <lestat@i.com.ua>
parents:
3384
diff
changeset
|
1275 PgChromaOffCx(rdata->gc); |
fff074de9675
Photon SDL renderer almost finished, the double/tripple buffering is left only.
Mike Gorchak <lestat@i.com.ua>
parents:
3384
diff
changeset
|
1276 PgAlphaOffCx(rdata->gc); |
fff074de9675
Photon SDL renderer almost finished, the double/tripple buffering is left only.
Mike Gorchak <lestat@i.com.ua>
parents:
3384
diff
changeset
|
1277 break; |
fff074de9675
Photon SDL renderer almost finished, the double/tripple buffering is left only.
Mike Gorchak <lestat@i.com.ua>
parents:
3384
diff
changeset
|
1278 case SDL_BLENDMODE_ADD: |
fff074de9675
Photon SDL renderer almost finished, the double/tripple buffering is left only.
Mike Gorchak <lestat@i.com.ua>
parents:
3384
diff
changeset
|
1279 /* Disable chroma key and alpha blending */ |
fff074de9675
Photon SDL renderer almost finished, the double/tripple buffering is left only.
Mike Gorchak <lestat@i.com.ua>
parents:
3384
diff
changeset
|
1280 PgChromaOffCx(rdata->gc); |
fff074de9675
Photon SDL renderer almost finished, the double/tripple buffering is left only.
Mike Gorchak <lestat@i.com.ua>
parents:
3384
diff
changeset
|
1281 PgAlphaOffCx(rdata->gc); |
fff074de9675
Photon SDL renderer almost finished, the double/tripple buffering is left only.
Mike Gorchak <lestat@i.com.ua>
parents:
3384
diff
changeset
|
1282 break; |
fff074de9675
Photon SDL renderer almost finished, the double/tripple buffering is left only.
Mike Gorchak <lestat@i.com.ua>
parents:
3384
diff
changeset
|
1283 case SDL_BLENDMODE_MOD: |
fff074de9675
Photon SDL renderer almost finished, the double/tripple buffering is left only.
Mike Gorchak <lestat@i.com.ua>
parents:
3384
diff
changeset
|
1284 /* Disable chroma key and alpha blending */ |
fff074de9675
Photon SDL renderer almost finished, the double/tripple buffering is left only.
Mike Gorchak <lestat@i.com.ua>
parents:
3384
diff
changeset
|
1285 PgAlphaOffCx(rdata->gc); |
3383
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1286 break; |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1287 case SDL_BLENDMODE_NONE: |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1288 default: |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1289 /* Do nothing */ |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1290 break; |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1291 } |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1292 |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1293 return 0; |
3092
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1294 } |
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1295 |
3139 | 1296 static void |
1297 photon_renderpresent(SDL_Renderer * renderer) | |
3092
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1298 { |
3375
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
1299 SDL_RenderData *rdata = (SDL_RenderData *) renderer->driverdata; |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
1300 SDL_Window *window = window=SDL_GetWindowFromID(renderer->window); |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
1301 SDL_WindowData *wdata = (SDL_WindowData *) window->driverdata; |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
1302 PhRect_t src_rect; |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
1303 PhPoint_t src_point; |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
1304 |
3383
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1305 /* Check, if it is not initialized */ |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1306 if (rdata->surfaces_type==SDL_PHOTON_SURFTYPE_UNKNOWN) |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1307 { |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1308 SDL_SetError("Photon: can't render present for OpenGL ES window"); |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1309 return; |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1310 } |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1311 |
3375
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
1312 /* Flush all undrawn graphics data to surface */ |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
1313 switch (rdata->surfaces_type) |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
1314 { |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
1315 case SDL_PHOTON_SURFTYPE_OFFSCREEN: |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
1316 PgFlushCx(rdata->osurfaces[rdata->surface_render_idx]); |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
1317 PgWaitHWIdle(); |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
1318 break; |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
1319 case SDL_PHOTON_SURFTYPE_PHIMAGE: |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
1320 PmMemFlush(rdata->pcontexts[rdata->surface_render_idx], rdata->psurfaces[rdata->surface_render_idx]); |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
1321 break; |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
1322 case SDL_PHOTON_SURFTYPE_UNKNOWN: |
3383
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1323 default: |
3375
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
1324 return; |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
1325 } |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
1326 |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
1327 PgFFlush(Ph_START_DRAW); |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
1328 PgSetRegionCx(PhDCGetCurrent(), PtWidgetRid(wdata->window)); |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
1329 |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
1330 /* Set blit area */ |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
1331 src_rect.ul.x = 0; |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
1332 src_rect.ul.y = 0; |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
1333 src_rect.lr.x = rdata->window_width - 1; |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
1334 src_rect.lr.y = rdata->window_height - 1; |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
1335 |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
1336 src_point.x = 0; |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
1337 src_point.y = 0; |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
1338 |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
1339 switch (rdata->surfaces_type) |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
1340 { |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
1341 case SDL_PHOTON_SURFTYPE_OFFSCREEN: |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
1342 PgContextBlit(rdata->osurfaces[rdata->surface_render_idx], &src_rect, NULL, &src_rect); |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
1343 break; |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
1344 case SDL_PHOTON_SURFTYPE_PHIMAGE: |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
1345 PgDrawPhImagev(&src_point, rdata->psurfaces[rdata->surface_render_idx], 0); |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
1346 break; |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
1347 case SDL_PHOTON_SURFTYPE_UNKNOWN: |
3383
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1348 default: |
3375
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
1349 break; |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
1350 } |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
1351 |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
1352 /* finish blit */ |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
1353 PgFFlush(Ph_DONE_DRAW); |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
1354 PgWaitHWIdle(); |
3092
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1355 } |
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1356 |
3139 | 1357 static void |
1358 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
|
1359 { |
3383
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1360 SDL_RenderData *rdata = (SDL_RenderData *) renderer->driverdata; |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1361 SDL_TextureData* tdata=(SDL_TextureData*)texture->driverdata; |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1362 |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1363 /* Check if partially created texture must be destroyed */ |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1364 if (tdata==NULL) |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1365 { |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1366 return; |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1367 } |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1368 |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1369 /* Check, if it is not initialized */ |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1370 if (rdata->surfaces_type==SDL_PHOTON_SURFTYPE_UNKNOWN) |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1371 { |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1372 SDL_SetError("Photon: can't destroy texture for OpenGL ES window"); |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1373 return; |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1374 } |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1375 |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1376 switch (tdata->surface_type) |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1377 { |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1378 case SDL_PHOTON_SURFTYPE_OFFSCREEN: |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1379 if (tdata->osurface!=NULL) |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1380 { |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1381 PhDCRelease(tdata->osurface); |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1382 tdata->osurface = NULL; |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1383 } |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1384 break; |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1385 case SDL_PHOTON_SURFTYPE_PHIMAGE: |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1386 if (tdata->pcontext!=NULL) |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1387 { |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1388 PmMemReleaseMC(tdata->pcontext); |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1389 tdata->pcontext=NULL; |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1390 } |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1391 |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1392 if (tdata->psurface!=NULL) |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1393 { |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1394 if (tdata->psurface->palette!=NULL) |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1395 { |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1396 SDL_free(tdata->psurface->palette); |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1397 tdata->psurface->palette=NULL; |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1398 } |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1399 /* Destroy shared memory for PhImage_t */ |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1400 PgShmemDestroy(tdata->psurface->image); |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1401 tdata->psurface->image=NULL; |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1402 SDL_free(tdata->psurface); |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1403 tdata->psurface=NULL; |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1404 } |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1405 break; |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1406 default: |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1407 break; |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1408 } |
3092
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1409 } |
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1410 |
3139 | 1411 static void |
1412 photon_destroyrenderer(SDL_Renderer * renderer) | |
3092
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1413 { |
3139 | 1414 SDL_RenderData *rdata = (SDL_RenderData *) renderer->driverdata; |
3375
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
1415 SDL_Window *window = SDL_GetWindowFromID(renderer->window); |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
1416 SDL_WindowData *wdata = (SDL_WindowData *)window->driverdata; |
3139 | 1417 uint32_t it; |
3092
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1418 |
3375
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
1419 /* Destroy graphics context */ |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
1420 if (rdata->gc!=NULL) |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
1421 { |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
1422 PgDestroyGC(rdata->gc); |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
1423 rdata->gc=NULL; |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
1424 } |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
1425 |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
1426 switch (rdata->surfaces_type) |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
1427 { |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
1428 case SDL_PHOTON_SURFTYPE_OFFSCREEN: |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
1429 { |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
1430 /* Destroy current surfaces */ |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
1431 for (it=0; it<SDL_PHOTON_MAX_SURFACES; it++) |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
1432 { |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
1433 if (rdata->osurfaces[it] != NULL) |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
1434 { |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
1435 PhDCRelease(rdata->osurfaces[it]); |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
1436 rdata->osurfaces[it] = NULL; |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
1437 } |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
1438 } |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
1439 } |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
1440 break; |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
1441 case SDL_PHOTON_SURFTYPE_PHIMAGE: |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
1442 { |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
1443 /* Destroy current surfaces */ |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
1444 for (it=0; it<SDL_PHOTON_MAX_SURFACES; it++) |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
1445 { |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
1446 if (rdata->pcontexts[it]!=NULL) |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
1447 { |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
1448 PmMemReleaseMC(rdata->pcontexts[it]); |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
1449 rdata->pcontexts[it]=NULL; |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
1450 } |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
1451 if (rdata->psurfaces[it]!=NULL) |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
1452 { |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
1453 if (rdata->psurfaces[it]->palette!=NULL) |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
1454 { |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
1455 SDL_free(rdata->psurfaces[it]->palette); |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
1456 rdata->psurfaces[it]->palette=NULL; |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
1457 } |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
1458 /* Destroy shared memory for PhImage_t */ |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
1459 PgShmemDestroy(rdata->psurfaces[it]->image); |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
1460 rdata->psurfaces[it]->image=NULL; |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
1461 SDL_free(rdata->psurfaces[it]); |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
1462 rdata->psurfaces[it]=NULL; |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
1463 } |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
1464 } |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
1465 } |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
1466 break; |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
1467 case SDL_PHOTON_SURFTYPE_UNKNOWN: |
3383
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1468 default: |
3375
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
1469 { |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
1470 /* nothing to do */ |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
1471 } |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
1472 break; |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
1473 } |
3092
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1474 } |
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1475 |
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1476 /* vi: set ts=4 sw=4 expandtab: */ |