Mercurial > sdl-ios-xcode
annotate src/video/photon/SDL_ph_image.c @ 297:f6ffac90895c
Updated copyright information for 2002
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Wed, 06 Mar 2002 11:23:08 +0000 |
parents | 68a8a8237c09 |
children | 3333b6e68289 |
rev | line source |
---|---|
0 | 1 /* |
2 SDL - Simple DirectMedia Layer | |
297
f6ffac90895c
Updated copyright information for 2002
Sam Lantinga <slouken@libsdl.org>
parents:
291
diff
changeset
|
3 Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002 Sam Lantinga |
0 | 4 |
5 This library is free software; you can redistribute it and/or | |
6 modify it under the terms of the GNU Library General Public | |
7 License as published by the Free Software Foundation; either | |
8 version 2 of the License, or (at your option) any later version. | |
9 | |
10 This library is distributed in the hope that it will be useful, | |
11 but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
13 Library General Public License for more details. | |
14 | |
15 You should have received a copy of the GNU Library General Public | |
16 License along with this library; if not, write to the Free | |
17 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
18 | |
19 Sam Lantinga | |
252
e8157fcb3114
Updated the source with the correct e-mail address
Sam Lantinga <slouken@libsdl.org>
parents:
19
diff
changeset
|
20 slouken@libsdl.org |
0 | 21 */ |
22 | |
23 #ifdef SAVE_RCSID | |
24 static char rcsid = | |
25 "@(#) $Id$"; | |
26 #endif | |
27 | |
28 #include <stdlib.h> | |
29 #include <Ph.h> | |
30 #include <photon/Pg.h> | |
31 | |
32 #include "SDL_error.h" | |
33 #include "SDL_endian.h" | |
34 #include "SDL_ph_image_c.h" | |
35 | |
36 int ph_SetupImage(_THIS, SDL_Surface *screen) | |
37 { | |
291
68a8a8237c09
Date: Thu, 21 Feb 2002 09:18:24 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
283
diff
changeset
|
38 int type = 0; |
0 | 39 |
291
68a8a8237c09
Date: Thu, 21 Feb 2002 09:18:24 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
283
diff
changeset
|
40 /* Determine image type */ |
68a8a8237c09
Date: Thu, 21 Feb 2002 09:18:24 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
283
diff
changeset
|
41 switch(screen->format->BitsPerPixel) |
68a8a8237c09
Date: Thu, 21 Feb 2002 09:18:24 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
283
diff
changeset
|
42 { |
68a8a8237c09
Date: Thu, 21 Feb 2002 09:18:24 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
283
diff
changeset
|
43 case 8:{ |
68a8a8237c09
Date: Thu, 21 Feb 2002 09:18:24 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
283
diff
changeset
|
44 type = Pg_IMAGE_PALETTE_BYTE; |
68a8a8237c09
Date: Thu, 21 Feb 2002 09:18:24 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
283
diff
changeset
|
45 } |
68a8a8237c09
Date: Thu, 21 Feb 2002 09:18:24 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
283
diff
changeset
|
46 break; |
68a8a8237c09
Date: Thu, 21 Feb 2002 09:18:24 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
283
diff
changeset
|
47 case 15:{ |
68a8a8237c09
Date: Thu, 21 Feb 2002 09:18:24 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
283
diff
changeset
|
48 type = Pg_IMAGE_DIRECT_555; |
68a8a8237c09
Date: Thu, 21 Feb 2002 09:18:24 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
283
diff
changeset
|
49 } |
68a8a8237c09
Date: Thu, 21 Feb 2002 09:18:24 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
283
diff
changeset
|
50 break; |
68a8a8237c09
Date: Thu, 21 Feb 2002 09:18:24 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
283
diff
changeset
|
51 case 16:{ |
68a8a8237c09
Date: Thu, 21 Feb 2002 09:18:24 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
283
diff
changeset
|
52 type = Pg_IMAGE_DIRECT_565; |
68a8a8237c09
Date: Thu, 21 Feb 2002 09:18:24 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
283
diff
changeset
|
53 } |
68a8a8237c09
Date: Thu, 21 Feb 2002 09:18:24 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
283
diff
changeset
|
54 break; |
68a8a8237c09
Date: Thu, 21 Feb 2002 09:18:24 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
283
diff
changeset
|
55 case 24:{ |
68a8a8237c09
Date: Thu, 21 Feb 2002 09:18:24 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
283
diff
changeset
|
56 type = Pg_IMAGE_DIRECT_888; |
68a8a8237c09
Date: Thu, 21 Feb 2002 09:18:24 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
283
diff
changeset
|
57 } |
68a8a8237c09
Date: Thu, 21 Feb 2002 09:18:24 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
283
diff
changeset
|
58 break; |
68a8a8237c09
Date: Thu, 21 Feb 2002 09:18:24 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
283
diff
changeset
|
59 case 32:{ |
68a8a8237c09
Date: Thu, 21 Feb 2002 09:18:24 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
283
diff
changeset
|
60 type = Pg_IMAGE_DIRECT_8888; |
68a8a8237c09
Date: Thu, 21 Feb 2002 09:18:24 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
283
diff
changeset
|
61 } |
68a8a8237c09
Date: Thu, 21 Feb 2002 09:18:24 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
283
diff
changeset
|
62 break; |
68a8a8237c09
Date: Thu, 21 Feb 2002 09:18:24 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
283
diff
changeset
|
63 default:{ |
68a8a8237c09
Date: Thu, 21 Feb 2002 09:18:24 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
283
diff
changeset
|
64 /* should never get here */ |
68a8a8237c09
Date: Thu, 21 Feb 2002 09:18:24 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
283
diff
changeset
|
65 fprintf(stderr,"error: unsupported bbp = %d\n", |
68a8a8237c09
Date: Thu, 21 Feb 2002 09:18:24 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
283
diff
changeset
|
66 screen->format->BitsPerPixel); |
68a8a8237c09
Date: Thu, 21 Feb 2002 09:18:24 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
283
diff
changeset
|
67 return -1; |
68a8a8237c09
Date: Thu, 21 Feb 2002 09:18:24 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
283
diff
changeset
|
68 } |
68a8a8237c09
Date: Thu, 21 Feb 2002 09:18:24 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
283
diff
changeset
|
69 break; |
68a8a8237c09
Date: Thu, 21 Feb 2002 09:18:24 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
283
diff
changeset
|
70 } |
0 | 71 |
291
68a8a8237c09
Date: Thu, 21 Feb 2002 09:18:24 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
283
diff
changeset
|
72 /* using shared memory for speed (set last param to 1) */ |
68a8a8237c09
Date: Thu, 21 Feb 2002 09:18:24 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
283
diff
changeset
|
73 if ((SDL_Image = PhCreateImage(NULL, screen->w, screen->h, type, NULL, 0, 1)) == NULL) |
68a8a8237c09
Date: Thu, 21 Feb 2002 09:18:24 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
283
diff
changeset
|
74 { |
68a8a8237c09
Date: Thu, 21 Feb 2002 09:18:24 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
283
diff
changeset
|
75 fprintf(stderr,"error: PhCreateImage failed.\n"); |
68a8a8237c09
Date: Thu, 21 Feb 2002 09:18:24 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
283
diff
changeset
|
76 return -1; |
68a8a8237c09
Date: Thu, 21 Feb 2002 09:18:24 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
283
diff
changeset
|
77 } |
0 | 78 |
291
68a8a8237c09
Date: Thu, 21 Feb 2002 09:18:24 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
283
diff
changeset
|
79 screen->pixels = SDL_Image->image; |
0 | 80 |
291
68a8a8237c09
Date: Thu, 21 Feb 2002 09:18:24 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
283
diff
changeset
|
81 this->UpdateRects = ph_NormalUpdate; |
68a8a8237c09
Date: Thu, 21 Feb 2002 09:18:24 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
283
diff
changeset
|
82 |
68a8a8237c09
Date: Thu, 21 Feb 2002 09:18:24 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
283
diff
changeset
|
83 return 0; |
0 | 84 } |
85 | |
86 int ph_SetupOCImage(_THIS, SDL_Surface *screen) //Offscreen context | |
87 { | |
88 int type = 0; | |
89 | |
90 /* Determine image type */ | |
91 switch(screen->format->BitsPerPixel) | |
92 { | |
93 case 8:{ | |
94 type = Pg_IMAGE_PALETTE_BYTE; | |
95 } | |
96 break; | |
97 case 15:{ | |
98 type = Pg_IMAGE_DIRECT_555; | |
99 } | |
100 break; | |
101 case 16:{ | |
102 type = Pg_IMAGE_DIRECT_565; | |
103 } | |
104 break; | |
105 | |
106 case 24:{ | |
107 type = Pg_IMAGE_DIRECT_888; | |
108 } | |
109 break; | |
110 | |
111 case 32:{ | |
112 type = Pg_IMAGE_DIRECT_8888; | |
113 } | |
114 break; | |
115 default:{ | |
116 /* should never get here */ | |
117 fprintf(stderr,"error: unsupported bbp = %d\n", | |
118 screen->format->BitsPerPixel); | |
119 return -1; | |
120 } | |
121 break; | |
122 } | |
123 | |
266
c6abdda2f666
Added QNX cleanups by Mike Gorchak (thanks!)
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
124 OCImage.FrameData0 = (FRAMEDATA *) malloc((size_t)(sizeof( FRAMEDATA))); |
c6abdda2f666
Added QNX cleanups by Mike Gorchak (thanks!)
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
125 OCImage.FrameData1 = (FRAMEDATA *) malloc((size_t)(sizeof( FRAMEDATA))); |
0 | 126 |
127 if(OCImage.direct_context == NULL) | |
266
c6abdda2f666
Added QNX cleanups by Mike Gorchak (thanks!)
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
128 OCImage.direct_context = PdCreateDirectContext(); |
0 | 129 |
266
c6abdda2f666
Added QNX cleanups by Mike Gorchak (thanks!)
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
130 OCImage.offscreen_context = PdCreateOffscreenContext(0,screen->w,screen->h, Pg_OSC_MEM_PAGE_ALIGN); |
0 | 131 |
266
c6abdda2f666
Added QNX cleanups by Mike Gorchak (thanks!)
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
132 if (OCImage.offscreen_context == NULL) |
c6abdda2f666
Added QNX cleanups by Mike Gorchak (thanks!)
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
133 { |
c6abdda2f666
Added QNX cleanups by Mike Gorchak (thanks!)
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
134 printf("PdCreateOffscreenContext failed\n"); |
c6abdda2f666
Added QNX cleanups by Mike Gorchak (thanks!)
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
135 return -1; |
c6abdda2f666
Added QNX cleanups by Mike Gorchak (thanks!)
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
136 } |
0 | 137 |
266
c6abdda2f666
Added QNX cleanups by Mike Gorchak (thanks!)
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
138 OCImage.Stride = OCImage.offscreen_context->pitch; |
0 | 139 |
266
c6abdda2f666
Added QNX cleanups by Mike Gorchak (thanks!)
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
140 if (OCImage.flags & SDL_DOUBLEBUF) |
c6abdda2f666
Added QNX cleanups by Mike Gorchak (thanks!)
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
141 printf("hardware flag for doublebuf offscreen context\n"); |
0 | 142 |
143 | |
144 OCImage.dc_ptr.ptr8 = (unsigned char *) PdGetOffscreenContextPtr(OCImage.offscreen_context); | |
145 | |
146 OCImage.CurrentFrameData = OCImage.FrameData0; | |
147 OCImage.CurrentFrameData->Y = OCImage.dc_ptr.ptr8; | |
148 OCImage.CurrentFrameData->U = NULL; | |
149 OCImage.CurrentFrameData->V = NULL; | |
150 OCImage.current = 0; | |
151 | |
152 if(OCImage.dc_ptr.ptr8 == NULL) | |
153 { | |
154 printf("PdGetOffscreenContextPtr failed\n"); | |
155 return -1; | |
156 } | |
157 | |
158 PhDCSetCurrent(OCImage.offscreen_context); | |
159 | |
160 screen->pixels = OCImage.CurrentFrameData->Y; | |
161 | |
162 this->UpdateRects = ph_OCUpdate; | |
163 | |
164 return 0; | |
165 } | |
166 | |
291
68a8a8237c09
Date: Thu, 21 Feb 2002 09:18:24 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
283
diff
changeset
|
167 int ph_SetupOpenGLImage(_THIS, SDL_Surface* screen) |
68a8a8237c09
Date: Thu, 21 Feb 2002 09:18:24 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
283
diff
changeset
|
168 { |
68a8a8237c09
Date: Thu, 21 Feb 2002 09:18:24 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
283
diff
changeset
|
169 this->UpdateRects = ph_OpenGLUpdate; |
68a8a8237c09
Date: Thu, 21 Feb 2002 09:18:24 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
283
diff
changeset
|
170 |
68a8a8237c09
Date: Thu, 21 Feb 2002 09:18:24 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
283
diff
changeset
|
171 return 0; |
68a8a8237c09
Date: Thu, 21 Feb 2002 09:18:24 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
283
diff
changeset
|
172 } |
0 | 173 |
174 void ph_DestroyImage(_THIS, SDL_Surface *screen) | |
175 { | |
291
68a8a8237c09
Date: Thu, 21 Feb 2002 09:18:24 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
283
diff
changeset
|
176 if (OCImage.offscreen_context != NULL) |
68a8a8237c09
Date: Thu, 21 Feb 2002 09:18:24 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
283
diff
changeset
|
177 { |
68a8a8237c09
Date: Thu, 21 Feb 2002 09:18:24 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
283
diff
changeset
|
178 PhDCRelease(OCImage.offscreen_context); |
68a8a8237c09
Date: Thu, 21 Feb 2002 09:18:24 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
283
diff
changeset
|
179 OCImage.offscreen_context = NULL; |
68a8a8237c09
Date: Thu, 21 Feb 2002 09:18:24 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
283
diff
changeset
|
180 free(OCImage.FrameData0); |
68a8a8237c09
Date: Thu, 21 Feb 2002 09:18:24 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
283
diff
changeset
|
181 OCImage.FrameData0 = NULL; |
68a8a8237c09
Date: Thu, 21 Feb 2002 09:18:24 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
283
diff
changeset
|
182 free(OCImage.FrameData1); |
68a8a8237c09
Date: Thu, 21 Feb 2002 09:18:24 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
283
diff
changeset
|
183 OCImage.FrameData1 = NULL; |
68a8a8237c09
Date: Thu, 21 Feb 2002 09:18:24 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
283
diff
changeset
|
184 } |
0 | 185 |
291
68a8a8237c09
Date: Thu, 21 Feb 2002 09:18:24 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
283
diff
changeset
|
186 if (SDL_Image) |
68a8a8237c09
Date: Thu, 21 Feb 2002 09:18:24 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
283
diff
changeset
|
187 { |
68a8a8237c09
Date: Thu, 21 Feb 2002 09:18:24 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
283
diff
changeset
|
188 PgShmemDestroy(SDL_Image->image); |
68a8a8237c09
Date: Thu, 21 Feb 2002 09:18:24 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
283
diff
changeset
|
189 free(SDL_Image); |
68a8a8237c09
Date: Thu, 21 Feb 2002 09:18:24 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
283
diff
changeset
|
190 SDL_Image = NULL; |
68a8a8237c09
Date: Thu, 21 Feb 2002 09:18:24 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
283
diff
changeset
|
191 } |
0 | 192 |
291
68a8a8237c09
Date: Thu, 21 Feb 2002 09:18:24 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
283
diff
changeset
|
193 if (screen) |
68a8a8237c09
Date: Thu, 21 Feb 2002 09:18:24 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
283
diff
changeset
|
194 { |
68a8a8237c09
Date: Thu, 21 Feb 2002 09:18:24 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
283
diff
changeset
|
195 screen->pixels = NULL; |
68a8a8237c09
Date: Thu, 21 Feb 2002 09:18:24 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
283
diff
changeset
|
196 } |
0 | 197 } |
198 | |
199 int ph_ResizeImage(_THIS, SDL_Surface *screen, Uint32 flags) | |
200 { | |
201 ph_DestroyImage(this, screen); | |
202 | |
203 if( flags & SDL_HWSURFACE) | |
204 { | |
291
68a8a8237c09
Date: Thu, 21 Feb 2002 09:18:24 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
283
diff
changeset
|
205 OCImage.flags = flags; /* needed for SDL_DOUBLEBUF check */ |
68a8a8237c09
Date: Thu, 21 Feb 2002 09:18:24 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
283
diff
changeset
|
206 return ph_SetupOCImage(this, screen); |
0 | 207 } |
291
68a8a8237c09
Date: Thu, 21 Feb 2002 09:18:24 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
283
diff
changeset
|
208 else if(flags & SDL_OPENGL) |
0 | 209 { |
291
68a8a8237c09
Date: Thu, 21 Feb 2002 09:18:24 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
283
diff
changeset
|
210 return ph_SetupOpenGLImage(this, screen); |
0 | 211 } |
212 else | |
213 { | |
214 return ph_SetupImage(this, screen); | |
215 } | |
216 } | |
217 | |
218 int ph_AllocHWSurface(_THIS, SDL_Surface *surface) | |
219 { | |
220 return(-1); | |
221 } | |
222 | |
223 void ph_FreeHWSurface(_THIS, SDL_Surface *surface) | |
224 { | |
225 return; | |
226 } | |
227 | |
228 int ph_FlipHWSurface(_THIS, SDL_Surface *surface) | |
229 { | |
230 return(0); | |
231 } | |
232 | |
233 int ph_LockHWSurface(_THIS, SDL_Surface *surface) | |
234 { | |
235 if ( (surface == SDL_VideoSurface) && blit_queued ) { | |
236 // XSync(GFX_Display, False); | |
237 PgFlush(); | |
238 blit_queued = 0; | |
239 } | |
240 return(0); | |
241 } | |
242 | |
243 void ph_UnlockHWSurface(_THIS, SDL_Surface *surface) | |
244 { | |
245 return; | |
246 } | |
247 | |
248 static PhPoint_t ph_pos; | |
249 static PhRect_t ph_rect; | |
250 static int i; | |
251 | |
291
68a8a8237c09
Date: Thu, 21 Feb 2002 09:18:24 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
283
diff
changeset
|
252 void ph_OpenGLUpdate(_THIS, int numrects, SDL_Rect* rects) |
68a8a8237c09
Date: Thu, 21 Feb 2002 09:18:24 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
283
diff
changeset
|
253 { |
68a8a8237c09
Date: Thu, 21 Feb 2002 09:18:24 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
283
diff
changeset
|
254 this->GL_SwapBuffers(this); |
68a8a8237c09
Date: Thu, 21 Feb 2002 09:18:24 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
283
diff
changeset
|
255 |
68a8a8237c09
Date: Thu, 21 Feb 2002 09:18:24 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
283
diff
changeset
|
256 return; |
68a8a8237c09
Date: Thu, 21 Feb 2002 09:18:24 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
283
diff
changeset
|
257 } |
68a8a8237c09
Date: Thu, 21 Feb 2002 09:18:24 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
283
diff
changeset
|
258 |
0 | 259 void ph_NormalUpdate(_THIS, int numrects, SDL_Rect *rects) |
260 { | |
261 | |
262 for ( i=0; i<numrects; ++i ) | |
263 { | |
264 if ( rects[i].w == 0 ) { /* Clipped? */ | |
265 continue; | |
266 } | |
267 | |
268 ph_pos.x = rects[i].x; | |
269 ph_pos.y = rects[i].y; | |
270 ph_rect.ul.x = rects[i].x; | |
271 ph_rect.ul.y = rects[i].y; | |
272 ph_rect.lr.x = rects[i].x + rects[i].w; | |
273 ph_rect.lr.y = rects[i].y + rects[i].h; | |
274 | |
275 if (PgDrawPhImageRectmx( &ph_pos, SDL_Image, &ph_rect, 0 ) < 0) | |
276 { | |
277 fprintf(stderr,"error: PgDrawPhImageRectmx failed.\n"); | |
278 } | |
279 } | |
280 if (PgFlush() < 0) | |
266
c6abdda2f666
Added QNX cleanups by Mike Gorchak (thanks!)
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
281 { |
0 | 282 fprintf(stderr,"error: PgFlush failed.\n"); |
283 } | |
284 } | |
285 void ph_OCUpdate(_THIS, int numrects, SDL_Rect *rects) | |
286 { | |
287 PhPoint_t zero = {0}; | |
288 PhRect_t src_rect; | |
289 PhRect_t dest_rect; | |
290 | |
291 if(OCImage.direct_context == NULL) | |
292 { | |
293 return; | |
294 } | |
295 | |
296 PgSetRegion(PtWidgetRid(window)); | |
297 PgSetClipping(0,NULL); | |
298 PgWaitHWIdle(); | |
299 | |
300 | |
301 for ( i=0; i<numrects; ++i ) | |
302 { | |
303 if ( rects[i].w == 0 ) { /* Clipped? */ | |
304 continue; | |
305 } | |
306 | |
307 src_rect.ul.x=rects[i].x; | |
308 src_rect.ul.y=rects[i].y; | |
309 dest_rect.ul.x=rects[i].x; | |
310 dest_rect.ul.y=rects[i].y; | |
311 | |
312 dest_rect.lr.x=src_rect.lr.x= rects[i].x +rects[i].w; | |
313 dest_rect.lr.y=src_rect.lr.y= rects[i].y +rects[i].h; | |
314 | |
315 zero.x = zero.y = 0; | |
316 PgSetTranslation (&zero, 0); | |
266
c6abdda2f666
Added QNX cleanups by Mike Gorchak (thanks!)
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
317 PgSetRegion(PtWidgetRid(window)); |
0 | 318 PgSetClipping(0,NULL); |
319 PgContextBlitArea(OCImage.offscreen_context, (PhArea_t *)(&src_rect), NULL, (PhArea_t *)(&dest_rect)); | |
320 | |
321 } | |
322 if (PgFlush() < 0) | |
266
c6abdda2f666
Added QNX cleanups by Mike Gorchak (thanks!)
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
323 { |
0 | 324 fprintf(stderr,"error: PgFlush failed.\n"); |
325 } | |
326 | |
327 //later used to toggling double buffer | |
328 if(OCImage.current == 0) | |
329 { | |
330 OCImage.CurrentFrameData = OCImage.FrameData0; | |
331 } | |
332 else | |
333 { | |
334 OCImage.CurrentFrameData = OCImage.FrameData1; | |
335 } | |
336 } | |
337 |