Mercurial > sdl-ios-xcode
annotate src/video/photon/SDL_ph_image.c @ 1642:f1211a4b7380
Fixed bug #189
Clip the overlay destination rectangle to the screen area on X11
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Mon, 17 Apr 2006 05:38:33 +0000 |
parents | d910939febfa |
children | e49147870aac c121d94672cb a1b03ba2fcd0 |
rev | line source |
---|---|
0 | 1 /* |
2 SDL - Simple DirectMedia Layer | |
1312
c9b51268668f
Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents:
910
diff
changeset
|
3 Copyright (C) 1997-2006 Sam Lantinga |
0 | 4 |
5 This library is free software; you can redistribute it and/or | |
1312
c9b51268668f
Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents:
910
diff
changeset
|
6 modify it under the terms of the GNU Lesser General Public |
0 | 7 License as published by the Free Software Foundation; either |
1312
c9b51268668f
Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents:
910
diff
changeset
|
8 version 2.1 of the License, or (at your option) any later version. |
0 | 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 | |
1312
c9b51268668f
Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents:
910
diff
changeset
|
13 Lesser General Public License for more details. |
0 | 14 |
1312
c9b51268668f
Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents:
910
diff
changeset
|
15 You should have received a copy of the GNU Lesser General Public |
c9b51268668f
Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents:
910
diff
changeset
|
16 License along with this library; if not, write to the Free Software |
c9b51268668f
Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents:
910
diff
changeset
|
17 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
0 | 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 */ |
1402
d910939febfa
Use consistent identifiers for the various platforms we support.
Sam Lantinga <slouken@libsdl.org>
parents:
1361
diff
changeset
|
22 #include "SDL_config.h" |
0 | 23 |
24 #include <Ph.h> | |
25 #include <photon/Pg.h> | |
26 | |
27 #include "SDL_endian.h" | |
571
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
380
diff
changeset
|
28 #include "SDL_video.h" |
1361
19418e4422cb
New configure-based build system. Still work in progress, but much improved
Sam Lantinga <slouken@libsdl.org>
parents:
1358
diff
changeset
|
29 #include "../SDL_pixels_c.h" |
910
4ab6d1fd028f
Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
886
diff
changeset
|
30 #include "SDL_ph_video.h" |
0 | 31 #include "SDL_ph_image_c.h" |
663
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
32 #include "SDL_ph_modes_c.h" |
910
4ab6d1fd028f
Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
886
diff
changeset
|
33 #include "SDL_ph_gl.h" |
315
3333b6e68289
Date: Sat, 23 Mar 2002 13:53:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
34 |
0 | 35 int ph_SetupImage(_THIS, SDL_Surface *screen) |
36 { | |
380
bce7171e7a85
Date: Wed, 22 May 2002 22:30:58 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
370
diff
changeset
|
37 PgColor_t* palette=NULL; |
315
3333b6e68289
Date: Sat, 23 Mar 2002 13:53:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
38 int type=0; |
380
bce7171e7a85
Date: Wed, 22 May 2002 22:30:58 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
370
diff
changeset
|
39 int bpp; |
bce7171e7a85
Date: Wed, 22 May 2002 22:30:58 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
370
diff
changeset
|
40 |
bce7171e7a85
Date: Wed, 22 May 2002 22:30:58 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
370
diff
changeset
|
41 bpp=screen->format->BitsPerPixel; |
0 | 42 |
291
68a8a8237c09
Date: Thu, 21 Feb 2002 09:18:24 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
283
diff
changeset
|
43 /* Determine image type */ |
380
bce7171e7a85
Date: Wed, 22 May 2002 22:30:58 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
370
diff
changeset
|
44 switch(bpp) |
291
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 case 8:{ |
68a8a8237c09
Date: Thu, 21 Feb 2002 09:18:24 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
283
diff
changeset
|
47 type = Pg_IMAGE_PALETTE_BYTE; |
68a8a8237c09
Date: Thu, 21 Feb 2002 09:18:24 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
283
diff
changeset
|
48 } |
68a8a8237c09
Date: Thu, 21 Feb 2002 09:18:24 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
283
diff
changeset
|
49 break; |
68a8a8237c09
Date: Thu, 21 Feb 2002 09:18:24 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
283
diff
changeset
|
50 case 15:{ |
68a8a8237c09
Date: Thu, 21 Feb 2002 09:18:24 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
283
diff
changeset
|
51 type = Pg_IMAGE_DIRECT_555; |
68a8a8237c09
Date: Thu, 21 Feb 2002 09:18:24 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
283
diff
changeset
|
52 } |
68a8a8237c09
Date: Thu, 21 Feb 2002 09:18:24 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
283
diff
changeset
|
53 break; |
68a8a8237c09
Date: Thu, 21 Feb 2002 09:18:24 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
283
diff
changeset
|
54 case 16:{ |
68a8a8237c09
Date: Thu, 21 Feb 2002 09:18:24 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
283
diff
changeset
|
55 type = Pg_IMAGE_DIRECT_565; |
68a8a8237c09
Date: Thu, 21 Feb 2002 09:18:24 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
283
diff
changeset
|
56 } |
68a8a8237c09
Date: Thu, 21 Feb 2002 09:18:24 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
283
diff
changeset
|
57 break; |
68a8a8237c09
Date: Thu, 21 Feb 2002 09:18:24 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
283
diff
changeset
|
58 case 24:{ |
68a8a8237c09
Date: Thu, 21 Feb 2002 09:18:24 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
283
diff
changeset
|
59 type = Pg_IMAGE_DIRECT_888; |
68a8a8237c09
Date: Thu, 21 Feb 2002 09:18:24 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
283
diff
changeset
|
60 } |
68a8a8237c09
Date: Thu, 21 Feb 2002 09:18:24 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
283
diff
changeset
|
61 break; |
68a8a8237c09
Date: Thu, 21 Feb 2002 09:18:24 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
283
diff
changeset
|
62 case 32:{ |
68a8a8237c09
Date: Thu, 21 Feb 2002 09:18:24 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
283
diff
changeset
|
63 type = Pg_IMAGE_DIRECT_8888; |
68a8a8237c09
Date: Thu, 21 Feb 2002 09:18:24 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
283
diff
changeset
|
64 } |
68a8a8237c09
Date: Thu, 21 Feb 2002 09:18:24 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
283
diff
changeset
|
65 break; |
68a8a8237c09
Date: Thu, 21 Feb 2002 09:18:24 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
283
diff
changeset
|
66 default:{ |
663
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
67 SDL_SetError("ph_SetupImage(): unsupported bpp=%d !\n", bpp); |
291
68a8a8237c09
Date: Thu, 21 Feb 2002 09:18:24 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
283
diff
changeset
|
68 return -1; |
68a8a8237c09
Date: Thu, 21 Feb 2002 09:18:24 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
283
diff
changeset
|
69 } |
68a8a8237c09
Date: Thu, 21 Feb 2002 09:18:24 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
283
diff
changeset
|
70 break; |
68a8a8237c09
Date: Thu, 21 Feb 2002 09:18:24 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
283
diff
changeset
|
71 } |
0 | 72 |
315
3333b6e68289
Date: Sat, 23 Mar 2002 13:53:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
73 /* palette emulation code */ |
380
bce7171e7a85
Date: Wed, 22 May 2002 22:30:58 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
370
diff
changeset
|
74 if ((bpp==8) && (desktoppal==SDLPH_PAL_EMULATE)) |
291
68a8a8237c09
Date: Thu, 21 Feb 2002 09:18:24 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
283
diff
changeset
|
75 { |
315
3333b6e68289
Date: Sat, 23 Mar 2002 13:53:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
76 /* creating image palette */ |
1336
3692456e7b0f
Use SDL_ prefixed versions of C library functions.
Sam Lantinga <slouken@libsdl.org>
parents:
1312
diff
changeset
|
77 palette=SDL_malloc(_Pg_MAX_PALETTE*sizeof(PgColor_t)); |
663
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
78 if (palette==NULL) |
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
79 { |
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
80 SDL_SetError("ph_SetupImage(): can't allocate memory for palette !\n"); |
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
81 return -1; |
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
82 } |
315
3333b6e68289
Date: Sat, 23 Mar 2002 13:53:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
83 PgGetPalette(palette); |
3333b6e68289
Date: Sat, 23 Mar 2002 13:53:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
84 |
3333b6e68289
Date: Sat, 23 Mar 2002 13:53:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
85 /* using shared memory for speed (set last param to 1) */ |
3333b6e68289
Date: Sat, 23 Mar 2002 13:53:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
86 if ((SDL_Image = PhCreateImage(NULL, screen->w, screen->h, type, palette, _Pg_MAX_PALETTE, 1)) == NULL) |
3333b6e68289
Date: Sat, 23 Mar 2002 13:53:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
87 { |
663
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
88 SDL_SetError("ph_SetupImage(): PhCreateImage() failed for bpp=8 !\n"); |
1336
3692456e7b0f
Use SDL_ prefixed versions of C library functions.
Sam Lantinga <slouken@libsdl.org>
parents:
1312
diff
changeset
|
89 SDL_free(palette); |
315
3333b6e68289
Date: Sat, 23 Mar 2002 13:53:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
90 return -1; |
3333b6e68289
Date: Sat, 23 Mar 2002 13:53:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
91 } |
3333b6e68289
Date: Sat, 23 Mar 2002 13:53:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
92 } |
3333b6e68289
Date: Sat, 23 Mar 2002 13:53:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
93 else |
3333b6e68289
Date: Sat, 23 Mar 2002 13:53:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
94 { |
3333b6e68289
Date: Sat, 23 Mar 2002 13:53:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
95 /* using shared memory for speed (set last param to 1) */ |
3333b6e68289
Date: Sat, 23 Mar 2002 13:53:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
96 if ((SDL_Image = PhCreateImage(NULL, screen->w, screen->h, type, NULL, 0, 1)) == NULL) |
3333b6e68289
Date: Sat, 23 Mar 2002 13:53:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
97 { |
663
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
98 SDL_SetError("ph_SetupImage(): PhCreateImage() failed for bpp=%d !\n", bpp); |
315
3333b6e68289
Date: Sat, 23 Mar 2002 13:53:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
99 return -1; |
3333b6e68289
Date: Sat, 23 Mar 2002 13:53:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
100 } |
291
68a8a8237c09
Date: Thu, 21 Feb 2002 09:18:24 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
283
diff
changeset
|
101 } |
571
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
380
diff
changeset
|
102 |
291
68a8a8237c09
Date: Thu, 21 Feb 2002 09:18:24 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
283
diff
changeset
|
103 screen->pixels = SDL_Image->image; |
663
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
104 screen->pitch = SDL_Image->bpl; |
571
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
380
diff
changeset
|
105 |
291
68a8a8237c09
Date: Thu, 21 Feb 2002 09:18:24 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
283
diff
changeset
|
106 this->UpdateRects = ph_NormalUpdate; |
68a8a8237c09
Date: Thu, 21 Feb 2002 09:18:24 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
283
diff
changeset
|
107 |
68a8a8237c09
Date: Thu, 21 Feb 2002 09:18:24 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
283
diff
changeset
|
108 return 0; |
0 | 109 } |
110 | |
315
3333b6e68289
Date: Sat, 23 Mar 2002 13:53:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
111 int ph_SetupOCImage(_THIS, SDL_Surface *screen) |
0 | 112 { |
370
ba72f259bc88
Date: Sat, 18 May 2002 17:40:53 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
315
diff
changeset
|
113 int type = 0; |
380
bce7171e7a85
Date: Wed, 22 May 2002 22:30:58 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
370
diff
changeset
|
114 int bpp; |
571
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
380
diff
changeset
|
115 |
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
380
diff
changeset
|
116 OCImage.flags = screen->flags; |
380
bce7171e7a85
Date: Wed, 22 May 2002 22:30:58 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
370
diff
changeset
|
117 |
bce7171e7a85
Date: Wed, 22 May 2002 22:30:58 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
370
diff
changeset
|
118 bpp=screen->format->BitsPerPixel; |
0 | 119 |
370
ba72f259bc88
Date: Sat, 18 May 2002 17:40:53 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
315
diff
changeset
|
120 /* Determine image type */ |
380
bce7171e7a85
Date: Wed, 22 May 2002 22:30:58 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
370
diff
changeset
|
121 switch(bpp) |
370
ba72f259bc88
Date: Sat, 18 May 2002 17:40:53 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
315
diff
changeset
|
122 { |
ba72f259bc88
Date: Sat, 18 May 2002 17:40:53 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
315
diff
changeset
|
123 case 8: { |
ba72f259bc88
Date: Sat, 18 May 2002 17:40:53 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
315
diff
changeset
|
124 type = Pg_IMAGE_PALETTE_BYTE; |
ba72f259bc88
Date: Sat, 18 May 2002 17:40:53 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
315
diff
changeset
|
125 } |
ba72f259bc88
Date: Sat, 18 May 2002 17:40:53 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
315
diff
changeset
|
126 break; |
ba72f259bc88
Date: Sat, 18 May 2002 17:40:53 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
315
diff
changeset
|
127 case 15:{ |
ba72f259bc88
Date: Sat, 18 May 2002 17:40:53 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
315
diff
changeset
|
128 type = Pg_IMAGE_DIRECT_555; |
0 | 129 } |
130 break; | |
370
ba72f259bc88
Date: Sat, 18 May 2002 17:40:53 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
315
diff
changeset
|
131 case 16:{ |
ba72f259bc88
Date: Sat, 18 May 2002 17:40:53 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
315
diff
changeset
|
132 type = Pg_IMAGE_DIRECT_565; |
ba72f259bc88
Date: Sat, 18 May 2002 17:40:53 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
315
diff
changeset
|
133 } |
ba72f259bc88
Date: Sat, 18 May 2002 17:40:53 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
315
diff
changeset
|
134 break; |
ba72f259bc88
Date: Sat, 18 May 2002 17:40:53 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
315
diff
changeset
|
135 case 24:{ |
ba72f259bc88
Date: Sat, 18 May 2002 17:40:53 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
315
diff
changeset
|
136 type = Pg_IMAGE_DIRECT_888; |
ba72f259bc88
Date: Sat, 18 May 2002 17:40:53 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
315
diff
changeset
|
137 } |
ba72f259bc88
Date: Sat, 18 May 2002 17:40:53 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
315
diff
changeset
|
138 break; |
ba72f259bc88
Date: Sat, 18 May 2002 17:40:53 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
315
diff
changeset
|
139 case 32:{ |
ba72f259bc88
Date: Sat, 18 May 2002 17:40:53 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
315
diff
changeset
|
140 type = Pg_IMAGE_DIRECT_8888; |
ba72f259bc88
Date: Sat, 18 May 2002 17:40:53 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
315
diff
changeset
|
141 } |
ba72f259bc88
Date: Sat, 18 May 2002 17:40:53 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
315
diff
changeset
|
142 break; |
ba72f259bc88
Date: Sat, 18 May 2002 17:40:53 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
315
diff
changeset
|
143 default:{ |
663
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
144 SDL_SetError("ph_SetupOCImage(): unsupported bpp=%d !\n", bpp); |
370
ba72f259bc88
Date: Sat, 18 May 2002 17:40:53 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
315
diff
changeset
|
145 return -1; |
ba72f259bc88
Date: Sat, 18 May 2002 17:40:53 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
315
diff
changeset
|
146 } |
ba72f259bc88
Date: Sat, 18 May 2002 17:40:53 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
315
diff
changeset
|
147 break; |
ba72f259bc88
Date: Sat, 18 May 2002 17:40:53 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
315
diff
changeset
|
148 } |
0 | 149 |
886
05c551e5bc64
Date: Sat, 24 Apr 2004 15:13:32 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
821
diff
changeset
|
150 /* Currently offscreen contexts with the same bit depth as display bpp only can be created */ |
370
ba72f259bc88
Date: Sat, 18 May 2002 17:40:53 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
315
diff
changeset
|
151 OCImage.offscreen_context = PdCreateOffscreenContext(0, screen->w, screen->h, Pg_OSC_MEM_PAGE_ALIGN); |
0 | 152 |
370
ba72f259bc88
Date: Sat, 18 May 2002 17:40:53 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
315
diff
changeset
|
153 if (OCImage.offscreen_context == NULL) |
ba72f259bc88
Date: Sat, 18 May 2002 17:40:53 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
315
diff
changeset
|
154 { |
663
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
155 SDL_SetError("ph_SetupOCImage(): PdCreateOffscreenContext() function failed !\n"); |
370
ba72f259bc88
Date: Sat, 18 May 2002 17:40:53 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
315
diff
changeset
|
156 return -1; |
ba72f259bc88
Date: Sat, 18 May 2002 17:40:53 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
315
diff
changeset
|
157 } |
ba72f259bc88
Date: Sat, 18 May 2002 17:40:53 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
315
diff
changeset
|
158 |
663
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
159 screen->pitch = OCImage.offscreen_context->pitch; |
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
160 |
821
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
161 OCImage.dc_ptr = (unsigned char *)PdGetOffscreenContextPtr(OCImage.offscreen_context); |
370
ba72f259bc88
Date: Sat, 18 May 2002 17:40:53 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
315
diff
changeset
|
162 |
663
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
163 if (OCImage.dc_ptr == NULL) |
370
ba72f259bc88
Date: Sat, 18 May 2002 17:40:53 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
315
diff
changeset
|
164 { |
663
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
165 SDL_SetError("ph_SetupOCImage(): PdGetOffscreenContextPtr function failed !\n"); |
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
166 PhDCRelease(OCImage.offscreen_context); |
370
ba72f259bc88
Date: Sat, 18 May 2002 17:40:53 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
315
diff
changeset
|
167 return -1; |
ba72f259bc88
Date: Sat, 18 May 2002 17:40:53 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
315
diff
changeset
|
168 } |
0 | 169 |
663
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
170 OCImage.FrameData0 = OCImage.dc_ptr; |
370
ba72f259bc88
Date: Sat, 18 May 2002 17:40:53 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
315
diff
changeset
|
171 OCImage.CurrentFrameData = OCImage.FrameData0; |
ba72f259bc88
Date: Sat, 18 May 2002 17:40:53 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
315
diff
changeset
|
172 OCImage.current = 0; |
ba72f259bc88
Date: Sat, 18 May 2002 17:40:53 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
315
diff
changeset
|
173 |
ba72f259bc88
Date: Sat, 18 May 2002 17:40:53 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
315
diff
changeset
|
174 PhDCSetCurrent(OCImage.offscreen_context); |
ba72f259bc88
Date: Sat, 18 May 2002 17:40:53 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
315
diff
changeset
|
175 |
571
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
380
diff
changeset
|
176 screen->pixels = OCImage.CurrentFrameData; |
370
ba72f259bc88
Date: Sat, 18 May 2002 17:40:53 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
315
diff
changeset
|
177 |
ba72f259bc88
Date: Sat, 18 May 2002 17:40:53 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
315
diff
changeset
|
178 this->UpdateRects = ph_OCUpdate; |
ba72f259bc88
Date: Sat, 18 May 2002 17:40:53 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
315
diff
changeset
|
179 |
ba72f259bc88
Date: Sat, 18 May 2002 17:40:53 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
315
diff
changeset
|
180 return 0; |
0 | 181 } |
182 | |
571
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
380
diff
changeset
|
183 int ph_SetupFullScreenImage(_THIS, SDL_Surface* screen) |
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
380
diff
changeset
|
184 { |
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
380
diff
changeset
|
185 OCImage.flags = screen->flags; |
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
380
diff
changeset
|
186 |
910
4ab6d1fd028f
Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
886
diff
changeset
|
187 /* Begin direct and fullscreen mode */ |
4ab6d1fd028f
Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
886
diff
changeset
|
188 if (!ph_EnterFullScreen(this, screen, PH_ENTER_DIRECTMODE)) |
571
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
380
diff
changeset
|
189 { |
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
380
diff
changeset
|
190 return -1; |
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
380
diff
changeset
|
191 } |
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
380
diff
changeset
|
192 |
663
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
193 /* store palette for fullscreen */ |
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
194 if ((screen->format->BitsPerPixel==8) && (desktopbpp!=8)) |
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
195 { |
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
196 PgGetPalette(savedpal); |
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
197 PgGetPalette(syspalph); |
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
198 } |
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
199 |
701
aaf3b8af6616
Date: Sat, 30 Aug 2003 16:28:10 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
692
diff
changeset
|
200 OCImage.offscreen_context = PdCreateOffscreenContext(0, 0, 0, Pg_OSC_MAIN_DISPLAY | Pg_OSC_MEM_PAGE_ALIGN | Pg_OSC_CRTC_SAFE); |
663
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
201 if (OCImage.offscreen_context == NULL) |
571
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
380
diff
changeset
|
202 { |
663
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
203 SDL_SetError("ph_SetupFullScreenImage(): PdCreateOffscreenContext() function failed !\n"); |
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
204 return -1; |
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
205 } |
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
206 |
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
207 if ((screen->flags & SDL_DOUBLEBUF) == SDL_DOUBLEBUF) |
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
208 { |
821
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
209 OCImage.offscreen_backcontext = PdDupOffscreenContext(OCImage.offscreen_context, Pg_OSC_MEM_PAGE_ALIGN | Pg_OSC_CRTC_SAFE); |
663
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
210 if (OCImage.offscreen_backcontext == NULL) |
571
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
380
diff
changeset
|
211 { |
663
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
212 SDL_SetError("ph_SetupFullScreenImage(): PdCreateOffscreenContext(back) function failed !\n"); |
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
213 return -1; |
571
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
380
diff
changeset
|
214 } |
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
380
diff
changeset
|
215 } |
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
380
diff
changeset
|
216 |
663
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
217 OCImage.FrameData0 = (unsigned char *)PdGetOffscreenContextPtr(OCImage.offscreen_context); |
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
218 if (OCImage.FrameData0 == NULL) |
571
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
380
diff
changeset
|
219 { |
663
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
220 SDL_SetError("ph_SetupFullScreenImage(): PdGetOffscreenContextPtr() function failed !\n"); |
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
221 ph_DestroyImage(this, screen); |
571
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
380
diff
changeset
|
222 return -1; |
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
380
diff
changeset
|
223 } |
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
380
diff
changeset
|
224 |
663
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
225 if ((screen->flags & SDL_DOUBLEBUF) == SDL_DOUBLEBUF) |
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
226 { |
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
227 OCImage.FrameData1 = (unsigned char *)PdGetOffscreenContextPtr(OCImage.offscreen_backcontext); |
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
228 if (OCImage.FrameData1 == NULL) |
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
229 { |
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
230 SDL_SetError("ph_SetupFullScreenImage(back): PdGetOffscreenContextPtr() function failed !\n"); |
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
231 ph_DestroyImage(this, screen); |
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
232 return -1; |
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
233 } |
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
234 } |
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
235 |
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
236 /* wait for the hardware */ |
821
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
237 PgFlush(); |
571
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
380
diff
changeset
|
238 PgWaitHWIdle(); |
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
380
diff
changeset
|
239 |
663
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
240 if ((screen->flags & SDL_DOUBLEBUF) == SDL_DOUBLEBUF) |
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
241 { |
821
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
242 OCImage.current = 0; |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
243 PhDCSetCurrent(OCImage.offscreen_context); |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
244 screen->pitch = OCImage.offscreen_context->pitch; |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
245 screen->pixels = OCImage.FrameData0; |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
246 |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
247 /* emulate 640x400 videomode */ |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
248 if (videomode_emulatemode==1) |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
249 { |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
250 int i; |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
251 |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
252 for (i=0; i<40; i++) |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
253 { |
1336
3692456e7b0f
Use SDL_ prefixed versions of C library functions.
Sam Lantinga <slouken@libsdl.org>
parents:
1312
diff
changeset
|
254 SDL_memset(screen->pixels+screen->pitch*i, 0x00, screen->pitch); |
821
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
255 } |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
256 for (i=440; i<480; i++) |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
257 { |
1336
3692456e7b0f
Use SDL_ prefixed versions of C library functions.
Sam Lantinga <slouken@libsdl.org>
parents:
1312
diff
changeset
|
258 SDL_memset(screen->pixels+screen->pitch*i, 0x00, screen->pitch); |
821
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
259 } |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
260 screen->pixels+=screen->pitch*40; |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
261 } |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
262 PgSwapDisplay(OCImage.offscreen_backcontext, 0); |
663
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
263 } |
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
264 else |
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
265 { |
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
266 OCImage.current = 0; |
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
267 PhDCSetCurrent(OCImage.offscreen_context); |
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
268 screen->pitch = OCImage.offscreen_context->pitch; |
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
269 screen->pixels = OCImage.FrameData0; |
821
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
270 |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
271 /* emulate 640x400 videomode */ |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
272 if (videomode_emulatemode==1) |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
273 { |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
274 int i; |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
275 |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
276 for (i=0; i<40; i++) |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
277 { |
1336
3692456e7b0f
Use SDL_ prefixed versions of C library functions.
Sam Lantinga <slouken@libsdl.org>
parents:
1312
diff
changeset
|
278 SDL_memset(screen->pixels+screen->pitch*i, 0x00, screen->pitch); |
821
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
279 } |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
280 for (i=440; i<480; i++) |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
281 { |
1336
3692456e7b0f
Use SDL_ prefixed versions of C library functions.
Sam Lantinga <slouken@libsdl.org>
parents:
1312
diff
changeset
|
282 SDL_memset(screen->pixels+screen->pitch*i, 0x00, screen->pitch); |
821
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
283 } |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
284 screen->pixels+=screen->pitch*40; |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
285 } |
663
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
286 } |
571
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
380
diff
changeset
|
287 |
663
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
288 this->UpdateRects = ph_OCDCUpdate; |
571
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
380
diff
changeset
|
289 |
821
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
290 /* wait for the hardware */ |
692
04dd6c6d7c30
Date: Fri, 15 Aug 2003 09:13:59 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
663
diff
changeset
|
291 PgFlush(); |
821
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
292 PgWaitHWIdle(); |
692
04dd6c6d7c30
Date: Fri, 15 Aug 2003 09:13:59 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
663
diff
changeset
|
293 |
571
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
380
diff
changeset
|
294 return 0; |
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
380
diff
changeset
|
295 } |
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
380
diff
changeset
|
296 |
1361
19418e4422cb
New configure-based build system. Still work in progress, but much improved
Sam Lantinga <slouken@libsdl.org>
parents:
1358
diff
changeset
|
297 #if SDL_VIDEO_OPENGL |
701
aaf3b8af6616
Date: Sat, 30 Aug 2003 16:28:10 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
692
diff
changeset
|
298 |
aaf3b8af6616
Date: Sat, 30 Aug 2003 16:28:10 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
692
diff
changeset
|
299 int ph_SetupOpenGLImage(_THIS, SDL_Surface* screen) |
aaf3b8af6616
Date: Sat, 30 Aug 2003 16:28:10 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
692
diff
changeset
|
300 { |
910
4ab6d1fd028f
Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
886
diff
changeset
|
301 this->UpdateRects = ph_OpenGLUpdate; |
4ab6d1fd028f
Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
886
diff
changeset
|
302 screen->pixels=NULL; |
4ab6d1fd028f
Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
886
diff
changeset
|
303 screen->pitch=NULL; |
701
aaf3b8af6616
Date: Sat, 30 Aug 2003 16:28:10 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
692
diff
changeset
|
304 |
910
4ab6d1fd028f
Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
886
diff
changeset
|
305 #if (_NTO_VERSION >= 630) |
4ab6d1fd028f
Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
886
diff
changeset
|
306 if ((screen->flags & SDL_FULLSCREEN) == SDL_FULLSCREEN) |
4ab6d1fd028f
Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
886
diff
changeset
|
307 { |
4ab6d1fd028f
Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
886
diff
changeset
|
308 if (!ph_EnterFullScreen(this, screen, PH_IGNORE_DIRECTMODE)) |
4ab6d1fd028f
Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
886
diff
changeset
|
309 { |
4ab6d1fd028f
Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
886
diff
changeset
|
310 screen->flags &= ~SDL_FULLSCREEN; |
4ab6d1fd028f
Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
886
diff
changeset
|
311 return -1; |
4ab6d1fd028f
Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
886
diff
changeset
|
312 } |
4ab6d1fd028f
Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
886
diff
changeset
|
313 } |
4ab6d1fd028f
Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
886
diff
changeset
|
314 #endif /* 6.3.0 */ |
4ab6d1fd028f
Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
886
diff
changeset
|
315 |
4ab6d1fd028f
Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
886
diff
changeset
|
316 if (ph_SetupOpenGLContext(this, screen->w, screen->h, screen->format->BitsPerPixel, screen->flags)!=0) |
4ab6d1fd028f
Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
886
diff
changeset
|
317 { |
4ab6d1fd028f
Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
886
diff
changeset
|
318 screen->flags &= ~SDL_OPENGL; |
4ab6d1fd028f
Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
886
diff
changeset
|
319 return -1; |
4ab6d1fd028f
Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
886
diff
changeset
|
320 } |
701
aaf3b8af6616
Date: Sat, 30 Aug 2003 16:28:10 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
692
diff
changeset
|
321 |
910
4ab6d1fd028f
Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
886
diff
changeset
|
322 return 0; |
701
aaf3b8af6616
Date: Sat, 30 Aug 2003 16:28:10 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
692
diff
changeset
|
323 } |
aaf3b8af6616
Date: Sat, 30 Aug 2003 16:28:10 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
692
diff
changeset
|
324 |
1361
19418e4422cb
New configure-based build system. Still work in progress, but much improved
Sam Lantinga <slouken@libsdl.org>
parents:
1358
diff
changeset
|
325 #endif /* SDL_VIDEO_OPENGL */ |
701
aaf3b8af6616
Date: Sat, 30 Aug 2003 16:28:10 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
692
diff
changeset
|
326 |
aaf3b8af6616
Date: Sat, 30 Aug 2003 16:28:10 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
692
diff
changeset
|
327 void ph_DestroyImage(_THIS, SDL_Surface* screen) |
aaf3b8af6616
Date: Sat, 30 Aug 2003 16:28:10 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
692
diff
changeset
|
328 { |
aaf3b8af6616
Date: Sat, 30 Aug 2003 16:28:10 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
692
diff
changeset
|
329 |
1361
19418e4422cb
New configure-based build system. Still work in progress, but much improved
Sam Lantinga <slouken@libsdl.org>
parents:
1358
diff
changeset
|
330 #if SDL_VIDEO_OPENGL |
701
aaf3b8af6616
Date: Sat, 30 Aug 2003 16:28:10 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
692
diff
changeset
|
331 if ((screen->flags & SDL_OPENGL)==SDL_OPENGL) |
aaf3b8af6616
Date: Sat, 30 Aug 2003 16:28:10 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
692
diff
changeset
|
332 { |
aaf3b8af6616
Date: Sat, 30 Aug 2003 16:28:10 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
692
diff
changeset
|
333 if (oglctx) |
aaf3b8af6616
Date: Sat, 30 Aug 2003 16:28:10 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
692
diff
changeset
|
334 { |
910
4ab6d1fd028f
Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
886
diff
changeset
|
335 #if (_NTO_VERSION < 630) |
4ab6d1fd028f
Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
886
diff
changeset
|
336 PhDCSetCurrent(NULL); |
4ab6d1fd028f
Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
886
diff
changeset
|
337 PhDCRelease(oglctx); |
4ab6d1fd028f
Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
886
diff
changeset
|
338 #else |
4ab6d1fd028f
Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
886
diff
changeset
|
339 qnxgl_context_destroy(oglctx); |
4ab6d1fd028f
Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
886
diff
changeset
|
340 qnxgl_buffers_destroy(oglbuffers); |
4ab6d1fd028f
Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
886
diff
changeset
|
341 qnxgl_finish(); |
4ab6d1fd028f
Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
886
diff
changeset
|
342 #endif /* 6.3.0 */ |
701
aaf3b8af6616
Date: Sat, 30 Aug 2003 16:28:10 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
692
diff
changeset
|
343 oglctx=NULL; |
910
4ab6d1fd028f
Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
886
diff
changeset
|
344 oglbuffers=NULL; |
701
aaf3b8af6616
Date: Sat, 30 Aug 2003 16:28:10 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
692
diff
changeset
|
345 oglflags=0; |
aaf3b8af6616
Date: Sat, 30 Aug 2003 16:28:10 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
692
diff
changeset
|
346 oglbpp=0; |
aaf3b8af6616
Date: Sat, 30 Aug 2003 16:28:10 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
692
diff
changeset
|
347 } |
910
4ab6d1fd028f
Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
886
diff
changeset
|
348 |
4ab6d1fd028f
Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
886
diff
changeset
|
349 #if (_NTO_VERSION >= 630) |
4ab6d1fd028f
Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
886
diff
changeset
|
350 if (currently_fullscreen) |
4ab6d1fd028f
Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
886
diff
changeset
|
351 { |
4ab6d1fd028f
Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
886
diff
changeset
|
352 ph_LeaveFullScreen(this); |
4ab6d1fd028f
Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
886
diff
changeset
|
353 } |
4ab6d1fd028f
Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
886
diff
changeset
|
354 #endif /* 6.3.0 */ |
4ab6d1fd028f
Date: Sat, 26 Jun 2004 14:58:42 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
886
diff
changeset
|
355 |
701
aaf3b8af6616
Date: Sat, 30 Aug 2003 16:28:10 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
692
diff
changeset
|
356 return; |
aaf3b8af6616
Date: Sat, 30 Aug 2003 16:28:10 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
692
diff
changeset
|
357 } |
1361
19418e4422cb
New configure-based build system. Still work in progress, but much improved
Sam Lantinga <slouken@libsdl.org>
parents:
1358
diff
changeset
|
358 #endif /* SDL_VIDEO_OPENGL */ |
701
aaf3b8af6616
Date: Sat, 30 Aug 2003 16:28:10 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
692
diff
changeset
|
359 |
663
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
360 if (currently_fullscreen) |
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
361 { |
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
362 /* if we right now in 8bpp fullscreen we must release palette */ |
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
363 if ((screen->format->BitsPerPixel==8) && (desktopbpp!=8)) |
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
364 { |
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
365 PgSetPalette(syspalph, 0, -1, 0, 0, 0); |
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
366 PgSetPalette(savedpal, 0, 0, _Pg_MAX_PALETTE, Pg_PALSET_GLOBAL | Pg_PALSET_FORCE_EXPOSE, 0); |
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
367 PgFlush(); |
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
368 } |
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
369 ph_LeaveFullScreen(this); |
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
370 } |
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
371 |
291
68a8a8237c09
Date: Thu, 21 Feb 2002 09:18:24 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
283
diff
changeset
|
372 if (OCImage.offscreen_context != NULL) |
68a8a8237c09
Date: Thu, 21 Feb 2002 09:18:24 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
283
diff
changeset
|
373 { |
68a8a8237c09
Date: Thu, 21 Feb 2002 09:18:24 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
283
diff
changeset
|
374 PhDCRelease(OCImage.offscreen_context); |
68a8a8237c09
Date: Thu, 21 Feb 2002 09:18:24 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
283
diff
changeset
|
375 OCImage.offscreen_context = NULL; |
68a8a8237c09
Date: Thu, 21 Feb 2002 09:18:24 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
283
diff
changeset
|
376 OCImage.FrameData0 = NULL; |
663
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
377 } |
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
378 if (OCImage.offscreen_backcontext != NULL) |
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
379 { |
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
380 PhDCRelease(OCImage.offscreen_backcontext); |
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
381 OCImage.offscreen_backcontext = NULL; |
291
68a8a8237c09
Date: Thu, 21 Feb 2002 09:18:24 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
283
diff
changeset
|
382 OCImage.FrameData1 = NULL; |
68a8a8237c09
Date: Thu, 21 Feb 2002 09:18:24 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
283
diff
changeset
|
383 } |
663
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
384 OCImage.CurrentFrameData = NULL; |
0 | 385 |
291
68a8a8237c09
Date: Thu, 21 Feb 2002 09:18:24 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
283
diff
changeset
|
386 if (SDL_Image) |
68a8a8237c09
Date: Thu, 21 Feb 2002 09:18:24 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
283
diff
changeset
|
387 { |
315
3333b6e68289
Date: Sat, 23 Mar 2002 13:53:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
388 /* if palette allocated, free it */ |
3333b6e68289
Date: Sat, 23 Mar 2002 13:53:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
389 if (SDL_Image->palette) |
3333b6e68289
Date: Sat, 23 Mar 2002 13:53:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
390 { |
1336
3692456e7b0f
Use SDL_ prefixed versions of C library functions.
Sam Lantinga <slouken@libsdl.org>
parents:
1312
diff
changeset
|
391 SDL_free(SDL_Image->palette); |
315
3333b6e68289
Date: Sat, 23 Mar 2002 13:53:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
392 } |
291
68a8a8237c09
Date: Thu, 21 Feb 2002 09:18:24 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
283
diff
changeset
|
393 PgShmemDestroy(SDL_Image->image); |
1336
3692456e7b0f
Use SDL_ prefixed versions of C library functions.
Sam Lantinga <slouken@libsdl.org>
parents:
1312
diff
changeset
|
394 SDL_free(SDL_Image); |
291
68a8a8237c09
Date: Thu, 21 Feb 2002 09:18:24 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
283
diff
changeset
|
395 } |
0 | 396 |
315
3333b6e68289
Date: Sat, 23 Mar 2002 13:53:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
397 /* Must be zeroed everytime */ |
3333b6e68289
Date: Sat, 23 Mar 2002 13:53:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
398 SDL_Image = NULL; |
3333b6e68289
Date: Sat, 23 Mar 2002 13:53:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
399 |
291
68a8a8237c09
Date: Thu, 21 Feb 2002 09:18:24 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
283
diff
changeset
|
400 if (screen) |
68a8a8237c09
Date: Thu, 21 Feb 2002 09:18:24 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
283
diff
changeset
|
401 { |
68a8a8237c09
Date: Thu, 21 Feb 2002 09:18:24 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
283
diff
changeset
|
402 screen->pixels = NULL; |
68a8a8237c09
Date: Thu, 21 Feb 2002 09:18:24 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
283
diff
changeset
|
403 } |
0 | 404 } |
405 | |
821
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
406 int ph_UpdateHWInfo(_THIS) |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
407 { |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
408 PgVideoModeInfo_t vmode; |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
409 PgHWCaps_t hwcaps; |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
410 |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
411 /* Update video ram amount */ |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
412 if (PgGetGraphicsHWCaps(&hwcaps) < 0) |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
413 { |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
414 SDL_SetError("ph_UpdateHWInfo(): GetGraphicsHWCaps() function failed !\n"); |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
415 return -1; |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
416 } |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
417 this->info.video_mem=hwcaps.currently_available_video_ram/1024; |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
418 |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
419 /* obtain current mode capabilities */ |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
420 if (PgGetVideoModeInfo(hwcaps.current_video_mode, &vmode) < 0) |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
421 { |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
422 SDL_SetError("ph_UpdateHWInfo(): GetVideoModeInfo() function failed !\n"); |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
423 return -1; |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
424 } |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
425 |
886
05c551e5bc64
Date: Sat, 24 Apr 2004 15:13:32 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
821
diff
changeset
|
426 if ((vmode.mode_capabilities1 & PgVM_MODE_CAP1_OFFSCREEN) == PgVM_MODE_CAP1_OFFSCREEN) |
05c551e5bc64
Date: Sat, 24 Apr 2004 15:13:32 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
821
diff
changeset
|
427 { |
05c551e5bc64
Date: Sat, 24 Apr 2004 15:13:32 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
821
diff
changeset
|
428 /* this is a special test for drivers which tries to lie about offscreen capability */ |
05c551e5bc64
Date: Sat, 24 Apr 2004 15:13:32 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
821
diff
changeset
|
429 if (hwcaps.currently_available_video_ram!=0) |
05c551e5bc64
Date: Sat, 24 Apr 2004 15:13:32 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
821
diff
changeset
|
430 { |
05c551e5bc64
Date: Sat, 24 Apr 2004 15:13:32 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
821
diff
changeset
|
431 this->info.hw_available = 1; |
05c551e5bc64
Date: Sat, 24 Apr 2004 15:13:32 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
821
diff
changeset
|
432 } |
05c551e5bc64
Date: Sat, 24 Apr 2004 15:13:32 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
821
diff
changeset
|
433 else |
05c551e5bc64
Date: Sat, 24 Apr 2004 15:13:32 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
821
diff
changeset
|
434 { |
05c551e5bc64
Date: Sat, 24 Apr 2004 15:13:32 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
821
diff
changeset
|
435 this->info.hw_available = 0; |
05c551e5bc64
Date: Sat, 24 Apr 2004 15:13:32 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
821
diff
changeset
|
436 } |
05c551e5bc64
Date: Sat, 24 Apr 2004 15:13:32 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
821
diff
changeset
|
437 } |
05c551e5bc64
Date: Sat, 24 Apr 2004 15:13:32 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
821
diff
changeset
|
438 else |
05c551e5bc64
Date: Sat, 24 Apr 2004 15:13:32 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
821
diff
changeset
|
439 { |
05c551e5bc64
Date: Sat, 24 Apr 2004 15:13:32 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
821
diff
changeset
|
440 this->info.hw_available = 0; |
05c551e5bc64
Date: Sat, 24 Apr 2004 15:13:32 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
821
diff
changeset
|
441 } |
05c551e5bc64
Date: Sat, 24 Apr 2004 15:13:32 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
821
diff
changeset
|
442 |
05c551e5bc64
Date: Sat, 24 Apr 2004 15:13:32 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
821
diff
changeset
|
443 if ((vmode.mode_capabilities2 & PgVM_MODE_CAP2_RECTANGLE) == PgVM_MODE_CAP2_RECTANGLE) |
05c551e5bc64
Date: Sat, 24 Apr 2004 15:13:32 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
821
diff
changeset
|
444 { |
05c551e5bc64
Date: Sat, 24 Apr 2004 15:13:32 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
821
diff
changeset
|
445 this->info.blit_fill = 1; |
05c551e5bc64
Date: Sat, 24 Apr 2004 15:13:32 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
821
diff
changeset
|
446 } |
05c551e5bc64
Date: Sat, 24 Apr 2004 15:13:32 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
821
diff
changeset
|
447 else |
05c551e5bc64
Date: Sat, 24 Apr 2004 15:13:32 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
821
diff
changeset
|
448 { |
05c551e5bc64
Date: Sat, 24 Apr 2004 15:13:32 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
821
diff
changeset
|
449 this->info.blit_fill = 0; |
05c551e5bc64
Date: Sat, 24 Apr 2004 15:13:32 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
821
diff
changeset
|
450 } |
05c551e5bc64
Date: Sat, 24 Apr 2004 15:13:32 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
821
diff
changeset
|
451 |
05c551e5bc64
Date: Sat, 24 Apr 2004 15:13:32 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
821
diff
changeset
|
452 if ((vmode.mode_capabilities2 & PgVM_MODE_CAP2_BITBLT) == PgVM_MODE_CAP2_BITBLT) |
05c551e5bc64
Date: Sat, 24 Apr 2004 15:13:32 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
821
diff
changeset
|
453 { |
05c551e5bc64
Date: Sat, 24 Apr 2004 15:13:32 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
821
diff
changeset
|
454 this->info.blit_hw = 1; |
05c551e5bc64
Date: Sat, 24 Apr 2004 15:13:32 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
821
diff
changeset
|
455 } |
05c551e5bc64
Date: Sat, 24 Apr 2004 15:13:32 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
821
diff
changeset
|
456 else |
05c551e5bc64
Date: Sat, 24 Apr 2004 15:13:32 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
821
diff
changeset
|
457 { |
05c551e5bc64
Date: Sat, 24 Apr 2004 15:13:32 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
821
diff
changeset
|
458 this->info.blit_hw = 0; |
05c551e5bc64
Date: Sat, 24 Apr 2004 15:13:32 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
821
diff
changeset
|
459 } |
821
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
460 |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
461 if ((vmode.mode_capabilities2 & PgVM_MODE_CAP2_ALPHA_BLEND) == PgVM_MODE_CAP2_ALPHA_BLEND) |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
462 { |
886
05c551e5bc64
Date: Sat, 24 Apr 2004 15:13:32 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
821
diff
changeset
|
463 this->info.blit_hw_A = 1; |
821
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
464 } |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
465 else |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
466 { |
886
05c551e5bc64
Date: Sat, 24 Apr 2004 15:13:32 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
821
diff
changeset
|
467 this->info.blit_hw_A = 0; |
821
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
468 } |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
469 |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
470 if ((vmode.mode_capabilities2 & PgVM_MODE_CAP2_CHROMA) == PgVM_MODE_CAP2_CHROMA) |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
471 { |
886
05c551e5bc64
Date: Sat, 24 Apr 2004 15:13:32 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
821
diff
changeset
|
472 this->info.blit_hw_CC = 1; |
821
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
473 } |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
474 else |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
475 { |
886
05c551e5bc64
Date: Sat, 24 Apr 2004 15:13:32 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
821
diff
changeset
|
476 this->info.blit_hw_CC = 0; |
821
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
477 } |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
478 |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
479 return 0; |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
480 } |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
481 |
701
aaf3b8af6616
Date: Sat, 30 Aug 2003 16:28:10 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
692
diff
changeset
|
482 int ph_SetupUpdateFunction(_THIS, SDL_Surface* screen, Uint32 flags) |
0 | 483 { |
821
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
484 int setupresult=-1; |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
485 |
0 | 486 ph_DestroyImage(this, screen); |
487 | |
1361
19418e4422cb
New configure-based build system. Still work in progress, but much improved
Sam Lantinga <slouken@libsdl.org>
parents:
1358
diff
changeset
|
488 #if SDL_VIDEO_OPENGL |
701
aaf3b8af6616
Date: Sat, 30 Aug 2003 16:28:10 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
692
diff
changeset
|
489 if ((flags & SDL_OPENGL)==SDL_OPENGL) |
aaf3b8af6616
Date: Sat, 30 Aug 2003 16:28:10 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
692
diff
changeset
|
490 { |
821
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
491 setupresult=ph_SetupOpenGLImage(this, screen); |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
492 } |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
493 else |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
494 { |
1361
19418e4422cb
New configure-based build system. Still work in progress, but much improved
Sam Lantinga <slouken@libsdl.org>
parents:
1358
diff
changeset
|
495 #endif |
821
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
496 if ((flags & SDL_FULLSCREEN)==SDL_FULLSCREEN) |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
497 { |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
498 setupresult=ph_SetupFullScreenImage(this, screen); |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
499 } |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
500 else |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
501 { |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
502 if ((flags & SDL_HWSURFACE)==SDL_HWSURFACE) |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
503 { |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
504 setupresult=ph_SetupOCImage(this, screen); |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
505 } |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
506 else |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
507 { |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
508 setupresult=ph_SetupImage(this, screen); |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
509 } |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
510 } |
1361
19418e4422cb
New configure-based build system. Still work in progress, but much improved
Sam Lantinga <slouken@libsdl.org>
parents:
1358
diff
changeset
|
511 #if SDL_VIDEO_OPENGL |
701
aaf3b8af6616
Date: Sat, 30 Aug 2003 16:28:10 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
692
diff
changeset
|
512 } |
1361
19418e4422cb
New configure-based build system. Still work in progress, but much improved
Sam Lantinga <slouken@libsdl.org>
parents:
1358
diff
changeset
|
513 #endif |
821
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
514 if (setupresult!=-1) |
0 | 515 { |
821
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
516 ph_UpdateHWInfo(this); |
571
8e3ce997621c
Date: Thu, 16 Jan 2003 13:48:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
380
diff
changeset
|
517 } |
821
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
518 |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
519 return setupresult; |
0 | 520 } |
663
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
521 |
701
aaf3b8af6616
Date: Sat, 30 Aug 2003 16:28:10 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
692
diff
changeset
|
522 int ph_AllocHWSurface(_THIS, SDL_Surface* surface) |
0 | 523 { |
821
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
524 PgHWCaps_t hwcaps; |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
525 |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
526 if (surface->hwdata!=NULL) |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
527 { |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
528 SDL_SetError("ph_AllocHWSurface(): hwdata already exists!\n"); |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
529 return -1; |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
530 } |
1336
3692456e7b0f
Use SDL_ prefixed versions of C library functions.
Sam Lantinga <slouken@libsdl.org>
parents:
1312
diff
changeset
|
531 surface->hwdata=SDL_malloc(sizeof(struct private_hwdata)); |
3692456e7b0f
Use SDL_ prefixed versions of C library functions.
Sam Lantinga <slouken@libsdl.org>
parents:
1312
diff
changeset
|
532 SDL_memset(surface->hwdata, 0x00, sizeof(struct private_hwdata)); |
821
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
533 surface->hwdata->offscreenctx=PdCreateOffscreenContext(0, surface->w, surface->h, Pg_OSC_MEM_PAGE_ALIGN); |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
534 if (surface->hwdata->offscreenctx == NULL) |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
535 { |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
536 SDL_SetError("ph_AllocHWSurface(): PdCreateOffscreenContext() function failed !\n"); |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
537 return -1; |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
538 } |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
539 surface->pixels=PdGetOffscreenContextPtr(surface->hwdata->offscreenctx); |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
540 if (surface->pixels==NULL) |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
541 { |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
542 PhDCRelease(surface->hwdata->offscreenctx); |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
543 SDL_SetError("ph_AllocHWSurface(): PdGetOffscreenContextPtr() function failed !\n"); |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
544 return -1; |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
545 } |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
546 surface->pitch=surface->hwdata->offscreenctx->pitch; |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
547 surface->flags|=SDL_HWSURFACE; |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
548 surface->flags|=SDL_PREALLOC; |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
549 |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
550 #if 0 /* FIXME */ |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
551 /* create simple offscreen lock */ |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
552 surface->hwdata->crlockparam.flags=0; |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
553 if (PdCreateOffscreenLock(surface->hwdata->offscreenctx, &surface->hwdata->crlockparam)!=EOK) |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
554 { |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
555 PhDCRelease(surface->hwdata->offscreenctx); |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
556 SDL_SetError("ph_AllocHWSurface(): Can't create offscreen lock !\n"); |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
557 return -1; |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
558 } |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
559 #endif /* 0 */ |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
560 |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
561 /* Update video ram amount */ |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
562 if (PgGetGraphicsHWCaps(&hwcaps) < 0) |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
563 { |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
564 PdDestroyOffscreenLock(surface->hwdata->offscreenctx); |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
565 PhDCRelease(surface->hwdata->offscreenctx); |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
566 SDL_SetError("ph_AllocHWSurface(): GetGraphicsHWCaps() function failed !\n"); |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
567 return -1; |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
568 } |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
569 this->info.video_mem=hwcaps.currently_available_video_ram/1024; |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
570 |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
571 return 0; |
0 | 572 } |
573 | |
701
aaf3b8af6616
Date: Sat, 30 Aug 2003 16:28:10 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
692
diff
changeset
|
574 void ph_FreeHWSurface(_THIS, SDL_Surface* surface) |
0 | 575 { |
821
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
576 PgHWCaps_t hwcaps; |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
577 |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
578 if (surface->hwdata==NULL) |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
579 { |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
580 SDL_SetError("ph_FreeHWSurface(): no hwdata!\n"); |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
581 return; |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
582 } |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
583 if (surface->hwdata->offscreenctx == NULL) |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
584 { |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
585 SDL_SetError("ph_FreeHWSurface(): no offscreen context to delete!\n"); |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
586 return; |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
587 } |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
588 |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
589 #if 0 /* FIXME */ |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
590 /* unlock the offscreen context if it has been locked before destroy it */ |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
591 if (PdIsOffscreenLocked(surface->hwdata->offscreenctx)==Pg_OSC_LOCKED) |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
592 { |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
593 PdUnlockOffscreen(surface->hwdata->offscreenctx); |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
594 } |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
595 |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
596 PdDestroyOffscreenLock(surface->hwdata->offscreenctx); |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
597 #endif /* 0 */ |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
598 |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
599 PhDCRelease(surface->hwdata->offscreenctx); |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
600 |
1336
3692456e7b0f
Use SDL_ prefixed versions of C library functions.
Sam Lantinga <slouken@libsdl.org>
parents:
1312
diff
changeset
|
601 SDL_free(surface->hwdata); |
821
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
602 surface->hwdata=NULL; |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
603 |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
604 /* Update video ram amount */ |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
605 if (PgGetGraphicsHWCaps(&hwcaps) < 0) |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
606 { |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
607 SDL_SetError("ph_FreeHWSurface(): GetGraphicsHWCaps() function failed !\n"); |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
608 return; |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
609 } |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
610 this->info.video_mem=hwcaps.currently_available_video_ram/1024; |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
611 |
315
3333b6e68289
Date: Sat, 23 Mar 2002 13:53:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
612 return; |
0 | 613 } |
614 | |
821
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
615 int ph_CheckHWBlit(_THIS, SDL_Surface *src, SDL_Surface *dst) |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
616 { |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
617 if ((src->hwdata==NULL) && (src != this->screen)) |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
618 { |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
619 SDL_SetError("ph_CheckHWBlit(): Source surface haven't hardware specific data.\n"); |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
620 src->flags&=~SDL_HWACCEL; |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
621 return -1; |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
622 } |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
623 if ((src->flags & SDL_HWSURFACE) != SDL_HWSURFACE) |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
624 { |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
625 SDL_SetError("ph_CheckHWBlit(): Source surface isn't a hardware surface.\n"); |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
626 src->flags&=~SDL_HWACCEL; |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
627 return -1; |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
628 } |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
629 |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
630 if ((src->flags & SDL_SRCCOLORKEY) == SDL_SRCCOLORKEY) |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
631 { |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
632 if (this->info.blit_hw_CC!=1) |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
633 { |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
634 src->flags&=~SDL_HWACCEL; |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
635 src->map->hw_blit=NULL; |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
636 return -1; |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
637 } |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
638 } |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
639 |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
640 if ((src->flags & SDL_SRCALPHA) == SDL_SRCALPHA) |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
641 { |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
642 if (this->info.blit_hw_A!=1) |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
643 { |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
644 src->flags&=~SDL_HWACCEL; |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
645 src->map->hw_blit=NULL; |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
646 return -1; |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
647 } |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
648 } |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
649 |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
650 src->flags|=SDL_HWACCEL; |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
651 src->map->hw_blit = ph_HWAccelBlit; |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
652 |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
653 return 1; |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
654 } |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
655 |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
656 PgColor_t ph_ExpandColor(_THIS, SDL_Surface* surface, Uint32 color) |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
657 { |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
658 Uint32 truecolor; |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
659 |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
660 /* Photon API accepts true colors only during hw filling operations */ |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
661 switch(surface->format->BitsPerPixel) |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
662 { |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
663 case 8: |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
664 { |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
665 if ((surface->format->palette) && (color<=surface->format->palette->ncolors)) |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
666 { |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
667 truecolor=PgRGB(surface->format->palette->colors[color].r, |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
668 surface->format->palette->colors[color].g, |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
669 surface->format->palette->colors[color].b); |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
670 } |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
671 else |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
672 { |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
673 SDL_SetError("ph_ExpandColor(): Color out of range for the 8bpp mode !\n"); |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
674 return 0xFFFFFFFFUL; |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
675 } |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
676 } |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
677 break; |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
678 case 15: |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
679 { |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
680 truecolor = ((color & 0x00007C00UL) << 9) | /* R */ |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
681 ((color & 0x000003E0UL) << 6) | /* G */ |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
682 ((color & 0x0000001FUL) << 3) | /* B */ |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
683 ((color & 0x00007000UL) << 4) | /* R compensation */ |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
684 ((color & 0x00000380UL) << 1) | /* G compensation */ |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
685 ((color & 0x0000001CUL) >> 2); /* B compensation */ |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
686 } |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
687 break; |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
688 case 16: |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
689 { |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
690 truecolor = ((color & 0x0000F800UL) << 8) | /* R */ |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
691 ((color & 0x000007E0UL) << 5) | /* G */ |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
692 ((color & 0x0000001FUL) << 3) | /* B */ |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
693 ((color & 0x0000E000UL) << 3) | /* R compensation */ |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
694 ((color & 0x00000600UL) >> 1) | /* G compensation */ |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
695 ((color & 0x0000001CUL) >> 2); /* B compensation */ |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
696 |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
697 } |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
698 break; |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
699 case 24: |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
700 { |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
701 truecolor=color & 0x00FFFFFFUL; |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
702 } |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
703 break; |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
704 case 32: |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
705 { |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
706 truecolor=color; |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
707 } |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
708 break; |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
709 default: |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
710 { |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
711 SDL_SetError("ph_ExpandColor(): Unsupported depth for the hardware operations !\n"); |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
712 return 0xFFFFFFFFUL; |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
713 } |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
714 } |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
715 |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
716 return truecolor; |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
717 } |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
718 |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
719 int ph_FillHWRect(_THIS, SDL_Surface* surface, SDL_Rect* rect, Uint32 color) |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
720 { |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
721 PgColor_t oldcolor; |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
722 Uint32 truecolor; |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
723 int ydisp=0; |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
724 |
886
05c551e5bc64
Date: Sat, 24 Apr 2004 15:13:32 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
821
diff
changeset
|
725 if (this->info.blit_fill!=1) |
05c551e5bc64
Date: Sat, 24 Apr 2004 15:13:32 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
821
diff
changeset
|
726 { |
05c551e5bc64
Date: Sat, 24 Apr 2004 15:13:32 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
821
diff
changeset
|
727 return -1; |
05c551e5bc64
Date: Sat, 24 Apr 2004 15:13:32 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
821
diff
changeset
|
728 } |
05c551e5bc64
Date: Sat, 24 Apr 2004 15:13:32 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
821
diff
changeset
|
729 |
821
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
730 truecolor=ph_ExpandColor(this, surface, color); |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
731 if (truecolor==0xFFFFFFFFUL) |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
732 { |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
733 return -1; |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
734 } |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
735 |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
736 oldcolor=PgSetFillColor(truecolor); |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
737 |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
738 /* 640x400 videomode emulation */ |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
739 if (videomode_emulatemode==1) |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
740 { |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
741 ydisp+=40; |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
742 } |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
743 |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
744 PgDrawIRect(rect->x, rect->y+ydisp, rect->w+rect->x-1, rect->h+rect->y+ydisp-1, Pg_DRAW_FILL); |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
745 PgSetFillColor(oldcolor); |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
746 PgFlush(); |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
747 PgWaitHWIdle(); |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
748 |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
749 return 0; |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
750 } |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
751 |
701
aaf3b8af6616
Date: Sat, 30 Aug 2003 16:28:10 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
692
diff
changeset
|
752 int ph_FlipHWSurface(_THIS, SDL_Surface* screen) |
0 | 753 { |
821
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
754 PhArea_t farea; |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
755 |
663
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
756 if ((screen->flags & SDL_FULLSCREEN) == SDL_FULLSCREEN) |
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
757 { |
821
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
758 /* flush all drawing ops before blitting */ |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
759 PgFlush(); |
701
aaf3b8af6616
Date: Sat, 30 Aug 2003 16:28:10 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
692
diff
changeset
|
760 PgWaitHWIdle(); |
821
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
761 |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
762 farea.pos.x=0; |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
763 farea.pos.y=0; |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
764 farea.size.w=screen->w; |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
765 farea.size.h=screen->h; |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
766 |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
767 /* emulate 640x400 videomode */ |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
768 if (videomode_emulatemode==1) |
663
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
769 { |
821
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
770 farea.pos.y+=40; |
663
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
771 } |
821
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
772 |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
773 PgContextBlitArea(OCImage.offscreen_context, &farea, OCImage.offscreen_backcontext, &farea); |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
774 |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
775 /* flush the blitting */ |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
776 PgFlush(); |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
777 PgWaitHWIdle(); |
663
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
778 } |
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
779 return 0; |
0 | 780 } |
781 | |
821
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
782 int ph_LockHWSurface(_THIS, SDL_Surface* surface) |
0 | 783 { |
821
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
784 |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
785 #if 0 /* FIXME */ |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
786 int lockresult; |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
787 |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
788 if (surface->hwdata == NULL) |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
789 { |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
790 return; |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
791 } |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
792 |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
793 surface->hwdata->lockparam.flags=0; |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
794 surface->hwdata->lockparam.time_out=NULL; |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
795 lockresult=PdLockOffscreen(surface->hwdata->offscreenctx, &surface->hwdata->lockparam); |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
796 |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
797 switch (lockresult) |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
798 { |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
799 case EOK: |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
800 break; |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
801 case Pg_OSC_LOCK_DEADLOCK: |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
802 SDL_SetError("ph_LockHWSurface(): Deadlock detected !\n"); |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
803 return -1; |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
804 case Pg_OSC_LOCK_INVALID: |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
805 SDL_SetError("ph_LockHWSurface(): Lock invalid !\n"); |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
806 return -1; |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
807 default: |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
808 SDL_SetError("ph_LockHWSurface(): Can't lock the surface !\n"); |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
809 return -1; |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
810 } |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
811 #endif /* 0 */ |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
812 |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
813 return 0; |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
814 } |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
815 |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
816 void ph_UnlockHWSurface(_THIS, SDL_Surface* surface) |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
817 { |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
818 |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
819 #if 0 /* FIXME */ |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
820 int unlockresult; |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
821 |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
822 if ((surface == NULL) || (surface->hwdata == NULL)) |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
823 { |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
824 return; |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
825 } |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
826 |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
827 if (PdIsOffscreenLocked(surface->hwdata->offscreenctx)==Pg_OSC_LOCKED) |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
828 { |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
829 unlockresult=PdUnlockOffscreen(surface->hwdata->offscreenctx); |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
830 } |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
831 #endif /* 0 */ |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
832 |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
833 return; |
0 | 834 } |
835 | |
821
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
836 int ph_HWAccelBlit(SDL_Surface* src, SDL_Rect* srcrect, SDL_Surface* dst, SDL_Rect* dstrect) |
0 | 837 { |
821
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
838 SDL_VideoDevice* this=current_video; |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
839 PhArea_t srcarea; |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
840 PhArea_t dstarea; |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
841 int ydisp=0; |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
842 |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
843 /* 640x400 videomode emulation */ |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
844 if (videomode_emulatemode==1) |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
845 { |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
846 ydisp+=40; |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
847 } |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
848 |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
849 srcarea.pos.x=srcrect->x; |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
850 srcarea.pos.y=srcrect->y; |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
851 srcarea.size.w=srcrect->w; |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
852 srcarea.size.h=srcrect->h; |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
853 |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
854 dstarea.pos.x=dstrect->x; |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
855 dstarea.pos.y=dstrect->y; |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
856 dstarea.size.w=dstrect->w; |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
857 dstarea.size.h=dstrect->h; |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
858 |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
859 if (((src == this->screen) || (src->hwdata!=NULL)) && ((dst == this->screen) || (dst->hwdata!=NULL))) |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
860 { |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
861 if ((src->flags & SDL_SRCCOLORKEY) == SDL_SRCCOLORKEY) |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
862 { |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
863 ph_SetHWColorKey(this, src, src->format->colorkey); |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
864 PgChromaOn(); |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
865 } |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
866 |
886
05c551e5bc64
Date: Sat, 24 Apr 2004 15:13:32 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
821
diff
changeset
|
867 if ((src->flags & SDL_SRCALPHA) == SDL_SRCALPHA) |
05c551e5bc64
Date: Sat, 24 Apr 2004 15:13:32 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
821
diff
changeset
|
868 { |
05c551e5bc64
Date: Sat, 24 Apr 2004 15:13:32 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
821
diff
changeset
|
869 ph_SetHWAlpha(this, src, src->format->alpha); |
05c551e5bc64
Date: Sat, 24 Apr 2004 15:13:32 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
821
diff
changeset
|
870 PgAlphaOn(); |
05c551e5bc64
Date: Sat, 24 Apr 2004 15:13:32 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
821
diff
changeset
|
871 } |
05c551e5bc64
Date: Sat, 24 Apr 2004 15:13:32 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
821
diff
changeset
|
872 |
821
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
873 if (dst == this->screen) |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
874 { |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
875 if (src == this->screen) |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
876 { |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
877 /* blitting from main screen to main screen */ |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
878 dstarea.pos.y+=ydisp; |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
879 srcarea.pos.y+=ydisp; |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
880 PgContextBlitArea(OCImage.offscreen_context, &srcarea, OCImage.offscreen_context, &dstarea); |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
881 } |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
882 else |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
883 { |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
884 /* blitting from offscreen to main screen */ |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
885 dstarea.pos.y+=ydisp; |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
886 PgContextBlitArea(src->hwdata->offscreenctx, &srcarea, OCImage.offscreen_context, &dstarea); |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
887 } |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
888 } |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
889 else |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
890 { |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
891 if (src == this->screen) |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
892 { |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
893 /* blitting from main screen to offscreen */ |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
894 srcarea.pos.y+=ydisp; |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
895 PgContextBlitArea(OCImage.offscreen_context, &srcarea, dst->hwdata->offscreenctx, &dstarea); |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
896 } |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
897 else |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
898 { |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
899 /* blitting offscreen to offscreen */ |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
900 PgContextBlitArea(src->hwdata->offscreenctx, &srcarea, dst->hwdata->offscreenctx, &dstarea); |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
901 } |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
902 } |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
903 |
886
05c551e5bc64
Date: Sat, 24 Apr 2004 15:13:32 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
821
diff
changeset
|
904 if ((src->flags & SDL_SRCALPHA) == SDL_SRCALPHA) |
05c551e5bc64
Date: Sat, 24 Apr 2004 15:13:32 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
821
diff
changeset
|
905 { |
05c551e5bc64
Date: Sat, 24 Apr 2004 15:13:32 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
821
diff
changeset
|
906 PgAlphaOff(); |
05c551e5bc64
Date: Sat, 24 Apr 2004 15:13:32 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
821
diff
changeset
|
907 } |
05c551e5bc64
Date: Sat, 24 Apr 2004 15:13:32 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
821
diff
changeset
|
908 |
821
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
909 if ((src->flags & SDL_SRCCOLORKEY) == SDL_SRCCOLORKEY) |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
910 { |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
911 PgChromaOff(); |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
912 } |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
913 } |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
914 else |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
915 { |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
916 SDL_SetError("ph_HWAccelBlit(): Source or target surface is not a hardware surface !\n"); |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
917 return -1; |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
918 } |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
919 |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
920 PgFlush(); |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
921 PgWaitHWIdle(); |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
922 |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
923 return 0; |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
924 } |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
925 |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
926 int ph_SetHWColorKey(_THIS, SDL_Surface *surface, Uint32 key) |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
927 { |
886
05c551e5bc64
Date: Sat, 24 Apr 2004 15:13:32 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
821
diff
changeset
|
928 if (this->info.blit_hw_CC!=1) |
05c551e5bc64
Date: Sat, 24 Apr 2004 15:13:32 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
821
diff
changeset
|
929 { |
05c551e5bc64
Date: Sat, 24 Apr 2004 15:13:32 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
821
diff
changeset
|
930 return -1; |
05c551e5bc64
Date: Sat, 24 Apr 2004 15:13:32 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
821
diff
changeset
|
931 } |
05c551e5bc64
Date: Sat, 24 Apr 2004 15:13:32 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
821
diff
changeset
|
932 |
821
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
933 if (surface->hwdata!=NULL) |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
934 { |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
935 surface->hwdata->colorkey=ph_ExpandColor(this, surface, key); |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
936 if (surface->hwdata->colorkey==0xFFFFFFFFUL) |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
937 { |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
938 return -1; |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
939 } |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
940 } |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
941 PgSetChroma(surface->hwdata->colorkey, Pg_CHROMA_SRC_MATCH | Pg_CHROMA_NODRAW); |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
942 |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
943 return 0; |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
944 } |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
945 |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
946 int ph_SetHWAlpha(_THIS, SDL_Surface* surface, Uint8 alpha) |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
947 { |
886
05c551e5bc64
Date: Sat, 24 Apr 2004 15:13:32 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
821
diff
changeset
|
948 if (this->info.blit_hw_A!=1) |
05c551e5bc64
Date: Sat, 24 Apr 2004 15:13:32 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
821
diff
changeset
|
949 { |
05c551e5bc64
Date: Sat, 24 Apr 2004 15:13:32 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
821
diff
changeset
|
950 return -1; |
05c551e5bc64
Date: Sat, 24 Apr 2004 15:13:32 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
821
diff
changeset
|
951 } |
05c551e5bc64
Date: Sat, 24 Apr 2004 15:13:32 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
821
diff
changeset
|
952 |
05c551e5bc64
Date: Sat, 24 Apr 2004 15:13:32 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
821
diff
changeset
|
953 PgSetAlphaBlend(NULL, alpha); |
05c551e5bc64
Date: Sat, 24 Apr 2004 15:13:32 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
821
diff
changeset
|
954 |
05c551e5bc64
Date: Sat, 24 Apr 2004 15:13:32 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
821
diff
changeset
|
955 return 0; |
0 | 956 } |
957 | |
1361
19418e4422cb
New configure-based build system. Still work in progress, but much improved
Sam Lantinga <slouken@libsdl.org>
parents:
1358
diff
changeset
|
958 #if SDL_VIDEO_OPENGL |
291
68a8a8237c09
Date: Thu, 21 Feb 2002 09:18:24 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
283
diff
changeset
|
959 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
|
960 { |
68a8a8237c09
Date: Thu, 21 Feb 2002 09:18:24 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
283
diff
changeset
|
961 this->GL_SwapBuffers(this); |
68a8a8237c09
Date: Thu, 21 Feb 2002 09:18:24 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
283
diff
changeset
|
962 |
68a8a8237c09
Date: Thu, 21 Feb 2002 09:18:24 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
283
diff
changeset
|
963 return; |
68a8a8237c09
Date: Thu, 21 Feb 2002 09:18:24 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
283
diff
changeset
|
964 } |
1361
19418e4422cb
New configure-based build system. Still work in progress, but much improved
Sam Lantinga <slouken@libsdl.org>
parents:
1358
diff
changeset
|
965 #endif /* SDL_VIDEO_OPENGL */ |
291
68a8a8237c09
Date: Thu, 21 Feb 2002 09:18:24 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
283
diff
changeset
|
966 |
0 | 967 void ph_NormalUpdate(_THIS, int numrects, SDL_Rect *rects) |
968 { | |
380
bce7171e7a85
Date: Wed, 22 May 2002 22:30:58 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
370
diff
changeset
|
969 PhPoint_t ph_pos; |
bce7171e7a85
Date: Wed, 22 May 2002 22:30:58 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
370
diff
changeset
|
970 PhRect_t ph_rect; |
bce7171e7a85
Date: Wed, 22 May 2002 22:30:58 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
370
diff
changeset
|
971 int i; |
bce7171e7a85
Date: Wed, 22 May 2002 22:30:58 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
370
diff
changeset
|
972 |
bce7171e7a85
Date: Wed, 22 May 2002 22:30:58 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
370
diff
changeset
|
973 for (i=0; i<numrects; ++i) |
315
3333b6e68289
Date: Sat, 23 Mar 2002 13:53:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
974 { |
821
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
975 if (rects[i].w==0) /* Clipped? dunno why but this occurs sometime. */ |
315
3333b6e68289
Date: Sat, 23 Mar 2002 13:53:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
976 { |
3333b6e68289
Date: Sat, 23 Mar 2002 13:53:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
977 continue; |
0 | 978 } |
979 | |
821
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
980 if (rects[i].h==0) /* Clipped? dunno why but this occurs sometime. */ |
663
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
981 { |
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
982 continue; |
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
983 } |
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
984 |
315
3333b6e68289
Date: Sat, 23 Mar 2002 13:53:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
985 ph_pos.x = rects[i].x; |
3333b6e68289
Date: Sat, 23 Mar 2002 13:53:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
986 ph_pos.y = rects[i].y; |
3333b6e68289
Date: Sat, 23 Mar 2002 13:53:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
987 ph_rect.ul.x = rects[i].x; |
3333b6e68289
Date: Sat, 23 Mar 2002 13:53:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
988 ph_rect.ul.y = rects[i].y; |
3333b6e68289
Date: Sat, 23 Mar 2002 13:53:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
989 ph_rect.lr.x = rects[i].x + rects[i].w; |
3333b6e68289
Date: Sat, 23 Mar 2002 13:53:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
990 ph_rect.lr.y = rects[i].y + rects[i].h; |
0 | 991 |
315
3333b6e68289
Date: Sat, 23 Mar 2002 13:53:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
992 if (PgDrawPhImageRectmx(&ph_pos, SDL_Image, &ph_rect, 0) < 0) |
3333b6e68289
Date: Sat, 23 Mar 2002 13:53:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
993 { |
821
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
994 SDL_SetError("ph_NormalUpdate(): PgDrawPhImageRectmx failed!\n"); |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
995 return; |
315
3333b6e68289
Date: Sat, 23 Mar 2002 13:53:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
996 } |
3333b6e68289
Date: Sat, 23 Mar 2002 13:53:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
997 } |
3333b6e68289
Date: Sat, 23 Mar 2002 13:53:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
998 |
0 | 999 if (PgFlush() < 0) |
266
c6abdda2f666
Added QNX cleanups by Mike Gorchak (thanks!)
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
1000 { |
821
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
1001 SDL_SetError("ph_NormalUpdate(): PgFlush() function failed!\n"); |
0 | 1002 } |
1003 } | |
370
ba72f259bc88
Date: Sat, 18 May 2002 17:40:53 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
315
diff
changeset
|
1004 |
0 | 1005 void ph_OCUpdate(_THIS, int numrects, SDL_Rect *rects) |
1006 { | |
380
bce7171e7a85
Date: Wed, 22 May 2002 22:30:58 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
370
diff
changeset
|
1007 int i; |
bce7171e7a85
Date: Wed, 22 May 2002 22:30:58 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
370
diff
changeset
|
1008 |
821
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
1009 PhPoint_t zero = {0, 0}; |
370
ba72f259bc88
Date: Sat, 18 May 2002 17:40:53 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
315
diff
changeset
|
1010 PhArea_t src_rect; |
ba72f259bc88
Date: Sat, 18 May 2002 17:40:53 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
315
diff
changeset
|
1011 PhArea_t dest_rect; |
315
3333b6e68289
Date: Sat, 23 Mar 2002 13:53:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
1012 |
821
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
1013 PgSetTranslation(&zero, 0); |
315
3333b6e68289
Date: Sat, 23 Mar 2002 13:53:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
1014 PgSetRegion(PtWidgetRid(window)); |
370
ba72f259bc88
Date: Sat, 18 May 2002 17:40:53 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
315
diff
changeset
|
1015 PgSetClipping(0, NULL); |
821
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
1016 |
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
1017 PgFlush(); |
315
3333b6e68289
Date: Sat, 23 Mar 2002 13:53:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
1018 PgWaitHWIdle(); |
0 | 1019 |
315
3333b6e68289
Date: Sat, 23 Mar 2002 13:53:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
1020 for (i=0; i<numrects; ++i) |
3333b6e68289
Date: Sat, 23 Mar 2002 13:53:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
1021 { |
3333b6e68289
Date: Sat, 23 Mar 2002 13:53:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
1022 if (rects[i].w == 0) /* Clipped? */ |
3333b6e68289
Date: Sat, 23 Mar 2002 13:53:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
1023 { |
3333b6e68289
Date: Sat, 23 Mar 2002 13:53:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
1024 continue; |
0 | 1025 } |
1026 | |
663
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
1027 if (rects[i].h == 0) /* Clipped? */ |
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
1028 { |
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
1029 continue; |
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
1030 } |
821
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
1031 |
370
ba72f259bc88
Date: Sat, 18 May 2002 17:40:53 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
315
diff
changeset
|
1032 src_rect.pos.x=rects[i].x; |
ba72f259bc88
Date: Sat, 18 May 2002 17:40:53 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
315
diff
changeset
|
1033 src_rect.pos.y=rects[i].y; |
ba72f259bc88
Date: Sat, 18 May 2002 17:40:53 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
315
diff
changeset
|
1034 dest_rect.pos.x=rects[i].x; |
ba72f259bc88
Date: Sat, 18 May 2002 17:40:53 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
315
diff
changeset
|
1035 dest_rect.pos.y=rects[i].y; |
315
3333b6e68289
Date: Sat, 23 Mar 2002 13:53:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
1036 |
370
ba72f259bc88
Date: Sat, 18 May 2002 17:40:53 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
315
diff
changeset
|
1037 src_rect.size.w=rects[i].w; |
ba72f259bc88
Date: Sat, 18 May 2002 17:40:53 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
315
diff
changeset
|
1038 src_rect.size.h=rects[i].h; |
ba72f259bc88
Date: Sat, 18 May 2002 17:40:53 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
315
diff
changeset
|
1039 dest_rect.size.w=rects[i].w; |
ba72f259bc88
Date: Sat, 18 May 2002 17:40:53 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
315
diff
changeset
|
1040 dest_rect.size.h=rects[i].h; |
821
30168104389f
Date: Sat, 14 Feb 2004 14:52:40 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
1041 |
370
ba72f259bc88
Date: Sat, 18 May 2002 17:40:53 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
315
diff
changeset
|
1042 PgContextBlitArea(OCImage.offscreen_context, &src_rect, NULL, &dest_rect); |
ba72f259bc88
Date: Sat, 18 May 2002 17:40:53 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
315
diff
changeset
|
1043 } |
315
3333b6e68289
Date: Sat, 23 Mar 2002 13:53:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
1044 |
0 | 1045 if (PgFlush() < 0) |
266
c6abdda2f666
Added QNX cleanups by Mike Gorchak (thanks!)
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
1046 { |
663
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
1047 SDL_SetError("ph_OCUpdate(): PgFlush failed.\n"); |
315
3333b6e68289
Date: Sat, 23 Mar 2002 13:53:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
1048 } |
0 | 1049 } |
663
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
1050 |
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
1051 void ph_OCDCUpdate(_THIS, int numrects, SDL_Rect *rects) |
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
1052 { |
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
1053 PgWaitHWIdle(); |
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
1054 |
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
1055 if (PgFlush() < 0) |
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
1056 { |
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
1057 SDL_SetError("ph_OCDCUpdate(): PgFlush failed.\n"); |
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
1058 } |
8bedd6d61642
Date: Sat, 2 Aug 2003 16:22:51 +0300
Sam Lantinga <slouken@libsdl.org>
parents:
571
diff
changeset
|
1059 } |