annotate src/video/photon/SDL_ph_image.c @ 886:05c551e5bc64

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