Mercurial > sdl-ios-xcode
annotate src/video/photon/SDL_photon_render.c @ 3459:feea0def118d
Support for RendererReadPixels and RendererWritePixels has been added to photon renderer.
author | Mike Gorchak <lestat@i.com.ua> |
---|---|
date | Thu, 19 Nov 2009 08:44:07 +0000 |
parents | d15a4daa4a58 |
children | 6265b67848e0 |
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 |
3411
d15a4daa4a58
Fixes in GLES configuration selection. Support for an old QNX 6.3.2.
Mike Gorchak <lestat@i.com.ua>
parents:
3396
diff
changeset
|
37 #ifndef Pg_OSC_MEM_LINEAR_ACCESSIBLE |
d15a4daa4a58
Fixes in GLES configuration selection. Support for an old QNX 6.3.2.
Mike Gorchak <lestat@i.com.ua>
parents:
3396
diff
changeset
|
38 /* For QNX 6.3.2 compatibility */ |
d15a4daa4a58
Fixes in GLES configuration selection. Support for an old QNX 6.3.2.
Mike Gorchak <lestat@i.com.ua>
parents:
3396
diff
changeset
|
39 #define Pg_OSC_MEM_LINEAR_ACCESSIBLE 0 |
d15a4daa4a58
Fixes in GLES configuration selection. Support for an old QNX 6.3.2.
Mike Gorchak <lestat@i.com.ua>
parents:
3396
diff
changeset
|
40 #endif /* Pg_OSC_MEM_LINEAR_ACCESSIBLE */ |
d15a4daa4a58
Fixes in GLES configuration selection. Support for an old QNX 6.3.2.
Mike Gorchak <lestat@i.com.ua>
parents:
3396
diff
changeset
|
41 |
3139 | 42 static SDL_Renderer *photon_createrenderer(SDL_Window * window, Uint32 flags); |
43 static int photon_displaymodechanged(SDL_Renderer * renderer); | |
44 static int photon_activaterenderer(SDL_Renderer * renderer); | |
45 static int photon_createtexture(SDL_Renderer * renderer, | |
46 SDL_Texture * texture); | |
47 static int photon_querytexturepixels(SDL_Renderer * renderer, | |
48 SDL_Texture * texture, void **pixels, | |
49 int *pitch); | |
50 static int photon_settexturepalette(SDL_Renderer * renderer, | |
51 SDL_Texture * texture, | |
52 const SDL_Color * colors, int firstcolor, | |
53 int ncolors); | |
54 static int photon_gettexturepalette(SDL_Renderer * renderer, | |
55 SDL_Texture * texture, SDL_Color * colors, | |
56 int firstcolor, int ncolors); | |
57 static int photon_settexturecolormod(SDL_Renderer * renderer, | |
58 SDL_Texture * texture); | |
59 static int photon_settexturealphamod(SDL_Renderer * renderer, | |
60 SDL_Texture * texture); | |
61 static int photon_settextureblendmode(SDL_Renderer * renderer, | |
62 SDL_Texture * texture); | |
63 static int photon_settexturescalemode(SDL_Renderer * renderer, | |
64 SDL_Texture * texture); | |
65 static int photon_updatetexture(SDL_Renderer * renderer, | |
66 SDL_Texture * texture, const SDL_Rect * rect, | |
67 const void *pixels, int pitch); | |
68 static int photon_locktexture(SDL_Renderer * renderer, SDL_Texture * texture, | |
69 const SDL_Rect * rect, int markDirty, | |
70 void **pixels, int *pitch); | |
71 static void photon_unlocktexture(SDL_Renderer * renderer, | |
72 SDL_Texture * texture); | |
73 static void photon_dirtytexture(SDL_Renderer * renderer, | |
74 SDL_Texture * texture, int numrects, | |
75 const SDL_Rect * rects); | |
3375
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
76 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
|
77 static int photon_setdrawblendmode(SDL_Renderer * renderer); |
3139 | 78 static int photon_renderpoint(SDL_Renderer * renderer, int x, int y); |
79 static int photon_renderline(SDL_Renderer * renderer, int x1, int y1, int x2, | |
80 int y2); | |
81 static int photon_renderfill(SDL_Renderer * renderer, const SDL_Rect * rect); | |
82 static int photon_rendercopy(SDL_Renderer * renderer, SDL_Texture * texture, | |
83 const SDL_Rect * srcrect, | |
84 const SDL_Rect * dstrect); | |
3459
feea0def118d
Support for RendererReadPixels and RendererWritePixels has been added to photon renderer.
Mike Gorchak <lestat@i.com.ua>
parents:
3411
diff
changeset
|
85 static int photon_renderreadpixels(SDL_Renderer * renderer, const SDL_Rect * rect, |
feea0def118d
Support for RendererReadPixels and RendererWritePixels has been added to photon renderer.
Mike Gorchak <lestat@i.com.ua>
parents:
3411
diff
changeset
|
86 Uint32 format, void * pixels, int pitch); |
feea0def118d
Support for RendererReadPixels and RendererWritePixels has been added to photon renderer.
Mike Gorchak <lestat@i.com.ua>
parents:
3411
diff
changeset
|
87 static int photon_renderwritepixels(SDL_Renderer * renderer, const SDL_Rect * rect, |
feea0def118d
Support for RendererReadPixels and RendererWritePixels has been added to photon renderer.
Mike Gorchak <lestat@i.com.ua>
parents:
3411
diff
changeset
|
88 Uint32 format, const void * pixels, int pitch); |
3139 | 89 static void photon_renderpresent(SDL_Renderer * renderer); |
90 static void photon_destroytexture(SDL_Renderer * renderer, | |
91 SDL_Texture * texture); | |
92 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
|
93 |
3375
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
94 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
|
95 |
3139 | 96 SDL_RenderDriver photon_renderdriver = { |
3092
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
97 photon_createrenderer, |
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
98 { |
3139 | 99 "photon", |
100 (SDL_RENDERER_SINGLEBUFFER | SDL_RENDERER_PRESENTCOPY | | |
101 SDL_RENDERER_PRESENTFLIP2 | SDL_RENDERER_PRESENTFLIP3 | | |
102 SDL_RENDERER_PRESENTVSYNC | SDL_RENDERER_PRESENTDISCARD | | |
103 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
|
104 (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
|
105 (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
|
106 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
|
107 (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
|
108 SDL_TEXTURESCALEMODE_FAST), |
3375
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
109 10, |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
110 {SDL_PIXELFORMAT_INDEX8, |
3139 | 111 SDL_PIXELFORMAT_RGB555, |
112 SDL_PIXELFORMAT_RGB565, | |
3375
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
113 SDL_PIXELFORMAT_RGB24, |
3139 | 114 SDL_PIXELFORMAT_RGB888, |
115 SDL_PIXELFORMAT_ARGB8888, | |
116 SDL_PIXELFORMAT_YV12, | |
117 SDL_PIXELFORMAT_YUY2, | |
118 SDL_PIXELFORMAT_UYVY, | |
119 SDL_PIXELFORMAT_YVYU}, | |
120 0, | |
121 0} | |
3092
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
122 }; |
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
123 |
3139 | 124 static SDL_Renderer * |
125 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
|
126 { |
3139 | 127 SDL_VideoDisplay *display = SDL_GetDisplayFromWindow(window); |
128 SDL_DisplayData *didata = (SDL_DisplayData *) display->driverdata; | |
129 SDL_WindowData *wdata = (SDL_WindowData *) window->driverdata; | |
130 SDL_Renderer *renderer = NULL; | |
131 SDL_RenderData *rdata = NULL; | |
3092
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
132 |
3139 | 133 /* Allocate new renderer structure */ |
134 renderer = (SDL_Renderer *) SDL_calloc(1, sizeof(SDL_Renderer)); | |
135 if (renderer == NULL) { | |
136 SDL_OutOfMemory(); | |
137 return NULL; | |
138 } | |
3092
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
139 |
3139 | 140 /* Allocate renderer data */ |
141 rdata = (SDL_RenderData *) SDL_calloc(1, sizeof(SDL_RenderData)); | |
142 if (rdata == NULL) { | |
143 SDL_free(renderer); | |
144 SDL_OutOfMemory(); | |
145 return NULL; | |
146 } | |
3092
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
147 |
3139 | 148 renderer->DisplayModeChanged = photon_displaymodechanged; |
149 renderer->ActivateRenderer = photon_activaterenderer; | |
150 renderer->CreateTexture = photon_createtexture; | |
151 renderer->QueryTexturePixels = photon_querytexturepixels; | |
152 renderer->SetTexturePalette = photon_settexturepalette; | |
153 renderer->GetTexturePalette = photon_gettexturepalette; | |
154 renderer->SetTextureAlphaMod = photon_settexturealphamod; | |
155 renderer->SetTextureColorMod = photon_settexturecolormod; | |
156 renderer->SetTextureBlendMode = photon_settextureblendmode; | |
157 renderer->SetTextureScaleMode = photon_settexturescalemode; | |
158 renderer->UpdateTexture = photon_updatetexture; | |
159 renderer->LockTexture = photon_locktexture; | |
160 renderer->UnlockTexture = photon_unlocktexture; | |
161 renderer->DirtyTexture = photon_dirtytexture; | |
3375
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
162 renderer->SetDrawColor = photon_setdrawcolor; |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
163 renderer->SetDrawBlendMode = photon_setdrawblendmode; |
3139 | 164 renderer->RenderPoint = photon_renderpoint; |
165 renderer->RenderLine = photon_renderline; | |
166 renderer->RenderFill = photon_renderfill; | |
167 renderer->RenderCopy = photon_rendercopy; | |
168 renderer->RenderPresent = photon_renderpresent; | |
169 renderer->DestroyTexture = photon_destroytexture; | |
170 renderer->DestroyRenderer = photon_destroyrenderer; | |
171 renderer->info = photon_renderdriver.info; | |
172 renderer->window = window->id; | |
173 renderer->driverdata = rdata; | |
3092
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
174 |
3387
05499ec8c022
Initial support for fullscreen application modes.
Mike Gorchak <lestat@i.com.ua>
parents:
3386
diff
changeset
|
175 /* Copy direct_mode status */ |
05499ec8c022
Initial support for fullscreen application modes.
Mike Gorchak <lestat@i.com.ua>
parents:
3386
diff
changeset
|
176 rdata->direct_mode=didata->direct_mode; |
05499ec8c022
Initial support for fullscreen application modes.
Mike Gorchak <lestat@i.com.ua>
parents:
3386
diff
changeset
|
177 |
3139 | 178 /* Set render acceleration flag in case it is accelerated */ |
179 if ((didata->caps & SDL_PHOTON_ACCELERATED) == SDL_PHOTON_ACCELERATED) { | |
180 renderer->info.flags = SDL_RENDERER_ACCELERATED; | |
181 } else { | |
3384
04af265172f9
Continue working on 2D support in Photon.
Mike Gorchak <lestat@i.com.ua>
parents:
3383
diff
changeset
|
182 renderer->info.flags = 0; |
3139 | 183 } |
3092
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
184 |
3139 | 185 /* Check if upper level requested synchronization on vsync signal */ |
186 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
|
187 if (rdata->direct_mode==SDL_TRUE) |
05499ec8c022
Initial support for fullscreen application modes.
Mike Gorchak <lestat@i.com.ua>
parents:
3386
diff
changeset
|
188 { |
05499ec8c022
Initial support for fullscreen application modes.
Mike Gorchak <lestat@i.com.ua>
parents:
3386
diff
changeset
|
189 /* 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
|
190 rdata->enable_vsync = SDL_TRUE; |
05499ec8c022
Initial support for fullscreen application modes.
Mike Gorchak <lestat@i.com.ua>
parents:
3386
diff
changeset
|
191 renderer->info.flags |= SDL_RENDERER_PRESENTVSYNC; |
05499ec8c022
Initial support for fullscreen application modes.
Mike Gorchak <lestat@i.com.ua>
parents:
3386
diff
changeset
|
192 } |
05499ec8c022
Initial support for fullscreen application modes.
Mike Gorchak <lestat@i.com.ua>
parents:
3386
diff
changeset
|
193 else |
05499ec8c022
Initial support for fullscreen application modes.
Mike Gorchak <lestat@i.com.ua>
parents:
3386
diff
changeset
|
194 { |
05499ec8c022
Initial support for fullscreen application modes.
Mike Gorchak <lestat@i.com.ua>
parents:
3386
diff
changeset
|
195 rdata->enable_vsync = SDL_FALSE; |
05499ec8c022
Initial support for fullscreen application modes.
Mike Gorchak <lestat@i.com.ua>
parents:
3386
diff
changeset
|
196 } |
3139 | 197 } else { |
198 rdata->enable_vsync = SDL_FALSE; | |
199 } | |
3092
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
200 |
3139 | 201 /* Check what buffer copy/flip scheme is requested */ |
202 rdata->surfaces_count = 0; | |
203 if ((flags & SDL_RENDERER_SINGLEBUFFER) == SDL_RENDERER_SINGLEBUFFER) { | |
204 if ((flags & SDL_RENDERER_PRESENTDISCARD) == | |
205 SDL_RENDERER_PRESENTDISCARD) { | |
206 renderer->info.flags |= | |
207 SDL_RENDERER_SINGLEBUFFER | SDL_RENDERER_PRESENTDISCARD; | |
208 } else { | |
209 renderer->info.flags |= | |
210 SDL_RENDERER_SINGLEBUFFER | SDL_RENDERER_PRESENTCOPY; | |
211 } | |
212 rdata->surfaces_count = 1; | |
213 rdata->surface_visible_idx = 0; | |
214 rdata->surface_render_idx = 0; | |
215 } else { | |
216 if ((flags & SDL_RENDERER_PRESENTFLIP2) == SDL_RENDERER_PRESENTFLIP2) { | |
217 renderer->info.flags |= SDL_RENDERER_PRESENTFLIP2; | |
218 rdata->surfaces_count = 2; | |
219 rdata->surface_visible_idx = 0; | |
220 rdata->surface_render_idx = 1; | |
221 } else { | |
222 if ((flags & SDL_RENDERER_PRESENTFLIP3) == | |
223 SDL_RENDERER_PRESENTFLIP3) { | |
224 renderer->info.flags |= SDL_RENDERER_PRESENTFLIP3; | |
225 rdata->surfaces_count = 3; | |
226 rdata->surface_visible_idx = 0; | |
227 rdata->surface_render_idx = 1; | |
228 } else { | |
229 renderer->info.flags |= | |
230 SDL_RENDERER_SINGLEBUFFER | SDL_RENDERER_PRESENTCOPY; | |
231 rdata->surfaces_count = 1; | |
232 rdata->surface_visible_idx = 0; | |
233 rdata->surface_render_idx = 0; | |
234 } | |
235 } | |
236 } | |
3092
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
237 |
3384
04af265172f9
Continue working on 2D support in Photon.
Mike Gorchak <lestat@i.com.ua>
parents:
3383
diff
changeset
|
238 /* 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
|
239 if (rdata->gc==NULL) |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
240 { |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
241 rdata->gc=PgCreateGC(0); |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
242 PgDefaultGC(rdata->gc); |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
243 } |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
244 |
3383
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
245 /* 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
|
246 renderer->info.num_texture_formats=1; |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
247 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
|
248 |
3384
04af265172f9
Continue working on 2D support in Photon.
Mike Gorchak <lestat@i.com.ua>
parents:
3383
diff
changeset
|
249 /* Initialize surfaces */ |
04af265172f9
Continue working on 2D support in Photon.
Mike Gorchak <lestat@i.com.ua>
parents:
3383
diff
changeset
|
250 _photon_recreate_surfaces(renderer); |
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 /* Set current scale blitting capabilities */ |
04af265172f9
Continue working on 2D support in Photon.
Mike Gorchak <lestat@i.com.ua>
parents:
3383
diff
changeset
|
253 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
|
254 { |
04af265172f9
Continue working on 2D support in Photon.
Mike Gorchak <lestat@i.com.ua>
parents:
3383
diff
changeset
|
255 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
|
256 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
|
257 { |
04af265172f9
Continue working on 2D support in Photon.
Mike Gorchak <lestat@i.com.ua>
parents:
3383
diff
changeset
|
258 /* This video mode supports hardware scaling */ |
04af265172f9
Continue working on 2D support in Photon.
Mike Gorchak <lestat@i.com.ua>
parents:
3383
diff
changeset
|
259 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
|
260 } |
04af265172f9
Continue working on 2D support in Photon.
Mike Gorchak <lestat@i.com.ua>
parents:
3383
diff
changeset
|
261 } |
04af265172f9
Continue working on 2D support in Photon.
Mike Gorchak <lestat@i.com.ua>
parents:
3383
diff
changeset
|
262 else |
04af265172f9
Continue working on 2D support in Photon.
Mike Gorchak <lestat@i.com.ua>
parents:
3383
diff
changeset
|
263 { |
04af265172f9
Continue working on 2D support in Photon.
Mike Gorchak <lestat@i.com.ua>
parents:
3383
diff
changeset
|
264 /* 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
|
265 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
|
266 } |
04af265172f9
Continue working on 2D support in Photon.
Mike Gorchak <lestat@i.com.ua>
parents:
3383
diff
changeset
|
267 |
3139 | 268 return renderer; |
3092
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
269 } |
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
270 |
3139 | 271 void |
272 photon_addrenderdriver(_THIS) | |
3092
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
273 { |
3139 | 274 uint32_t it; |
3092
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
275 |
3139 | 276 for (it = 0; it < _this->num_displays; it++) { |
277 SDL_AddRenderDriver(it, &photon_renderdriver); | |
278 } | |
3092
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
279 } |
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
280 |
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
281 /****************************************************************************/ |
3396
d6b79fc83362
All 2D operations in Photon driver have been finished. The driver is ready to use. There fullscreen modes and YUV textures are rest only.
Mike Gorchak <lestat@i.com.ua>
parents:
3387
diff
changeset
|
282 /* Renderer helper functions */ |
3092
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
283 /****************************************************************************/ |
3375
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
284 |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
285 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
|
286 { |
3139 | 287 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
|
288 SDL_VideoDisplay *display = NULL; |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
289 SDL_DisplayData *didata = NULL; |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
290 SDL_Window *window = NULL; |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
291 SDL_WindowData *wdata = NULL; |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
292 SDL_VideoData *phdata = NULL; |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
293 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
|
294 int32_t status; |
3092
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
295 |
3375
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
296 /* Obtain window and display structures */ |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
297 window=SDL_GetWindowFromID(renderer->window); |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
298 wdata=(SDL_WindowData*)window->driverdata; |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
299 display=SDL_GetDisplayFromWindow(window); |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
300 didata=(SDL_DisplayData *) display->driverdata; |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
301 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
|
302 |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
303 /* 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
|
304 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
|
305 /* 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
|
306 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
|
307 return 0; |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
308 } |
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_UNKNOWN) |
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 /* Try to allocate 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 else |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
316 { |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
317 uint32_t it; |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
318 |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
319 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
|
320 { |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
321 /* Create offscreen surfaces */ |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
322 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
|
323 |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
324 /* Destroy current surfaces */ |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
325 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
|
326 { |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
327 if (rdata->osurfaces[it] != NULL) |
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 PhDCRelease(rdata->osurfaces[it]); |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
330 rdata->osurfaces[it] = NULL; |
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 } |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
333 } |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
334 else |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
335 { |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
336 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
|
337 { |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
338 /* Create shared phimage surfaces */ |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
339 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
|
340 |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
341 /* Destroy current surfaces */ |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
342 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
|
343 { |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
344 if (rdata->pcontexts[it]!=NULL) |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
345 { |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
346 PmMemReleaseMC(rdata->pcontexts[it]); |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
347 rdata->pcontexts[it]=NULL; |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
348 } |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
349 if (rdata->psurfaces[it]!=NULL) |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
350 { |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
351 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
|
352 { |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
353 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
|
354 rdata->psurfaces[it]->palette=NULL; |
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 /* 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
|
357 PgShmemDestroy(rdata->psurfaces[it]->image); |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
358 rdata->psurfaces[it]->image=NULL; |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
359 SDL_free(rdata->psurfaces[it]); |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
360 rdata->psurfaces[it]=NULL; |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
361 } |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
362 } |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
363 } |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
364 } |
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 |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
367 /* 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
|
368 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
|
369 /* 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
|
370 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
|
371 if (status != 0) { |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
372 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
|
373 return -1; |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
374 } |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
375 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
|
376 } |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
377 |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
378 switch (allocate_task) |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
379 { |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
380 case SDL_PHOTON_SURFTYPE_OFFSCREEN: |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
381 { |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
382 int32_t it; |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
383 int32_t jt; |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
384 |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
385 /* 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
|
386 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
|
387 { |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
388 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
|
389 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
|
390 /* 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
|
391 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
|
392 /* 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
|
393 if (rdata->osurfaces[it]==NULL) |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
394 { |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
395 /* Destroy previously allocated surface(s) */ |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
396 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
|
397 { |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
398 PhDCRelease(rdata->osurfaces[jt]); |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
399 rdata->osurfaces[jt] = NULL; |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
400 } |
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 } |
3092
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
404 |
3375
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
405 /* 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
|
406 if (rdata->osurfaces[0]!=NULL) |
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 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
|
409 /* 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
|
410 break; |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
411 } |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
412 else |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
413 { |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
414 /* 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
|
415 } |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
416 } |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
417 /* fall through */ |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
418 case SDL_PHOTON_SURFTYPE_PHIMAGE: |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
419 { |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
420 int32_t it; |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
421 int32_t jt; |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
422 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
|
423 |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
424 /* 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
|
425 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
|
426 { |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
427 /* 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
|
428 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
|
429 { |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
430 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
|
431 image_pfmt, NULL, 256, 1); |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
432 } |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
433 else |
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 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
|
436 image_pfmt, NULL, 0, 1); |
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) |
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 PhPoint_t translation={0, 0}; |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
442 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
|
443 |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
444 /* 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
|
445 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
|
446 } |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
447 |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
448 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
|
449 { |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
450 /* Destroy previously allocated surface(s) */ |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
451 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
|
452 { |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
453 if (rdata->pcontexts[jt]!=NULL) |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
454 { |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
455 PmMemReleaseMC(rdata->pcontexts[it]); |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
456 rdata->pcontexts[jt]=NULL; |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
457 } |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
458 if (rdata->psurfaces[jt]!=NULL) |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
459 { |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
460 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
|
461 { |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
462 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
|
463 rdata->psurfaces[jt]->palette=NULL; |
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 /* 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
|
466 PgShmemDestroy(rdata->psurfaces[jt]->image); |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
467 rdata->psurfaces[jt]->image=NULL; |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
468 SDL_free(rdata->psurfaces[jt]); |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
469 rdata->psurfaces[jt] = NULL; |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
470 } |
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 break; |
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 } |
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 /* 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
|
477 if (rdata->psurfaces[0]!=NULL) |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
478 { |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
479 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
|
480 } |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
481 else |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
482 { |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
483 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
|
484 } |
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 break; |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
487 case SDL_PHOTON_SURFTYPE_UNKNOWN: |
3383
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
488 default: |
3375
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 /* do nothing with surface allocation */ |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
491 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
|
492 } |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
493 break; |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
494 } |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
495 |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
496 /* 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
|
497 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
|
498 { |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
499 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
|
500 return -1; |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
501 } |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
502 |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
503 /* Store current surface dimensions */ |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
504 rdata->window_width=window->w; |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
505 rdata->window_height=window->h; |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
506 |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
507 /* 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
|
508 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
|
509 { |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
510 rdata->surface_visible_idx = 0; |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
511 rdata->surface_render_idx = 0; |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
512 } |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
513 |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
514 /* 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
|
515 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
|
516 { |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
517 rdata->surface_visible_idx = 0; |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
518 rdata->surface_render_idx = 1; |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
519 } |
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 /* 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
|
522 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
|
523 { |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
524 rdata->surface_visible_idx = 0; |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
525 rdata->surface_render_idx = 1; |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
526 } |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
527 |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
528 switch (rdata->surfaces_type) |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
529 { |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
530 case SDL_PHOTON_SURFTYPE_OFFSCREEN: |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
531 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
|
532 break; |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
533 case SDL_PHOTON_SURFTYPE_PHIMAGE: |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
534 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
|
535 break; |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
536 case SDL_PHOTON_SURFTYPE_UNKNOWN: |
3383
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
537 default: |
3375
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
538 break; |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
539 } |
3092
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
540 |
3139 | 541 return 0; |
3092
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
542 } |
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
543 |
3375
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
544 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
|
545 { |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
546 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
|
547 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
|
548 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
|
549 PhPoint_t src_point; |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
550 |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
551 /* 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
|
552 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
|
553 { |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
554 /* 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
|
555 switch (rdata->surfaces_type) |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
556 { |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
557 case SDL_PHOTON_SURFTYPE_OFFSCREEN: |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
558 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
|
559 PgWaitHWIdle(); |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
560 break; |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
561 case SDL_PHOTON_SURFTYPE_PHIMAGE: |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
562 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
|
563 break; |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
564 case SDL_PHOTON_SURFTYPE_UNKNOWN: |
3383
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
565 default: |
3375
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
566 return; |
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 } |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
569 |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
570 PgSetRegionCx(PhDCGetCurrent(), PtWidgetRid(wdata->window)); |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
571 |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
572 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
|
573 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
|
574 |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
575 switch (rdata->surfaces_type) |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
576 { |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
577 case SDL_PHOTON_SURFTYPE_OFFSCREEN: |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
578 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
|
579 break; |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
580 case SDL_PHOTON_SURFTYPE_PHIMAGE: |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
581 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
|
582 break; |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
583 case SDL_PHOTON_SURFTYPE_UNKNOWN: |
3383
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
584 default: |
3375
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
585 break; |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
586 } |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
587 } |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
588 |
3396
d6b79fc83362
All 2D operations in Photon driver have been finished. The driver is ready to use. There fullscreen modes and YUV textures are rest only.
Mike Gorchak <lestat@i.com.ua>
parents:
3387
diff
changeset
|
589 int _photon_set_blending(SDL_Renderer* renderer, uint32_t blendmode, uint32_t globalalpha, uint32_t blendsource) |
d6b79fc83362
All 2D operations in Photon driver have been finished. The driver is ready to use. There fullscreen modes and YUV textures are rest only.
Mike Gorchak <lestat@i.com.ua>
parents:
3387
diff
changeset
|
590 { |
d6b79fc83362
All 2D operations in Photon driver have been finished. The driver is ready to use. There fullscreen modes and YUV textures are rest only.
Mike Gorchak <lestat@i.com.ua>
parents:
3387
diff
changeset
|
591 SDL_RenderData *rdata = (SDL_RenderData *) renderer->driverdata; |
d6b79fc83362
All 2D operations in Photon driver have been finished. The driver is ready to use. There fullscreen modes and YUV textures are rest only.
Mike Gorchak <lestat@i.com.ua>
parents:
3387
diff
changeset
|
592 |
d6b79fc83362
All 2D operations in Photon driver have been finished. The driver is ready to use. There fullscreen modes and YUV textures are rest only.
Mike Gorchak <lestat@i.com.ua>
parents:
3387
diff
changeset
|
593 /* Switch on requested graphics context modifiers */ |
d6b79fc83362
All 2D operations in Photon driver have been finished. The driver is ready to use. There fullscreen modes and YUV textures are rest only.
Mike Gorchak <lestat@i.com.ua>
parents:
3387
diff
changeset
|
594 switch (blendmode) |
d6b79fc83362
All 2D operations in Photon driver have been finished. The driver is ready to use. There fullscreen modes and YUV textures are rest only.
Mike Gorchak <lestat@i.com.ua>
parents:
3387
diff
changeset
|
595 { |
d6b79fc83362
All 2D operations in Photon driver have been finished. The driver is ready to use. There fullscreen modes and YUV textures are rest only.
Mike Gorchak <lestat@i.com.ua>
parents:
3387
diff
changeset
|
596 case SDL_BLENDMODE_MASK: |
d6b79fc83362
All 2D operations in Photon driver have been finished. The driver is ready to use. There fullscreen modes and YUV textures are rest only.
Mike Gorchak <lestat@i.com.ua>
parents:
3387
diff
changeset
|
597 /* Enable and set chroma key */ |
d6b79fc83362
All 2D operations in Photon driver have been finished. The driver is ready to use. There fullscreen modes and YUV textures are rest only.
Mike Gorchak <lestat@i.com.ua>
parents:
3387
diff
changeset
|
598 if (blendsource==SDL_PHOTON_TEXTURE_BLEND) |
d6b79fc83362
All 2D operations in Photon driver have been finished. The driver is ready to use. There fullscreen modes and YUV textures are rest only.
Mike Gorchak <lestat@i.com.ua>
parents:
3387
diff
changeset
|
599 { |
d6b79fc83362
All 2D operations in Photon driver have been finished. The driver is ready to use. There fullscreen modes and YUV textures are rest only.
Mike Gorchak <lestat@i.com.ua>
parents:
3387
diff
changeset
|
600 PgSetChromaCx(rdata->gc, PgRGB(255, 255, 255), Pg_CHROMA_SRC_MATCH | Pg_CHROMA_NODRAW); |
d6b79fc83362
All 2D operations in Photon driver have been finished. The driver is ready to use. There fullscreen modes and YUV textures are rest only.
Mike Gorchak <lestat@i.com.ua>
parents:
3387
diff
changeset
|
601 PgChromaOnCx(rdata->gc); |
d6b79fc83362
All 2D operations in Photon driver have been finished. The driver is ready to use. There fullscreen modes and YUV textures are rest only.
Mike Gorchak <lestat@i.com.ua>
parents:
3387
diff
changeset
|
602 } |
d6b79fc83362
All 2D operations in Photon driver have been finished. The driver is ready to use. There fullscreen modes and YUV textures are rest only.
Mike Gorchak <lestat@i.com.ua>
parents:
3387
diff
changeset
|
603 break; |
d6b79fc83362
All 2D operations in Photon driver have been finished. The driver is ready to use. There fullscreen modes and YUV textures are rest only.
Mike Gorchak <lestat@i.com.ua>
parents:
3387
diff
changeset
|
604 case SDL_BLENDMODE_BLEND: |
d6b79fc83362
All 2D operations in Photon driver have been finished. The driver is ready to use. There fullscreen modes and YUV textures are rest only.
Mike Gorchak <lestat@i.com.ua>
parents:
3387
diff
changeset
|
605 /* Enable and set chroma key and alpha blending */ |
d6b79fc83362
All 2D operations in Photon driver have been finished. The driver is ready to use. There fullscreen modes and YUV textures are rest only.
Mike Gorchak <lestat@i.com.ua>
parents:
3387
diff
changeset
|
606 if (blendsource==SDL_PHOTON_TEXTURE_BLEND) |
d6b79fc83362
All 2D operations in Photon driver have been finished. The driver is ready to use. There fullscreen modes and YUV textures are rest only.
Mike Gorchak <lestat@i.com.ua>
parents:
3387
diff
changeset
|
607 { |
d6b79fc83362
All 2D operations in Photon driver have been finished. The driver is ready to use. There fullscreen modes and YUV textures are rest only.
Mike Gorchak <lestat@i.com.ua>
parents:
3387
diff
changeset
|
608 PgSetChromaCx(rdata->gc, PgRGB(255, 255, 255), Pg_CHROMA_SRC_MATCH | Pg_CHROMA_NODRAW); |
d6b79fc83362
All 2D operations in Photon driver have been finished. The driver is ready to use. There fullscreen modes and YUV textures are rest only.
Mike Gorchak <lestat@i.com.ua>
parents:
3387
diff
changeset
|
609 PgChromaOnCx(rdata->gc); |
d6b79fc83362
All 2D operations in Photon driver have been finished. The driver is ready to use. There fullscreen modes and YUV textures are rest only.
Mike Gorchak <lestat@i.com.ua>
parents:
3387
diff
changeset
|
610 } |
d6b79fc83362
All 2D operations in Photon driver have been finished. The driver is ready to use. There fullscreen modes and YUV textures are rest only.
Mike Gorchak <lestat@i.com.ua>
parents:
3387
diff
changeset
|
611 PgSetAlphaCx(rdata->gc, Pg_ALPHA_OP_SRC_GLOBAL | Pg_BLEND_SRC_As | Pg_BLEND_DST_1mAs, NULL, NULL, globalalpha, 0); |
d6b79fc83362
All 2D operations in Photon driver have been finished. The driver is ready to use. There fullscreen modes and YUV textures are rest only.
Mike Gorchak <lestat@i.com.ua>
parents:
3387
diff
changeset
|
612 PgAlphaOnCx(rdata->gc); |
d6b79fc83362
All 2D operations in Photon driver have been finished. The driver is ready to use. There fullscreen modes and YUV textures are rest only.
Mike Gorchak <lestat@i.com.ua>
parents:
3387
diff
changeset
|
613 break; |
d6b79fc83362
All 2D operations in Photon driver have been finished. The driver is ready to use. There fullscreen modes and YUV textures are rest only.
Mike Gorchak <lestat@i.com.ua>
parents:
3387
diff
changeset
|
614 case SDL_BLENDMODE_ADD: |
d6b79fc83362
All 2D operations in Photon driver have been finished. The driver is ready to use. There fullscreen modes and YUV textures are rest only.
Mike Gorchak <lestat@i.com.ua>
parents:
3387
diff
changeset
|
615 /* Enable and set chroma key and alpha blending */ |
d6b79fc83362
All 2D operations in Photon driver have been finished. The driver is ready to use. There fullscreen modes and YUV textures are rest only.
Mike Gorchak <lestat@i.com.ua>
parents:
3387
diff
changeset
|
616 if (blendsource==SDL_PHOTON_TEXTURE_BLEND) |
d6b79fc83362
All 2D operations in Photon driver have been finished. The driver is ready to use. There fullscreen modes and YUV textures are rest only.
Mike Gorchak <lestat@i.com.ua>
parents:
3387
diff
changeset
|
617 { |
d6b79fc83362
All 2D operations in Photon driver have been finished. The driver is ready to use. There fullscreen modes and YUV textures are rest only.
Mike Gorchak <lestat@i.com.ua>
parents:
3387
diff
changeset
|
618 PgSetChromaCx(rdata->gc, PgRGB(255, 255, 255), Pg_CHROMA_SRC_MATCH | Pg_CHROMA_NODRAW); |
d6b79fc83362
All 2D operations in Photon driver have been finished. The driver is ready to use. There fullscreen modes and YUV textures are rest only.
Mike Gorchak <lestat@i.com.ua>
parents:
3387
diff
changeset
|
619 PgChromaOnCx(rdata->gc); |
d6b79fc83362
All 2D operations in Photon driver have been finished. The driver is ready to use. There fullscreen modes and YUV textures are rest only.
Mike Gorchak <lestat@i.com.ua>
parents:
3387
diff
changeset
|
620 } |
d6b79fc83362
All 2D operations in Photon driver have been finished. The driver is ready to use. There fullscreen modes and YUV textures are rest only.
Mike Gorchak <lestat@i.com.ua>
parents:
3387
diff
changeset
|
621 PgSetAlphaCx(rdata->gc, Pg_ALPHA_OP_SRC_GLOBAL | Pg_BLEND_SRC_As | Pg_BLEND_DST_1, NULL, NULL, globalalpha, 0); |
d6b79fc83362
All 2D operations in Photon driver have been finished. The driver is ready to use. There fullscreen modes and YUV textures are rest only.
Mike Gorchak <lestat@i.com.ua>
parents:
3387
diff
changeset
|
622 PgAlphaOnCx(rdata->gc); |
d6b79fc83362
All 2D operations in Photon driver have been finished. The driver is ready to use. There fullscreen modes and YUV textures are rest only.
Mike Gorchak <lestat@i.com.ua>
parents:
3387
diff
changeset
|
623 break; |
d6b79fc83362
All 2D operations in Photon driver have been finished. The driver is ready to use. There fullscreen modes and YUV textures are rest only.
Mike Gorchak <lestat@i.com.ua>
parents:
3387
diff
changeset
|
624 case SDL_BLENDMODE_MOD: |
d6b79fc83362
All 2D operations in Photon driver have been finished. The driver is ready to use. There fullscreen modes and YUV textures are rest only.
Mike Gorchak <lestat@i.com.ua>
parents:
3387
diff
changeset
|
625 /* Enable and set alpha blending */ |
d6b79fc83362
All 2D operations in Photon driver have been finished. The driver is ready to use. There fullscreen modes and YUV textures are rest only.
Mike Gorchak <lestat@i.com.ua>
parents:
3387
diff
changeset
|
626 PgSetAlphaCx(rdata->gc, Pg_BLEND_SRC_0 | Pg_BLEND_DST_S, NULL, NULL, 0, 0); |
d6b79fc83362
All 2D operations in Photon driver have been finished. The driver is ready to use. There fullscreen modes and YUV textures are rest only.
Mike Gorchak <lestat@i.com.ua>
parents:
3387
diff
changeset
|
627 PgAlphaOnCx(rdata->gc); |
d6b79fc83362
All 2D operations in Photon driver have been finished. The driver is ready to use. There fullscreen modes and YUV textures are rest only.
Mike Gorchak <lestat@i.com.ua>
parents:
3387
diff
changeset
|
628 break; |
d6b79fc83362
All 2D operations in Photon driver have been finished. The driver is ready to use. There fullscreen modes and YUV textures are rest only.
Mike Gorchak <lestat@i.com.ua>
parents:
3387
diff
changeset
|
629 case SDL_BLENDMODE_NONE: |
d6b79fc83362
All 2D operations in Photon driver have been finished. The driver is ready to use. There fullscreen modes and YUV textures are rest only.
Mike Gorchak <lestat@i.com.ua>
parents:
3387
diff
changeset
|
630 /* Do nothing */ |
d6b79fc83362
All 2D operations in Photon driver have been finished. The driver is ready to use. There fullscreen modes and YUV textures are rest only.
Mike Gorchak <lestat@i.com.ua>
parents:
3387
diff
changeset
|
631 break; |
d6b79fc83362
All 2D operations in Photon driver have been finished. The driver is ready to use. There fullscreen modes and YUV textures are rest only.
Mike Gorchak <lestat@i.com.ua>
parents:
3387
diff
changeset
|
632 default: |
d6b79fc83362
All 2D operations in Photon driver have been finished. The driver is ready to use. There fullscreen modes and YUV textures are rest only.
Mike Gorchak <lestat@i.com.ua>
parents:
3387
diff
changeset
|
633 return -1; |
d6b79fc83362
All 2D operations in Photon driver have been finished. The driver is ready to use. There fullscreen modes and YUV textures are rest only.
Mike Gorchak <lestat@i.com.ua>
parents:
3387
diff
changeset
|
634 } |
d6b79fc83362
All 2D operations in Photon driver have been finished. The driver is ready to use. There fullscreen modes and YUV textures are rest only.
Mike Gorchak <lestat@i.com.ua>
parents:
3387
diff
changeset
|
635 |
d6b79fc83362
All 2D operations in Photon driver have been finished. The driver is ready to use. There fullscreen modes and YUV textures are rest only.
Mike Gorchak <lestat@i.com.ua>
parents:
3387
diff
changeset
|
636 return 0; |
d6b79fc83362
All 2D operations in Photon driver have been finished. The driver is ready to use. There fullscreen modes and YUV textures are rest only.
Mike Gorchak <lestat@i.com.ua>
parents:
3387
diff
changeset
|
637 } |
d6b79fc83362
All 2D operations in Photon driver have been finished. The driver is ready to use. There fullscreen modes and YUV textures are rest only.
Mike Gorchak <lestat@i.com.ua>
parents:
3387
diff
changeset
|
638 |
d6b79fc83362
All 2D operations in Photon driver have been finished. The driver is ready to use. There fullscreen modes and YUV textures are rest only.
Mike Gorchak <lestat@i.com.ua>
parents:
3387
diff
changeset
|
639 int _photon_reset_blending(SDL_Renderer* renderer, uint32_t blendmode, uint32_t blendsource) |
d6b79fc83362
All 2D operations in Photon driver have been finished. The driver is ready to use. There fullscreen modes and YUV textures are rest only.
Mike Gorchak <lestat@i.com.ua>
parents:
3387
diff
changeset
|
640 { |
d6b79fc83362
All 2D operations in Photon driver have been finished. The driver is ready to use. There fullscreen modes and YUV textures are rest only.
Mike Gorchak <lestat@i.com.ua>
parents:
3387
diff
changeset
|
641 SDL_RenderData *rdata = (SDL_RenderData *) renderer->driverdata; |
d6b79fc83362
All 2D operations in Photon driver have been finished. The driver is ready to use. There fullscreen modes and YUV textures are rest only.
Mike Gorchak <lestat@i.com.ua>
parents:
3387
diff
changeset
|
642 |
d6b79fc83362
All 2D operations in Photon driver have been finished. The driver is ready to use. There fullscreen modes and YUV textures are rest only.
Mike Gorchak <lestat@i.com.ua>
parents:
3387
diff
changeset
|
643 /* Switch off graphics context modifiers */ |
d6b79fc83362
All 2D operations in Photon driver have been finished. The driver is ready to use. There fullscreen modes and YUV textures are rest only.
Mike Gorchak <lestat@i.com.ua>
parents:
3387
diff
changeset
|
644 switch (blendmode) |
d6b79fc83362
All 2D operations in Photon driver have been finished. The driver is ready to use. There fullscreen modes and YUV textures are rest only.
Mike Gorchak <lestat@i.com.ua>
parents:
3387
diff
changeset
|
645 { |
d6b79fc83362
All 2D operations in Photon driver have been finished. The driver is ready to use. There fullscreen modes and YUV textures are rest only.
Mike Gorchak <lestat@i.com.ua>
parents:
3387
diff
changeset
|
646 case SDL_BLENDMODE_MASK: |
d6b79fc83362
All 2D operations in Photon driver have been finished. The driver is ready to use. There fullscreen modes and YUV textures are rest only.
Mike Gorchak <lestat@i.com.ua>
parents:
3387
diff
changeset
|
647 /* Disable chroma key */ |
d6b79fc83362
All 2D operations in Photon driver have been finished. The driver is ready to use. There fullscreen modes and YUV textures are rest only.
Mike Gorchak <lestat@i.com.ua>
parents:
3387
diff
changeset
|
648 if (blendsource==SDL_PHOTON_TEXTURE_BLEND) |
d6b79fc83362
All 2D operations in Photon driver have been finished. The driver is ready to use. There fullscreen modes and YUV textures are rest only.
Mike Gorchak <lestat@i.com.ua>
parents:
3387
diff
changeset
|
649 { |
d6b79fc83362
All 2D operations in Photon driver have been finished. The driver is ready to use. There fullscreen modes and YUV textures are rest only.
Mike Gorchak <lestat@i.com.ua>
parents:
3387
diff
changeset
|
650 PgChromaOffCx(rdata->gc); |
d6b79fc83362
All 2D operations in Photon driver have been finished. The driver is ready to use. There fullscreen modes and YUV textures are rest only.
Mike Gorchak <lestat@i.com.ua>
parents:
3387
diff
changeset
|
651 } |
d6b79fc83362
All 2D operations in Photon driver have been finished. The driver is ready to use. There fullscreen modes and YUV textures are rest only.
Mike Gorchak <lestat@i.com.ua>
parents:
3387
diff
changeset
|
652 break; |
d6b79fc83362
All 2D operations in Photon driver have been finished. The driver is ready to use. There fullscreen modes and YUV textures are rest only.
Mike Gorchak <lestat@i.com.ua>
parents:
3387
diff
changeset
|
653 case SDL_BLENDMODE_BLEND: |
d6b79fc83362
All 2D operations in Photon driver have been finished. The driver is ready to use. There fullscreen modes and YUV textures are rest only.
Mike Gorchak <lestat@i.com.ua>
parents:
3387
diff
changeset
|
654 /* Disable chroma key and alpha blending */ |
d6b79fc83362
All 2D operations in Photon driver have been finished. The driver is ready to use. There fullscreen modes and YUV textures are rest only.
Mike Gorchak <lestat@i.com.ua>
parents:
3387
diff
changeset
|
655 if (blendsource==SDL_PHOTON_TEXTURE_BLEND) |
d6b79fc83362
All 2D operations in Photon driver have been finished. The driver is ready to use. There fullscreen modes and YUV textures are rest only.
Mike Gorchak <lestat@i.com.ua>
parents:
3387
diff
changeset
|
656 { |
d6b79fc83362
All 2D operations in Photon driver have been finished. The driver is ready to use. There fullscreen modes and YUV textures are rest only.
Mike Gorchak <lestat@i.com.ua>
parents:
3387
diff
changeset
|
657 PgChromaOffCx(rdata->gc); |
d6b79fc83362
All 2D operations in Photon driver have been finished. The driver is ready to use. There fullscreen modes and YUV textures are rest only.
Mike Gorchak <lestat@i.com.ua>
parents:
3387
diff
changeset
|
658 } |
d6b79fc83362
All 2D operations in Photon driver have been finished. The driver is ready to use. There fullscreen modes and YUV textures are rest only.
Mike Gorchak <lestat@i.com.ua>
parents:
3387
diff
changeset
|
659 PgAlphaOffCx(rdata->gc); |
d6b79fc83362
All 2D operations in Photon driver have been finished. The driver is ready to use. There fullscreen modes and YUV textures are rest only.
Mike Gorchak <lestat@i.com.ua>
parents:
3387
diff
changeset
|
660 break; |
d6b79fc83362
All 2D operations in Photon driver have been finished. The driver is ready to use. There fullscreen modes and YUV textures are rest only.
Mike Gorchak <lestat@i.com.ua>
parents:
3387
diff
changeset
|
661 case SDL_BLENDMODE_ADD: |
d6b79fc83362
All 2D operations in Photon driver have been finished. The driver is ready to use. There fullscreen modes and YUV textures are rest only.
Mike Gorchak <lestat@i.com.ua>
parents:
3387
diff
changeset
|
662 /* Disable chroma key and alpha blending */ |
d6b79fc83362
All 2D operations in Photon driver have been finished. The driver is ready to use. There fullscreen modes and YUV textures are rest only.
Mike Gorchak <lestat@i.com.ua>
parents:
3387
diff
changeset
|
663 if (blendsource==SDL_PHOTON_TEXTURE_BLEND) |
d6b79fc83362
All 2D operations in Photon driver have been finished. The driver is ready to use. There fullscreen modes and YUV textures are rest only.
Mike Gorchak <lestat@i.com.ua>
parents:
3387
diff
changeset
|
664 { |
d6b79fc83362
All 2D operations in Photon driver have been finished. The driver is ready to use. There fullscreen modes and YUV textures are rest only.
Mike Gorchak <lestat@i.com.ua>
parents:
3387
diff
changeset
|
665 PgChromaOffCx(rdata->gc); |
d6b79fc83362
All 2D operations in Photon driver have been finished. The driver is ready to use. There fullscreen modes and YUV textures are rest only.
Mike Gorchak <lestat@i.com.ua>
parents:
3387
diff
changeset
|
666 } |
d6b79fc83362
All 2D operations in Photon driver have been finished. The driver is ready to use. There fullscreen modes and YUV textures are rest only.
Mike Gorchak <lestat@i.com.ua>
parents:
3387
diff
changeset
|
667 PgAlphaOffCx(rdata->gc); |
d6b79fc83362
All 2D operations in Photon driver have been finished. The driver is ready to use. There fullscreen modes and YUV textures are rest only.
Mike Gorchak <lestat@i.com.ua>
parents:
3387
diff
changeset
|
668 break; |
d6b79fc83362
All 2D operations in Photon driver have been finished. The driver is ready to use. There fullscreen modes and YUV textures are rest only.
Mike Gorchak <lestat@i.com.ua>
parents:
3387
diff
changeset
|
669 case SDL_BLENDMODE_MOD: |
d6b79fc83362
All 2D operations in Photon driver have been finished. The driver is ready to use. There fullscreen modes and YUV textures are rest only.
Mike Gorchak <lestat@i.com.ua>
parents:
3387
diff
changeset
|
670 /* Disable chroma key and alpha blending */ |
d6b79fc83362
All 2D operations in Photon driver have been finished. The driver is ready to use. There fullscreen modes and YUV textures are rest only.
Mike Gorchak <lestat@i.com.ua>
parents:
3387
diff
changeset
|
671 PgAlphaOffCx(rdata->gc); |
d6b79fc83362
All 2D operations in Photon driver have been finished. The driver is ready to use. There fullscreen modes and YUV textures are rest only.
Mike Gorchak <lestat@i.com.ua>
parents:
3387
diff
changeset
|
672 break; |
d6b79fc83362
All 2D operations in Photon driver have been finished. The driver is ready to use. There fullscreen modes and YUV textures are rest only.
Mike Gorchak <lestat@i.com.ua>
parents:
3387
diff
changeset
|
673 case SDL_BLENDMODE_NONE: |
d6b79fc83362
All 2D operations in Photon driver have been finished. The driver is ready to use. There fullscreen modes and YUV textures are rest only.
Mike Gorchak <lestat@i.com.ua>
parents:
3387
diff
changeset
|
674 /* Do nothing */ |
d6b79fc83362
All 2D operations in Photon driver have been finished. The driver is ready to use. There fullscreen modes and YUV textures are rest only.
Mike Gorchak <lestat@i.com.ua>
parents:
3387
diff
changeset
|
675 break; |
d6b79fc83362
All 2D operations in Photon driver have been finished. The driver is ready to use. There fullscreen modes and YUV textures are rest only.
Mike Gorchak <lestat@i.com.ua>
parents:
3387
diff
changeset
|
676 default: |
d6b79fc83362
All 2D operations in Photon driver have been finished. The driver is ready to use. There fullscreen modes and YUV textures are rest only.
Mike Gorchak <lestat@i.com.ua>
parents:
3387
diff
changeset
|
677 return -1; |
d6b79fc83362
All 2D operations in Photon driver have been finished. The driver is ready to use. There fullscreen modes and YUV textures are rest only.
Mike Gorchak <lestat@i.com.ua>
parents:
3387
diff
changeset
|
678 } |
d6b79fc83362
All 2D operations in Photon driver have been finished. The driver is ready to use. There fullscreen modes and YUV textures are rest only.
Mike Gorchak <lestat@i.com.ua>
parents:
3387
diff
changeset
|
679 |
d6b79fc83362
All 2D operations in Photon driver have been finished. The driver is ready to use. There fullscreen modes and YUV textures are rest only.
Mike Gorchak <lestat@i.com.ua>
parents:
3387
diff
changeset
|
680 return 0; |
d6b79fc83362
All 2D operations in Photon driver have been finished. The driver is ready to use. There fullscreen modes and YUV textures are rest only.
Mike Gorchak <lestat@i.com.ua>
parents:
3387
diff
changeset
|
681 } |
d6b79fc83362
All 2D operations in Photon driver have been finished. The driver is ready to use. There fullscreen modes and YUV textures are rest only.
Mike Gorchak <lestat@i.com.ua>
parents:
3387
diff
changeset
|
682 |
3375
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
683 /****************************************************************************/ |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
684 /* SDL render interface */ |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
685 /****************************************************************************/ |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
686 |
3139 | 687 static int |
688 photon_activaterenderer(SDL_Renderer * renderer) | |
3092
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
689 { |
3375
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
690 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
|
691 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
|
692 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
|
693 |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
694 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
|
695 { |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
696 return _photon_recreate_surfaces(renderer); |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
697 } |
3092
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
698 |
3375
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
699 switch (rdata->surfaces_type) |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
700 { |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
701 case SDL_PHOTON_SURFTYPE_OFFSCREEN: |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
702 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
|
703 break; |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
704 case SDL_PHOTON_SURFTYPE_PHIMAGE: |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
705 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
|
706 break; |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
707 case SDL_PHOTON_SURFTYPE_UNKNOWN: |
3383
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
708 default: |
3375
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
709 break; |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
710 } |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
711 |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
712 return 0; |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
713 } |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
714 |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
715 static int |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
716 photon_displaymodechanged(SDL_Renderer * renderer) |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
717 { |
3387
05499ec8c022
Initial support for fullscreen application modes.
Mike Gorchak <lestat@i.com.ua>
parents:
3386
diff
changeset
|
718 SDL_RenderData *rdata = (SDL_RenderData *) renderer->driverdata; |
05499ec8c022
Initial support for fullscreen application modes.
Mike Gorchak <lestat@i.com.ua>
parents:
3386
diff
changeset
|
719 SDL_Window *window = SDL_GetWindowFromID(renderer->window); |
05499ec8c022
Initial support for fullscreen application modes.
Mike Gorchak <lestat@i.com.ua>
parents:
3386
diff
changeset
|
720 SDL_VideoDisplay *display = SDL_GetDisplayFromWindow(window); |
05499ec8c022
Initial support for fullscreen application modes.
Mike Gorchak <lestat@i.com.ua>
parents:
3386
diff
changeset
|
721 SDL_DisplayData *didata = (SDL_DisplayData *) display->driverdata; |
05499ec8c022
Initial support for fullscreen application modes.
Mike Gorchak <lestat@i.com.ua>
parents:
3386
diff
changeset
|
722 |
05499ec8c022
Initial support for fullscreen application modes.
Mike Gorchak <lestat@i.com.ua>
parents:
3386
diff
changeset
|
723 /* Copy direct_mode status */ |
05499ec8c022
Initial support for fullscreen application modes.
Mike Gorchak <lestat@i.com.ua>
parents:
3386
diff
changeset
|
724 rdata->direct_mode=didata->direct_mode; |
05499ec8c022
Initial support for fullscreen application modes.
Mike Gorchak <lestat@i.com.ua>
parents:
3386
diff
changeset
|
725 |
05499ec8c022
Initial support for fullscreen application modes.
Mike Gorchak <lestat@i.com.ua>
parents:
3386
diff
changeset
|
726 /* Update the surfaces */ |
3375
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
727 return _photon_recreate_surfaces(renderer); |
3092
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
728 } |
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
729 |
3139 | 730 static int |
731 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
|
732 { |
3383
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
733 SDL_RenderData *rdata = (SDL_RenderData *) renderer->driverdata; |
3139 | 734 SDL_Window *window = SDL_GetWindowFromID(renderer->window); |
735 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
|
736 SDL_DisplayData *didata = (SDL_DisplayData *) display->driverdata; |
3139 | 737 SDL_TextureData *tdata = NULL; |
3383
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
738 uint32_t it; |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
739 |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
740 /* Check, if it is not initialized */ |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
741 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
|
742 { |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
743 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
|
744 return -1; |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
745 } |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
746 |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
747 /* 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
|
748 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
|
749 { |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
750 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
|
751 { |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
752 break; |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
753 } |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
754 } |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
755 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
|
756 { |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
757 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
|
758 return -1; |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
759 } |
3092
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
760 |
3139 | 761 /* Allocate texture driver data */ |
762 tdata = (SDL_TextureData *) SDL_calloc(1, sizeof(SDL_TextureData)); | |
763 if (tdata == NULL) { | |
764 SDL_OutOfMemory(); | |
765 return -1; | |
766 } | |
3092
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
767 |
3139 | 768 /* Set texture driver data */ |
769 texture->driverdata = tdata; | |
3383
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
770 |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
771 /* 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
|
772 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
|
773 { |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
774 /* Try to allocate offscreen memory first */ |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
775 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
|
776 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
|
777 /* 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
|
778 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
|
779 } |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
780 |
3384
04af265172f9
Continue working on 2D support in Photon.
Mike Gorchak <lestat@i.com.ua>
parents:
3383
diff
changeset
|
781 /* 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
|
782 if (tdata->osurface==NULL) |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
783 { |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
784 PhPoint_t translation={0, 0}; |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
785 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
|
786 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
|
787 |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
788 /* Allocate photon image */ |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
789 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
|
790 { |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
791 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
|
792 image_pfmt, NULL, 256, 1); |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
793 } |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
794 else |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
795 { |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
796 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
|
797 image_pfmt, NULL, 0, 1); |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
798 } |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
799 |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
800 if (tdata->psurface==NULL) |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
801 { |
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 /* Create memory context for PhImage_t */ |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
806 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
|
807 if (tdata->pcontext==NULL) |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
808 { |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
809 /* Destroy PhImage */ |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
810 if (tdata->psurface!=NULL) |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
811 { |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
812 if (tdata->psurface->palette!=NULL) |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
813 { |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
814 SDL_free(tdata->psurface->palette); |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
815 tdata->psurface->palette=NULL; |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
816 } |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
817 /* Destroy shared memory for PhImage_t */ |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
818 PgShmemDestroy(tdata->psurface->image); |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
819 tdata->psurface->image=NULL; |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
820 SDL_free(tdata->psurface); |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
821 tdata->psurface=NULL; |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
822 } |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
823 } |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
824 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
|
825 } |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
826 else |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
827 { |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
828 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
|
829 } |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
830 |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
831 return 0; |
3092
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
832 } |
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
833 |
3139 | 834 static int |
835 photon_querytexturepixels(SDL_Renderer * renderer, SDL_Texture * texture, | |
836 void **pixels, int *pitch) | |
837 { | |
3383
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
838 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
|
839 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
|
840 |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
841 /* Check, if it is not initialized */ |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
842 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
|
843 { |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
844 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
|
845 return -1; |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
846 } |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
847 |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
848 /* Clear outcoming parameters */ |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
849 *pixels=NULL; |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
850 *pitch=0; |
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 switch (tdata->surface_type) |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
853 { |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
854 case SDL_PHOTON_SURFTYPE_OFFSCREEN: |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
855 *pixels=(void*)PdGetOffscreenContextPtr(tdata->osurface); |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
856 *pitch=tdata->osurface->pitch; |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
857 break; |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
858 case SDL_PHOTON_SURFTYPE_PHIMAGE: |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
859 *pixels=(void*)tdata->psurface->image; |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
860 *pitch=tdata->psurface->bpl; |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
861 break; |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
862 default: |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
863 break; |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
864 } |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
865 |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
866 return 0; |
3139 | 867 } |
868 | |
869 static int | |
870 photon_settexturepalette(SDL_Renderer * renderer, SDL_Texture * texture, | |
871 const SDL_Color * colors, int firstcolor, | |
872 int ncolors) | |
3092
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
873 { |
3383
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
874 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
|
875 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
|
876 |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
877 /* Check, if it is not initialized */ |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
878 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
|
879 { |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
880 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
|
881 return -1; |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
882 } |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
883 |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
884 if (texture->format!=SDL_PIXELFORMAT_INDEX8) |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
885 { |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
886 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
|
887 return -1; |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
888 } |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
889 |
3386
fff074de9675
Photon SDL renderer almost finished, the double/tripple buffering is left only.
Mike Gorchak <lestat@i.com.ua>
parents:
3384
diff
changeset
|
890 SDL_Unsupported(); |
3383
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
891 return -1; |
3092
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
892 } |
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
893 |
3139 | 894 static int |
895 photon_gettexturepalette(SDL_Renderer * renderer, SDL_Texture * texture, | |
896 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
|
897 { |
3383
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
898 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
|
899 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
|
900 |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
901 /* Check, if it is not initialized */ |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
902 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
|
903 { |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
904 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
|
905 return -1; |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
906 } |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
907 |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
908 if (texture->format!=SDL_PIXELFORMAT_INDEX8) |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
909 { |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
910 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
|
911 return -1; |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
912 } |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
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_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
|
920 { |
3386
fff074de9675
Photon SDL renderer almost finished, the double/tripple buffering is left only.
Mike Gorchak <lestat@i.com.ua>
parents:
3384
diff
changeset
|
921 SDL_Unsupported(); |
3383
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
922 return -1; |
3092
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
923 } |
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
924 |
3139 | 925 static int |
926 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
|
927 { |
3386
fff074de9675
Photon SDL renderer almost finished, the double/tripple buffering is left only.
Mike Gorchak <lestat@i.com.ua>
parents:
3384
diff
changeset
|
928 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
|
929 |
fff074de9675
Photon SDL renderer almost finished, the double/tripple buffering is left only.
Mike Gorchak <lestat@i.com.ua>
parents:
3384
diff
changeset
|
930 /* 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
|
931 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
|
932 { |
fff074de9675
Photon SDL renderer almost finished, the double/tripple buffering is left only.
Mike Gorchak <lestat@i.com.ua>
parents:
3384
diff
changeset
|
933 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
|
934 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
|
935 } |
fff074de9675
Photon SDL renderer almost finished, the double/tripple buffering is left only.
Mike Gorchak <lestat@i.com.ua>
parents:
3384
diff
changeset
|
936 |
fff074de9675
Photon SDL renderer almost finished, the double/tripple buffering is left only.
Mike Gorchak <lestat@i.com.ua>
parents:
3384
diff
changeset
|
937 /* 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
|
938 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
|
939 { |
fff074de9675
Photon SDL renderer almost finished, the double/tripple buffering is left only.
Mike Gorchak <lestat@i.com.ua>
parents:
3384
diff
changeset
|
940 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
|
941 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
|
942 } |
fff074de9675
Photon SDL renderer almost finished, the double/tripple buffering is left only.
Mike Gorchak <lestat@i.com.ua>
parents:
3384
diff
changeset
|
943 |
fff074de9675
Photon SDL renderer almost finished, the double/tripple buffering is left only.
Mike Gorchak <lestat@i.com.ua>
parents:
3384
diff
changeset
|
944 return 0; |
3092
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
945 } |
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
946 |
3139 | 947 static int |
948 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
|
949 { |
3383
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
950 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
|
951 |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
952 /* Check, if it is not initialized */ |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
953 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
|
954 { |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
955 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
|
956 return -1; |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
957 } |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
958 |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
959 switch (texture->blendMode) |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
960 { |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
961 case SDL_BLENDMODE_NONE: |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
962 case SDL_BLENDMODE_MASK: |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
963 case SDL_BLENDMODE_BLEND: |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
964 case SDL_BLENDMODE_ADD: |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
965 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
|
966 return 0; |
3383
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
967 default: |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
968 SDL_Unsupported(); |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
969 texture->blendMode = SDL_BLENDMODE_NONE; |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
970 return -1; |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
971 } |
3092
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
972 } |
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
973 |
3139 | 974 static int |
975 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
|
976 { |
3384
04af265172f9
Continue working on 2D support in Photon.
Mike Gorchak <lestat@i.com.ua>
parents:
3383
diff
changeset
|
977 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
|
978 |
04af265172f9
Continue working on 2D support in Photon.
Mike Gorchak <lestat@i.com.ua>
parents:
3383
diff
changeset
|
979 switch (texture->scaleMode) |
04af265172f9
Continue working on 2D support in Photon.
Mike Gorchak <lestat@i.com.ua>
parents:
3383
diff
changeset
|
980 { |
04af265172f9
Continue working on 2D support in Photon.
Mike Gorchak <lestat@i.com.ua>
parents:
3383
diff
changeset
|
981 case SDL_TEXTURESCALEMODE_NONE: |
04af265172f9
Continue working on 2D support in Photon.
Mike Gorchak <lestat@i.com.ua>
parents:
3383
diff
changeset
|
982 return 0; |
04af265172f9
Continue working on 2D support in Photon.
Mike Gorchak <lestat@i.com.ua>
parents:
3383
diff
changeset
|
983 case SDL_TEXTURESCALEMODE_FAST: |
04af265172f9
Continue working on 2D support in Photon.
Mike Gorchak <lestat@i.com.ua>
parents:
3383
diff
changeset
|
984 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
|
985 { |
04af265172f9
Continue working on 2D support in Photon.
Mike Gorchak <lestat@i.com.ua>
parents:
3383
diff
changeset
|
986 return 0; |
04af265172f9
Continue working on 2D support in Photon.
Mike Gorchak <lestat@i.com.ua>
parents:
3383
diff
changeset
|
987 } |
04af265172f9
Continue working on 2D support in Photon.
Mike Gorchak <lestat@i.com.ua>
parents:
3383
diff
changeset
|
988 else |
04af265172f9
Continue working on 2D support in Photon.
Mike Gorchak <lestat@i.com.ua>
parents:
3383
diff
changeset
|
989 { |
04af265172f9
Continue working on 2D support in Photon.
Mike Gorchak <lestat@i.com.ua>
parents:
3383
diff
changeset
|
990 SDL_Unsupported(); |
04af265172f9
Continue working on 2D support in Photon.
Mike Gorchak <lestat@i.com.ua>
parents:
3383
diff
changeset
|
991 texture->scaleMode = SDL_TEXTURESCALEMODE_FAST; |
04af265172f9
Continue working on 2D support in Photon.
Mike Gorchak <lestat@i.com.ua>
parents:
3383
diff
changeset
|
992 return -1; |
04af265172f9
Continue working on 2D support in Photon.
Mike Gorchak <lestat@i.com.ua>
parents:
3383
diff
changeset
|
993 } |
04af265172f9
Continue working on 2D support in Photon.
Mike Gorchak <lestat@i.com.ua>
parents:
3383
diff
changeset
|
994 break; |
04af265172f9
Continue working on 2D support in Photon.
Mike Gorchak <lestat@i.com.ua>
parents:
3383
diff
changeset
|
995 case SDL_TEXTURESCALEMODE_SLOW: |
04af265172f9
Continue working on 2D support in Photon.
Mike Gorchak <lestat@i.com.ua>
parents:
3383
diff
changeset
|
996 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
|
997 { |
04af265172f9
Continue working on 2D support in Photon.
Mike Gorchak <lestat@i.com.ua>
parents:
3383
diff
changeset
|
998 return 0; |
04af265172f9
Continue working on 2D support in Photon.
Mike Gorchak <lestat@i.com.ua>
parents:
3383
diff
changeset
|
999 } |
04af265172f9
Continue working on 2D support in Photon.
Mike Gorchak <lestat@i.com.ua>
parents:
3383
diff
changeset
|
1000 else |
04af265172f9
Continue working on 2D support in Photon.
Mike Gorchak <lestat@i.com.ua>
parents:
3383
diff
changeset
|
1001 { |
04af265172f9
Continue working on 2D support in Photon.
Mike Gorchak <lestat@i.com.ua>
parents:
3383
diff
changeset
|
1002 SDL_Unsupported(); |
04af265172f9
Continue working on 2D support in Photon.
Mike Gorchak <lestat@i.com.ua>
parents:
3383
diff
changeset
|
1003 texture->scaleMode = SDL_TEXTURESCALEMODE_SLOW; |
04af265172f9
Continue working on 2D support in Photon.
Mike Gorchak <lestat@i.com.ua>
parents:
3383
diff
changeset
|
1004 return -1; |
04af265172f9
Continue working on 2D support in Photon.
Mike Gorchak <lestat@i.com.ua>
parents:
3383
diff
changeset
|
1005 } |
04af265172f9
Continue working on 2D support in Photon.
Mike Gorchak <lestat@i.com.ua>
parents:
3383
diff
changeset
|
1006 break; |
04af265172f9
Continue working on 2D support in Photon.
Mike Gorchak <lestat@i.com.ua>
parents:
3383
diff
changeset
|
1007 case SDL_TEXTURESCALEMODE_BEST: |
04af265172f9
Continue working on 2D support in Photon.
Mike Gorchak <lestat@i.com.ua>
parents:
3383
diff
changeset
|
1008 SDL_Unsupported(); |
04af265172f9
Continue working on 2D support in Photon.
Mike Gorchak <lestat@i.com.ua>
parents:
3383
diff
changeset
|
1009 texture->scaleMode = SDL_TEXTURESCALEMODE_SLOW; |
04af265172f9
Continue working on 2D support in Photon.
Mike Gorchak <lestat@i.com.ua>
parents:
3383
diff
changeset
|
1010 return -1; |
04af265172f9
Continue working on 2D support in Photon.
Mike Gorchak <lestat@i.com.ua>
parents:
3383
diff
changeset
|
1011 default: |
04af265172f9
Continue working on 2D support in Photon.
Mike Gorchak <lestat@i.com.ua>
parents:
3383
diff
changeset
|
1012 SDL_Unsupported(); |
04af265172f9
Continue working on 2D support in Photon.
Mike Gorchak <lestat@i.com.ua>
parents:
3383
diff
changeset
|
1013 texture->scaleMode = SDL_TEXTURESCALEMODE_NONE; |
04af265172f9
Continue working on 2D support in Photon.
Mike Gorchak <lestat@i.com.ua>
parents:
3383
diff
changeset
|
1014 return -1; |
04af265172f9
Continue working on 2D support in Photon.
Mike Gorchak <lestat@i.com.ua>
parents:
3383
diff
changeset
|
1015 } |
04af265172f9
Continue working on 2D support in Photon.
Mike Gorchak <lestat@i.com.ua>
parents:
3383
diff
changeset
|
1016 |
3386
fff074de9675
Photon SDL renderer almost finished, the double/tripple buffering is left only.
Mike Gorchak <lestat@i.com.ua>
parents:
3384
diff
changeset
|
1017 SDL_Unsupported(); |
3383
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1018 return -1; |
3092
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1019 } |
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1020 |
3139 | 1021 static int |
1022 photon_updatetexture(SDL_Renderer * renderer, SDL_Texture * texture, | |
1023 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
|
1024 { |
3383
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1025 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
|
1026 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
|
1027 |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1028 uint8_t* src=(uint8_t*)pixels; |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1029 uint8_t* dst; |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1030 uint32_t dst_pitch; |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1031 uint32_t it; |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1032 uint32_t copy_length; |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1033 |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1034 /* Check, if it is not initialized */ |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1035 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
|
1036 { |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1037 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
|
1038 return -1; |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1039 } |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1040 |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1041 switch (tdata->surface_type) |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1042 { |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1043 case SDL_PHOTON_SURFTYPE_OFFSCREEN: |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1044 dst=(uint8_t*)PdGetOffscreenContextPtr(tdata->osurface); |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1045 dst_pitch=tdata->osurface->pitch; |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1046 if (dst==NULL) |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1047 { |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1048 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
|
1049 return -1; |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1050 } |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1051 break; |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1052 case SDL_PHOTON_SURFTYPE_PHIMAGE: |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1053 dst=(uint8_t*)tdata->psurface->image; |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1054 dst_pitch=tdata->psurface->bpl; |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1055 if (dst==NULL) |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1056 { |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1057 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
|
1058 return -1; |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1059 } |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1060 break; |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1061 default: |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1062 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
|
1063 return -1; |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1064 } |
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 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
|
1067 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
|
1068 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
|
1069 { |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1070 SDL_memcpy(dst, src, copy_length); |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1071 src+=pitch; |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1072 dst+=dst_pitch; |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1073 } |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1074 |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1075 return 0; |
3092
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1076 } |
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1077 |
3139 | 1078 static int |
1079 photon_locktexture(SDL_Renderer * renderer, SDL_Texture * texture, | |
1080 const SDL_Rect * rect, int markDirty, void **pixels, | |
1081 int *pitch) | |
3092
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1082 { |
3383
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1083 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
|
1084 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
|
1085 |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1086 /* Check, if it is not initialized */ |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1087 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
|
1088 { |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1089 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
|
1090 return -1; |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1091 } |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1092 |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1093 /* Clear outcoming parameters */ |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1094 *pixels=NULL; |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1095 *pitch=0; |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1096 |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1097 switch (tdata->surface_type) |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1098 { |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1099 case SDL_PHOTON_SURFTYPE_OFFSCREEN: |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1100 *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
|
1101 rect->y * tdata->osurface->pitch + |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1102 rect->x * SDL_BYTESPERPIXEL(texture->format)); |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1103 *pitch=tdata->osurface->pitch; |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1104 break; |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1105 case SDL_PHOTON_SURFTYPE_PHIMAGE: |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1106 *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
|
1107 rect->y * tdata->osurface->pitch + |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1108 rect->x * SDL_BYTESPERPIXEL(texture->format)); |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1109 *pitch=tdata->psurface->bpl; |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1110 break; |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1111 default: |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1112 break; |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1113 } |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1114 |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1115 return 0; |
3092
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1116 } |
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1117 |
3139 | 1118 static void |
1119 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
|
1120 { |
3383
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1121 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
|
1122 |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1123 /* Check, if it is not initialized */ |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1124 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
|
1125 { |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1126 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
|
1127 return; |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1128 } |
3092
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1129 } |
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1130 |
3139 | 1131 static void |
1132 photon_dirtytexture(SDL_Renderer * renderer, SDL_Texture * texture, | |
1133 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
|
1134 { |
3386
fff074de9675
Photon SDL renderer almost finished, the double/tripple buffering is left only.
Mike Gorchak <lestat@i.com.ua>
parents:
3384
diff
changeset
|
1135 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
|
1136 |
3384
04af265172f9
Continue working on 2D support in Photon.
Mike Gorchak <lestat@i.com.ua>
parents:
3383
diff
changeset
|
1137 /* Check, if it is not initialized */ |
04af265172f9
Continue working on 2D support in Photon.
Mike Gorchak <lestat@i.com.ua>
parents:
3383
diff
changeset
|
1138 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
|
1139 { |
04af265172f9
Continue working on 2D support in Photon.
Mike Gorchak <lestat@i.com.ua>
parents:
3383
diff
changeset
|
1140 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
|
1141 return; |
04af265172f9
Continue working on 2D support in Photon.
Mike Gorchak <lestat@i.com.ua>
parents:
3383
diff
changeset
|
1142 } |
3092
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1143 } |
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1144 |
3139 | 1145 static int |
3375
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
1146 photon_setdrawcolor(SDL_Renderer * renderer) |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
1147 { |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
1148 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
|
1149 |
3383
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1150 /* Check, if it is not initialized */ |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1151 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
|
1152 { |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1153 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
|
1154 return -1; |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1155 } |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1156 |
3375
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
1157 switch (rdata->surfaces_type) |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
1158 { |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
1159 case SDL_PHOTON_SURFTYPE_OFFSCREEN: |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
1160 case SDL_PHOTON_SURFTYPE_PHIMAGE: |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
1161 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
|
1162 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
|
1163 break; |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
1164 case SDL_PHOTON_SURFTYPE_UNKNOWN: |
3383
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1165 default: |
3375
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
1166 break; |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
1167 } |
3383
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1168 |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1169 return 0; |
3375
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
1170 } |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
1171 |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
1172 static int |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
1173 photon_setdrawblendmode(SDL_Renderer * renderer) |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
1174 { |
3396
d6b79fc83362
All 2D operations in Photon driver have been finished. The driver is ready to use. There fullscreen modes and YUV textures are rest only.
Mike Gorchak <lestat@i.com.ua>
parents:
3387
diff
changeset
|
1175 SDL_RenderData *rdata = (SDL_RenderData *) renderer->driverdata; |
d6b79fc83362
All 2D operations in Photon driver have been finished. The driver is ready to use. There fullscreen modes and YUV textures are rest only.
Mike Gorchak <lestat@i.com.ua>
parents:
3387
diff
changeset
|
1176 |
d6b79fc83362
All 2D operations in Photon driver have been finished. The driver is ready to use. There fullscreen modes and YUV textures are rest only.
Mike Gorchak <lestat@i.com.ua>
parents:
3387
diff
changeset
|
1177 /* Check, if it is not initialized */ |
d6b79fc83362
All 2D operations in Photon driver have been finished. The driver is ready to use. There fullscreen modes and YUV textures are rest only.
Mike Gorchak <lestat@i.com.ua>
parents:
3387
diff
changeset
|
1178 if (rdata->surfaces_type==SDL_PHOTON_SURFTYPE_UNKNOWN) |
d6b79fc83362
All 2D operations in Photon driver have been finished. The driver is ready to use. There fullscreen modes and YUV textures are rest only.
Mike Gorchak <lestat@i.com.ua>
parents:
3387
diff
changeset
|
1179 { |
d6b79fc83362
All 2D operations in Photon driver have been finished. The driver is ready to use. There fullscreen modes and YUV textures are rest only.
Mike Gorchak <lestat@i.com.ua>
parents:
3387
diff
changeset
|
1180 SDL_SetError("Photon: can't set texture blend mode for OpenGL ES window"); |
d6b79fc83362
All 2D operations in Photon driver have been finished. The driver is ready to use. There fullscreen modes and YUV textures are rest only.
Mike Gorchak <lestat@i.com.ua>
parents:
3387
diff
changeset
|
1181 return -1; |
d6b79fc83362
All 2D operations in Photon driver have been finished. The driver is ready to use. There fullscreen modes and YUV textures are rest only.
Mike Gorchak <lestat@i.com.ua>
parents:
3387
diff
changeset
|
1182 } |
d6b79fc83362
All 2D operations in Photon driver have been finished. The driver is ready to use. There fullscreen modes and YUV textures are rest only.
Mike Gorchak <lestat@i.com.ua>
parents:
3387
diff
changeset
|
1183 |
d6b79fc83362
All 2D operations in Photon driver have been finished. The driver is ready to use. There fullscreen modes and YUV textures are rest only.
Mike Gorchak <lestat@i.com.ua>
parents:
3387
diff
changeset
|
1184 switch (renderer->blendMode) |
d6b79fc83362
All 2D operations in Photon driver have been finished. The driver is ready to use. There fullscreen modes and YUV textures are rest only.
Mike Gorchak <lestat@i.com.ua>
parents:
3387
diff
changeset
|
1185 { |
d6b79fc83362
All 2D operations in Photon driver have been finished. The driver is ready to use. There fullscreen modes and YUV textures are rest only.
Mike Gorchak <lestat@i.com.ua>
parents:
3387
diff
changeset
|
1186 case SDL_BLENDMODE_NONE: |
d6b79fc83362
All 2D operations in Photon driver have been finished. The driver is ready to use. There fullscreen modes and YUV textures are rest only.
Mike Gorchak <lestat@i.com.ua>
parents:
3387
diff
changeset
|
1187 case SDL_BLENDMODE_MASK: |
d6b79fc83362
All 2D operations in Photon driver have been finished. The driver is ready to use. There fullscreen modes and YUV textures are rest only.
Mike Gorchak <lestat@i.com.ua>
parents:
3387
diff
changeset
|
1188 case SDL_BLENDMODE_BLEND: |
d6b79fc83362
All 2D operations in Photon driver have been finished. The driver is ready to use. There fullscreen modes and YUV textures are rest only.
Mike Gorchak <lestat@i.com.ua>
parents:
3387
diff
changeset
|
1189 case SDL_BLENDMODE_ADD: |
d6b79fc83362
All 2D operations in Photon driver have been finished. The driver is ready to use. There fullscreen modes and YUV textures are rest only.
Mike Gorchak <lestat@i.com.ua>
parents:
3387
diff
changeset
|
1190 case SDL_BLENDMODE_MOD: |
d6b79fc83362
All 2D operations in Photon driver have been finished. The driver is ready to use. There fullscreen modes and YUV textures are rest only.
Mike Gorchak <lestat@i.com.ua>
parents:
3387
diff
changeset
|
1191 return 0; |
d6b79fc83362
All 2D operations in Photon driver have been finished. The driver is ready to use. There fullscreen modes and YUV textures are rest only.
Mike Gorchak <lestat@i.com.ua>
parents:
3387
diff
changeset
|
1192 default: |
d6b79fc83362
All 2D operations in Photon driver have been finished. The driver is ready to use. There fullscreen modes and YUV textures are rest only.
Mike Gorchak <lestat@i.com.ua>
parents:
3387
diff
changeset
|
1193 SDL_Unsupported(); |
d6b79fc83362
All 2D operations in Photon driver have been finished. The driver is ready to use. There fullscreen modes and YUV textures are rest only.
Mike Gorchak <lestat@i.com.ua>
parents:
3387
diff
changeset
|
1194 renderer->blendMode = SDL_BLENDMODE_NONE; |
d6b79fc83362
All 2D operations in Photon driver have been finished. The driver is ready to use. There fullscreen modes and YUV textures are rest only.
Mike Gorchak <lestat@i.com.ua>
parents:
3387
diff
changeset
|
1195 return -1; |
d6b79fc83362
All 2D operations in Photon driver have been finished. The driver is ready to use. There fullscreen modes and YUV textures are rest only.
Mike Gorchak <lestat@i.com.ua>
parents:
3387
diff
changeset
|
1196 } |
d6b79fc83362
All 2D operations in Photon driver have been finished. The driver is ready to use. There fullscreen modes and YUV textures are rest only.
Mike Gorchak <lestat@i.com.ua>
parents:
3387
diff
changeset
|
1197 |
d6b79fc83362
All 2D operations in Photon driver have been finished. The driver is ready to use. There fullscreen modes and YUV textures are rest only.
Mike Gorchak <lestat@i.com.ua>
parents:
3387
diff
changeset
|
1198 return 0; |
3375
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
1199 } |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
1200 |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
1201 static int |
3139 | 1202 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
|
1203 { |
3375
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
1204 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
|
1205 |
3383
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1206 /* Check, if it is not initialized */ |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1207 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
|
1208 { |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1209 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
|
1210 return -1; |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1211 } |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1212 |
3396
d6b79fc83362
All 2D operations in Photon driver have been finished. The driver is ready to use. There fullscreen modes and YUV textures are rest only.
Mike Gorchak <lestat@i.com.ua>
parents:
3387
diff
changeset
|
1213 /* Enable blending, if requested */ |
d6b79fc83362
All 2D operations in Photon driver have been finished. The driver is ready to use. There fullscreen modes and YUV textures are rest only.
Mike Gorchak <lestat@i.com.ua>
parents:
3387
diff
changeset
|
1214 _photon_set_blending(renderer, renderer->blendMode, renderer->a, SDL_PHOTON_DRAW_BLEND); |
d6b79fc83362
All 2D operations in Photon driver have been finished. The driver is ready to use. There fullscreen modes and YUV textures are rest only.
Mike Gorchak <lestat@i.com.ua>
parents:
3387
diff
changeset
|
1215 |
3375
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
1216 switch (rdata->surfaces_type) |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
1217 { |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
1218 case SDL_PHOTON_SURFTYPE_OFFSCREEN: |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
1219 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
|
1220 break; |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
1221 case SDL_PHOTON_SURFTYPE_PHIMAGE: |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
1222 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
|
1223 break; |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
1224 case SDL_PHOTON_SURFTYPE_UNKNOWN: |
3383
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1225 default: |
3375
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
1226 break; |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
1227 } |
3383
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1228 |
3396
d6b79fc83362
All 2D operations in Photon driver have been finished. The driver is ready to use. There fullscreen modes and YUV textures are rest only.
Mike Gorchak <lestat@i.com.ua>
parents:
3387
diff
changeset
|
1229 /* Disable blending, if it was enabled */ |
d6b79fc83362
All 2D operations in Photon driver have been finished. The driver is ready to use. There fullscreen modes and YUV textures are rest only.
Mike Gorchak <lestat@i.com.ua>
parents:
3387
diff
changeset
|
1230 _photon_reset_blending(renderer, renderer->blendMode, SDL_PHOTON_DRAW_BLEND); |
d6b79fc83362
All 2D operations in Photon driver have been finished. The driver is ready to use. There fullscreen modes and YUV textures are rest only.
Mike Gorchak <lestat@i.com.ua>
parents:
3387
diff
changeset
|
1231 |
3383
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1232 return 0; |
3092
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1233 } |
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1234 |
3139 | 1235 static int |
1236 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
|
1237 { |
3375
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
1238 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
|
1239 |
3383
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1240 /* Check, if it is not initialized */ |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1241 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
|
1242 { |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1243 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
|
1244 return -1; |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1245 } |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1246 |
3396
d6b79fc83362
All 2D operations in Photon driver have been finished. The driver is ready to use. There fullscreen modes and YUV textures are rest only.
Mike Gorchak <lestat@i.com.ua>
parents:
3387
diff
changeset
|
1247 /* Enable blending, if requested */ |
d6b79fc83362
All 2D operations in Photon driver have been finished. The driver is ready to use. There fullscreen modes and YUV textures are rest only.
Mike Gorchak <lestat@i.com.ua>
parents:
3387
diff
changeset
|
1248 _photon_set_blending(renderer, renderer->blendMode, renderer->a, SDL_PHOTON_DRAW_BLEND); |
d6b79fc83362
All 2D operations in Photon driver have been finished. The driver is ready to use. There fullscreen modes and YUV textures are rest only.
Mike Gorchak <lestat@i.com.ua>
parents:
3387
diff
changeset
|
1249 |
3375
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
1250 switch (rdata->surfaces_type) |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
1251 { |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
1252 case SDL_PHOTON_SURFTYPE_OFFSCREEN: |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
1253 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
|
1254 break; |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
1255 case SDL_PHOTON_SURFTYPE_PHIMAGE: |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
1256 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
|
1257 break; |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
1258 case SDL_PHOTON_SURFTYPE_UNKNOWN: |
3383
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1259 default: |
3375
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
1260 break; |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
1261 } |
3383
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1262 |
3396
d6b79fc83362
All 2D operations in Photon driver have been finished. The driver is ready to use. There fullscreen modes and YUV textures are rest only.
Mike Gorchak <lestat@i.com.ua>
parents:
3387
diff
changeset
|
1263 /* Disable blending, if it was enabled */ |
d6b79fc83362
All 2D operations in Photon driver have been finished. The driver is ready to use. There fullscreen modes and YUV textures are rest only.
Mike Gorchak <lestat@i.com.ua>
parents:
3387
diff
changeset
|
1264 _photon_reset_blending(renderer, renderer->blendMode, SDL_PHOTON_DRAW_BLEND); |
d6b79fc83362
All 2D operations in Photon driver have been finished. The driver is ready to use. There fullscreen modes and YUV textures are rest only.
Mike Gorchak <lestat@i.com.ua>
parents:
3387
diff
changeset
|
1265 |
3383
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1266 return 0; |
3092
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1267 } |
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1268 |
3139 | 1269 static int |
1270 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
|
1271 { |
3375
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
1272 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
|
1273 |
3383
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1274 /* Check, if it is not initialized */ |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1275 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
|
1276 { |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1277 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
|
1278 return -1; |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1279 } |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1280 |
3396
d6b79fc83362
All 2D operations in Photon driver have been finished. The driver is ready to use. There fullscreen modes and YUV textures are rest only.
Mike Gorchak <lestat@i.com.ua>
parents:
3387
diff
changeset
|
1281 /* Enable blending, if requested */ |
d6b79fc83362
All 2D operations in Photon driver have been finished. The driver is ready to use. There fullscreen modes and YUV textures are rest only.
Mike Gorchak <lestat@i.com.ua>
parents:
3387
diff
changeset
|
1282 _photon_set_blending(renderer, renderer->blendMode, renderer->a, SDL_PHOTON_DRAW_BLEND); |
d6b79fc83362
All 2D operations in Photon driver have been finished. The driver is ready to use. There fullscreen modes and YUV textures are rest only.
Mike Gorchak <lestat@i.com.ua>
parents:
3387
diff
changeset
|
1283 |
3375
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
1284 switch (rdata->surfaces_type) |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
1285 { |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
1286 case SDL_PHOTON_SURFTYPE_OFFSCREEN: |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
1287 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
|
1288 break; |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
1289 case SDL_PHOTON_SURFTYPE_PHIMAGE: |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
1290 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
|
1291 break; |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
1292 case SDL_PHOTON_SURFTYPE_UNKNOWN: |
3383
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1293 default: |
3375
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
1294 break; |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
1295 } |
3396
d6b79fc83362
All 2D operations in Photon driver have been finished. The driver is ready to use. There fullscreen modes and YUV textures are rest only.
Mike Gorchak <lestat@i.com.ua>
parents:
3387
diff
changeset
|
1296 |
d6b79fc83362
All 2D operations in Photon driver have been finished. The driver is ready to use. There fullscreen modes and YUV textures are rest only.
Mike Gorchak <lestat@i.com.ua>
parents:
3387
diff
changeset
|
1297 /* Disable blending, if it was enabled */ |
d6b79fc83362
All 2D operations in Photon driver have been finished. The driver is ready to use. There fullscreen modes and YUV textures are rest only.
Mike Gorchak <lestat@i.com.ua>
parents:
3387
diff
changeset
|
1298 _photon_reset_blending(renderer, renderer->blendMode, SDL_PHOTON_DRAW_BLEND); |
d6b79fc83362
All 2D operations in Photon driver have been finished. The driver is ready to use. There fullscreen modes and YUV textures are rest only.
Mike Gorchak <lestat@i.com.ua>
parents:
3387
diff
changeset
|
1299 |
d6b79fc83362
All 2D operations in Photon driver have been finished. The driver is ready to use. There fullscreen modes and YUV textures are rest only.
Mike Gorchak <lestat@i.com.ua>
parents:
3387
diff
changeset
|
1300 return 0; |
3092
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1301 } |
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1302 |
3139 | 1303 static int |
1304 photon_rendercopy(SDL_Renderer * renderer, SDL_Texture * texture, | |
1305 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
|
1306 { |
3383
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1307 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
|
1308 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
|
1309 |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1310 PhRect_t src_rect; |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1311 PhRect_t dst_rect; |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1312 PhPoint_t dst_point; |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1313 |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1314 /* Check, if it is not initialized */ |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1315 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
|
1316 { |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1317 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
|
1318 return -1; |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1319 } |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1320 |
3396
d6b79fc83362
All 2D operations in Photon driver have been finished. The driver is ready to use. There fullscreen modes and YUV textures are rest only.
Mike Gorchak <lestat@i.com.ua>
parents:
3387
diff
changeset
|
1321 _photon_set_blending(renderer, texture->blendMode, texture->a, SDL_PHOTON_TEXTURE_BLEND); |
3383
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1322 |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1323 /* Set source blit area */ |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1324 src_rect.ul.x = srcrect->x; |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1325 src_rect.ul.y = srcrect->y; |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1326 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
|
1327 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
|
1328 |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1329 /* Set destination blit area */ |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1330 dst_rect.ul.x = dstrect->x; |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1331 dst_rect.ul.y = dstrect->y; |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1332 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
|
1333 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
|
1334 |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1335 /* Set destination point */ |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1336 dst_point.x = dstrect->x; |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1337 dst_point.y = dstrect->y; |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1338 |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1339 /* Do blit */ |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1340 switch (rdata->surfaces_type) |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1341 { |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1342 case SDL_PHOTON_SURFTYPE_OFFSCREEN: |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1343 /* two possible combinations */ |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1344 switch (tdata->surface_type) |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1345 { |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1346 case SDL_PHOTON_SURFTYPE_OFFSCREEN: |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1347 /* easiest full accelerated combination: offscreen->offscreen */ |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1348 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
|
1349 &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
|
1350 break; |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1351 case SDL_PHOTON_SURFTYPE_PHIMAGE: |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1352 /* not accelerated combination: PhImage->offscreen */ |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1353 /* 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
|
1354 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
|
1355 tdata->psurface, &src_rect, 0); |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1356 break; |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1357 default: |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1358 break; |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1359 } |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1360 break; |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1361 case SDL_PHOTON_SURFTYPE_PHIMAGE: |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1362 /* two possible combinations */ |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1363 switch (tdata->surface_type) |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1364 { |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1365 case SDL_PHOTON_SURFTYPE_OFFSCREEN: |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1366 /* not supported combination: offscreen->PhImage */ |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1367 return -1; |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1368 case SDL_PHOTON_SURFTYPE_PHIMAGE: |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1369 /* 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
|
1370 /* 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
|
1371 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
|
1372 break; |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1373 default: |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1374 break; |
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 break; |
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 |
3396
d6b79fc83362
All 2D operations in Photon driver have been finished. The driver is ready to use. There fullscreen modes and YUV textures are rest only.
Mike Gorchak <lestat@i.com.ua>
parents:
3387
diff
changeset
|
1379 _photon_reset_blending(renderer, texture->blendMode, SDL_PHOTON_TEXTURE_BLEND); |
3383
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 return 0; |
3092
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1382 } |
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1383 |
3139 | 1384 static void |
1385 photon_renderpresent(SDL_Renderer * renderer) | |
3092
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1386 { |
3375
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
1387 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
|
1388 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
|
1389 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
|
1390 PhRect_t src_rect; |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
1391 PhPoint_t src_point; |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
1392 |
3383
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1393 /* Check, if it is not initialized */ |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1394 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
|
1395 { |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1396 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
|
1397 return; |
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 |
3375
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
1400 /* 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
|
1401 switch (rdata->surfaces_type) |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
1402 { |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
1403 case SDL_PHOTON_SURFTYPE_OFFSCREEN: |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
1404 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
|
1405 PgWaitHWIdle(); |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
1406 break; |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
1407 case SDL_PHOTON_SURFTYPE_PHIMAGE: |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
1408 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
|
1409 break; |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
1410 case SDL_PHOTON_SURFTYPE_UNKNOWN: |
3383
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1411 default: |
3375
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
1412 return; |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
1413 } |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
1414 |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
1415 PgFFlush(Ph_START_DRAW); |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
1416 PgSetRegionCx(PhDCGetCurrent(), PtWidgetRid(wdata->window)); |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
1417 |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
1418 /* Set blit area */ |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
1419 src_rect.ul.x = 0; |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
1420 src_rect.ul.y = 0; |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
1421 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
|
1422 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
|
1423 |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
1424 src_point.x = 0; |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
1425 src_point.y = 0; |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
1426 |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
1427 switch (rdata->surfaces_type) |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
1428 { |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
1429 case SDL_PHOTON_SURFTYPE_OFFSCREEN: |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
1430 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
|
1431 break; |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
1432 case SDL_PHOTON_SURFTYPE_PHIMAGE: |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
1433 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
|
1434 break; |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
1435 case SDL_PHOTON_SURFTYPE_UNKNOWN: |
3383
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1436 default: |
3375
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
1437 break; |
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 /* finish blit */ |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
1441 PgFFlush(Ph_DONE_DRAW); |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
1442 PgWaitHWIdle(); |
3396
d6b79fc83362
All 2D operations in Photon driver have been finished. The driver is ready to use. There fullscreen modes and YUV textures are rest only.
Mike Gorchak <lestat@i.com.ua>
parents:
3387
diff
changeset
|
1443 |
d6b79fc83362
All 2D operations in Photon driver have been finished. The driver is ready to use. There fullscreen modes and YUV textures are rest only.
Mike Gorchak <lestat@i.com.ua>
parents:
3387
diff
changeset
|
1444 /* Check if we are using double buffering */ |
d6b79fc83362
All 2D operations in Photon driver have been finished. The driver is ready to use. There fullscreen modes and YUV textures are rest only.
Mike Gorchak <lestat@i.com.ua>
parents:
3387
diff
changeset
|
1445 if ((renderer->info.flags & SDL_RENDERER_PRESENTFLIP2) == SDL_RENDERER_PRESENTFLIP2) |
d6b79fc83362
All 2D operations in Photon driver have been finished. The driver is ready to use. There fullscreen modes and YUV textures are rest only.
Mike Gorchak <lestat@i.com.ua>
parents:
3387
diff
changeset
|
1446 { |
d6b79fc83362
All 2D operations in Photon driver have been finished. The driver is ready to use. There fullscreen modes and YUV textures are rest only.
Mike Gorchak <lestat@i.com.ua>
parents:
3387
diff
changeset
|
1447 rdata->surface_visible_idx=rdata->surface_render_idx; |
d6b79fc83362
All 2D operations in Photon driver have been finished. The driver is ready to use. There fullscreen modes and YUV textures are rest only.
Mike Gorchak <lestat@i.com.ua>
parents:
3387
diff
changeset
|
1448 rdata->surface_render_idx=(rdata->surface_render_idx + 1) % 2; |
d6b79fc83362
All 2D operations in Photon driver have been finished. The driver is ready to use. There fullscreen modes and YUV textures are rest only.
Mike Gorchak <lestat@i.com.ua>
parents:
3387
diff
changeset
|
1449 } |
d6b79fc83362
All 2D operations in Photon driver have been finished. The driver is ready to use. There fullscreen modes and YUV textures are rest only.
Mike Gorchak <lestat@i.com.ua>
parents:
3387
diff
changeset
|
1450 |
d6b79fc83362
All 2D operations in Photon driver have been finished. The driver is ready to use. There fullscreen modes and YUV textures are rest only.
Mike Gorchak <lestat@i.com.ua>
parents:
3387
diff
changeset
|
1451 /* Check if we are using triple buffering */ |
d6b79fc83362
All 2D operations in Photon driver have been finished. The driver is ready to use. There fullscreen modes and YUV textures are rest only.
Mike Gorchak <lestat@i.com.ua>
parents:
3387
diff
changeset
|
1452 if ((renderer->info.flags & SDL_RENDERER_PRESENTFLIP3) == SDL_RENDERER_PRESENTFLIP3) |
d6b79fc83362
All 2D operations in Photon driver have been finished. The driver is ready to use. There fullscreen modes and YUV textures are rest only.
Mike Gorchak <lestat@i.com.ua>
parents:
3387
diff
changeset
|
1453 { |
d6b79fc83362
All 2D operations in Photon driver have been finished. The driver is ready to use. There fullscreen modes and YUV textures are rest only.
Mike Gorchak <lestat@i.com.ua>
parents:
3387
diff
changeset
|
1454 rdata->surface_visible_idx=rdata->surface_render_idx; |
d6b79fc83362
All 2D operations in Photon driver have been finished. The driver is ready to use. There fullscreen modes and YUV textures are rest only.
Mike Gorchak <lestat@i.com.ua>
parents:
3387
diff
changeset
|
1455 rdata->surface_render_idx=(rdata->surface_render_idx + 1) % 3; |
d6b79fc83362
All 2D operations in Photon driver have been finished. The driver is ready to use. There fullscreen modes and YUV textures are rest only.
Mike Gorchak <lestat@i.com.ua>
parents:
3387
diff
changeset
|
1456 } |
3092
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1457 } |
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1458 |
3139 | 1459 static void |
1460 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
|
1461 { |
3383
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1462 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
|
1463 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
|
1464 |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1465 /* 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
|
1466 if (tdata==NULL) |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1467 { |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1468 return; |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1469 } |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1470 |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1471 /* Check, if it is not initialized */ |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1472 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
|
1473 { |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1474 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
|
1475 return; |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1476 } |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1477 |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1478 switch (tdata->surface_type) |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1479 { |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1480 case SDL_PHOTON_SURFTYPE_OFFSCREEN: |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1481 if (tdata->osurface!=NULL) |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1482 { |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1483 PhDCRelease(tdata->osurface); |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1484 tdata->osurface = NULL; |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1485 } |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1486 break; |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1487 case SDL_PHOTON_SURFTYPE_PHIMAGE: |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1488 if (tdata->pcontext!=NULL) |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1489 { |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1490 PmMemReleaseMC(tdata->pcontext); |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1491 tdata->pcontext=NULL; |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1492 } |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1493 |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1494 if (tdata->psurface!=NULL) |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1495 { |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1496 if (tdata->psurface->palette!=NULL) |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1497 { |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1498 SDL_free(tdata->psurface->palette); |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1499 tdata->psurface->palette=NULL; |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1500 } |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1501 /* Destroy shared memory for PhImage_t */ |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1502 PgShmemDestroy(tdata->psurface->image); |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1503 tdata->psurface->image=NULL; |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1504 SDL_free(tdata->psurface); |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1505 tdata->psurface=NULL; |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1506 } |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1507 break; |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1508 default: |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1509 break; |
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1510 } |
3092
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1511 } |
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1512 |
3139 | 1513 static void |
1514 photon_destroyrenderer(SDL_Renderer * renderer) | |
3092
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1515 { |
3139 | 1516 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
|
1517 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
|
1518 SDL_WindowData *wdata = (SDL_WindowData *)window->driverdata; |
3139 | 1519 uint32_t it; |
3092
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1520 |
3375
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
1521 /* Destroy graphics context */ |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
1522 if (rdata->gc!=NULL) |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
1523 { |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
1524 PgDestroyGC(rdata->gc); |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
1525 rdata->gc=NULL; |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
1526 } |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
1527 |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
1528 switch (rdata->surfaces_type) |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
1529 { |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
1530 case SDL_PHOTON_SURFTYPE_OFFSCREEN: |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
1531 { |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
1532 /* Destroy current surfaces */ |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
1533 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
|
1534 { |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
1535 if (rdata->osurfaces[it] != NULL) |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
1536 { |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
1537 PhDCRelease(rdata->osurfaces[it]); |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
1538 rdata->osurfaces[it] = NULL; |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
1539 } |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
1540 } |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
1541 } |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
1542 break; |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
1543 case SDL_PHOTON_SURFTYPE_PHIMAGE: |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
1544 { |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
1545 /* Destroy current surfaces */ |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
1546 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
|
1547 { |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
1548 if (rdata->pcontexts[it]!=NULL) |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
1549 { |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
1550 PmMemReleaseMC(rdata->pcontexts[it]); |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
1551 rdata->pcontexts[it]=NULL; |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
1552 } |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
1553 if (rdata->psurfaces[it]!=NULL) |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
1554 { |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
1555 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
|
1556 { |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
1557 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
|
1558 rdata->psurfaces[it]->palette=NULL; |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
1559 } |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
1560 /* 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
|
1561 PgShmemDestroy(rdata->psurfaces[it]->image); |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
1562 rdata->psurfaces[it]->image=NULL; |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
1563 SDL_free(rdata->psurfaces[it]); |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
1564 rdata->psurfaces[it]=NULL; |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
1565 } |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
1566 } |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
1567 } |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
1568 break; |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
1569 case SDL_PHOTON_SURFTYPE_UNKNOWN: |
3383
90935231e9b6
Continue working on 2D support in Photon
Mike Gorchak <lestat@i.com.ua>
parents:
3375
diff
changeset
|
1570 default: |
3375
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
1571 { |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
1572 /* nothing to do */ |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
1573 } |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
1574 break; |
dd105b317335
Continue working on 2D support for Photon/QNX.
Mike Gorchak <lestat@i.com.ua>
parents:
3139
diff
changeset
|
1575 } |
3092
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1576 } |
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1577 |
3459
feea0def118d
Support for RendererReadPixels and RendererWritePixels has been added to photon renderer.
Mike Gorchak <lestat@i.com.ua>
parents:
3411
diff
changeset
|
1578 static int |
feea0def118d
Support for RendererReadPixels and RendererWritePixels has been added to photon renderer.
Mike Gorchak <lestat@i.com.ua>
parents:
3411
diff
changeset
|
1579 photon_renderreadpixels(SDL_Renderer * renderer, const SDL_Rect * rect, |
feea0def118d
Support for RendererReadPixels and RendererWritePixels has been added to photon renderer.
Mike Gorchak <lestat@i.com.ua>
parents:
3411
diff
changeset
|
1580 Uint32 format, void * pixels, int pitch) |
feea0def118d
Support for RendererReadPixels and RendererWritePixels has been added to photon renderer.
Mike Gorchak <lestat@i.com.ua>
parents:
3411
diff
changeset
|
1581 { |
feea0def118d
Support for RendererReadPixels and RendererWritePixels has been added to photon renderer.
Mike Gorchak <lestat@i.com.ua>
parents:
3411
diff
changeset
|
1582 SDL_RenderData *rdata = (SDL_RenderData *)renderer->driverdata; |
feea0def118d
Support for RendererReadPixels and RendererWritePixels has been added to photon renderer.
Mike Gorchak <lestat@i.com.ua>
parents:
3411
diff
changeset
|
1583 Uint32 sformat=0; |
feea0def118d
Support for RendererReadPixels and RendererWritePixels has been added to photon renderer.
Mike Gorchak <lestat@i.com.ua>
parents:
3411
diff
changeset
|
1584 uint8_t* spixels=NULL; |
feea0def118d
Support for RendererReadPixels and RendererWritePixels has been added to photon renderer.
Mike Gorchak <lestat@i.com.ua>
parents:
3411
diff
changeset
|
1585 unsigned int spitch=0; |
feea0def118d
Support for RendererReadPixels and RendererWritePixels has been added to photon renderer.
Mike Gorchak <lestat@i.com.ua>
parents:
3411
diff
changeset
|
1586 |
feea0def118d
Support for RendererReadPixels and RendererWritePixels has been added to photon renderer.
Mike Gorchak <lestat@i.com.ua>
parents:
3411
diff
changeset
|
1587 switch (rdata->surfaces_type) |
feea0def118d
Support for RendererReadPixels and RendererWritePixels has been added to photon renderer.
Mike Gorchak <lestat@i.com.ua>
parents:
3411
diff
changeset
|
1588 { |
feea0def118d
Support for RendererReadPixels and RendererWritePixels has been added to photon renderer.
Mike Gorchak <lestat@i.com.ua>
parents:
3411
diff
changeset
|
1589 case SDL_PHOTON_SURFTYPE_OFFSCREEN: |
feea0def118d
Support for RendererReadPixels and RendererWritePixels has been added to photon renderer.
Mike Gorchak <lestat@i.com.ua>
parents:
3411
diff
changeset
|
1590 sformat=photon_image_to_sdl_pixelformat(rdata->osurfaces[rdata->surface_visible_idx]->format); |
feea0def118d
Support for RendererReadPixels and RendererWritePixels has been added to photon renderer.
Mike Gorchak <lestat@i.com.ua>
parents:
3411
diff
changeset
|
1591 spixels=(uint8_t*)PdGetOffscreenContextPtr(rdata->osurfaces[rdata->surface_visible_idx]); |
feea0def118d
Support for RendererReadPixels and RendererWritePixels has been added to photon renderer.
Mike Gorchak <lestat@i.com.ua>
parents:
3411
diff
changeset
|
1592 spitch=rdata->osurfaces[rdata->surface_visible_idx]->pitch; |
feea0def118d
Support for RendererReadPixels and RendererWritePixels has been added to photon renderer.
Mike Gorchak <lestat@i.com.ua>
parents:
3411
diff
changeset
|
1593 break; |
feea0def118d
Support for RendererReadPixels and RendererWritePixels has been added to photon renderer.
Mike Gorchak <lestat@i.com.ua>
parents:
3411
diff
changeset
|
1594 case SDL_PHOTON_SURFTYPE_PHIMAGE: |
feea0def118d
Support for RendererReadPixels and RendererWritePixels has been added to photon renderer.
Mike Gorchak <lestat@i.com.ua>
parents:
3411
diff
changeset
|
1595 sformat=photon_image_to_sdl_pixelformat(rdata->psurfaces[rdata->surface_visible_idx]->type); |
feea0def118d
Support for RendererReadPixels and RendererWritePixels has been added to photon renderer.
Mike Gorchak <lestat@i.com.ua>
parents:
3411
diff
changeset
|
1596 spixels=(uint8_t*)rdata->psurfaces[rdata->surface_visible_idx]->image; |
feea0def118d
Support for RendererReadPixels and RendererWritePixels has been added to photon renderer.
Mike Gorchak <lestat@i.com.ua>
parents:
3411
diff
changeset
|
1597 spitch=rdata->psurfaces[rdata->surface_visible_idx]->bpl; |
feea0def118d
Support for RendererReadPixels and RendererWritePixels has been added to photon renderer.
Mike Gorchak <lestat@i.com.ua>
parents:
3411
diff
changeset
|
1598 break; |
feea0def118d
Support for RendererReadPixels and RendererWritePixels has been added to photon renderer.
Mike Gorchak <lestat@i.com.ua>
parents:
3411
diff
changeset
|
1599 case SDL_PHOTON_SURFTYPE_UNKNOWN: |
feea0def118d
Support for RendererReadPixels and RendererWritePixels has been added to photon renderer.
Mike Gorchak <lestat@i.com.ua>
parents:
3411
diff
changeset
|
1600 default: |
feea0def118d
Support for RendererReadPixels and RendererWritePixels has been added to photon renderer.
Mike Gorchak <lestat@i.com.ua>
parents:
3411
diff
changeset
|
1601 SDL_SetError("Photon: surfaces are not initialized"); |
feea0def118d
Support for RendererReadPixels and RendererWritePixels has been added to photon renderer.
Mike Gorchak <lestat@i.com.ua>
parents:
3411
diff
changeset
|
1602 return -1; |
feea0def118d
Support for RendererReadPixels and RendererWritePixels has been added to photon renderer.
Mike Gorchak <lestat@i.com.ua>
parents:
3411
diff
changeset
|
1603 } |
feea0def118d
Support for RendererReadPixels and RendererWritePixels has been added to photon renderer.
Mike Gorchak <lestat@i.com.ua>
parents:
3411
diff
changeset
|
1604 |
feea0def118d
Support for RendererReadPixels and RendererWritePixels has been added to photon renderer.
Mike Gorchak <lestat@i.com.ua>
parents:
3411
diff
changeset
|
1605 /* Adjust surface pixels pointer to the rectangle coordinates */ |
feea0def118d
Support for RendererReadPixels and RendererWritePixels has been added to photon renderer.
Mike Gorchak <lestat@i.com.ua>
parents:
3411
diff
changeset
|
1606 spixels+=rect->y*spitch + rect->x*SDL_BYTESPERPIXEL(sformat); |
feea0def118d
Support for RendererReadPixels and RendererWritePixels has been added to photon renderer.
Mike Gorchak <lestat@i.com.ua>
parents:
3411
diff
changeset
|
1607 |
feea0def118d
Support for RendererReadPixels and RendererWritePixels has been added to photon renderer.
Mike Gorchak <lestat@i.com.ua>
parents:
3411
diff
changeset
|
1608 SDL_ConvertPixels(rect->w, rect->h, |
feea0def118d
Support for RendererReadPixels and RendererWritePixels has been added to photon renderer.
Mike Gorchak <lestat@i.com.ua>
parents:
3411
diff
changeset
|
1609 sformat, spixels, spitch, |
feea0def118d
Support for RendererReadPixels and RendererWritePixels has been added to photon renderer.
Mike Gorchak <lestat@i.com.ua>
parents:
3411
diff
changeset
|
1610 format, pixels, pitch); |
feea0def118d
Support for RendererReadPixels and RendererWritePixels has been added to photon renderer.
Mike Gorchak <lestat@i.com.ua>
parents:
3411
diff
changeset
|
1611 |
feea0def118d
Support for RendererReadPixels and RendererWritePixels has been added to photon renderer.
Mike Gorchak <lestat@i.com.ua>
parents:
3411
diff
changeset
|
1612 return 0; |
feea0def118d
Support for RendererReadPixels and RendererWritePixels has been added to photon renderer.
Mike Gorchak <lestat@i.com.ua>
parents:
3411
diff
changeset
|
1613 } |
feea0def118d
Support for RendererReadPixels and RendererWritePixels has been added to photon renderer.
Mike Gorchak <lestat@i.com.ua>
parents:
3411
diff
changeset
|
1614 |
feea0def118d
Support for RendererReadPixels and RendererWritePixels has been added to photon renderer.
Mike Gorchak <lestat@i.com.ua>
parents:
3411
diff
changeset
|
1615 static int |
feea0def118d
Support for RendererReadPixels and RendererWritePixels has been added to photon renderer.
Mike Gorchak <lestat@i.com.ua>
parents:
3411
diff
changeset
|
1616 photon_renderwritepixels(SDL_Renderer * renderer, const SDL_Rect * rect, |
feea0def118d
Support for RendererReadPixels and RendererWritePixels has been added to photon renderer.
Mike Gorchak <lestat@i.com.ua>
parents:
3411
diff
changeset
|
1617 Uint32 format, const void * pixels, int pitch) |
feea0def118d
Support for RendererReadPixels and RendererWritePixels has been added to photon renderer.
Mike Gorchak <lestat@i.com.ua>
parents:
3411
diff
changeset
|
1618 { |
feea0def118d
Support for RendererReadPixels and RendererWritePixels has been added to photon renderer.
Mike Gorchak <lestat@i.com.ua>
parents:
3411
diff
changeset
|
1619 SDL_RenderData *rdata = (SDL_RenderData *)renderer->driverdata; |
feea0def118d
Support for RendererReadPixels and RendererWritePixels has been added to photon renderer.
Mike Gorchak <lestat@i.com.ua>
parents:
3411
diff
changeset
|
1620 Uint32 sformat=0; |
feea0def118d
Support for RendererReadPixels and RendererWritePixels has been added to photon renderer.
Mike Gorchak <lestat@i.com.ua>
parents:
3411
diff
changeset
|
1621 uint8_t* spixels=NULL; |
feea0def118d
Support for RendererReadPixels and RendererWritePixels has been added to photon renderer.
Mike Gorchak <lestat@i.com.ua>
parents:
3411
diff
changeset
|
1622 unsigned int spitch=0; |
feea0def118d
Support for RendererReadPixels and RendererWritePixels has been added to photon renderer.
Mike Gorchak <lestat@i.com.ua>
parents:
3411
diff
changeset
|
1623 |
feea0def118d
Support for RendererReadPixels and RendererWritePixels has been added to photon renderer.
Mike Gorchak <lestat@i.com.ua>
parents:
3411
diff
changeset
|
1624 switch (rdata->surfaces_type) |
feea0def118d
Support for RendererReadPixels and RendererWritePixels has been added to photon renderer.
Mike Gorchak <lestat@i.com.ua>
parents:
3411
diff
changeset
|
1625 { |
feea0def118d
Support for RendererReadPixels and RendererWritePixels has been added to photon renderer.
Mike Gorchak <lestat@i.com.ua>
parents:
3411
diff
changeset
|
1626 case SDL_PHOTON_SURFTYPE_OFFSCREEN: |
feea0def118d
Support for RendererReadPixels and RendererWritePixels has been added to photon renderer.
Mike Gorchak <lestat@i.com.ua>
parents:
3411
diff
changeset
|
1627 sformat=photon_image_to_sdl_pixelformat(rdata->osurfaces[rdata->surface_visible_idx]->format); |
feea0def118d
Support for RendererReadPixels and RendererWritePixels has been added to photon renderer.
Mike Gorchak <lestat@i.com.ua>
parents:
3411
diff
changeset
|
1628 spixels=(uint8_t*)PdGetOffscreenContextPtr(rdata->osurfaces[rdata->surface_visible_idx]); |
feea0def118d
Support for RendererReadPixels and RendererWritePixels has been added to photon renderer.
Mike Gorchak <lestat@i.com.ua>
parents:
3411
diff
changeset
|
1629 spitch=rdata->osurfaces[rdata->surface_visible_idx]->pitch; |
feea0def118d
Support for RendererReadPixels and RendererWritePixels has been added to photon renderer.
Mike Gorchak <lestat@i.com.ua>
parents:
3411
diff
changeset
|
1630 break; |
feea0def118d
Support for RendererReadPixels and RendererWritePixels has been added to photon renderer.
Mike Gorchak <lestat@i.com.ua>
parents:
3411
diff
changeset
|
1631 case SDL_PHOTON_SURFTYPE_PHIMAGE: |
feea0def118d
Support for RendererReadPixels and RendererWritePixels has been added to photon renderer.
Mike Gorchak <lestat@i.com.ua>
parents:
3411
diff
changeset
|
1632 sformat=photon_image_to_sdl_pixelformat(rdata->psurfaces[rdata->surface_visible_idx]->type); |
feea0def118d
Support for RendererReadPixels and RendererWritePixels has been added to photon renderer.
Mike Gorchak <lestat@i.com.ua>
parents:
3411
diff
changeset
|
1633 spixels=(uint8_t*)rdata->psurfaces[rdata->surface_visible_idx]->image; |
feea0def118d
Support for RendererReadPixels and RendererWritePixels has been added to photon renderer.
Mike Gorchak <lestat@i.com.ua>
parents:
3411
diff
changeset
|
1634 spitch=rdata->psurfaces[rdata->surface_visible_idx]->bpl; |
feea0def118d
Support for RendererReadPixels and RendererWritePixels has been added to photon renderer.
Mike Gorchak <lestat@i.com.ua>
parents:
3411
diff
changeset
|
1635 break; |
feea0def118d
Support for RendererReadPixels and RendererWritePixels has been added to photon renderer.
Mike Gorchak <lestat@i.com.ua>
parents:
3411
diff
changeset
|
1636 case SDL_PHOTON_SURFTYPE_UNKNOWN: |
feea0def118d
Support for RendererReadPixels and RendererWritePixels has been added to photon renderer.
Mike Gorchak <lestat@i.com.ua>
parents:
3411
diff
changeset
|
1637 default: |
feea0def118d
Support for RendererReadPixels and RendererWritePixels has been added to photon renderer.
Mike Gorchak <lestat@i.com.ua>
parents:
3411
diff
changeset
|
1638 SDL_SetError("Photon: surfaces are not initialized"); |
feea0def118d
Support for RendererReadPixels and RendererWritePixels has been added to photon renderer.
Mike Gorchak <lestat@i.com.ua>
parents:
3411
diff
changeset
|
1639 return -1; |
feea0def118d
Support for RendererReadPixels and RendererWritePixels has been added to photon renderer.
Mike Gorchak <lestat@i.com.ua>
parents:
3411
diff
changeset
|
1640 } |
feea0def118d
Support for RendererReadPixels and RendererWritePixels has been added to photon renderer.
Mike Gorchak <lestat@i.com.ua>
parents:
3411
diff
changeset
|
1641 |
feea0def118d
Support for RendererReadPixels and RendererWritePixels has been added to photon renderer.
Mike Gorchak <lestat@i.com.ua>
parents:
3411
diff
changeset
|
1642 /* Adjust surface pixels pointer to the rectangle coordinates */ |
feea0def118d
Support for RendererReadPixels and RendererWritePixels has been added to photon renderer.
Mike Gorchak <lestat@i.com.ua>
parents:
3411
diff
changeset
|
1643 spixels+=rect->y*spitch + rect->x*SDL_BYTESPERPIXEL(sformat); |
feea0def118d
Support for RendererReadPixels and RendererWritePixels has been added to photon renderer.
Mike Gorchak <lestat@i.com.ua>
parents:
3411
diff
changeset
|
1644 |
feea0def118d
Support for RendererReadPixels and RendererWritePixels has been added to photon renderer.
Mike Gorchak <lestat@i.com.ua>
parents:
3411
diff
changeset
|
1645 SDL_ConvertPixels(rect->w, rect->h, format, pixels, pitch, |
feea0def118d
Support for RendererReadPixels and RendererWritePixels has been added to photon renderer.
Mike Gorchak <lestat@i.com.ua>
parents:
3411
diff
changeset
|
1646 sformat, spixels, spitch); |
feea0def118d
Support for RendererReadPixels and RendererWritePixels has been added to photon renderer.
Mike Gorchak <lestat@i.com.ua>
parents:
3411
diff
changeset
|
1647 |
feea0def118d
Support for RendererReadPixels and RendererWritePixels has been added to photon renderer.
Mike Gorchak <lestat@i.com.ua>
parents:
3411
diff
changeset
|
1648 return 0; |
feea0def118d
Support for RendererReadPixels and RendererWritePixels has been added to photon renderer.
Mike Gorchak <lestat@i.com.ua>
parents:
3411
diff
changeset
|
1649 } |
feea0def118d
Support for RendererReadPixels and RendererWritePixels has been added to photon renderer.
Mike Gorchak <lestat@i.com.ua>
parents:
3411
diff
changeset
|
1650 |
3092
cad1aefa2ed9
Date: Thu, 12 Mar 2009 15:14:38 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1651 /* vi: set ts=4 sw=4 expandtab: */ |