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