annotate src/video/gem/SDL_gemvideo.c @ 3942:b3b6f1a8d60a SDL-1.2

Simply resize existing window
author Patrice Mandin <patmandin@gmail.com>
date Sat, 26 May 2007 20:09:56 +0000
parents 2409c20399c1
children 1d9cd0ff67cc
rev   line source
281
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1 /*
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
2 SDL - Simple DirectMedia Layer
1312
c9b51268668f Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents: 1239
diff changeset
3 Copyright (C) 1997-2006 Sam Lantinga
281
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
4
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
5 This library is free software; you can redistribute it and/or
1312
c9b51268668f Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents: 1239
diff changeset
6 modify it under the terms of the GNU Lesser General Public
281
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
7 License as published by the Free Software Foundation; either
1312
c9b51268668f Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents: 1239
diff changeset
8 version 2.1 of the License, or (at your option) any later version.
281
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
9
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
10 This library is distributed in the hope that it will be useful,
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
1312
c9b51268668f Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents: 1239
diff changeset
13 Lesser General Public License for more details.
281
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
14
1312
c9b51268668f Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents: 1239
diff changeset
15 You should have received a copy of the GNU Lesser General Public
c9b51268668f Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents: 1239
diff changeset
16 License along with this library; if not, write to the Free Software
c9b51268668f Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents: 1239
diff changeset
17 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
281
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
18
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
19 Sam Lantinga
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
20 slouken@libsdl.org
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
21 */
1402
d910939febfa Use consistent identifiers for the various platforms we support.
Sam Lantinga <slouken@libsdl.org>
parents: 1361
diff changeset
22 #include "SDL_config.h"
281
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
23
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
24 /*
736
028e03e273c8 Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents: 593
diff changeset
25 GEM video driver
028e03e273c8 Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents: 593
diff changeset
26
028e03e273c8 Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents: 593
diff changeset
27 Patrice Mandin
028e03e273c8 Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents: 593
diff changeset
28 and work from
028e03e273c8 Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents: 593
diff changeset
29 Olivier Landemarre, Johan Klockars, Xavier Joubert, Claude Attard
028e03e273c8 Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents: 593
diff changeset
30 */
281
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
31
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
32 /* Mint includes */
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
33 #include <gem.h>
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
34 #include <gemx.h>
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
35 #include <mint/osbind.h>
557
0ce5a68278fd Updated Atari port for new system headers (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents: 508
diff changeset
36 #include <mint/cookie.h>
281
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
37
1358
c71e05b4dc2e More header massaging... works great on Windows. ;-)
Sam Lantinga <slouken@libsdl.org>
parents: 1338
diff changeset
38 #include "SDL_endian.h"
281
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
39 #include "SDL_video.h"
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
40 #include "SDL_mouse.h"
1361
19418e4422cb New configure-based build system. Still work in progress, but much improved
Sam Lantinga <slouken@libsdl.org>
parents: 1358
diff changeset
41 #include "../SDL_sysvideo.h"
19418e4422cb New configure-based build system. Still work in progress, but much improved
Sam Lantinga <slouken@libsdl.org>
parents: 1358
diff changeset
42 #include "../SDL_pixels_c.h"
19418e4422cb New configure-based build system. Still work in progress, but much improved
Sam Lantinga <slouken@libsdl.org>
parents: 1358
diff changeset
43 #include "../../events/SDL_events_c.h"
19418e4422cb New configure-based build system. Still work in progress, but much improved
Sam Lantinga <slouken@libsdl.org>
parents: 1358
diff changeset
44 #include "../SDL_cursor_c.h"
281
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
45
1412
a8181c4040b8 Fixed include files
Patrice Mandin <patmandin@gmail.com>
parents: 1402
diff changeset
46 #include "../ataricommon/SDL_ataric2p_s.h"
a8181c4040b8 Fixed include files
Patrice Mandin <patmandin@gmail.com>
parents: 1402
diff changeset
47 #include "../ataricommon/SDL_atarieddi_s.h"
a8181c4040b8 Fixed include files
Patrice Mandin <patmandin@gmail.com>
parents: 1402
diff changeset
48 #include "../ataricommon/SDL_atarimxalloc_c.h"
a8181c4040b8 Fixed include files
Patrice Mandin <patmandin@gmail.com>
parents: 1402
diff changeset
49 #include "../ataricommon/SDL_atarigl_c.h"
989
475166d13b44 Factorize OSMesa OpenGL code for Atari drivers
Patrice Mandin <patmandin@gmail.com>
parents: 988
diff changeset
50
281
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
51 #include "SDL_gemvideo.h"
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
52 #include "SDL_gemevents_c.h"
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
53 #include "SDL_gemmouse_c.h"
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
54 #include "SDL_gemwm_c.h"
1412
a8181c4040b8 Fixed include files
Patrice Mandin <patmandin@gmail.com>
parents: 1402
diff changeset
55 #include "../ataricommon/SDL_xbiosevents_c.h"
1420
2405517b5eab Added preliminary support for MiNT /dev/mouse driver (disabled atm)
Patrice Mandin <patmandin@gmail.com>
parents: 1412
diff changeset
56 #include "../ataricommon/SDL_ataridevmouse_c.h"
281
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
57
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
58 /* Defines */
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
59
984
44fd54a0ae5f Add OSMesa OpenGL support to the Atari GEM video driver
Patrice Mandin <patmandin@gmail.com>
parents: 964
diff changeset
60 /*#define DEBUG_VIDEO_GEM 1*/
736
028e03e273c8 Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents: 593
diff changeset
61
281
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
62 #define GEM_VID_DRIVER_NAME "gem"
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
63
737
7e4347dd2f9c Small fix for iconification
Patrice Mandin <patmandin@gmail.com>
parents: 736
diff changeset
64 #undef MIN
7e4347dd2f9c Small fix for iconification
Patrice Mandin <patmandin@gmail.com>
parents: 736
diff changeset
65 #define MIN(a,b) (((a)<(b)) ? (a) : (b))
7e4347dd2f9c Small fix for iconification
Patrice Mandin <patmandin@gmail.com>
parents: 736
diff changeset
66 #undef MAX
7e4347dd2f9c Small fix for iconification
Patrice Mandin <patmandin@gmail.com>
parents: 736
diff changeset
67 #define MAX(a,b) (((a)>(b)) ? (a) : (b))
7e4347dd2f9c Small fix for iconification
Patrice Mandin <patmandin@gmail.com>
parents: 736
diff changeset
68
281
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
69 /* Variables */
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
70
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
71 static unsigned char vdi_index[256] = {
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
72 0, 2, 3, 6, 4, 7, 5, 8,
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
73 9, 10, 11, 14, 12, 15, 13, 255
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
74 };
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
75
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
76 static const unsigned char empty_name[]="";
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
77
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
78 /* Initialization/Query functions */
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
79 static int GEM_VideoInit(_THIS, SDL_PixelFormat *vformat);
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
80 static SDL_Rect **GEM_ListModes(_THIS, SDL_PixelFormat *format, Uint32 flags);
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
81 static SDL_Surface *GEM_SetVideoMode(_THIS, SDL_Surface *current, int width, int height, int bpp, Uint32 flags);
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
82 static int GEM_SetColors(_THIS, int firstcolor, int ncolors, SDL_Color *colors);
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
83 static void GEM_VideoQuit(_THIS);
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
84
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
85 /* Hardware surface functions */
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
86 static int GEM_AllocHWSurface(_THIS, SDL_Surface *surface);
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
87 static int GEM_LockHWSurface(_THIS, SDL_Surface *surface);
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
88 static int GEM_FlipHWSurface(_THIS, SDL_Surface *surface);
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
89 static void GEM_UnlockHWSurface(_THIS, SDL_Surface *surface);
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
90 static void GEM_FreeHWSurface(_THIS, SDL_Surface *surface);
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
91 static void GEM_UpdateRects(_THIS, int numrects, SDL_Rect *rects);
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
92 #if 0
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
93 static int GEM_ToggleFullScreen(_THIS, int on);
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
94 #endif
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
95
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
96 /* Internal functions */
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
97 static void GEM_FreeBuffers(_THIS);
319
189a6a3416c7 *** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents: 305
diff changeset
98 static void GEM_ClearScreen(_THIS);
736
028e03e273c8 Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents: 593
diff changeset
99 static void GEM_ClearRect(_THIS, short *rect);
1074
936da0056ed3 Save/restore system palette when application topped/untopped
Patrice Mandin <patmandin@gmail.com>
parents: 1072
diff changeset
100 static void GEM_SetNewPalette(_THIS, Uint16 newpal[256][3]);
319
189a6a3416c7 *** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents: 305
diff changeset
101 static void GEM_LockScreen(_THIS);
189a6a3416c7 *** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents: 305
diff changeset
102 static void GEM_UnlockScreen(_THIS);
281
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
103 static void refresh_window(_THIS, int winhandle, short *rect);
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
104
1361
19418e4422cb New configure-based build system. Still work in progress, but much improved
Sam Lantinga <slouken@libsdl.org>
parents: 1358
diff changeset
105 #if SDL_VIDEO_OPENGL
984
44fd54a0ae5f Add OSMesa OpenGL support to the Atari GEM video driver
Patrice Mandin <patmandin@gmail.com>
parents: 964
diff changeset
106 /* OpenGL functions */
44fd54a0ae5f Add OSMesa OpenGL support to the Atari GEM video driver
Patrice Mandin <patmandin@gmail.com>
parents: 964
diff changeset
107 static void GEM_GL_SwapBuffers(_THIS);
44fd54a0ae5f Add OSMesa OpenGL support to the Atari GEM video driver
Patrice Mandin <patmandin@gmail.com>
parents: 964
diff changeset
108 #endif
44fd54a0ae5f Add OSMesa OpenGL support to the Atari GEM video driver
Patrice Mandin <patmandin@gmail.com>
parents: 964
diff changeset
109
281
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
110 /* GEM driver bootstrap functions */
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
111
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
112 static int GEM_Available(void)
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
113 {
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
114 /* Test if AES available */
557
0ce5a68278fd Updated Atari port for new system headers (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents: 508
diff changeset
115 if (appl_init() == -1)
281
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
116 return 0;
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
117
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
118 appl_exit();
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
119 return 1;
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
120 }
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
121
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
122 static void GEM_DeleteDevice(SDL_VideoDevice *device)
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
123 {
1336
3692456e7b0f Use SDL_ prefixed versions of C library functions.
Sam Lantinga <slouken@libsdl.org>
parents: 1312
diff changeset
124 SDL_free(device->hidden);
3692456e7b0f Use SDL_ prefixed versions of C library functions.
Sam Lantinga <slouken@libsdl.org>
parents: 1312
diff changeset
125 SDL_free(device);
281
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
126 }
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
127
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
128 static SDL_VideoDevice *GEM_CreateDevice(int devindex)
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
129 {
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
130 SDL_VideoDevice *device;
1237
a8068adf156b Disable XBIOS driver for mouse and joystick under MiNT. Will write a driver for /dev/mouse later.
Patrice Mandin <patmandin@gmail.com>
parents: 1104
diff changeset
131 int vectors_mask;
a8068adf156b Disable XBIOS driver for mouse and joystick under MiNT. Will write a driver for /dev/mouse later.
Patrice Mandin <patmandin@gmail.com>
parents: 1104
diff changeset
132 unsigned long dummy;
281
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
133
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
134 /* Initialize all variables that we clean on shutdown */
1336
3692456e7b0f Use SDL_ prefixed versions of C library functions.
Sam Lantinga <slouken@libsdl.org>
parents: 1312
diff changeset
135 device = (SDL_VideoDevice *)SDL_malloc(sizeof(SDL_VideoDevice));
281
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
136 if ( device ) {
1336
3692456e7b0f Use SDL_ prefixed versions of C library functions.
Sam Lantinga <slouken@libsdl.org>
parents: 1312
diff changeset
137 SDL_memset(device, 0, (sizeof *device));
281
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
138 device->hidden = (struct SDL_PrivateVideoData *)
1336
3692456e7b0f Use SDL_ prefixed versions of C library functions.
Sam Lantinga <slouken@libsdl.org>
parents: 1312
diff changeset
139 SDL_malloc((sizeof *device->hidden));
989
475166d13b44 Factorize OSMesa OpenGL code for Atari drivers
Patrice Mandin <patmandin@gmail.com>
parents: 988
diff changeset
140 device->gl_data = (struct SDL_PrivateGLData *)
1336
3692456e7b0f Use SDL_ prefixed versions of C library functions.
Sam Lantinga <slouken@libsdl.org>
parents: 1312
diff changeset
141 SDL_malloc((sizeof *device->gl_data));
281
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
142 }
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
143 if ( (device == NULL) || (device->hidden == NULL) ) {
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
144 SDL_OutOfMemory();
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
145 if ( device ) {
1336
3692456e7b0f Use SDL_ prefixed versions of C library functions.
Sam Lantinga <slouken@libsdl.org>
parents: 1312
diff changeset
146 SDL_free(device);
281
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
147 }
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
148 return(0);
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
149 }
1336
3692456e7b0f Use SDL_ prefixed versions of C library functions.
Sam Lantinga <slouken@libsdl.org>
parents: 1312
diff changeset
150 SDL_memset(device->hidden, 0, (sizeof *device->hidden));
3692456e7b0f Use SDL_ prefixed versions of C library functions.
Sam Lantinga <slouken@libsdl.org>
parents: 1312
diff changeset
151 SDL_memset(device->gl_data, 0, sizeof(*device->gl_data));
281
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
152
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
153 /* Set the function pointers */
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
154 device->VideoInit = GEM_VideoInit;
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
155 device->ListModes = GEM_ListModes;
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
156 device->SetVideoMode = GEM_SetVideoMode;
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
157 device->SetColors = GEM_SetColors;
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
158 device->UpdateRects = NULL /*GEM_UpdateRects*/;
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
159 device->VideoQuit = GEM_VideoQuit;
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
160 device->AllocHWSurface = GEM_AllocHWSurface;
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
161 device->LockHWSurface = GEM_LockHWSurface;
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
162 device->UnlockHWSurface = GEM_UnlockHWSurface;
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
163 device->FlipHWSurface = GEM_FlipHWSurface;
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
164 device->FreeHWSurface = GEM_FreeHWSurface;
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
165 device->ToggleFullScreen = NULL /*GEM_ToggleFullScreen*/;
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
166
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
167 /* Window manager */
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
168 device->SetCaption = GEM_SetCaption;
736
028e03e273c8 Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents: 593
diff changeset
169 device->SetIcon = GEM_SetIcon;
281
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
170 device->IconifyWindow = GEM_IconifyWindow;
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
171 device->GrabInput = GEM_GrabInput;
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
172
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
173 /* Events */
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
174 device->InitOSKeymap = GEM_InitOSKeymap;
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
175 device->PumpEvents = GEM_PumpEvents;
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
176
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
177 /* Mouse */
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
178 device->FreeWMCursor = GEM_FreeWMCursor;
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
179 device->CreateWMCursor = GEM_CreateWMCursor;
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
180 device->ShowWMCursor = GEM_ShowWMCursor;
319
189a6a3416c7 *** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents: 305
diff changeset
181 device->WarpWMCursor = NULL /*GEM_WarpWMCursor*/;
281
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
182 device->CheckMouseMode = GEM_CheckMouseMode;
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
183
1361
19418e4422cb New configure-based build system. Still work in progress, but much improved
Sam Lantinga <slouken@libsdl.org>
parents: 1358
diff changeset
184 #if SDL_VIDEO_OPENGL
984
44fd54a0ae5f Add OSMesa OpenGL support to the Atari GEM video driver
Patrice Mandin <patmandin@gmail.com>
parents: 964
diff changeset
185 /* OpenGL functions */
989
475166d13b44 Factorize OSMesa OpenGL code for Atari drivers
Patrice Mandin <patmandin@gmail.com>
parents: 988
diff changeset
186 device->GL_LoadLibrary = SDL_AtariGL_LoadLibrary;
475166d13b44 Factorize OSMesa OpenGL code for Atari drivers
Patrice Mandin <patmandin@gmail.com>
parents: 988
diff changeset
187 device->GL_GetProcAddress = SDL_AtariGL_GetProcAddress;
475166d13b44 Factorize OSMesa OpenGL code for Atari drivers
Patrice Mandin <patmandin@gmail.com>
parents: 988
diff changeset
188 device->GL_GetAttribute = SDL_AtariGL_GetAttribute;
475166d13b44 Factorize OSMesa OpenGL code for Atari drivers
Patrice Mandin <patmandin@gmail.com>
parents: 988
diff changeset
189 device->GL_MakeCurrent = SDL_AtariGL_MakeCurrent;
984
44fd54a0ae5f Add OSMesa OpenGL support to the Atari GEM video driver
Patrice Mandin <patmandin@gmail.com>
parents: 964
diff changeset
190 device->GL_SwapBuffers = GEM_GL_SwapBuffers;
44fd54a0ae5f Add OSMesa OpenGL support to the Atari GEM video driver
Patrice Mandin <patmandin@gmail.com>
parents: 964
diff changeset
191 #endif
44fd54a0ae5f Add OSMesa OpenGL support to the Atari GEM video driver
Patrice Mandin <patmandin@gmail.com>
parents: 964
diff changeset
192
1420
2405517b5eab Added preliminary support for MiNT /dev/mouse driver (disabled atm)
Patrice Mandin <patmandin@gmail.com>
parents: 1412
diff changeset
193 device->hidden->use_dev_mouse =
2405517b5eab Added preliminary support for MiNT /dev/mouse driver (disabled atm)
Patrice Mandin <patmandin@gmail.com>
parents: 1412
diff changeset
194 (SDL_AtariDevMouse_Open()!=0) ? SDL_TRUE : SDL_FALSE;
2405517b5eab Added preliminary support for MiNT /dev/mouse driver (disabled atm)
Patrice Mandin <patmandin@gmail.com>
parents: 1412
diff changeset
195
2405517b5eab Added preliminary support for MiNT /dev/mouse driver (disabled atm)
Patrice Mandin <patmandin@gmail.com>
parents: 1412
diff changeset
196 vectors_mask = ATARI_XBIOS_JOYSTICKEVENTS; /* XBIOS joystick events */
2405517b5eab Added preliminary support for MiNT /dev/mouse driver (disabled atm)
Patrice Mandin <patmandin@gmail.com>
parents: 1412
diff changeset
197 if (!(device->hidden->use_dev_mouse)) {
2405517b5eab Added preliminary support for MiNT /dev/mouse driver (disabled atm)
Patrice Mandin <patmandin@gmail.com>
parents: 1412
diff changeset
198 vectors_mask |= ATARI_XBIOS_MOUSEEVENTS; /* XBIOS mouse events */
2405517b5eab Added preliminary support for MiNT /dev/mouse driver (disabled atm)
Patrice Mandin <patmandin@gmail.com>
parents: 1412
diff changeset
199 }
3858
9ffd318e7b64 Reenable xbios usage to get relative mouse motion
Patrice Mandin <patmandin@gmail.com>
parents: 1857
diff changeset
200 /* if (Getcookie(C_MiNT, &dummy)==C_FOUND) {
1237
a8068adf156b Disable XBIOS driver for mouse and joystick under MiNT. Will write a driver for /dev/mouse later.
Patrice Mandin <patmandin@gmail.com>
parents: 1104
diff changeset
201 vectors_mask = 0;
3858
9ffd318e7b64 Reenable xbios usage to get relative mouse motion
Patrice Mandin <patmandin@gmail.com>
parents: 1857
diff changeset
202 }*/
1237
a8068adf156b Disable XBIOS driver for mouse and joystick under MiNT. Will write a driver for /dev/mouse later.
Patrice Mandin <patmandin@gmail.com>
parents: 1104
diff changeset
203
a8068adf156b Disable XBIOS driver for mouse and joystick under MiNT. Will write a driver for /dev/mouse later.
Patrice Mandin <patmandin@gmail.com>
parents: 1104
diff changeset
204 SDL_AtariXbios_InstallVectors(vectors_mask);
305
9c6613983e85 Atari port cleanups from Patrice
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
205
281
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
206 device->free = GEM_DeleteDevice;
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
207
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
208 return device;
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
209 }
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
210
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
211 VideoBootStrap GEM_bootstrap = {
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
212 GEM_VID_DRIVER_NAME, "Atari GEM video driver",
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
213 GEM_Available, GEM_CreateDevice
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
214 };
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
215
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
216 static void VDI_ReadExtInfo(_THIS, short *work_out)
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
217 {
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
218 unsigned long EdDI_version;
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
219 unsigned long cookie_EdDI;
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
220 Uint32 num_colours;
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
221 Uint16 clut_type, num_bits;
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
222
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
223 /* Read EdDI informations */
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
224 if (Getcookie(C_EdDI, &cookie_EdDI) == C_NOTFOUND) {
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
225 return;
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
226 }
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
227
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
228 EdDI_version = Atari_get_EdDI_version( (void *)cookie_EdDI);
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
229
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
230 vq_scrninfo(VDI_handle, work_out);
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
231
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
232 VDI_format = work_out[0];
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
233 clut_type = work_out[1];
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
234 num_bits = work_out[2];
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
235 num_colours = *((Uint32 *) &work_out[3]);
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
236
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
237 /* With EdDI>=1.1, we can have screen pitch, address and format
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
238 * so we can directly write to screen without using vro_cpyfm
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
239 */
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
240 if (EdDI_version >= EDDI_11) {
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
241 VDI_pitch = work_out[5];
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
242 VDI_screen = (void *) *((unsigned long *) &work_out[6]);
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
243 }
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
244
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
245 switch(clut_type) {
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
246 case VDI_CLUT_HARDWARE:
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
247 {
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
248 int i;
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
249 Uint16 *tmp_p;
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
250
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
251 tmp_p = (Uint16 *)&work_out[16];
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
252
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
253 for (i=0;i<256;i++) {
319
189a6a3416c7 *** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents: 305
diff changeset
254 vdi_index[*tmp_p++] = i;
281
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
255 }
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
256 }
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
257 break;
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
258 case VDI_CLUT_SOFTWARE:
800
60a4293ffea9 When commiting code, cleanup before doing it
Patrice Mandin <patmandin@gmail.com>
parents: 799
diff changeset
259 {
281
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
260 int component; /* red, green, blue, alpha, overlay */
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
261 int num_bit;
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
262 unsigned short *tmp_p;
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
263
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
264 /* We can build masks with info here */
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
265 tmp_p = (unsigned short *) &work_out[16];
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
266 for (component=0;component<5;component++) {
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
267 for (num_bit=0;num_bit<16;num_bit++) {
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
268 unsigned short valeur;
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
269
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
270 valeur = *tmp_p++;
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
271
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
272 if (valeur == 0xffff) {
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
273 continue;
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
274 }
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
275
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
276 switch(component) {
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
277 case 0:
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
278 VDI_redmask |= 1<< valeur;
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
279 break;
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
280 case 1:
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
281 VDI_greenmask |= 1<< valeur;
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
282 break;
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
283 case 2:
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
284 VDI_bluemask |= 1<< valeur;
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
285 break;
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
286 case 3:
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
287 VDI_alphamask |= 1<< valeur;
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
288 break;
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
289 }
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
290 }
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
291 }
319
189a6a3416c7 *** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents: 305
diff changeset
292 }
281
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
293
319
189a6a3416c7 *** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents: 305
diff changeset
294 /* Remove lower green bits for Intel endian screen */
189a6a3416c7 *** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents: 305
diff changeset
295 if ((VDI_greenmask == ((7<<13)|3)) || (VDI_greenmask == ((7<<13)|7))) {
189a6a3416c7 *** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents: 305
diff changeset
296 VDI_greenmask &= ~(7<<13);
281
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
297 }
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
298 break;
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
299 case VDI_CLUT_NONE:
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
300 break;
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
301 }
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
302 }
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
303
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
304 int GEM_VideoInit(_THIS, SDL_PixelFormat *vformat)
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
305 {
1070
75e8378103a9 Forgot variable declaration
Patrice Mandin <patmandin@gmail.com>
parents: 1069
diff changeset
306 int i, menubar_size;
281
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
307 short work_in[12], work_out[272], dummy;
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
308
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
309 /* Open AES (Application Environment Services) */
557
0ce5a68278fd Updated Atari port for new system headers (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents: 508
diff changeset
310 if (appl_init() == -1) {
281
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
311 fprintf(stderr,"Can not open AES\n");
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
312 return 1;
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
313 }
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
314
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
315 /* Read version and features */
736
028e03e273c8 Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents: 593
diff changeset
316 GEM_version = aes_global[0];
028e03e273c8 Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents: 593
diff changeset
317 if (GEM_version >= 0x0410) {
028e03e273c8 Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents: 593
diff changeset
318 short ap_gout[4], errorcode;
281
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
319
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
320 GEM_wfeatures=0;
736
028e03e273c8 Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents: 593
diff changeset
321 errorcode=appl_getinfo(AES_WINDOW, &ap_gout[0], &ap_gout[1], &ap_gout[2], &ap_gout[3]);
028e03e273c8 Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents: 593
diff changeset
322
028e03e273c8 Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents: 593
diff changeset
323 if (errorcode==0) {
281
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
324 GEM_wfeatures=ap_gout[0];
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
325 }
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
326 }
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
327
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
328 /* Ask VDI physical workstation handle opened by AES */
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
329 VDI_handle = graf_handle(&dummy, &dummy, &dummy, &dummy);
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
330 if (VDI_handle<1) {
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
331 fprintf(stderr,"Wrong VDI handle %d returned by AES\n",VDI_handle);
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
332 return 1;
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
333 }
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
334
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
335 /* Open virtual VDI workstation */
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
336 work_in[0]=Getrez()+2;
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
337 for(i = 1; i < 10; i++)
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
338 work_in[i] = 1;
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
339 work_in[10] = 2;
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
340
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
341 v_opnvwk(work_in, &VDI_handle, work_out);
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
342 if (VDI_handle == 0) {
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
343 fprintf(stderr,"Can not open VDI virtual workstation\n");
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
344 return 1;
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
345 }
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
346
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
347 /* Read fullscreen size */
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
348 VDI_w = work_out[0] + 1;
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
349 VDI_h = work_out[1] + 1;
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
350
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
351 /* Read desktop size and position */
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
352 if (!wind_get(DESKTOP_HANDLE, WF_WORKXYWH, &GEM_desk_x, &GEM_desk_y, &GEM_desk_w, &GEM_desk_h)) {
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
353 fprintf(stderr,"Can not read desktop properties\n");
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
354 return 1;
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
355 }
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
356
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
357 /* Read bit depth */
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
358 vq_extnd(VDI_handle, 1, work_out);
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
359 VDI_bpp = work_out[4];
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
360 VDI_oldnumcolors=0;
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
361
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
362 switch(VDI_bpp) {
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
363 case 8:
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
364 VDI_pixelsize=1;
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
365 break;
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
366 case 15:
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
367 case 16:
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
368 VDI_pixelsize=2;
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
369 break;
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
370 case 24:
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
371 VDI_pixelsize=3;
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
372 break;
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
373 case 32:
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
374 VDI_pixelsize=4;
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
375 break;
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
376 default:
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
377 fprintf(stderr,"%d bits colour depth not supported\n",VDI_bpp);
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
378 return 1;
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
379 }
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
380
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
381 /* Setup hardware -> VDI palette mapping */
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
382 for(i = 16; i < 255; i++) {
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
383 vdi_index[i] = i;
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
384 }
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
385 vdi_index[255] = 1;
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
386
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
387 /* Save current palette */
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
388 if (VDI_bpp>8) {
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
389 VDI_oldnumcolors=1<<8;
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
390 } else {
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
391 VDI_oldnumcolors=1<<VDI_bpp;
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
392 }
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
393
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
394 for(i = 0; i < VDI_oldnumcolors; i++) {
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
395 short rgb[3];
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
396
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
397 vq_color(VDI_handle, i, 0, rgb);
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
398
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
399 VDI_oldpalette[i][0] = rgb[0];
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
400 VDI_oldpalette[i][1] = rgb[1];
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
401 VDI_oldpalette[i][2] = rgb[2];
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
402 }
1074
936da0056ed3 Save/restore system palette when application topped/untopped
Patrice Mandin <patmandin@gmail.com>
parents: 1072
diff changeset
403 VDI_setpalette = GEM_SetNewPalette;
1336
3692456e7b0f Use SDL_ prefixed versions of C library functions.
Sam Lantinga <slouken@libsdl.org>
parents: 1312
diff changeset
404 SDL_memcpy(VDI_curpalette,VDI_oldpalette,sizeof(VDI_curpalette));
281
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
405
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
406 /* Setup screen info */
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
407 GEM_title_name = empty_name;
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
408 GEM_icon_name = empty_name;
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
409
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
410 GEM_handle = -1;
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
411 GEM_locked = SDL_FALSE;
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
412 GEM_win_fulled = SDL_FALSE;
926
83db694556eb Give mouse position relative to window position, and do not generate mouse button event if outside of the window
Patrice Mandin <patmandin@gmail.com>
parents: 925
diff changeset
413 GEM_fullscreen = SDL_FALSE;
964
d9209754ebee Prevent redraws till internal buffers are correctly setup
Patrice Mandin <patmandin@gmail.com>
parents: 959
diff changeset
414 GEM_lock_redraw = SDL_TRUE; /* Prevent redraw till buffers are setup */
281
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
415
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
416 VDI_screen = NULL;
799
85960507bd2e Bugfixes: some info about current framebuffer overwritten by some default values, and screen width must be multiple of 16 pixels to work correctly
Patrice Mandin <patmandin@gmail.com>
parents: 769
diff changeset
417 VDI_pitch = VDI_w * VDI_pixelsize;
85960507bd2e Bugfixes: some info about current framebuffer overwritten by some default values, and screen width must be multiple of 16 pixels to work correctly
Patrice Mandin <patmandin@gmail.com>
parents: 769
diff changeset
418 VDI_format = ( (VDI_bpp <= 8) ? VDI_FORMAT_INTER : VDI_FORMAT_PACK);
85960507bd2e Bugfixes: some info about current framebuffer overwritten by some default values, and screen width must be multiple of 16 pixels to work correctly
Patrice Mandin <patmandin@gmail.com>
parents: 769
diff changeset
419 VDI_redmask = VDI_greenmask = VDI_bluemask = VDI_alphamask = 0;
85960507bd2e Bugfixes: some info about current framebuffer overwritten by some default values, and screen width must be multiple of 16 pixels to work correctly
Patrice Mandin <patmandin@gmail.com>
parents: 769
diff changeset
420 VDI_ReadExtInfo(this, work_out);
85960507bd2e Bugfixes: some info about current framebuffer overwritten by some default values, and screen width must be multiple of 16 pixels to work correctly
Patrice Mandin <patmandin@gmail.com>
parents: 769
diff changeset
421
85960507bd2e Bugfixes: some info about current framebuffer overwritten by some default values, and screen width must be multiple of 16 pixels to work correctly
Patrice Mandin <patmandin@gmail.com>
parents: 769
diff changeset
422 #ifdef DEBUG_VIDEO_GEM
85960507bd2e Bugfixes: some info about current framebuffer overwritten by some default values, and screen width must be multiple of 16 pixels to work correctly
Patrice Mandin <patmandin@gmail.com>
parents: 769
diff changeset
423 printf("sdl:video:gem: screen: address=0x%08x, pitch=%d\n", VDI_screen, VDI_pitch);
85960507bd2e Bugfixes: some info about current framebuffer overwritten by some default values, and screen width must be multiple of 16 pixels to work correctly
Patrice Mandin <patmandin@gmail.com>
parents: 769
diff changeset
424 printf("sdl:video:gem: format=%d\n", VDI_format);
85960507bd2e Bugfixes: some info about current framebuffer overwritten by some default values, and screen width must be multiple of 16 pixels to work correctly
Patrice Mandin <patmandin@gmail.com>
parents: 769
diff changeset
425 printf("sdl:video:gem: masks: 0x%08x, 0x%08x, 0x%08x, 0x%08x\n",
85960507bd2e Bugfixes: some info about current framebuffer overwritten by some default values, and screen width must be multiple of 16 pixels to work correctly
Patrice Mandin <patmandin@gmail.com>
parents: 769
diff changeset
426 VDI_alphamask, VDI_redmask, VDI_greenmask, VDI_bluemask
85960507bd2e Bugfixes: some info about current framebuffer overwritten by some default values, and screen width must be multiple of 16 pixels to work correctly
Patrice Mandin <patmandin@gmail.com>
parents: 769
diff changeset
427 );
85960507bd2e Bugfixes: some info about current framebuffer overwritten by some default values, and screen width must be multiple of 16 pixels to work correctly
Patrice Mandin <patmandin@gmail.com>
parents: 769
diff changeset
428 #endif
281
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
429
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
430 /* Setup destination mfdb */
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
431 VDI_dst_mfdb.fd_addr = NULL;
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
432
1545
8d9bb0cf2c2a Added current_w and current_h to the SDL_VideoInfo structure, which is set to the desktop resolution during video intialization, and then set to the current resolution when a video mode is set.
Sam Lantinga <slouken@libsdl.org>
parents: 1420
diff changeset
433 /* Determine the current screen size */
8d9bb0cf2c2a Added current_w and current_h to the SDL_VideoInfo structure, which is set to the desktop resolution during video intialization, and then set to the current resolution when a video mode is set.
Sam Lantinga <slouken@libsdl.org>
parents: 1420
diff changeset
434 this->info.current_w = VDI_w;
8d9bb0cf2c2a Added current_w and current_h to the SDL_VideoInfo structure, which is set to the desktop resolution during video intialization, and then set to the current resolution when a video mode is set.
Sam Lantinga <slouken@libsdl.org>
parents: 1420
diff changeset
435 this->info.current_h = VDI_h;
281
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
436
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
437 /* Determine the screen depth */
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
438 /* we change this during the SDL_SetVideoMode implementation... */
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
439 vformat->BitsPerPixel = VDI_bpp;
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
440
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
441 /* Set mouse cursor to arrow */
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
442 graf_mouse(ARROW, NULL);
1857
417f2af2bd52 Fix mouse cursor change
Patrice Mandin <patmandin@gmail.com>
parents: 1545
diff changeset
443 GEM_cursor = NULL;
281
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
444
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
445 /* Init chunky to planar routine */
736
028e03e273c8 Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents: 593
diff changeset
446 SDL_Atari_C2pConvert = SDL_Atari_C2pConvert8;
028e03e273c8 Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents: 593
diff changeset
447
028e03e273c8 Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents: 593
diff changeset
448 /* Setup VDI fill functions */
028e03e273c8 Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents: 593
diff changeset
449 vsf_color(VDI_handle,0);
028e03e273c8 Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents: 593
diff changeset
450 vsf_interior(VDI_handle,1);
028e03e273c8 Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents: 593
diff changeset
451 vsf_perimeter(VDI_handle,0);
028e03e273c8 Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents: 593
diff changeset
452
1069
8b1c83edcde2 Restore and save menu bar when entering and exiting fullscreen mode
Patrice Mandin <patmandin@gmail.com>
parents: 1066
diff changeset
453 /* Menu bar save buffer */
8b1c83edcde2 Restore and save menu bar when entering and exiting fullscreen mode
Patrice Mandin <patmandin@gmail.com>
parents: 1066
diff changeset
454 menubar_size = GEM_desk_w * GEM_desk_y * VDI_pixelsize;
8b1c83edcde2 Restore and save menu bar when entering and exiting fullscreen mode
Patrice Mandin <patmandin@gmail.com>
parents: 1066
diff changeset
455 GEM_menubar=Atari_SysMalloc(menubar_size,MX_PREFTTRAM);
8b1c83edcde2 Restore and save menu bar when entering and exiting fullscreen mode
Patrice Mandin <patmandin@gmail.com>
parents: 1066
diff changeset
456
902
99f439d6ee4a Forgot to initialize video mode list
Patrice Mandin <patmandin@gmail.com>
parents: 800
diff changeset
457 /* Fill video modes list */
1336
3692456e7b0f Use SDL_ prefixed versions of C library functions.
Sam Lantinga <slouken@libsdl.org>
parents: 1312
diff changeset
458 SDL_modelist[0] = SDL_malloc(sizeof(SDL_Rect));
902
99f439d6ee4a Forgot to initialize video mode list
Patrice Mandin <patmandin@gmail.com>
parents: 800
diff changeset
459 SDL_modelist[0]->x = 0;
99f439d6ee4a Forgot to initialize video mode list
Patrice Mandin <patmandin@gmail.com>
parents: 800
diff changeset
460 SDL_modelist[0]->y = 0;
99f439d6ee4a Forgot to initialize video mode list
Patrice Mandin <patmandin@gmail.com>
parents: 800
diff changeset
461 SDL_modelist[0]->w = VDI_w;
99f439d6ee4a Forgot to initialize video mode list
Patrice Mandin <patmandin@gmail.com>
parents: 800
diff changeset
462 SDL_modelist[0]->h = VDI_h;
99f439d6ee4a Forgot to initialize video mode list
Patrice Mandin <patmandin@gmail.com>
parents: 800
diff changeset
463
99f439d6ee4a Forgot to initialize video mode list
Patrice Mandin <patmandin@gmail.com>
parents: 800
diff changeset
464 SDL_modelist[1] = NULL;
99f439d6ee4a Forgot to initialize video mode list
Patrice Mandin <patmandin@gmail.com>
parents: 800
diff changeset
465
1361
19418e4422cb New configure-based build system. Still work in progress, but much improved
Sam Lantinga <slouken@libsdl.org>
parents: 1358
diff changeset
466 #if SDL_VIDEO_OPENGL
991
12b13601a544 Final touches to OSMesa OpenGL support on Atari, using loadable libraries. Hope SDL 1.2.8 is out soon.
Patrice Mandin <patmandin@gmail.com>
parents: 989
diff changeset
467 SDL_AtariGL_InitPointers(this);
736
028e03e273c8 Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents: 593
diff changeset
468 #endif
281
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
469
3941
2409c20399c1 GEM has a window manager, of course
Patrice Mandin <patmandin@gmail.com>
parents: 3858
diff changeset
470 video->info.wm_available = 1;
2409c20399c1 GEM has a window manager, of course
Patrice Mandin <patmandin@gmail.com>
parents: 3858
diff changeset
471
281
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
472 /* We're done! */
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
473 return(0);
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
474 }
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
475
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
476 SDL_Rect **GEM_ListModes(_THIS, SDL_PixelFormat *format, Uint32 flags)
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
477 {
902
99f439d6ee4a Forgot to initialize video mode list
Patrice Mandin <patmandin@gmail.com>
parents: 800
diff changeset
478 if (format->BitsPerPixel != VDI_bpp) {
281
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
479 return ((SDL_Rect **)NULL);
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
480 }
902
99f439d6ee4a Forgot to initialize video mode list
Patrice Mandin <patmandin@gmail.com>
parents: 800
diff changeset
481
99f439d6ee4a Forgot to initialize video mode list
Patrice Mandin <patmandin@gmail.com>
parents: 800
diff changeset
482 if (flags & SDL_FULLSCREEN) {
99f439d6ee4a Forgot to initialize video mode list
Patrice Mandin <patmandin@gmail.com>
parents: 800
diff changeset
483 return (SDL_modelist);
99f439d6ee4a Forgot to initialize video mode list
Patrice Mandin <patmandin@gmail.com>
parents: 800
diff changeset
484 }
99f439d6ee4a Forgot to initialize video mode list
Patrice Mandin <patmandin@gmail.com>
parents: 800
diff changeset
485
99f439d6ee4a Forgot to initialize video mode list
Patrice Mandin <patmandin@gmail.com>
parents: 800
diff changeset
486 return((SDL_Rect **)-1);
281
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
487 }
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
488
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
489 static void GEM_FreeBuffers(_THIS)
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
490 {
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
491 /* Release buffer */
736
028e03e273c8 Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents: 593
diff changeset
492 if ( GEM_buffer2 ) {
1072
5dbcac12f22b Use correct system function to free memory
Patrice Mandin <patmandin@gmail.com>
parents: 1071
diff changeset
493 Mfree( GEM_buffer2 );
736
028e03e273c8 Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents: 593
diff changeset
494 GEM_buffer2=NULL;
028e03e273c8 Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents: 593
diff changeset
495 }
028e03e273c8 Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents: 593
diff changeset
496
028e03e273c8 Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents: 593
diff changeset
497 if ( GEM_buffer1 ) {
1072
5dbcac12f22b Use correct system function to free memory
Patrice Mandin <patmandin@gmail.com>
parents: 1071
diff changeset
498 Mfree( GEM_buffer1 );
736
028e03e273c8 Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents: 593
diff changeset
499 GEM_buffer1=NULL;
281
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
500 }
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
501 }
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
502
736
028e03e273c8 Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents: 593
diff changeset
503 static void GEM_ClearRect(_THIS, short *rect)
028e03e273c8 Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents: 593
diff changeset
504 {
028e03e273c8 Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents: 593
diff changeset
505 short oldrgb[3], rgb[3]={0,0,0};
028e03e273c8 Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents: 593
diff changeset
506
028e03e273c8 Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents: 593
diff changeset
507 vq_color(VDI_handle, vdi_index[0], 0, oldrgb);
028e03e273c8 Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents: 593
diff changeset
508 vs_color(VDI_handle, vdi_index[0], rgb);
028e03e273c8 Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents: 593
diff changeset
509
028e03e273c8 Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents: 593
diff changeset
510 vsf_color(VDI_handle,0);
028e03e273c8 Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents: 593
diff changeset
511 vsf_interior(VDI_handle,1);
028e03e273c8 Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents: 593
diff changeset
512 vsf_perimeter(VDI_handle,0);
028e03e273c8 Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents: 593
diff changeset
513 v_bar(VDI_handle, rect);
028e03e273c8 Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents: 593
diff changeset
514
028e03e273c8 Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents: 593
diff changeset
515 vs_color(VDI_handle, vdi_index[0], oldrgb);
028e03e273c8 Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents: 593
diff changeset
516 }
028e03e273c8 Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents: 593
diff changeset
517
319
189a6a3416c7 *** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents: 305
diff changeset
518 static void GEM_ClearScreen(_THIS)
189a6a3416c7 *** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents: 305
diff changeset
519 {
189a6a3416c7 *** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents: 305
diff changeset
520 short pxy[4];
189a6a3416c7 *** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents: 305
diff changeset
521
189a6a3416c7 *** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents: 305
diff changeset
522 v_hide_c(VDI_handle);
189a6a3416c7 *** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents: 305
diff changeset
523
189a6a3416c7 *** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents: 305
diff changeset
524 pxy[0] = pxy[1] = 0;
189a6a3416c7 *** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents: 305
diff changeset
525 pxy[2] = VDI_w - 1;
189a6a3416c7 *** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents: 305
diff changeset
526 pxy[3] = VDI_h - 1;
736
028e03e273c8 Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents: 593
diff changeset
527 GEM_ClearRect(this, pxy);
319
189a6a3416c7 *** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents: 305
diff changeset
528
189a6a3416c7 *** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents: 305
diff changeset
529 v_show_c(VDI_handle, 1);
189a6a3416c7 *** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents: 305
diff changeset
530 }
189a6a3416c7 *** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents: 305
diff changeset
531
1074
936da0056ed3 Save/restore system palette when application topped/untopped
Patrice Mandin <patmandin@gmail.com>
parents: 1072
diff changeset
532 static void GEM_SetNewPalette(_THIS, Uint16 newpal[256][3])
936da0056ed3 Save/restore system palette when application topped/untopped
Patrice Mandin <patmandin@gmail.com>
parents: 1072
diff changeset
533 {
936da0056ed3 Save/restore system palette when application topped/untopped
Patrice Mandin <patmandin@gmail.com>
parents: 1072
diff changeset
534 int i;
936da0056ed3 Save/restore system palette when application topped/untopped
Patrice Mandin <patmandin@gmail.com>
parents: 1072
diff changeset
535 short rgb[3];
936da0056ed3 Save/restore system palette when application topped/untopped
Patrice Mandin <patmandin@gmail.com>
parents: 1072
diff changeset
536
936da0056ed3 Save/restore system palette when application topped/untopped
Patrice Mandin <patmandin@gmail.com>
parents: 1072
diff changeset
537 if (VDI_oldnumcolors==0)
936da0056ed3 Save/restore system palette when application topped/untopped
Patrice Mandin <patmandin@gmail.com>
parents: 1072
diff changeset
538 return;
936da0056ed3 Save/restore system palette when application topped/untopped
Patrice Mandin <patmandin@gmail.com>
parents: 1072
diff changeset
539
936da0056ed3 Save/restore system palette when application topped/untopped
Patrice Mandin <patmandin@gmail.com>
parents: 1072
diff changeset
540 for(i = 0; i < VDI_oldnumcolors; i++) {
936da0056ed3 Save/restore system palette when application topped/untopped
Patrice Mandin <patmandin@gmail.com>
parents: 1072
diff changeset
541 rgb[0] = newpal[i][0];
936da0056ed3 Save/restore system palette when application topped/untopped
Patrice Mandin <patmandin@gmail.com>
parents: 1072
diff changeset
542 rgb[1] = newpal[i][1];
936da0056ed3 Save/restore system palette when application topped/untopped
Patrice Mandin <patmandin@gmail.com>
parents: 1072
diff changeset
543 rgb[2] = newpal[i][2];
936da0056ed3 Save/restore system palette when application topped/untopped
Patrice Mandin <patmandin@gmail.com>
parents: 1072
diff changeset
544
936da0056ed3 Save/restore system palette when application topped/untopped
Patrice Mandin <patmandin@gmail.com>
parents: 1072
diff changeset
545 vs_color(VDI_handle, i, rgb);
936da0056ed3 Save/restore system palette when application topped/untopped
Patrice Mandin <patmandin@gmail.com>
parents: 1072
diff changeset
546 }
936da0056ed3 Save/restore system palette when application topped/untopped
Patrice Mandin <patmandin@gmail.com>
parents: 1072
diff changeset
547 }
936da0056ed3 Save/restore system palette when application topped/untopped
Patrice Mandin <patmandin@gmail.com>
parents: 1072
diff changeset
548
319
189a6a3416c7 *** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents: 305
diff changeset
549 static void GEM_LockScreen(_THIS)
189a6a3416c7 *** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents: 305
diff changeset
550 {
189a6a3416c7 *** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents: 305
diff changeset
551 if (!GEM_locked) {
189a6a3416c7 *** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents: 305
diff changeset
552 /* Lock AES */
189a6a3416c7 *** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents: 305
diff changeset
553 wind_update(BEG_UPDATE);
189a6a3416c7 *** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents: 305
diff changeset
554 wind_update(BEG_MCTRL);
917
24852aeb0657 Lock the screen before doing its backup
Patrice Mandin <patmandin@gmail.com>
parents: 902
diff changeset
555 /* Reserve memory space, used to be sure of compatibility */
24852aeb0657 Lock the screen before doing its backup
Patrice Mandin <patmandin@gmail.com>
parents: 902
diff changeset
556 form_dial( FMD_START, 0,0,0,0, 0,0,VDI_w,VDI_h);
319
189a6a3416c7 *** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents: 305
diff changeset
557
1069
8b1c83edcde2 Restore and save menu bar when entering and exiting fullscreen mode
Patrice Mandin <patmandin@gmail.com>
parents: 1066
diff changeset
558 /* Save menu bar */
8b1c83edcde2 Restore and save menu bar when entering and exiting fullscreen mode
Patrice Mandin <patmandin@gmail.com>
parents: 1066
diff changeset
559 if (GEM_menubar) {
8b1c83edcde2 Restore and save menu bar when entering and exiting fullscreen mode
Patrice Mandin <patmandin@gmail.com>
parents: 1066
diff changeset
560 MFDB mfdb_src;
8b1c83edcde2 Restore and save menu bar when entering and exiting fullscreen mode
Patrice Mandin <patmandin@gmail.com>
parents: 1066
diff changeset
561 short blitcoords[8];
8b1c83edcde2 Restore and save menu bar when entering and exiting fullscreen mode
Patrice Mandin <patmandin@gmail.com>
parents: 1066
diff changeset
562
8b1c83edcde2 Restore and save menu bar when entering and exiting fullscreen mode
Patrice Mandin <patmandin@gmail.com>
parents: 1066
diff changeset
563 mfdb_src.fd_addr=GEM_menubar;
8b1c83edcde2 Restore and save menu bar when entering and exiting fullscreen mode
Patrice Mandin <patmandin@gmail.com>
parents: 1066
diff changeset
564 mfdb_src.fd_w=GEM_desk_w;
8b1c83edcde2 Restore and save menu bar when entering and exiting fullscreen mode
Patrice Mandin <patmandin@gmail.com>
parents: 1066
diff changeset
565 mfdb_src.fd_h=GEM_desk_y;
1075
1f5ef94e8bef Use wrong line length of menubar save buffer
Patrice Mandin <patmandin@gmail.com>
parents: 1074
diff changeset
566 mfdb_src.fd_wdwidth=GEM_desk_w>>4;
1069
8b1c83edcde2 Restore and save menu bar when entering and exiting fullscreen mode
Patrice Mandin <patmandin@gmail.com>
parents: 1066
diff changeset
567 mfdb_src.fd_nplanes=VDI_bpp;
8b1c83edcde2 Restore and save menu bar when entering and exiting fullscreen mode
Patrice Mandin <patmandin@gmail.com>
parents: 1066
diff changeset
568 mfdb_src.fd_stand=
8b1c83edcde2 Restore and save menu bar when entering and exiting fullscreen mode
Patrice Mandin <patmandin@gmail.com>
parents: 1066
diff changeset
569 mfdb_src.fd_r1=
8b1c83edcde2 Restore and save menu bar when entering and exiting fullscreen mode
Patrice Mandin <patmandin@gmail.com>
parents: 1066
diff changeset
570 mfdb_src.fd_r2=
8b1c83edcde2 Restore and save menu bar when entering and exiting fullscreen mode
Patrice Mandin <patmandin@gmail.com>
parents: 1066
diff changeset
571 mfdb_src.fd_r3= 0;
8b1c83edcde2 Restore and save menu bar when entering and exiting fullscreen mode
Patrice Mandin <patmandin@gmail.com>
parents: 1066
diff changeset
572
8b1c83edcde2 Restore and save menu bar when entering and exiting fullscreen mode
Patrice Mandin <patmandin@gmail.com>
parents: 1066
diff changeset
573 blitcoords[0] = blitcoords[4] = 0;
8b1c83edcde2 Restore and save menu bar when entering and exiting fullscreen mode
Patrice Mandin <patmandin@gmail.com>
parents: 1066
diff changeset
574 blitcoords[1] = blitcoords[5] = 0;
8b1c83edcde2 Restore and save menu bar when entering and exiting fullscreen mode
Patrice Mandin <patmandin@gmail.com>
parents: 1066
diff changeset
575 blitcoords[2] = blitcoords[6] = GEM_desk_w-1;
8b1c83edcde2 Restore and save menu bar when entering and exiting fullscreen mode
Patrice Mandin <patmandin@gmail.com>
parents: 1066
diff changeset
576 blitcoords[3] = blitcoords[7] = GEM_desk_y-1;
8b1c83edcde2 Restore and save menu bar when entering and exiting fullscreen mode
Patrice Mandin <patmandin@gmail.com>
parents: 1066
diff changeset
577
8b1c83edcde2 Restore and save menu bar when entering and exiting fullscreen mode
Patrice Mandin <patmandin@gmail.com>
parents: 1066
diff changeset
578 vro_cpyfm(VDI_handle, S_ONLY, blitcoords, &VDI_dst_mfdb, &mfdb_src);
8b1c83edcde2 Restore and save menu bar when entering and exiting fullscreen mode
Patrice Mandin <patmandin@gmail.com>
parents: 1066
diff changeset
579 }
8b1c83edcde2 Restore and save menu bar when entering and exiting fullscreen mode
Patrice Mandin <patmandin@gmail.com>
parents: 1066
diff changeset
580
319
189a6a3416c7 *** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents: 305
diff changeset
581 GEM_locked=SDL_TRUE;
189a6a3416c7 *** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents: 305
diff changeset
582 }
189a6a3416c7 *** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents: 305
diff changeset
583 }
189a6a3416c7 *** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents: 305
diff changeset
584
189a6a3416c7 *** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents: 305
diff changeset
585 static void GEM_UnlockScreen(_THIS)
189a6a3416c7 *** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents: 305
diff changeset
586 {
189a6a3416c7 *** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents: 305
diff changeset
587 if (GEM_locked) {
1069
8b1c83edcde2 Restore and save menu bar when entering and exiting fullscreen mode
Patrice Mandin <patmandin@gmail.com>
parents: 1066
diff changeset
588 /* Restore menu bar */
8b1c83edcde2 Restore and save menu bar when entering and exiting fullscreen mode
Patrice Mandin <patmandin@gmail.com>
parents: 1066
diff changeset
589 if (GEM_menubar) {
8b1c83edcde2 Restore and save menu bar when entering and exiting fullscreen mode
Patrice Mandin <patmandin@gmail.com>
parents: 1066
diff changeset
590 MFDB mfdb_src;
8b1c83edcde2 Restore and save menu bar when entering and exiting fullscreen mode
Patrice Mandin <patmandin@gmail.com>
parents: 1066
diff changeset
591 short blitcoords[8];
8b1c83edcde2 Restore and save menu bar when entering and exiting fullscreen mode
Patrice Mandin <patmandin@gmail.com>
parents: 1066
diff changeset
592
8b1c83edcde2 Restore and save menu bar when entering and exiting fullscreen mode
Patrice Mandin <patmandin@gmail.com>
parents: 1066
diff changeset
593 mfdb_src.fd_addr=GEM_menubar;
8b1c83edcde2 Restore and save menu bar when entering and exiting fullscreen mode
Patrice Mandin <patmandin@gmail.com>
parents: 1066
diff changeset
594 mfdb_src.fd_w=GEM_desk_w;
8b1c83edcde2 Restore and save menu bar when entering and exiting fullscreen mode
Patrice Mandin <patmandin@gmail.com>
parents: 1066
diff changeset
595 mfdb_src.fd_h=GEM_desk_y;
1075
1f5ef94e8bef Use wrong line length of menubar save buffer
Patrice Mandin <patmandin@gmail.com>
parents: 1074
diff changeset
596 mfdb_src.fd_wdwidth=GEM_desk_w>>4;
1069
8b1c83edcde2 Restore and save menu bar when entering and exiting fullscreen mode
Patrice Mandin <patmandin@gmail.com>
parents: 1066
diff changeset
597 mfdb_src.fd_nplanes=VDI_bpp;
8b1c83edcde2 Restore and save menu bar when entering and exiting fullscreen mode
Patrice Mandin <patmandin@gmail.com>
parents: 1066
diff changeset
598 mfdb_src.fd_stand=
8b1c83edcde2 Restore and save menu bar when entering and exiting fullscreen mode
Patrice Mandin <patmandin@gmail.com>
parents: 1066
diff changeset
599 mfdb_src.fd_r1=
8b1c83edcde2 Restore and save menu bar when entering and exiting fullscreen mode
Patrice Mandin <patmandin@gmail.com>
parents: 1066
diff changeset
600 mfdb_src.fd_r2=
8b1c83edcde2 Restore and save menu bar when entering and exiting fullscreen mode
Patrice Mandin <patmandin@gmail.com>
parents: 1066
diff changeset
601 mfdb_src.fd_r3= 0;
8b1c83edcde2 Restore and save menu bar when entering and exiting fullscreen mode
Patrice Mandin <patmandin@gmail.com>
parents: 1066
diff changeset
602
8b1c83edcde2 Restore and save menu bar when entering and exiting fullscreen mode
Patrice Mandin <patmandin@gmail.com>
parents: 1066
diff changeset
603 blitcoords[0] = blitcoords[4] = 0;
8b1c83edcde2 Restore and save menu bar when entering and exiting fullscreen mode
Patrice Mandin <patmandin@gmail.com>
parents: 1066
diff changeset
604 blitcoords[1] = blitcoords[5] = 0;
8b1c83edcde2 Restore and save menu bar when entering and exiting fullscreen mode
Patrice Mandin <patmandin@gmail.com>
parents: 1066
diff changeset
605 blitcoords[2] = blitcoords[6] = GEM_desk_w-1;
8b1c83edcde2 Restore and save menu bar when entering and exiting fullscreen mode
Patrice Mandin <patmandin@gmail.com>
parents: 1066
diff changeset
606 blitcoords[3] = blitcoords[7] = GEM_desk_y-1;
8b1c83edcde2 Restore and save menu bar when entering and exiting fullscreen mode
Patrice Mandin <patmandin@gmail.com>
parents: 1066
diff changeset
607
8b1c83edcde2 Restore and save menu bar when entering and exiting fullscreen mode
Patrice Mandin <patmandin@gmail.com>
parents: 1066
diff changeset
608 vro_cpyfm(VDI_handle, S_ONLY, blitcoords, &mfdb_src, &VDI_dst_mfdb);
8b1c83edcde2 Restore and save menu bar when entering and exiting fullscreen mode
Patrice Mandin <patmandin@gmail.com>
parents: 1066
diff changeset
609 }
8b1c83edcde2 Restore and save menu bar when entering and exiting fullscreen mode
Patrice Mandin <patmandin@gmail.com>
parents: 1066
diff changeset
610
319
189a6a3416c7 *** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents: 305
diff changeset
611 /* Restore screen memory, and send REDRAW to all apps */
189a6a3416c7 *** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents: 305
diff changeset
612 form_dial( FMD_FINISH, 0,0,0,0, 0,0,VDI_w,VDI_h);
189a6a3416c7 *** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents: 305
diff changeset
613 /* Unlock AES */
189a6a3416c7 *** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents: 305
diff changeset
614 wind_update(END_MCTRL);
189a6a3416c7 *** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents: 305
diff changeset
615 wind_update(END_UPDATE);
189a6a3416c7 *** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents: 305
diff changeset
616
189a6a3416c7 *** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents: 305
diff changeset
617 GEM_locked=SDL_FALSE;
189a6a3416c7 *** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents: 305
diff changeset
618 }
189a6a3416c7 *** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents: 305
diff changeset
619 }
189a6a3416c7 *** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents: 305
diff changeset
620
281
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
621 SDL_Surface *GEM_SetVideoMode(_THIS, SDL_Surface *current,
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
622 int width, int height, int bpp, Uint32 flags)
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
623 {
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
624 int maxwidth, maxheight;
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
625 Uint32 modeflags, screensize;
736
028e03e273c8 Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents: 593
diff changeset
626 SDL_bool use_shadow1, use_shadow2;
281
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
627
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
628 /*--- Verify if asked mode can be used ---*/
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
629 if (flags & SDL_FULLSCREEN) {
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
630 maxwidth=VDI_w;
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
631 maxheight=VDI_h;
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
632 } else {
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
633 /* Windowed mode */
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
634 maxwidth=GEM_desk_w;
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
635 maxheight=GEM_desk_h;
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
636 }
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
637
799
85960507bd2e Bugfixes: some info about current framebuffer overwritten by some default values, and screen width must be multiple of 16 pixels to work correctly
Patrice Mandin <patmandin@gmail.com>
parents: 769
diff changeset
638 /* width must be multiple of 16, for vro_cpyfm() and c2p_convert() */
918
17822f1f9674 Wrongly test if width multiple of 16
Patrice Mandin <patmandin@gmail.com>
parents: 917
diff changeset
639 if ((width & 15) != 0) {
799
85960507bd2e Bugfixes: some info about current framebuffer overwritten by some default values, and screen width must be multiple of 16 pixels to work correctly
Patrice Mandin <patmandin@gmail.com>
parents: 769
diff changeset
640 width = (width | 15) +1;
85960507bd2e Bugfixes: some info about current framebuffer overwritten by some default values, and screen width must be multiple of 16 pixels to work correctly
Patrice Mandin <patmandin@gmail.com>
parents: 769
diff changeset
641 }
85960507bd2e Bugfixes: some info about current framebuffer overwritten by some default values, and screen width must be multiple of 16 pixels to work correctly
Patrice Mandin <patmandin@gmail.com>
parents: 769
diff changeset
642
281
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
643 if ((maxwidth < width) || (maxheight < height) || (VDI_bpp != bpp)) {
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
644 SDL_SetError("Couldn't find requested mode in list");
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
645 return(NULL);
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
646 }
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
647
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
648 /*--- Allocate the new pixel format for the screen ---*/
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
649 if ( ! SDL_ReallocFormat(current, VDI_bpp, VDI_redmask, VDI_greenmask, VDI_bluemask, VDI_alphamask) ) {
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
650 SDL_SetError("Couldn't allocate new pixel format for requested mode");
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
651 return(NULL);
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
652 }
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
653
736
028e03e273c8 Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents: 593
diff changeset
654 screensize = width * height * VDI_pixelsize;
028e03e273c8 Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents: 593
diff changeset
655
799
85960507bd2e Bugfixes: some info about current framebuffer overwritten by some default values, and screen width must be multiple of 16 pixels to work correctly
Patrice Mandin <patmandin@gmail.com>
parents: 769
diff changeset
656 #ifdef DEBUG_VIDEO_GEM
85960507bd2e Bugfixes: some info about current framebuffer overwritten by some default values, and screen width must be multiple of 16 pixels to work correctly
Patrice Mandin <patmandin@gmail.com>
parents: 769
diff changeset
657 printf("sdl:video:gem: setvideomode(): %dx%dx%d = %d\n", width, height, bpp, screensize);
85960507bd2e Bugfixes: some info about current framebuffer overwritten by some default values, and screen width must be multiple of 16 pixels to work correctly
Patrice Mandin <patmandin@gmail.com>
parents: 769
diff changeset
658 #endif
85960507bd2e Bugfixes: some info about current framebuffer overwritten by some default values, and screen width must be multiple of 16 pixels to work correctly
Patrice Mandin <patmandin@gmail.com>
parents: 769
diff changeset
659
736
028e03e273c8 Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents: 593
diff changeset
660 /*--- Allocate shadow buffers if needed, and conversion operations ---*/
925
15ff92ae7e1b Do not destroy window on resize, so we can go back to original size from maximized size
Patrice Mandin <patmandin@gmail.com>
parents: 924
diff changeset
661 GEM_FreeBuffers(this);
15ff92ae7e1b Do not destroy window on resize, so we can go back to original size from maximized size
Patrice Mandin <patmandin@gmail.com>
parents: 924
diff changeset
662
736
028e03e273c8 Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents: 593
diff changeset
663 GEM_bufops=0;
028e03e273c8 Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents: 593
diff changeset
664 use_shadow1=use_shadow2=SDL_FALSE;
028e03e273c8 Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents: 593
diff changeset
665 if (VDI_screen && (flags & SDL_FULLSCREEN)) {
028e03e273c8 Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents: 593
diff changeset
666 if (VDI_format==VDI_FORMAT_INTER) {
028e03e273c8 Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents: 593
diff changeset
667 use_shadow1=SDL_TRUE;
028e03e273c8 Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents: 593
diff changeset
668 GEM_bufops = B2S_C2P_1TOS;
281
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
669 }
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
670 } else {
736
028e03e273c8 Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents: 593
diff changeset
671 use_shadow1=SDL_TRUE;
028e03e273c8 Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents: 593
diff changeset
672 if (VDI_format==VDI_FORMAT_PACK) {
028e03e273c8 Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents: 593
diff changeset
673 GEM_bufops = B2S_VROCPYFM_1TOS;
028e03e273c8 Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents: 593
diff changeset
674 } else {
028e03e273c8 Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents: 593
diff changeset
675 use_shadow2=SDL_TRUE;
028e03e273c8 Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents: 593
diff changeset
676 GEM_bufops = B2S_C2P_1TO2|B2S_VROCPYFM_2TOS;
028e03e273c8 Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents: 593
diff changeset
677 }
281
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
678 }
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
679
736
028e03e273c8 Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents: 593
diff changeset
680 if (use_shadow1) {
028e03e273c8 Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents: 593
diff changeset
681 GEM_buffer1 = Atari_SysMalloc(screensize, MX_PREFTTRAM);
028e03e273c8 Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents: 593
diff changeset
682 if (GEM_buffer1==NULL) {
1104
bf145eaf76ef Tell user how many bytes are needed
Patrice Mandin <patmandin@gmail.com>
parents: 1103
diff changeset
683 SDL_SetError("Can not allocate %d KB for frame buffer", screensize>>10);
281
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
684 return NULL;
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
685 }
1336
3692456e7b0f Use SDL_ prefixed versions of C library functions.
Sam Lantinga <slouken@libsdl.org>
parents: 1312
diff changeset
686 SDL_memset(GEM_buffer1, 0, screensize);
736
028e03e273c8 Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents: 593
diff changeset
687 #ifdef DEBUG_VIDEO_GEM
028e03e273c8 Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents: 593
diff changeset
688 printf("sdl:video:gem: setvideomode(): allocated buffer 1\n");
028e03e273c8 Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents: 593
diff changeset
689 #endif
028e03e273c8 Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents: 593
diff changeset
690 }
028e03e273c8 Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents: 593
diff changeset
691
028e03e273c8 Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents: 593
diff changeset
692 if (use_shadow2) {
028e03e273c8 Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents: 593
diff changeset
693 GEM_buffer2 = Atari_SysMalloc(screensize, MX_PREFTTRAM);
028e03e273c8 Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents: 593
diff changeset
694 if (GEM_buffer2==NULL) {
1104
bf145eaf76ef Tell user how many bytes are needed
Patrice Mandin <patmandin@gmail.com>
parents: 1103
diff changeset
695 SDL_SetError("Can not allocate %d KB for shadow buffer", screensize>>10);
736
028e03e273c8 Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents: 593
diff changeset
696 return NULL;
028e03e273c8 Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents: 593
diff changeset
697 }
1336
3692456e7b0f Use SDL_ prefixed versions of C library functions.
Sam Lantinga <slouken@libsdl.org>
parents: 1312
diff changeset
698 SDL_memset(GEM_buffer2, 0, screensize);
736
028e03e273c8 Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents: 593
diff changeset
699 #ifdef DEBUG_VIDEO_GEM
028e03e273c8 Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents: 593
diff changeset
700 printf("sdl:video:gem: setvideomode(): allocated buffer 2\n");
028e03e273c8 Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents: 593
diff changeset
701 #endif
281
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
702 }
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
703
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
704 /*--- Initialize screen ---*/
1103
18e5babe266e Tell SDL to notfree my video surfaces (Damn, no how-to write a SDL driver)
Patrice Mandin <patmandin@gmail.com>
parents: 1075
diff changeset
705 modeflags = SDL_PREALLOC;
508
9ff7e90aaa94 Fixed gamma correction in Atari video drivers (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents: 319
diff changeset
706 if (VDI_bpp == 8) {
9ff7e90aaa94 Fixed gamma correction in Atari video drivers (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents: 319
diff changeset
707 modeflags |= SDL_HWPALETTE;
9ff7e90aaa94 Fixed gamma correction in Atari video drivers (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents: 319
diff changeset
708 }
9ff7e90aaa94 Fixed gamma correction in Atari video drivers (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents: 319
diff changeset
709
281
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
710 if (flags & SDL_FULLSCREEN) {
319
189a6a3416c7 *** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents: 305
diff changeset
711 GEM_LockScreen(this);
281
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
712
319
189a6a3416c7 *** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents: 305
diff changeset
713 GEM_ClearScreen(this);
281
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
714
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
715 modeflags |= SDL_FULLSCREEN;
736
028e03e273c8 Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents: 593
diff changeset
716 if (VDI_screen && (VDI_format==VDI_FORMAT_PACK) && !use_shadow1) {
281
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
717 modeflags |= SDL_HWSURFACE;
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
718 } else {
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
719 modeflags |= SDL_SWSURFACE;
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
720 }
926
83db694556eb Give mouse position relative to window position, and do not generate mouse button event if outside of the window
Patrice Mandin <patmandin@gmail.com>
parents: 925
diff changeset
721
83db694556eb Give mouse position relative to window position, and do not generate mouse button event if outside of the window
Patrice Mandin <patmandin@gmail.com>
parents: 925
diff changeset
722 GEM_fullscreen = SDL_TRUE;
281
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
723 } else {
925
15ff92ae7e1b Do not destroy window on resize, so we can go back to original size from maximized size
Patrice Mandin <patmandin@gmail.com>
parents: 924
diff changeset
724 int old_win_type;
281
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
725 short x2,y2,w2,h2;
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
726
319
189a6a3416c7 *** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents: 305
diff changeset
727 GEM_UnlockScreen(this);
281
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
728
923
2748679027ff Correctly center window on creation
Patrice Mandin <patmandin@gmail.com>
parents: 921
diff changeset
729 /* Set window gadgets */
925
15ff92ae7e1b Do not destroy window on resize, so we can go back to original size from maximized size
Patrice Mandin <patmandin@gmail.com>
parents: 924
diff changeset
730 old_win_type = GEM_win_type;
281
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
731 if (!(flags & SDL_NOFRAME)) {
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
732 GEM_win_type=NAME|MOVER|CLOSER|SMALLER;
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
733 if (flags & SDL_RESIZABLE) {
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
734 GEM_win_type |= FULLER|SIZER;
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
735 modeflags |= SDL_RESIZABLE;
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
736 }
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
737 } else {
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
738 GEM_win_type=0;
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
739 modeflags |= SDL_NOFRAME;
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
740 }
925
15ff92ae7e1b Do not destroy window on resize, so we can go back to original size from maximized size
Patrice Mandin <patmandin@gmail.com>
parents: 924
diff changeset
741 modeflags |= SDL_SWSURFACE;
281
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
742
925
15ff92ae7e1b Do not destroy window on resize, so we can go back to original size from maximized size
Patrice Mandin <patmandin@gmail.com>
parents: 924
diff changeset
743 /* Recreate window ? only for different widget or non-created window */
959
51ec8fc8bedb No need to close the window when going to fullscreen mode
Patrice Mandin <patmandin@gmail.com>
parents: 926
diff changeset
744 if ((old_win_type != GEM_win_type) || (GEM_handle < 0)) {
925
15ff92ae7e1b Do not destroy window on resize, so we can go back to original size from maximized size
Patrice Mandin <patmandin@gmail.com>
parents: 924
diff changeset
745 /* Calculate window size */
15ff92ae7e1b Do not destroy window on resize, so we can go back to original size from maximized size
Patrice Mandin <patmandin@gmail.com>
parents: 924
diff changeset
746 if (!wind_calc(WC_BORDER, GEM_win_type, 0,0,width,height, &x2,&y2,&w2,&h2)) {
15ff92ae7e1b Do not destroy window on resize, so we can go back to original size from maximized size
Patrice Mandin <patmandin@gmail.com>
parents: 924
diff changeset
747 GEM_FreeBuffers(this);
15ff92ae7e1b Do not destroy window on resize, so we can go back to original size from maximized size
Patrice Mandin <patmandin@gmail.com>
parents: 924
diff changeset
748 SDL_SetError("Can not calculate window attributes");
15ff92ae7e1b Do not destroy window on resize, so we can go back to original size from maximized size
Patrice Mandin <patmandin@gmail.com>
parents: 924
diff changeset
749 return NULL;
15ff92ae7e1b Do not destroy window on resize, so we can go back to original size from maximized size
Patrice Mandin <patmandin@gmail.com>
parents: 924
diff changeset
750 }
281
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
751
925
15ff92ae7e1b Do not destroy window on resize, so we can go back to original size from maximized size
Patrice Mandin <patmandin@gmail.com>
parents: 924
diff changeset
752 /* Center window */
15ff92ae7e1b Do not destroy window on resize, so we can go back to original size from maximized size
Patrice Mandin <patmandin@gmail.com>
parents: 924
diff changeset
753 x2 = GEM_desk_x+((GEM_desk_w-w2)>>1);
15ff92ae7e1b Do not destroy window on resize, so we can go back to original size from maximized size
Patrice Mandin <patmandin@gmail.com>
parents: 924
diff changeset
754 y2 = GEM_desk_y+((GEM_desk_h-h2)>>1);
923
2748679027ff Correctly center window on creation
Patrice Mandin <patmandin@gmail.com>
parents: 921
diff changeset
755
925
15ff92ae7e1b Do not destroy window on resize, so we can go back to original size from maximized size
Patrice Mandin <patmandin@gmail.com>
parents: 924
diff changeset
756 /* Destroy existing window */
15ff92ae7e1b Do not destroy window on resize, so we can go back to original size from maximized size
Patrice Mandin <patmandin@gmail.com>
parents: 924
diff changeset
757 if (GEM_handle >= 0) {
15ff92ae7e1b Do not destroy window on resize, so we can go back to original size from maximized size
Patrice Mandin <patmandin@gmail.com>
parents: 924
diff changeset
758 wind_close(GEM_handle);
15ff92ae7e1b Do not destroy window on resize, so we can go back to original size from maximized size
Patrice Mandin <patmandin@gmail.com>
parents: 924
diff changeset
759 wind_delete(GEM_handle);
15ff92ae7e1b Do not destroy window on resize, so we can go back to original size from maximized size
Patrice Mandin <patmandin@gmail.com>
parents: 924
diff changeset
760 }
15ff92ae7e1b Do not destroy window on resize, so we can go back to original size from maximized size
Patrice Mandin <patmandin@gmail.com>
parents: 924
diff changeset
761
15ff92ae7e1b Do not destroy window on resize, so we can go back to original size from maximized size
Patrice Mandin <patmandin@gmail.com>
parents: 924
diff changeset
762 /* Create window */
15ff92ae7e1b Do not destroy window on resize, so we can go back to original size from maximized size
Patrice Mandin <patmandin@gmail.com>
parents: 924
diff changeset
763 GEM_handle=wind_create(GEM_win_type, x2,y2,w2,h2);
15ff92ae7e1b Do not destroy window on resize, so we can go back to original size from maximized size
Patrice Mandin <patmandin@gmail.com>
parents: 924
diff changeset
764 if (GEM_handle<0) {
15ff92ae7e1b Do not destroy window on resize, so we can go back to original size from maximized size
Patrice Mandin <patmandin@gmail.com>
parents: 924
diff changeset
765 GEM_FreeBuffers(this);
15ff92ae7e1b Do not destroy window on resize, so we can go back to original size from maximized size
Patrice Mandin <patmandin@gmail.com>
parents: 924
diff changeset
766 SDL_SetError("Can not create window");
15ff92ae7e1b Do not destroy window on resize, so we can go back to original size from maximized size
Patrice Mandin <patmandin@gmail.com>
parents: 924
diff changeset
767 return NULL;
15ff92ae7e1b Do not destroy window on resize, so we can go back to original size from maximized size
Patrice Mandin <patmandin@gmail.com>
parents: 924
diff changeset
768 }
281
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
769
736
028e03e273c8 Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents: 593
diff changeset
770 #ifdef DEBUG_VIDEO_GEM
925
15ff92ae7e1b Do not destroy window on resize, so we can go back to original size from maximized size
Patrice Mandin <patmandin@gmail.com>
parents: 924
diff changeset
771 printf("sdl:video:gem: handle=%d\n", GEM_handle);
736
028e03e273c8 Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents: 593
diff changeset
772 #endif
028e03e273c8 Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents: 593
diff changeset
773
925
15ff92ae7e1b Do not destroy window on resize, so we can go back to original size from maximized size
Patrice Mandin <patmandin@gmail.com>
parents: 924
diff changeset
774 /* Setup window name */
15ff92ae7e1b Do not destroy window on resize, so we can go back to original size from maximized size
Patrice Mandin <patmandin@gmail.com>
parents: 924
diff changeset
775 wind_set(GEM_handle,WF_NAME,(short)(((unsigned long)GEM_title_name)>>16),(short)(((unsigned long)GEM_title_name) & 0xffff),0,0);
15ff92ae7e1b Do not destroy window on resize, so we can go back to original size from maximized size
Patrice Mandin <patmandin@gmail.com>
parents: 924
diff changeset
776 GEM_refresh_name = SDL_FALSE;
959
51ec8fc8bedb No need to close the window when going to fullscreen mode
Patrice Mandin <patmandin@gmail.com>
parents: 926
diff changeset
777
51ec8fc8bedb No need to close the window when going to fullscreen mode
Patrice Mandin <patmandin@gmail.com>
parents: 926
diff changeset
778 /* Open the window */
51ec8fc8bedb No need to close the window when going to fullscreen mode
Patrice Mandin <patmandin@gmail.com>
parents: 926
diff changeset
779 wind_open(GEM_handle,x2,y2,w2,h2);
1066
671bbd773c8a Resize window to fit asked video mode
Patrice Mandin <patmandin@gmail.com>
parents: 1041
diff changeset
780 } else {
3942
b3b6f1a8d60a Simply resize existing window
Patrice Mandin <patmandin@gmail.com>
parents: 3941
diff changeset
781 /* Resize window to fit asked video mode */
b3b6f1a8d60a Simply resize existing window
Patrice Mandin <patmandin@gmail.com>
parents: 3941
diff changeset
782 wind_get (GEM_handle, WF_WORKXYWH, &x2,&y2,&w2,&h2);
b3b6f1a8d60a Simply resize existing window
Patrice Mandin <patmandin@gmail.com>
parents: 3941
diff changeset
783 if (wind_calc(WC_BORDER, GEM_win_type, x2,y2,width,height, &x2,&y2,&w2,&h2)) {
b3b6f1a8d60a Simply resize existing window
Patrice Mandin <patmandin@gmail.com>
parents: 3941
diff changeset
784 wind_set (GEM_handle, WF_CURRXYWH, x2,y2,w2,h2);
1066
671bbd773c8a Resize window to fit asked video mode
Patrice Mandin <patmandin@gmail.com>
parents: 1041
diff changeset
785 }
925
15ff92ae7e1b Do not destroy window on resize, so we can go back to original size from maximized size
Patrice Mandin <patmandin@gmail.com>
parents: 924
diff changeset
786 }
926
83db694556eb Give mouse position relative to window position, and do not generate mouse button event if outside of the window
Patrice Mandin <patmandin@gmail.com>
parents: 925
diff changeset
787
83db694556eb Give mouse position relative to window position, and do not generate mouse button event if outside of the window
Patrice Mandin <patmandin@gmail.com>
parents: 925
diff changeset
788 GEM_fullscreen = SDL_FALSE;
281
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
789 }
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
790
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
791 /* Set up the new mode framebuffer */
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
792 current->w = width;
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
793 current->h = height;
736
028e03e273c8 Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents: 593
diff changeset
794 if (use_shadow1) {
028e03e273c8 Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents: 593
diff changeset
795 current->pixels = GEM_buffer1;
799
85960507bd2e Bugfixes: some info about current framebuffer overwritten by some default values, and screen width must be multiple of 16 pixels to work correctly
Patrice Mandin <patmandin@gmail.com>
parents: 769
diff changeset
796 current->pitch = width * VDI_pixelsize;
281
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
797 } else {
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
798 current->pixels = VDI_screen;
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
799 current->pitch = VDI_pitch;
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
800 }
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
801
1361
19418e4422cb New configure-based build system. Still work in progress, but much improved
Sam Lantinga <slouken@libsdl.org>
parents: 1358
diff changeset
802 #if SDL_VIDEO_OPENGL
984
44fd54a0ae5f Add OSMesa OpenGL support to the Atari GEM video driver
Patrice Mandin <patmandin@gmail.com>
parents: 964
diff changeset
803 if (flags & SDL_OPENGL) {
989
475166d13b44 Factorize OSMesa OpenGL code for Atari drivers
Patrice Mandin <patmandin@gmail.com>
parents: 988
diff changeset
804 if (!SDL_AtariGL_Init(this, current)) {
984
44fd54a0ae5f Add OSMesa OpenGL support to the Atari GEM video driver
Patrice Mandin <patmandin@gmail.com>
parents: 964
diff changeset
805 GEM_FreeBuffers(this);
989
475166d13b44 Factorize OSMesa OpenGL code for Atari drivers
Patrice Mandin <patmandin@gmail.com>
parents: 988
diff changeset
806 SDL_SetError("Can not create OpenGL context");
475166d13b44 Factorize OSMesa OpenGL code for Atari drivers
Patrice Mandin <patmandin@gmail.com>
parents: 988
diff changeset
807 return NULL;
984
44fd54a0ae5f Add OSMesa OpenGL support to the Atari GEM video driver
Patrice Mandin <patmandin@gmail.com>
parents: 964
diff changeset
808 }
44fd54a0ae5f Add OSMesa OpenGL support to the Atari GEM video driver
Patrice Mandin <patmandin@gmail.com>
parents: 964
diff changeset
809
44fd54a0ae5f Add OSMesa OpenGL support to the Atari GEM video driver
Patrice Mandin <patmandin@gmail.com>
parents: 964
diff changeset
810 modeflags |= SDL_OPENGL;
44fd54a0ae5f Add OSMesa OpenGL support to the Atari GEM video driver
Patrice Mandin <patmandin@gmail.com>
parents: 964
diff changeset
811 }
44fd54a0ae5f Add OSMesa OpenGL support to the Atari GEM video driver
Patrice Mandin <patmandin@gmail.com>
parents: 964
diff changeset
812 #endif
44fd54a0ae5f Add OSMesa OpenGL support to the Atari GEM video driver
Patrice Mandin <patmandin@gmail.com>
parents: 964
diff changeset
813
44fd54a0ae5f Add OSMesa OpenGL support to the Atari GEM video driver
Patrice Mandin <patmandin@gmail.com>
parents: 964
diff changeset
814 current->flags = modeflags;
44fd54a0ae5f Add OSMesa OpenGL support to the Atari GEM video driver
Patrice Mandin <patmandin@gmail.com>
parents: 964
diff changeset
815
799
85960507bd2e Bugfixes: some info about current framebuffer overwritten by some default values, and screen width must be multiple of 16 pixels to work correctly
Patrice Mandin <patmandin@gmail.com>
parents: 769
diff changeset
816 #ifdef DEBUG_VIDEO_GEM
85960507bd2e Bugfixes: some info about current framebuffer overwritten by some default values, and screen width must be multiple of 16 pixels to work correctly
Patrice Mandin <patmandin@gmail.com>
parents: 769
diff changeset
817 printf("sdl:video:gem: surface: %dx%d\n", current->w, current->h);
85960507bd2e Bugfixes: some info about current framebuffer overwritten by some default values, and screen width must be multiple of 16 pixels to work correctly
Patrice Mandin <patmandin@gmail.com>
parents: 769
diff changeset
818 #endif
85960507bd2e Bugfixes: some info about current framebuffer overwritten by some default values, and screen width must be multiple of 16 pixels to work correctly
Patrice Mandin <patmandin@gmail.com>
parents: 769
diff changeset
819
281
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
820 this->UpdateRects = GEM_UpdateRects;
964
d9209754ebee Prevent redraws till internal buffers are correctly setup
Patrice Mandin <patmandin@gmail.com>
parents: 959
diff changeset
821 GEM_lock_redraw = SDL_FALSE; /* Enable redraw */
281
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
822
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
823 /* We're done */
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
824 return(current);
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
825 }
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
826
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
827 static int GEM_AllocHWSurface(_THIS, SDL_Surface *surface)
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
828 {
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
829 return -1;
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
830 }
800
60a4293ffea9 When commiting code, cleanup before doing it
Patrice Mandin <patmandin@gmail.com>
parents: 799
diff changeset
831
281
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
832 static void GEM_FreeHWSurface(_THIS, SDL_Surface *surface)
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
833 {
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
834 return;
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
835 }
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
836
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
837 static int GEM_LockHWSurface(_THIS, SDL_Surface *surface)
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
838 {
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
839 return(0);
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
840 }
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
841
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
842 static void GEM_UnlockHWSurface(_THIS, SDL_Surface *surface)
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
843 {
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
844 return;
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
845 }
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
846
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
847 static void GEM_UpdateRectsFullscreen(_THIS, int numrects, SDL_Rect *rects)
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
848 {
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
849 SDL_Surface *surface;
799
85960507bd2e Bugfixes: some info about current framebuffer overwritten by some default values, and screen width must be multiple of 16 pixels to work correctly
Patrice Mandin <patmandin@gmail.com>
parents: 769
diff changeset
850 int i, surf_width;
281
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
851
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
852 surface = this->screen;
799
85960507bd2e Bugfixes: some info about current framebuffer overwritten by some default values, and screen width must be multiple of 16 pixels to work correctly
Patrice Mandin <patmandin@gmail.com>
parents: 769
diff changeset
853 /* Need to be a multiple of 16 pixels */
85960507bd2e Bugfixes: some info about current framebuffer overwritten by some default values, and screen width must be multiple of 16 pixels to work correctly
Patrice Mandin <patmandin@gmail.com>
parents: 769
diff changeset
854 surf_width=surface->w;
918
17822f1f9674 Wrongly test if width multiple of 16
Patrice Mandin <patmandin@gmail.com>
parents: 917
diff changeset
855 if ((surf_width & 15) != 0) {
799
85960507bd2e Bugfixes: some info about current framebuffer overwritten by some default values, and screen width must be multiple of 16 pixels to work correctly
Patrice Mandin <patmandin@gmail.com>
parents: 769
diff changeset
856 surf_width = (surf_width | 15) + 1;
85960507bd2e Bugfixes: some info about current framebuffer overwritten by some default values, and screen width must be multiple of 16 pixels to work correctly
Patrice Mandin <patmandin@gmail.com>
parents: 769
diff changeset
857 }
281
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
858
736
028e03e273c8 Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents: 593
diff changeset
859 if (GEM_bufops & (B2S_C2P_1TO2|B2S_C2P_1TOS)) {
028e03e273c8 Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents: 593
diff changeset
860 void *destscr;
028e03e273c8 Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents: 593
diff changeset
861 int destpitch;
028e03e273c8 Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents: 593
diff changeset
862
028e03e273c8 Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents: 593
diff changeset
863 if (GEM_bufops & B2S_C2P_1TOS) {
281
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
864 destscr = VDI_screen;
736
028e03e273c8 Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents: 593
diff changeset
865 destpitch = VDI_pitch;
028e03e273c8 Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents: 593
diff changeset
866 } else {
028e03e273c8 Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents: 593
diff changeset
867 destscr = GEM_buffer2;
028e03e273c8 Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents: 593
diff changeset
868 destpitch = surface->pitch;
028e03e273c8 Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents: 593
diff changeset
869 }
319
189a6a3416c7 *** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents: 305
diff changeset
870
736
028e03e273c8 Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents: 593
diff changeset
871 for (i=0;i<numrects;i++) {
028e03e273c8 Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents: 593
diff changeset
872 void *source,*destination;
028e03e273c8 Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents: 593
diff changeset
873 int x1,x2;
319
189a6a3416c7 *** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents: 305
diff changeset
874
736
028e03e273c8 Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents: 593
diff changeset
875 x1 = rects[i].x & ~15;
028e03e273c8 Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents: 593
diff changeset
876 x2 = rects[i].x+rects[i].w;
028e03e273c8 Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents: 593
diff changeset
877 if (x2 & 15) {
028e03e273c8 Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents: 593
diff changeset
878 x2 = (x2 | 15) +1;
319
189a6a3416c7 *** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents: 305
diff changeset
879 }
189a6a3416c7 *** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents: 305
diff changeset
880
736
028e03e273c8 Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents: 593
diff changeset
881 source = surface->pixels;
028e03e273c8 Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents: 593
diff changeset
882 source += surface->pitch * rects[i].y;
028e03e273c8 Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents: 593
diff changeset
883 source += x1;
319
189a6a3416c7 *** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents: 305
diff changeset
884
736
028e03e273c8 Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents: 593
diff changeset
885 destination = destscr;
028e03e273c8 Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents: 593
diff changeset
886 destination += destpitch * rects[i].y;
028e03e273c8 Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents: 593
diff changeset
887 destination += x1;
028e03e273c8 Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents: 593
diff changeset
888
028e03e273c8 Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents: 593
diff changeset
889 SDL_Atari_C2pConvert(
028e03e273c8 Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents: 593
diff changeset
890 source, destination,
028e03e273c8 Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents: 593
diff changeset
891 x2-x1, rects[i].h,
028e03e273c8 Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents: 593
diff changeset
892 SDL_FALSE,
028e03e273c8 Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents: 593
diff changeset
893 surface->pitch, destpitch
028e03e273c8 Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents: 593
diff changeset
894 );
319
189a6a3416c7 *** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents: 305
diff changeset
895 }
189a6a3416c7 *** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents: 305
diff changeset
896 }
281
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
897
736
028e03e273c8 Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents: 593
diff changeset
898 if (GEM_bufops & (B2S_VROCPYFM_1TOS|B2S_VROCPYFM_2TOS)) {
028e03e273c8 Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents: 593
diff changeset
899 MFDB mfdb_src;
028e03e273c8 Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents: 593
diff changeset
900 short blitcoords[8];
281
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
901
736
028e03e273c8 Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents: 593
diff changeset
902 mfdb_src.fd_addr=surface->pixels;
799
85960507bd2e Bugfixes: some info about current framebuffer overwritten by some default values, and screen width must be multiple of 16 pixels to work correctly
Patrice Mandin <patmandin@gmail.com>
parents: 769
diff changeset
903 mfdb_src.fd_w=surf_width;
736
028e03e273c8 Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents: 593
diff changeset
904 mfdb_src.fd_h=surface->h;
1041
af92ee34b3e2 Was using width of surface instead of pitch to calculate length of surface width in words
Patrice Mandin <patmandin@gmail.com>
parents: 993
diff changeset
905 mfdb_src.fd_wdwidth= (surface->pitch/VDI_pixelsize) >> 4;
736
028e03e273c8 Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents: 593
diff changeset
906 mfdb_src.fd_nplanes=surface->format->BitsPerPixel;
028e03e273c8 Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents: 593
diff changeset
907 mfdb_src.fd_stand=
028e03e273c8 Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents: 593
diff changeset
908 mfdb_src.fd_r1=
028e03e273c8 Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents: 593
diff changeset
909 mfdb_src.fd_r2=
028e03e273c8 Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents: 593
diff changeset
910 mfdb_src.fd_r3= 0;
028e03e273c8 Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents: 593
diff changeset
911 if (GEM_bufops & B2S_VROCPYFM_2TOS) {
028e03e273c8 Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents: 593
diff changeset
912 mfdb_src.fd_addr=GEM_buffer2;
028e03e273c8 Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents: 593
diff changeset
913 }
281
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
914
736
028e03e273c8 Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents: 593
diff changeset
915 for ( i=0; i<numrects; ++i ) {
1071
24470ffe8ee4 SDL will center surface on screen for us
Patrice Mandin <patmandin@gmail.com>
parents: 1070
diff changeset
916 blitcoords[0] = blitcoords[4] = rects[i].x;
24470ffe8ee4 SDL will center surface on screen for us
Patrice Mandin <patmandin@gmail.com>
parents: 1070
diff changeset
917 blitcoords[1] = blitcoords[5] = rects[i].y;
24470ffe8ee4 SDL will center surface on screen for us
Patrice Mandin <patmandin@gmail.com>
parents: 1070
diff changeset
918 blitcoords[2] = blitcoords[6] = rects[i].x + rects[i].w - 1;
24470ffe8ee4 SDL will center surface on screen for us
Patrice Mandin <patmandin@gmail.com>
parents: 1070
diff changeset
919 blitcoords[3] = blitcoords[7] = rects[i].y + rects[i].h - 1;
736
028e03e273c8 Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents: 593
diff changeset
920
028e03e273c8 Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents: 593
diff changeset
921 vro_cpyfm(VDI_handle, S_ONLY, blitcoords, &mfdb_src, &VDI_dst_mfdb);
028e03e273c8 Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents: 593
diff changeset
922 }
281
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
923 }
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
924 }
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
925
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
926 static void GEM_UpdateRectsWindowed(_THIS, int numrects, SDL_Rect *rects)
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
927 {
736
028e03e273c8 Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents: 593
diff changeset
928 short pxy[4], wind_pxy[4];
281
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
929 int i;
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
930
736
028e03e273c8 Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents: 593
diff changeset
931 if (wind_get(GEM_handle, WF_WORKXYWH, &wind_pxy[0], &wind_pxy[1], &wind_pxy[2], &wind_pxy[3])==0) {
028e03e273c8 Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents: 593
diff changeset
932 return;
028e03e273c8 Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents: 593
diff changeset
933 }
281
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
934
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
935 for ( i=0; i<numrects; ++i ) {
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
936 pxy[0] = wind_pxy[0] + rects[i].x;
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
937 pxy[1] = wind_pxy[1] + rects[i].y;
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
938 pxy[2] = rects[i].w;
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
939 pxy[3] = rects[i].h;
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
940
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
941 GEM_wind_redraw(this, GEM_handle, pxy);
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
942 }
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
943 }
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
944
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
945 static void GEM_UpdateRects(_THIS, int numrects, SDL_Rect *rects)
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
946 {
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
947 SDL_Surface *surface;
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
948
964
d9209754ebee Prevent redraws till internal buffers are correctly setup
Patrice Mandin <patmandin@gmail.com>
parents: 959
diff changeset
949 if (GEM_lock_redraw) {
d9209754ebee Prevent redraws till internal buffers are correctly setup
Patrice Mandin <patmandin@gmail.com>
parents: 959
diff changeset
950 return;
d9209754ebee Prevent redraws till internal buffers are correctly setup
Patrice Mandin <patmandin@gmail.com>
parents: 959
diff changeset
951 }
d9209754ebee Prevent redraws till internal buffers are correctly setup
Patrice Mandin <patmandin@gmail.com>
parents: 959
diff changeset
952
281
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
953 surface = this->screen;
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
954
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
955 if (surface->flags & SDL_FULLSCREEN) {
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
956 GEM_UpdateRectsFullscreen(this, numrects, rects);
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
957 } else {
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
958 GEM_UpdateRectsWindowed(this, numrects, rects);
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
959 }
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
960 }
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
961
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
962 static int GEM_FlipHWSurfaceFullscreen(_THIS, SDL_Surface *surface)
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
963 {
799
85960507bd2e Bugfixes: some info about current framebuffer overwritten by some default values, and screen width must be multiple of 16 pixels to work correctly
Patrice Mandin <patmandin@gmail.com>
parents: 769
diff changeset
964 int surf_width;
85960507bd2e Bugfixes: some info about current framebuffer overwritten by some default values, and screen width must be multiple of 16 pixels to work correctly
Patrice Mandin <patmandin@gmail.com>
parents: 769
diff changeset
965
85960507bd2e Bugfixes: some info about current framebuffer overwritten by some default values, and screen width must be multiple of 16 pixels to work correctly
Patrice Mandin <patmandin@gmail.com>
parents: 769
diff changeset
966 /* Need to be a multiple of 16 pixels */
85960507bd2e Bugfixes: some info about current framebuffer overwritten by some default values, and screen width must be multiple of 16 pixels to work correctly
Patrice Mandin <patmandin@gmail.com>
parents: 769
diff changeset
967 surf_width=surface->w;
918
17822f1f9674 Wrongly test if width multiple of 16
Patrice Mandin <patmandin@gmail.com>
parents: 917
diff changeset
968 if ((surf_width & 15) != 0) {
799
85960507bd2e Bugfixes: some info about current framebuffer overwritten by some default values, and screen width must be multiple of 16 pixels to work correctly
Patrice Mandin <patmandin@gmail.com>
parents: 769
diff changeset
969 surf_width = (surf_width | 15) + 1;
85960507bd2e Bugfixes: some info about current framebuffer overwritten by some default values, and screen width must be multiple of 16 pixels to work correctly
Patrice Mandin <patmandin@gmail.com>
parents: 769
diff changeset
970 }
85960507bd2e Bugfixes: some info about current framebuffer overwritten by some default values, and screen width must be multiple of 16 pixels to work correctly
Patrice Mandin <patmandin@gmail.com>
parents: 769
diff changeset
971
736
028e03e273c8 Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents: 593
diff changeset
972 if (GEM_bufops & (B2S_C2P_1TO2|B2S_C2P_1TOS)) {
028e03e273c8 Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents: 593
diff changeset
973 void *destscr;
028e03e273c8 Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents: 593
diff changeset
974 int destpitch;
319
189a6a3416c7 *** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents: 305
diff changeset
975
736
028e03e273c8 Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents: 593
diff changeset
976 if (GEM_bufops & B2S_C2P_1TOS) {
281
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
977 destscr = VDI_screen;
736
028e03e273c8 Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents: 593
diff changeset
978 destpitch = VDI_pitch;
028e03e273c8 Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents: 593
diff changeset
979 } else {
028e03e273c8 Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents: 593
diff changeset
980 destscr = GEM_buffer2;
028e03e273c8 Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents: 593
diff changeset
981 destpitch = surface->pitch;
281
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
982 }
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
983
736
028e03e273c8 Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents: 593
diff changeset
984 SDL_Atari_C2pConvert(
028e03e273c8 Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents: 593
diff changeset
985 surface->pixels, destscr,
799
85960507bd2e Bugfixes: some info about current framebuffer overwritten by some default values, and screen width must be multiple of 16 pixels to work correctly
Patrice Mandin <patmandin@gmail.com>
parents: 769
diff changeset
986 surf_width, surface->h,
736
028e03e273c8 Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents: 593
diff changeset
987 SDL_FALSE,
028e03e273c8 Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents: 593
diff changeset
988 surface->pitch, destpitch
028e03e273c8 Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents: 593
diff changeset
989 );
319
189a6a3416c7 *** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents: 305
diff changeset
990 }
736
028e03e273c8 Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents: 593
diff changeset
991
028e03e273c8 Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents: 593
diff changeset
992 if (GEM_bufops & (B2S_VROCPYFM_1TOS|B2S_VROCPYFM_2TOS)) {
028e03e273c8 Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents: 593
diff changeset
993 MFDB mfdb_src;
028e03e273c8 Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents: 593
diff changeset
994 short blitcoords[8];
281
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
995
799
85960507bd2e Bugfixes: some info about current framebuffer overwritten by some default values, and screen width must be multiple of 16 pixels to work correctly
Patrice Mandin <patmandin@gmail.com>
parents: 769
diff changeset
996 mfdb_src.fd_w=surf_width;
736
028e03e273c8 Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents: 593
diff changeset
997 mfdb_src.fd_h=surface->h;
799
85960507bd2e Bugfixes: some info about current framebuffer overwritten by some default values, and screen width must be multiple of 16 pixels to work correctly
Patrice Mandin <patmandin@gmail.com>
parents: 769
diff changeset
998 mfdb_src.fd_wdwidth=mfdb_src.fd_w >> 4;
736
028e03e273c8 Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents: 593
diff changeset
999 mfdb_src.fd_nplanes=surface->format->BitsPerPixel;
028e03e273c8 Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents: 593
diff changeset
1000 mfdb_src.fd_stand=
028e03e273c8 Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents: 593
diff changeset
1001 mfdb_src.fd_r1=
028e03e273c8 Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents: 593
diff changeset
1002 mfdb_src.fd_r2=
028e03e273c8 Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents: 593
diff changeset
1003 mfdb_src.fd_r3= 0;
028e03e273c8 Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents: 593
diff changeset
1004 if (GEM_bufops & B2S_VROCPYFM_1TOS) {
028e03e273c8 Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents: 593
diff changeset
1005 mfdb_src.fd_addr=surface->pixels;
028e03e273c8 Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents: 593
diff changeset
1006 } else {
028e03e273c8 Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents: 593
diff changeset
1007 mfdb_src.fd_addr=GEM_buffer2;
028e03e273c8 Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents: 593
diff changeset
1008 }
281
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1009
1071
24470ffe8ee4 SDL will center surface on screen for us
Patrice Mandin <patmandin@gmail.com>
parents: 1070
diff changeset
1010 blitcoords[0] = blitcoords[4] = 0;
24470ffe8ee4 SDL will center surface on screen for us
Patrice Mandin <patmandin@gmail.com>
parents: 1070
diff changeset
1011 blitcoords[1] = blitcoords[5] = 0;
24470ffe8ee4 SDL will center surface on screen for us
Patrice Mandin <patmandin@gmail.com>
parents: 1070
diff changeset
1012 blitcoords[2] = blitcoords[6] = surface->w - 1;
24470ffe8ee4 SDL will center surface on screen for us
Patrice Mandin <patmandin@gmail.com>
parents: 1070
diff changeset
1013 blitcoords[3] = blitcoords[7] = surface->h - 1;
736
028e03e273c8 Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents: 593
diff changeset
1014
028e03e273c8 Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents: 593
diff changeset
1015 vro_cpyfm(VDI_handle, S_ONLY, blitcoords, &mfdb_src, &VDI_dst_mfdb);
028e03e273c8 Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents: 593
diff changeset
1016 }
281
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1017
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1018 return(0);
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1019 }
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1020
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1021 static int GEM_FlipHWSurfaceWindowed(_THIS, SDL_Surface *surface)
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1022 {
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1023 short pxy[8];
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1024
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1025 /* Update the whole window */
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1026 wind_get(GEM_handle, WF_WORKXYWH, &pxy[0], &pxy[1], &pxy[2], &pxy[3]);
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1027
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1028 GEM_wind_redraw(this, GEM_handle, pxy);
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1029
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1030 return(0);
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1031 }
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1032
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1033 static int GEM_FlipHWSurface(_THIS, SDL_Surface *surface)
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1034 {
964
d9209754ebee Prevent redraws till internal buffers are correctly setup
Patrice Mandin <patmandin@gmail.com>
parents: 959
diff changeset
1035 if (GEM_lock_redraw) {
d9209754ebee Prevent redraws till internal buffers are correctly setup
Patrice Mandin <patmandin@gmail.com>
parents: 959
diff changeset
1036 return(0);
d9209754ebee Prevent redraws till internal buffers are correctly setup
Patrice Mandin <patmandin@gmail.com>
parents: 959
diff changeset
1037 }
d9209754ebee Prevent redraws till internal buffers are correctly setup
Patrice Mandin <patmandin@gmail.com>
parents: 959
diff changeset
1038
281
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1039 if (surface->flags & SDL_FULLSCREEN) {
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1040 return GEM_FlipHWSurfaceFullscreen(this, surface);
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1041 } else {
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1042 return GEM_FlipHWSurfaceWindowed(this, surface);
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1043 }
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1044 }
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1045
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1046 static int GEM_SetColors(_THIS, int firstcolor, int ncolors, SDL_Color *colors)
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1047 {
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1048 int i;
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1049 SDL_Surface *surface;
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1050
736
028e03e273c8 Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents: 593
diff changeset
1051 #ifdef DEBUG_VIDEO_GEM
028e03e273c8 Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents: 593
diff changeset
1052 printf("sdl:video:gem: setcolors()\n");
028e03e273c8 Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents: 593
diff changeset
1053 #endif
028e03e273c8 Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents: 593
diff changeset
1054
281
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1055 /* Do not change palette in True Colour */
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1056 surface = this->screen;
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1057 if (surface->format->BitsPerPixel > 8) {
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1058 return 1;
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1059 }
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1060
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1061 for(i = 0; i < ncolors; i++)
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1062 {
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1063 int r, g, b;
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1064 short rgb[3];
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1065
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1066 r = colors[i].r;
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1067 g = colors[i].g;
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1068 b = colors[i].b;
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1069
1074
936da0056ed3 Save/restore system palette when application topped/untopped
Patrice Mandin <patmandin@gmail.com>
parents: 1072
diff changeset
1070 rgb[0] = VDI_curpalette[i][0] = (1000 * r) / 255;
936da0056ed3 Save/restore system palette when application topped/untopped
Patrice Mandin <patmandin@gmail.com>
parents: 1072
diff changeset
1071 rgb[1] = VDI_curpalette[i][1] =(1000 * g) / 255;
936da0056ed3 Save/restore system palette when application topped/untopped
Patrice Mandin <patmandin@gmail.com>
parents: 1072
diff changeset
1072 rgb[2] = VDI_curpalette[i][2] =(1000 * b) / 255;
281
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1073
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1074 vs_color(VDI_handle, vdi_index[firstcolor+i], rgb);
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1075 }
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1076
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1077 return(1);
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1078 }
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1079
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1080 #if 0
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1081 static int GEM_ToggleFullScreen(_THIS, int on)
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1082 {
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1083 if (on) {
319
189a6a3416c7 *** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents: 305
diff changeset
1084 GEM_LockScreen(this);
281
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1085 } else {
319
189a6a3416c7 *** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents: 305
diff changeset
1086 GEM_UnlockScreen(this);
281
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1087 }
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1088
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1089 return(1);
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1090 }
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1091 #endif
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1092
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1093 /* Note: If we are terminated, this could be called in the middle of
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1094 another SDL video routine -- notably UpdateRects.
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1095 */
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1096 void GEM_VideoQuit(_THIS)
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1097 {
305
9c6613983e85 Atari port cleanups from Patrice
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
1098 SDL_AtariXbios_RestoreVectors();
1420
2405517b5eab Added preliminary support for MiNT /dev/mouse driver (disabled atm)
Patrice Mandin <patmandin@gmail.com>
parents: 1412
diff changeset
1099 if (GEM_usedevmouse) {
2405517b5eab Added preliminary support for MiNT /dev/mouse driver (disabled atm)
Patrice Mandin <patmandin@gmail.com>
parents: 1412
diff changeset
1100 SDL_AtariDevMouse_Close();
2405517b5eab Added preliminary support for MiNT /dev/mouse driver (disabled atm)
Patrice Mandin <patmandin@gmail.com>
parents: 1412
diff changeset
1101 }
305
9c6613983e85 Atari port cleanups from Patrice
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
1102
281
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1103 GEM_FreeBuffers(this);
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1104
1361
19418e4422cb New configure-based build system. Still work in progress, but much improved
Sam Lantinga <slouken@libsdl.org>
parents: 1358
diff changeset
1105 #if SDL_VIDEO_OPENGL
992
0324ce32b2d9 Keep current OpenGL context when possible
Patrice Mandin <patmandin@gmail.com>
parents: 991
diff changeset
1106 if (gl_active) {
0324ce32b2d9 Keep current OpenGL context when possible
Patrice Mandin <patmandin@gmail.com>
parents: 991
diff changeset
1107 SDL_AtariGL_Quit(this, SDL_TRUE);
0324ce32b2d9 Keep current OpenGL context when possible
Patrice Mandin <patmandin@gmail.com>
parents: 991
diff changeset
1108 }
0324ce32b2d9 Keep current OpenGL context when possible
Patrice Mandin <patmandin@gmail.com>
parents: 991
diff changeset
1109 #endif
0324ce32b2d9 Keep current OpenGL context when possible
Patrice Mandin <patmandin@gmail.com>
parents: 991
diff changeset
1110
925
15ff92ae7e1b Do not destroy window on resize, so we can go back to original size from maximized size
Patrice Mandin <patmandin@gmail.com>
parents: 924
diff changeset
1111 /* Destroy window */
15ff92ae7e1b Do not destroy window on resize, so we can go back to original size from maximized size
Patrice Mandin <patmandin@gmail.com>
parents: 924
diff changeset
1112 if (GEM_handle>=0) {
15ff92ae7e1b Do not destroy window on resize, so we can go back to original size from maximized size
Patrice Mandin <patmandin@gmail.com>
parents: 924
diff changeset
1113 wind_close(GEM_handle);
15ff92ae7e1b Do not destroy window on resize, so we can go back to original size from maximized size
Patrice Mandin <patmandin@gmail.com>
parents: 924
diff changeset
1114 wind_delete(GEM_handle);
15ff92ae7e1b Do not destroy window on resize, so we can go back to original size from maximized size
Patrice Mandin <patmandin@gmail.com>
parents: 924
diff changeset
1115 GEM_handle=-1;
15ff92ae7e1b Do not destroy window on resize, so we can go back to original size from maximized size
Patrice Mandin <patmandin@gmail.com>
parents: 924
diff changeset
1116 }
15ff92ae7e1b Do not destroy window on resize, so we can go back to original size from maximized size
Patrice Mandin <patmandin@gmail.com>
parents: 924
diff changeset
1117
319
189a6a3416c7 *** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents: 305
diff changeset
1118 GEM_UnlockScreen(this);
1069
8b1c83edcde2 Restore and save menu bar when entering and exiting fullscreen mode
Patrice Mandin <patmandin@gmail.com>
parents: 1066
diff changeset
1119 if (GEM_menubar) {
8b1c83edcde2 Restore and save menu bar when entering and exiting fullscreen mode
Patrice Mandin <patmandin@gmail.com>
parents: 1066
diff changeset
1120 Mfree(GEM_menubar);
8b1c83edcde2 Restore and save menu bar when entering and exiting fullscreen mode
Patrice Mandin <patmandin@gmail.com>
parents: 1066
diff changeset
1121 GEM_menubar=NULL;
8b1c83edcde2 Restore and save menu bar when entering and exiting fullscreen mode
Patrice Mandin <patmandin@gmail.com>
parents: 1066
diff changeset
1122 }
281
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1123
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1124 appl_exit();
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1125
1074
936da0056ed3 Save/restore system palette when application topped/untopped
Patrice Mandin <patmandin@gmail.com>
parents: 1072
diff changeset
1126 GEM_SetNewPalette(this, VDI_oldpalette);
281
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1127
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1128 /* Close VDI workstation */
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1129 if (VDI_handle) {
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1130 v_clsvwk(VDI_handle);
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1131 }
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1132
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1133 /* Free mode list */
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1134 if (SDL_modelist[0]) {
1336
3692456e7b0f Use SDL_ prefixed versions of C library functions.
Sam Lantinga <slouken@libsdl.org>
parents: 1312
diff changeset
1135 SDL_free(SDL_modelist[0]);
281
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1136 SDL_modelist[0]=NULL;
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1137 }
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1138
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1139 this->screen->pixels = NULL;
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1140 }
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1141
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1142 void GEM_wind_redraw(_THIS, int winhandle, short *inside)
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1143 {
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1144 short todo[4];
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1145
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1146 /* Tell AES we are going to update */
319
189a6a3416c7 *** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents: 305
diff changeset
1147 wind_update(BEG_UPDATE);
281
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1148
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1149 v_hide_c(VDI_handle);
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1150
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1151 /* Browse the rectangle list to redraw */
736
028e03e273c8 Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents: 593
diff changeset
1152 if (wind_get(winhandle, WF_FIRSTXYWH, &todo[0], &todo[1], &todo[2], &todo[3])!=0) {
281
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1153
736
028e03e273c8 Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents: 593
diff changeset
1154 while (todo[2] && todo[3]) {
281
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1155
736
028e03e273c8 Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents: 593
diff changeset
1156 if (rc_intersect((GRECT *)inside,(GRECT *)todo)) {
028e03e273c8 Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents: 593
diff changeset
1157 todo[2] += todo[0]-1;
028e03e273c8 Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents: 593
diff changeset
1158 todo[3] += todo[1]-1;
028e03e273c8 Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents: 593
diff changeset
1159 refresh_window(this, winhandle, todo);
028e03e273c8 Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents: 593
diff changeset
1160 }
028e03e273c8 Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents: 593
diff changeset
1161
028e03e273c8 Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents: 593
diff changeset
1162 if (wind_get(winhandle, WF_NEXTXYWH, &todo[0], &todo[1], &todo[2], &todo[3])==0) {
028e03e273c8 Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents: 593
diff changeset
1163 break;
028e03e273c8 Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents: 593
diff changeset
1164 }
281
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1165 }
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1166
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1167 }
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1168
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1169 /* Update finished */
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1170 wind_update(END_UPDATE);
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1171
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1172 v_show_c(VDI_handle,1);
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1173 }
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1174
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1175 static void refresh_window(_THIS, int winhandle, short *rect)
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1176 {
736
028e03e273c8 Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents: 593
diff changeset
1177 MFDB mfdb_src;
028e03e273c8 Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents: 593
diff changeset
1178 short pxy[8],wind_pxy[8];
028e03e273c8 Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents: 593
diff changeset
1179 SDL_Surface *surface;
281
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1180 int iconified;
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1181
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1182 /* Is window iconified ? */
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1183 iconified = 0;
736
028e03e273c8 Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents: 593
diff changeset
1184 /* if (GEM_wfeatures & (1<<WF_ICONIFY))*/ {
028e03e273c8 Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents: 593
diff changeset
1185 if (wind_get(winhandle, WF_ICONIFY, &wind_pxy[0], &wind_pxy[1], &wind_pxy[2], &wind_pxy[3])!=0) {
028e03e273c8 Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents: 593
diff changeset
1186 iconified = wind_pxy[0];
028e03e273c8 Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents: 593
diff changeset
1187 }
028e03e273c8 Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents: 593
diff changeset
1188 }
028e03e273c8 Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents: 593
diff changeset
1189
028e03e273c8 Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents: 593
diff changeset
1190 if (wind_get(winhandle, WF_WORKXYWH, &wind_pxy[0], &wind_pxy[1], &wind_pxy[2], &wind_pxy[3])==0) {
028e03e273c8 Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents: 593
diff changeset
1191 return;
281
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1192 }
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1193
736
028e03e273c8 Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents: 593
diff changeset
1194 if (iconified && GEM_icon) {
028e03e273c8 Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents: 593
diff changeset
1195 short icon_rect[4], dst_rect[4];
737
7e4347dd2f9c Small fix for iconification
Patrice Mandin <patmandin@gmail.com>
parents: 736
diff changeset
1196 short iconx,icony;
736
028e03e273c8 Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents: 593
diff changeset
1197
028e03e273c8 Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents: 593
diff changeset
1198 surface = GEM_icon;
028e03e273c8 Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents: 593
diff changeset
1199
028e03e273c8 Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents: 593
diff changeset
1200 GEM_ClearRect(this, rect);
028e03e273c8 Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents: 593
diff changeset
1201
028e03e273c8 Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents: 593
diff changeset
1202 /* Calculate centered icon(x,y,w,h) relative to window */
737
7e4347dd2f9c Small fix for iconification
Patrice Mandin <patmandin@gmail.com>
parents: 736
diff changeset
1203 iconx = (wind_pxy[2]-surface->w)>>1;
7e4347dd2f9c Small fix for iconification
Patrice Mandin <patmandin@gmail.com>
parents: 736
diff changeset
1204 icony = (wind_pxy[3]-surface->h)>>1;
7e4347dd2f9c Small fix for iconification
Patrice Mandin <patmandin@gmail.com>
parents: 736
diff changeset
1205
7e4347dd2f9c Small fix for iconification
Patrice Mandin <patmandin@gmail.com>
parents: 736
diff changeset
1206 icon_rect[0] = iconx;
7e4347dd2f9c Small fix for iconification
Patrice Mandin <patmandin@gmail.com>
parents: 736
diff changeset
1207 icon_rect[1] = icony;
736
028e03e273c8 Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents: 593
diff changeset
1208 icon_rect[2] = surface->w;
028e03e273c8 Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents: 593
diff changeset
1209 icon_rect[3] = surface->h;
028e03e273c8 Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents: 593
diff changeset
1210
028e03e273c8 Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents: 593
diff changeset
1211 /* Calculate redraw rectangle(x,y,w,h) relative to window */
028e03e273c8 Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents: 593
diff changeset
1212 dst_rect[0] = rect[0]-wind_pxy[0];
028e03e273c8 Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents: 593
diff changeset
1213 dst_rect[1] = rect[1]-wind_pxy[1];
028e03e273c8 Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents: 593
diff changeset
1214 dst_rect[2] = rect[2]-rect[0]+1;
028e03e273c8 Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents: 593
diff changeset
1215 dst_rect[3] = rect[3]-rect[1]+1;
028e03e273c8 Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents: 593
diff changeset
1216
028e03e273c8 Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents: 593
diff changeset
1217 /* Does the icon rectangle must be redrawn ? */
028e03e273c8 Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents: 593
diff changeset
1218 if (!rc_intersect((GRECT *)icon_rect, (GRECT *)dst_rect)) {
028e03e273c8 Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents: 593
diff changeset
1219 return;
028e03e273c8 Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents: 593
diff changeset
1220 }
028e03e273c8 Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents: 593
diff changeset
1221
799
85960507bd2e Bugfixes: some info about current framebuffer overwritten by some default values, and screen width must be multiple of 16 pixels to work correctly
Patrice Mandin <patmandin@gmail.com>
parents: 769
diff changeset
1222 #if DEBUG_VIDEO_GEM
736
028e03e273c8 Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents: 593
diff changeset
1223 printf("sdl:video:gem: clip(0,0,%d,%d) to (%d,%d,%d,%d)\n",
028e03e273c8 Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents: 593
diff changeset
1224 surface->w-1,surface->h-1, dst_rect[0],dst_rect[1],dst_rect[2],dst_rect[3]);
028e03e273c8 Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents: 593
diff changeset
1225 printf("sdl:video:gem: icon(%d,%d,%d,%d)\n",
028e03e273c8 Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents: 593
diff changeset
1226 icon_rect[0], icon_rect[1], icon_rect[2], icon_rect[3]);
028e03e273c8 Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents: 593
diff changeset
1227 printf("sdl:video:gem: refresh_window(): draw icon\n");
028e03e273c8 Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents: 593
diff changeset
1228 #endif
028e03e273c8 Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents: 593
diff changeset
1229
028e03e273c8 Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents: 593
diff changeset
1230 /* Calculate icon(x1,y1,x2,y2) relative to screen */
028e03e273c8 Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents: 593
diff changeset
1231 icon_rect[0] += wind_pxy[0];
028e03e273c8 Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents: 593
diff changeset
1232 icon_rect[1] += wind_pxy[1];
028e03e273c8 Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents: 593
diff changeset
1233 icon_rect[2] += icon_rect[0]-1;
028e03e273c8 Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents: 593
diff changeset
1234 icon_rect[3] += icon_rect[1]-1;
281
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1235
736
028e03e273c8 Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents: 593
diff changeset
1236 /* Calculate intersection rectangle to redraw */
737
7e4347dd2f9c Small fix for iconification
Patrice Mandin <patmandin@gmail.com>
parents: 736
diff changeset
1237 pxy[4]=pxy[0]=MAX(icon_rect[0],rect[0]);
7e4347dd2f9c Small fix for iconification
Patrice Mandin <patmandin@gmail.com>
parents: 736
diff changeset
1238 pxy[5]=pxy[1]=MAX(icon_rect[1],rect[1]);
7e4347dd2f9c Small fix for iconification
Patrice Mandin <patmandin@gmail.com>
parents: 736
diff changeset
1239 pxy[6]=pxy[2]=MIN(icon_rect[2],rect[2]);
7e4347dd2f9c Small fix for iconification
Patrice Mandin <patmandin@gmail.com>
parents: 736
diff changeset
1240 pxy[7]=pxy[3]=MIN(icon_rect[3],rect[3]);
736
028e03e273c8 Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents: 593
diff changeset
1241
737
7e4347dd2f9c Small fix for iconification
Patrice Mandin <patmandin@gmail.com>
parents: 736
diff changeset
1242 /* Calculate icon source image pos relative to window */
7e4347dd2f9c Small fix for iconification
Patrice Mandin <patmandin@gmail.com>
parents: 736
diff changeset
1243 pxy[0] -= wind_pxy[0]+iconx;
7e4347dd2f9c Small fix for iconification
Patrice Mandin <patmandin@gmail.com>
parents: 736
diff changeset
1244 pxy[1] -= wind_pxy[1]+icony;
7e4347dd2f9c Small fix for iconification
Patrice Mandin <patmandin@gmail.com>
parents: 736
diff changeset
1245 pxy[2] -= wind_pxy[0]+iconx;
7e4347dd2f9c Small fix for iconification
Patrice Mandin <patmandin@gmail.com>
parents: 736
diff changeset
1246 pxy[3] -= wind_pxy[1]+icony;
736
028e03e273c8 Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents: 593
diff changeset
1247
281
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1248 } else {
736
028e03e273c8 Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents: 593
diff changeset
1249 surface = this->screen;
028e03e273c8 Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents: 593
diff changeset
1250
799
85960507bd2e Bugfixes: some info about current framebuffer overwritten by some default values, and screen width must be multiple of 16 pixels to work correctly
Patrice Mandin <patmandin@gmail.com>
parents: 769
diff changeset
1251 #if DEBUG_VIDEO_GEM
736
028e03e273c8 Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents: 593
diff changeset
1252 printf("sdl:video:gem: refresh_window(): draw frame buffer\n");
028e03e273c8 Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents: 593
diff changeset
1253 #endif
028e03e273c8 Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents: 593
diff changeset
1254
028e03e273c8 Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents: 593
diff changeset
1255 /* Redraw all window content */
028e03e273c8 Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents: 593
diff changeset
1256 pxy[0] = rect[0]-wind_pxy[0];
028e03e273c8 Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents: 593
diff changeset
1257 pxy[1] = rect[1]-wind_pxy[1];
028e03e273c8 Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents: 593
diff changeset
1258 pxy[2] = rect[2]-wind_pxy[0];
028e03e273c8 Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents: 593
diff changeset
1259 pxy[3] = rect[3]-wind_pxy[1];
028e03e273c8 Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents: 593
diff changeset
1260
028e03e273c8 Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents: 593
diff changeset
1261 pxy[4] = rect[0];
028e03e273c8 Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents: 593
diff changeset
1262 pxy[5] = rect[1];
028e03e273c8 Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents: 593
diff changeset
1263 pxy[6] = rect[2];
028e03e273c8 Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents: 593
diff changeset
1264 pxy[7] = rect[3];
281
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1265 }
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1266
736
028e03e273c8 Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents: 593
diff changeset
1267 if (GEM_bufops & B2S_C2P_1TO2) {
028e03e273c8 Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents: 593
diff changeset
1268 void *src, *dest;
028e03e273c8 Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents: 593
diff changeset
1269 int x1,x2;
028e03e273c8 Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents: 593
diff changeset
1270
028e03e273c8 Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents: 593
diff changeset
1271 x1 = (rect[0]-wind_pxy[0]) & ~15;
028e03e273c8 Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents: 593
diff changeset
1272 x2 = rect[2]-wind_pxy[0];
028e03e273c8 Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents: 593
diff changeset
1273 if (x2 & 15) {
028e03e273c8 Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents: 593
diff changeset
1274 x2 = (x2 | 15) +1;
028e03e273c8 Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents: 593
diff changeset
1275 }
028e03e273c8 Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents: 593
diff changeset
1276
028e03e273c8 Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents: 593
diff changeset
1277 src = surface->pixels;
028e03e273c8 Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents: 593
diff changeset
1278 src += surface->pitch * (rect[1]-wind_pxy[1]);
028e03e273c8 Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents: 593
diff changeset
1279 src += x1;
028e03e273c8 Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents: 593
diff changeset
1280
028e03e273c8 Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents: 593
diff changeset
1281 dest = GEM_buffer2;
028e03e273c8 Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents: 593
diff changeset
1282 dest += surface->pitch * (rect[1]-wind_pxy[1]);
028e03e273c8 Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents: 593
diff changeset
1283 dest += x1;
281
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1284
736
028e03e273c8 Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents: 593
diff changeset
1285 SDL_Atari_C2pConvert(
028e03e273c8 Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents: 593
diff changeset
1286 src, dest,
028e03e273c8 Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents: 593
diff changeset
1287 x2-x1, rect[3]-rect[1]+1,
028e03e273c8 Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents: 593
diff changeset
1288 SDL_FALSE,
028e03e273c8 Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents: 593
diff changeset
1289 surface->pitch, surface->pitch
028e03e273c8 Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents: 593
diff changeset
1290 );
028e03e273c8 Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents: 593
diff changeset
1291 }
028e03e273c8 Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents: 593
diff changeset
1292
028e03e273c8 Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents: 593
diff changeset
1293 mfdb_src.fd_addr=surface->pixels;
799
85960507bd2e Bugfixes: some info about current framebuffer overwritten by some default values, and screen width must be multiple of 16 pixels to work correctly
Patrice Mandin <patmandin@gmail.com>
parents: 769
diff changeset
1294 {
85960507bd2e Bugfixes: some info about current framebuffer overwritten by some default values, and screen width must be multiple of 16 pixels to work correctly
Patrice Mandin <patmandin@gmail.com>
parents: 769
diff changeset
1295 int width;
85960507bd2e Bugfixes: some info about current framebuffer overwritten by some default values, and screen width must be multiple of 16 pixels to work correctly
Patrice Mandin <patmandin@gmail.com>
parents: 769
diff changeset
1296
85960507bd2e Bugfixes: some info about current framebuffer overwritten by some default values, and screen width must be multiple of 16 pixels to work correctly
Patrice Mandin <patmandin@gmail.com>
parents: 769
diff changeset
1297 /* Need to be a multiple of 16 pixels */
85960507bd2e Bugfixes: some info about current framebuffer overwritten by some default values, and screen width must be multiple of 16 pixels to work correctly
Patrice Mandin <patmandin@gmail.com>
parents: 769
diff changeset
1298 width=surface->w;
918
17822f1f9674 Wrongly test if width multiple of 16
Patrice Mandin <patmandin@gmail.com>
parents: 917
diff changeset
1299 if ((width & 15) != 0) {
799
85960507bd2e Bugfixes: some info about current framebuffer overwritten by some default values, and screen width must be multiple of 16 pixels to work correctly
Patrice Mandin <patmandin@gmail.com>
parents: 769
diff changeset
1300 width = (width | 15) + 1;
85960507bd2e Bugfixes: some info about current framebuffer overwritten by some default values, and screen width must be multiple of 16 pixels to work correctly
Patrice Mandin <patmandin@gmail.com>
parents: 769
diff changeset
1301 }
85960507bd2e Bugfixes: some info about current framebuffer overwritten by some default values, and screen width must be multiple of 16 pixels to work correctly
Patrice Mandin <patmandin@gmail.com>
parents: 769
diff changeset
1302 mfdb_src.fd_w=width;
85960507bd2e Bugfixes: some info about current framebuffer overwritten by some default values, and screen width must be multiple of 16 pixels to work correctly
Patrice Mandin <patmandin@gmail.com>
parents: 769
diff changeset
1303 }
736
028e03e273c8 Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents: 593
diff changeset
1304 mfdb_src.fd_h=surface->h;
028e03e273c8 Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents: 593
diff changeset
1305 mfdb_src.fd_nplanes=surface->format->BitsPerPixel;
028e03e273c8 Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents: 593
diff changeset
1306 mfdb_src.fd_wdwidth=mfdb_src.fd_w>>4;
028e03e273c8 Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents: 593
diff changeset
1307 mfdb_src.fd_stand=
028e03e273c8 Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents: 593
diff changeset
1308 mfdb_src.fd_r1=
028e03e273c8 Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents: 593
diff changeset
1309 mfdb_src.fd_r2=
028e03e273c8 Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents: 593
diff changeset
1310 mfdb_src.fd_r3= 0;
028e03e273c8 Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents: 593
diff changeset
1311
028e03e273c8 Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents: 593
diff changeset
1312 if (GEM_bufops & B2S_VROCPYFM_2TOS) {
028e03e273c8 Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents: 593
diff changeset
1313 mfdb_src.fd_addr=GEM_buffer2;
028e03e273c8 Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents: 593
diff changeset
1314 }
028e03e273c8 Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents: 593
diff changeset
1315
799
85960507bd2e Bugfixes: some info about current framebuffer overwritten by some default values, and screen width must be multiple of 16 pixels to work correctly
Patrice Mandin <patmandin@gmail.com>
parents: 769
diff changeset
1316 #if DEBUG_VIDEO_GEM
85960507bd2e Bugfixes: some info about current framebuffer overwritten by some default values, and screen width must be multiple of 16 pixels to work correctly
Patrice Mandin <patmandin@gmail.com>
parents: 769
diff changeset
1317 printf("sdl:video:gem: redraw %dx%d: (%d,%d,%d,%d) to (%d,%d,%d,%d)\n",
85960507bd2e Bugfixes: some info about current framebuffer overwritten by some default values, and screen width must be multiple of 16 pixels to work correctly
Patrice Mandin <patmandin@gmail.com>
parents: 769
diff changeset
1318 surface->w, surface->h,
736
028e03e273c8 Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents: 593
diff changeset
1319 pxy[0],pxy[1],pxy[2],pxy[3],
028e03e273c8 Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents: 593
diff changeset
1320 pxy[4],pxy[5],pxy[6],pxy[7]
028e03e273c8 Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents: 593
diff changeset
1321 );
028e03e273c8 Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents: 593
diff changeset
1322 #endif
281
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1323
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1324 vro_cpyfm( VDI_handle, S_ONLY, pxy, &mfdb_src, &VDI_dst_mfdb);
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1325 }
984
44fd54a0ae5f Add OSMesa OpenGL support to the Atari GEM video driver
Patrice Mandin <patmandin@gmail.com>
parents: 964
diff changeset
1326
1361
19418e4422cb New configure-based build system. Still work in progress, but much improved
Sam Lantinga <slouken@libsdl.org>
parents: 1358
diff changeset
1327 #if SDL_VIDEO_OPENGL
984
44fd54a0ae5f Add OSMesa OpenGL support to the Atari GEM video driver
Patrice Mandin <patmandin@gmail.com>
parents: 964
diff changeset
1328
989
475166d13b44 Factorize OSMesa OpenGL code for Atari drivers
Patrice Mandin <patmandin@gmail.com>
parents: 988
diff changeset
1329 static void GEM_GL_SwapBuffers(_THIS)
984
44fd54a0ae5f Add OSMesa OpenGL support to the Atari GEM video driver
Patrice Mandin <patmandin@gmail.com>
parents: 964
diff changeset
1330 {
993
2662da16d668 Forgot to flush OpenGL buffer using glFinish
Patrice Mandin <patmandin@gmail.com>
parents: 992
diff changeset
1331 SDL_AtariGL_SwapBuffers(this);
2662da16d668 Forgot to flush OpenGL buffer using glFinish
Patrice Mandin <patmandin@gmail.com>
parents: 992
diff changeset
1332 GEM_FlipHWSurface(this, this->screen);
984
44fd54a0ae5f Add OSMesa OpenGL support to the Atari GEM video driver
Patrice Mandin <patmandin@gmail.com>
parents: 964
diff changeset
1333 }
44fd54a0ae5f Add OSMesa OpenGL support to the Atari GEM video driver
Patrice Mandin <patmandin@gmail.com>
parents: 964
diff changeset
1334
44fd54a0ae5f Add OSMesa OpenGL support to the Atari GEM video driver
Patrice Mandin <patmandin@gmail.com>
parents: 964
diff changeset
1335 #endif