Mercurial > sdl-ios-xcode
annotate src/video/gem/SDL_gemvideo.c @ 988:24b5c3ad4852
Remove ambiguous/useless code
author | Patrice Mandin <patmandin@gmail.com> |
---|---|
date | Mon, 22 Nov 2004 20:37:41 +0000 |
parents | 952ec1ddcb58 |
children | 475166d13b44 |
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 |
769
b8d311d90021
Updated copyright information for 2004 (Happy New Year!)
Sam Lantinga <slouken@libsdl.org>
parents:
737
diff
changeset
|
3 Copyright (C) 1997-2004 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 |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6 modify it under the terms of the GNU Library General Public |
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 |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
8 version 2 of the License, or (at your option) any later version. |
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 |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
13 Library General Public License for more details. |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
14 |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
15 You should have received a copy of the GNU Library General Public |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
16 License along with this library; if not, write to the Free |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
17 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
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 */ |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
22 |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
23 #ifdef SAVE_RCSID |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
24 static char rcsid = |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
25 "@(#) $Id$"; |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
26 #endif |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
27 |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
28 /* |
736
028e03e273c8
Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents:
593
diff
changeset
|
29 GEM video driver |
028e03e273c8
Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents:
593
diff
changeset
|
30 |
028e03e273c8
Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents:
593
diff
changeset
|
31 Patrice Mandin |
028e03e273c8
Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents:
593
diff
changeset
|
32 and work from |
028e03e273c8
Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents:
593
diff
changeset
|
33 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
|
34 */ |
281
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
35 |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
36 #include <stdio.h> |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
37 #include <stdlib.h> |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
38 #include <string.h> |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
39 |
984
44fd54a0ae5f
Add OSMesa OpenGL support to the Atari GEM video driver
Patrice Mandin <patmandin@gmail.com>
parents:
964
diff
changeset
|
40 #ifdef HAVE_OPENGL |
44fd54a0ae5f
Add OSMesa OpenGL support to the Atari GEM video driver
Patrice Mandin <patmandin@gmail.com>
parents:
964
diff
changeset
|
41 #include <GL/osmesa.h> |
44fd54a0ae5f
Add OSMesa OpenGL support to the Atari GEM video driver
Patrice Mandin <patmandin@gmail.com>
parents:
964
diff
changeset
|
42 #endif |
44fd54a0ae5f
Add OSMesa OpenGL support to the Atari GEM video driver
Patrice Mandin <patmandin@gmail.com>
parents:
964
diff
changeset
|
43 |
281
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
44 /* Mint includes */ |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
45 #include <gem.h> |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
46 #include <gemx.h> |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
47 #include <mint/osbind.h> |
557
0ce5a68278fd
Updated Atari port for new system headers (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
508
diff
changeset
|
48 #include <mint/cookie.h> |
281
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
49 |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
50 #include "SDL.h" |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
51 #include "SDL_error.h" |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
52 #include "SDL_video.h" |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
53 #include "SDL_mouse.h" |
986
952ec1ddcb58
Add conversion routines for unsupported screen formats
Patrice Mandin <patmandin@gmail.com>
parents:
984
diff
changeset
|
54 #include "SDL_endian.h" |
281
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
55 #include "SDL_sysvideo.h" |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
56 #include "SDL_pixels_c.h" |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
57 #include "SDL_events_c.h" |
319
189a6a3416c7
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
305
diff
changeset
|
58 #include "SDL_cursor_c.h" |
281
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
59 |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
60 #include "SDL_ataric2p_s.h" |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
61 #include "SDL_atarieddi_s.h" |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
62 #include "SDL_atarimxalloc_c.h" |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
63 #include "SDL_gemvideo.h" |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
64 #include "SDL_gemevents_c.h" |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
65 #include "SDL_gemmouse_c.h" |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
66 #include "SDL_gemwm_c.h" |
305
9c6613983e85
Atari port cleanups from Patrice
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
67 #include "SDL_xbiosevents_c.h" |
281
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
68 |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
69 /* Defines */ |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
70 |
984
44fd54a0ae5f
Add OSMesa OpenGL support to the Atari GEM video driver
Patrice Mandin <patmandin@gmail.com>
parents:
964
diff
changeset
|
71 /*#define DEBUG_VIDEO_GEM 1*/ |
736
028e03e273c8
Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents:
593
diff
changeset
|
72 |
281
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
73 #define GEM_VID_DRIVER_NAME "gem" |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
74 |
737
7e4347dd2f9c
Small fix for iconification
Patrice Mandin <patmandin@gmail.com>
parents:
736
diff
changeset
|
75 #undef MIN |
7e4347dd2f9c
Small fix for iconification
Patrice Mandin <patmandin@gmail.com>
parents:
736
diff
changeset
|
76 #define MIN(a,b) (((a)<(b)) ? (a) : (b)) |
7e4347dd2f9c
Small fix for iconification
Patrice Mandin <patmandin@gmail.com>
parents:
736
diff
changeset
|
77 #undef MAX |
7e4347dd2f9c
Small fix for iconification
Patrice Mandin <patmandin@gmail.com>
parents:
736
diff
changeset
|
78 #define MAX(a,b) (((a)>(b)) ? (a) : (b)) |
7e4347dd2f9c
Small fix for iconification
Patrice Mandin <patmandin@gmail.com>
parents:
736
diff
changeset
|
79 |
281
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
80 /* Variables */ |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
81 |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
82 static unsigned char vdi_index[256] = { |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
83 0, 2, 3, 6, 4, 7, 5, 8, |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
84 9, 10, 11, 14, 12, 15, 13, 255 |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
85 }; |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
86 |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
87 static const unsigned char empty_name[]=""; |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
88 |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
89 /* Initialization/Query functions */ |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
90 static int GEM_VideoInit(_THIS, SDL_PixelFormat *vformat); |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
91 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
|
92 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
|
93 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
|
94 static void GEM_VideoQuit(_THIS); |
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 /* Hardware surface functions */ |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
97 static int GEM_AllocHWSurface(_THIS, SDL_Surface *surface); |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
98 static int GEM_LockHWSurface(_THIS, SDL_Surface *surface); |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
99 static int GEM_FlipHWSurface(_THIS, SDL_Surface *surface); |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
100 static void GEM_UnlockHWSurface(_THIS, SDL_Surface *surface); |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
101 static void GEM_FreeHWSurface(_THIS, SDL_Surface *surface); |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
102 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
|
103 #if 0 |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
104 static int GEM_ToggleFullScreen(_THIS, int on); |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
105 #endif |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
106 |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
107 /* Internal functions */ |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
108 static void GEM_FreeBuffers(_THIS); |
319
189a6a3416c7
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
305
diff
changeset
|
109 static void GEM_ClearScreen(_THIS); |
736
028e03e273c8
Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents:
593
diff
changeset
|
110 static void GEM_ClearRect(_THIS, short *rect); |
319
189a6a3416c7
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
305
diff
changeset
|
111 static void GEM_LockScreen(_THIS); |
189a6a3416c7
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
305
diff
changeset
|
112 static void GEM_UnlockScreen(_THIS); |
281
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
113 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
|
114 |
984
44fd54a0ae5f
Add OSMesa OpenGL support to the Atari GEM video driver
Patrice Mandin <patmandin@gmail.com>
parents:
964
diff
changeset
|
115 #ifdef HAVE_OPENGL |
44fd54a0ae5f
Add OSMesa OpenGL support to the Atari GEM video driver
Patrice Mandin <patmandin@gmail.com>
parents:
964
diff
changeset
|
116 /* OpenGL functions */ |
44fd54a0ae5f
Add OSMesa OpenGL support to the Atari GEM video driver
Patrice Mandin <patmandin@gmail.com>
parents:
964
diff
changeset
|
117 static int GEM_GL_LoadLibrary(_THIS, const char *path); |
44fd54a0ae5f
Add OSMesa OpenGL support to the Atari GEM video driver
Patrice Mandin <patmandin@gmail.com>
parents:
964
diff
changeset
|
118 static void *GEM_GL_GetProcAddress(_THIS, const char *proc); |
44fd54a0ae5f
Add OSMesa OpenGL support to the Atari GEM video driver
Patrice Mandin <patmandin@gmail.com>
parents:
964
diff
changeset
|
119 static int GEM_GL_GetAttribute(_THIS, SDL_GLattr attrib, int* value); |
44fd54a0ae5f
Add OSMesa OpenGL support to the Atari GEM video driver
Patrice Mandin <patmandin@gmail.com>
parents:
964
diff
changeset
|
120 static int GEM_GL_MakeCurrent(_THIS); |
44fd54a0ae5f
Add OSMesa OpenGL support to the Atari GEM video driver
Patrice Mandin <patmandin@gmail.com>
parents:
964
diff
changeset
|
121 static void GEM_GL_SwapBuffers(_THIS); |
986
952ec1ddcb58
Add conversion routines for unsupported screen formats
Patrice Mandin <patmandin@gmail.com>
parents:
984
diff
changeset
|
122 |
952ec1ddcb58
Add conversion routines for unsupported screen formats
Patrice Mandin <patmandin@gmail.com>
parents:
984
diff
changeset
|
123 static void GEM_GL_ConvertNull(SDL_Surface *surface); |
952ec1ddcb58
Add conversion routines for unsupported screen formats
Patrice Mandin <patmandin@gmail.com>
parents:
984
diff
changeset
|
124 static void GEM_GL_Convert565To555be(SDL_Surface *surface); |
952ec1ddcb58
Add conversion routines for unsupported screen formats
Patrice Mandin <patmandin@gmail.com>
parents:
984
diff
changeset
|
125 static void GEM_GL_Convert565To555le(SDL_Surface *surface); |
952ec1ddcb58
Add conversion routines for unsupported screen formats
Patrice Mandin <patmandin@gmail.com>
parents:
984
diff
changeset
|
126 static void GEM_GL_Convert565le(SDL_Surface *surface); |
952ec1ddcb58
Add conversion routines for unsupported screen formats
Patrice Mandin <patmandin@gmail.com>
parents:
984
diff
changeset
|
127 static void GEM_GL_ConvertBGRAToABGR(SDL_Surface *surface); |
952ec1ddcb58
Add conversion routines for unsupported screen formats
Patrice Mandin <patmandin@gmail.com>
parents:
984
diff
changeset
|
128 |
952ec1ddcb58
Add conversion routines for unsupported screen formats
Patrice Mandin <patmandin@gmail.com>
parents:
984
diff
changeset
|
129 static void (*GEM_GL_Convert)(SDL_Surface *surface); |
984
44fd54a0ae5f
Add OSMesa OpenGL support to the Atari GEM video driver
Patrice Mandin <patmandin@gmail.com>
parents:
964
diff
changeset
|
130 #endif |
44fd54a0ae5f
Add OSMesa OpenGL support to the Atari GEM video driver
Patrice Mandin <patmandin@gmail.com>
parents:
964
diff
changeset
|
131 |
281
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
132 /* GEM driver bootstrap functions */ |
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 static int GEM_Available(void) |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
135 { |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
136 /* Test if AES available */ |
557
0ce5a68278fd
Updated Atari port for new system headers (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
508
diff
changeset
|
137 if (appl_init() == -1) |
281
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
138 return 0; |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
139 |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
140 appl_exit(); |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
141 return 1; |
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 |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
144 static void GEM_DeleteDevice(SDL_VideoDevice *device) |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
145 { |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
146 free(device->hidden); |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
147 free(device); |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
148 } |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
149 |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
150 static SDL_VideoDevice *GEM_CreateDevice(int devindex) |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
151 { |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
152 SDL_VideoDevice *device; |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
153 |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
154 /* Initialize all variables that we clean on shutdown */ |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
155 device = (SDL_VideoDevice *)malloc(sizeof(SDL_VideoDevice)); |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
156 if ( device ) { |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
157 memset(device, 0, (sizeof *device)); |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
158 device->hidden = (struct SDL_PrivateVideoData *) |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
159 malloc((sizeof *device->hidden)); |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
160 } |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
161 if ( (device == NULL) || (device->hidden == NULL) ) { |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
162 SDL_OutOfMemory(); |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
163 if ( device ) { |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
164 free(device); |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
165 } |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
166 return(0); |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
167 } |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
168 memset(device->hidden, 0, (sizeof *device->hidden)); |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
169 |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
170 /* Set the function pointers */ |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
171 device->VideoInit = GEM_VideoInit; |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
172 device->ListModes = GEM_ListModes; |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
173 device->SetVideoMode = GEM_SetVideoMode; |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
174 device->SetColors = GEM_SetColors; |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
175 device->UpdateRects = NULL /*GEM_UpdateRects*/; |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
176 device->VideoQuit = GEM_VideoQuit; |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
177 device->AllocHWSurface = GEM_AllocHWSurface; |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
178 device->LockHWSurface = GEM_LockHWSurface; |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
179 device->UnlockHWSurface = GEM_UnlockHWSurface; |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
180 device->FlipHWSurface = GEM_FlipHWSurface; |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
181 device->FreeHWSurface = GEM_FreeHWSurface; |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
182 device->ToggleFullScreen = NULL /*GEM_ToggleFullScreen*/; |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
183 |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
184 /* Window manager */ |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
185 device->SetCaption = GEM_SetCaption; |
736
028e03e273c8
Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents:
593
diff
changeset
|
186 device->SetIcon = GEM_SetIcon; |
281
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
187 device->IconifyWindow = GEM_IconifyWindow; |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
188 device->GrabInput = GEM_GrabInput; |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
189 |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
190 /* Events */ |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
191 device->InitOSKeymap = GEM_InitOSKeymap; |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
192 device->PumpEvents = GEM_PumpEvents; |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
193 |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
194 /* Mouse */ |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
195 device->FreeWMCursor = GEM_FreeWMCursor; |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
196 device->CreateWMCursor = GEM_CreateWMCursor; |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
197 device->ShowWMCursor = GEM_ShowWMCursor; |
319
189a6a3416c7
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
305
diff
changeset
|
198 device->WarpWMCursor = NULL /*GEM_WarpWMCursor*/; |
281
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
199 device->CheckMouseMode = GEM_CheckMouseMode; |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
200 |
984
44fd54a0ae5f
Add OSMesa OpenGL support to the Atari GEM video driver
Patrice Mandin <patmandin@gmail.com>
parents:
964
diff
changeset
|
201 #ifdef HAVE_OPENGL |
44fd54a0ae5f
Add OSMesa OpenGL support to the Atari GEM video driver
Patrice Mandin <patmandin@gmail.com>
parents:
964
diff
changeset
|
202 /* OpenGL functions */ |
44fd54a0ae5f
Add OSMesa OpenGL support to the Atari GEM video driver
Patrice Mandin <patmandin@gmail.com>
parents:
964
diff
changeset
|
203 device->GL_LoadLibrary = GEM_GL_LoadLibrary; |
44fd54a0ae5f
Add OSMesa OpenGL support to the Atari GEM video driver
Patrice Mandin <patmandin@gmail.com>
parents:
964
diff
changeset
|
204 device->GL_GetProcAddress = GEM_GL_GetProcAddress; |
44fd54a0ae5f
Add OSMesa OpenGL support to the Atari GEM video driver
Patrice Mandin <patmandin@gmail.com>
parents:
964
diff
changeset
|
205 device->GL_GetAttribute = GEM_GL_GetAttribute; |
44fd54a0ae5f
Add OSMesa OpenGL support to the Atari GEM video driver
Patrice Mandin <patmandin@gmail.com>
parents:
964
diff
changeset
|
206 device->GL_MakeCurrent = GEM_GL_MakeCurrent; |
44fd54a0ae5f
Add OSMesa OpenGL support to the Atari GEM video driver
Patrice Mandin <patmandin@gmail.com>
parents:
964
diff
changeset
|
207 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
|
208 #endif |
44fd54a0ae5f
Add OSMesa OpenGL support to the Atari GEM video driver
Patrice Mandin <patmandin@gmail.com>
parents:
964
diff
changeset
|
209 |
319
189a6a3416c7
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
305
diff
changeset
|
210 /* Joystick + Mouse relative motion */ |
189a6a3416c7
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
305
diff
changeset
|
211 SDL_AtariXbios_InstallVectors(ATARI_XBIOS_MOUSEEVENTS|ATARI_XBIOS_JOYSTICKEVENTS); |
305
9c6613983e85
Atari port cleanups from Patrice
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
212 |
281
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
213 device->free = GEM_DeleteDevice; |
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 return device; |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
216 } |
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 VideoBootStrap GEM_bootstrap = { |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
219 GEM_VID_DRIVER_NAME, "Atari GEM video driver", |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
220 GEM_Available, GEM_CreateDevice |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
221 }; |
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 static void VDI_ReadExtInfo(_THIS, short *work_out) |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
224 { |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
225 unsigned long EdDI_version; |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
226 unsigned long cookie_EdDI; |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
227 Uint32 num_colours; |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
228 Uint16 clut_type, num_bits; |
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 /* Read EdDI informations */ |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
231 if (Getcookie(C_EdDI, &cookie_EdDI) == C_NOTFOUND) { |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
232 return; |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
233 } |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
234 |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
235 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
|
236 |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
237 vq_scrninfo(VDI_handle, work_out); |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
238 |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
239 VDI_format = work_out[0]; |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
240 clut_type = work_out[1]; |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
241 num_bits = work_out[2]; |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
242 num_colours = *((Uint32 *) &work_out[3]); |
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 /* 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
|
245 * 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
|
246 */ |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
247 if (EdDI_version >= EDDI_11) { |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
248 VDI_pitch = work_out[5]; |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
249 VDI_screen = (void *) *((unsigned long *) &work_out[6]); |
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 |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
252 switch(clut_type) { |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
253 case VDI_CLUT_HARDWARE: |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
254 { |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
255 int i; |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
256 Uint16 *tmp_p; |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
257 |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
258 tmp_p = (Uint16 *)&work_out[16]; |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
259 |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
260 for (i=0;i<256;i++) { |
319
189a6a3416c7
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
305
diff
changeset
|
261 vdi_index[*tmp_p++] = i; |
281
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
262 } |
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 break; |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
265 case VDI_CLUT_SOFTWARE: |
800
60a4293ffea9
When commiting code, cleanup before doing it
Patrice Mandin <patmandin@gmail.com>
parents:
799
diff
changeset
|
266 { |
281
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
267 int component; /* red, green, blue, alpha, overlay */ |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
268 int num_bit; |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
269 unsigned short *tmp_p; |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
270 |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
271 /* We can build masks with info here */ |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
272 tmp_p = (unsigned short *) &work_out[16]; |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
273 for (component=0;component<5;component++) { |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
274 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
|
275 unsigned short valeur; |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
276 |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
277 valeur = *tmp_p++; |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
278 |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
279 if (valeur == 0xffff) { |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
280 continue; |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
281 } |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
282 |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
283 switch(component) { |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
284 case 0: |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
285 VDI_redmask |= 1<< valeur; |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
286 break; |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
287 case 1: |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
288 VDI_greenmask |= 1<< valeur; |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
289 break; |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
290 case 2: |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
291 VDI_bluemask |= 1<< valeur; |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
292 break; |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
293 case 3: |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
294 VDI_alphamask |= 1<< valeur; |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
295 break; |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
296 } |
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 } |
319
189a6a3416c7
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
305
diff
changeset
|
299 } |
281
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
300 |
319
189a6a3416c7
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
305
diff
changeset
|
301 /* Remove lower green bits for Intel endian screen */ |
189a6a3416c7
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
305
diff
changeset
|
302 if ((VDI_greenmask == ((7<<13)|3)) || (VDI_greenmask == ((7<<13)|7))) { |
189a6a3416c7
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
305
diff
changeset
|
303 VDI_greenmask &= ~(7<<13); |
281
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
304 } |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
305 break; |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
306 case VDI_CLUT_NONE: |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
307 break; |
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 } |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
310 |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
311 int GEM_VideoInit(_THIS, SDL_PixelFormat *vformat) |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
312 { |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
313 int i; |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
314 short work_in[12], work_out[272], dummy; |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
315 |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
316 /* 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
|
317 if (appl_init() == -1) { |
281
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
318 fprintf(stderr,"Can not open AES\n"); |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
319 return 1; |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
320 } |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
321 |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
322 /* Read version and features */ |
736
028e03e273c8
Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents:
593
diff
changeset
|
323 GEM_version = aes_global[0]; |
028e03e273c8
Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents:
593
diff
changeset
|
324 if (GEM_version >= 0x0410) { |
028e03e273c8
Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents:
593
diff
changeset
|
325 short ap_gout[4], errorcode; |
281
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
326 |
736
028e03e273c8
Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents:
593
diff
changeset
|
327 #ifdef DEBUG_VIDEO_GEM |
028e03e273c8
Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents:
593
diff
changeset
|
328 printf("sdl:video:gem: AES %02x.%02x\n", (GEM_version>>8) & 0xff, GEM_version & 0xff); |
028e03e273c8
Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents:
593
diff
changeset
|
329 #endif |
028e03e273c8
Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents:
593
diff
changeset
|
330 |
281
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
331 GEM_wfeatures=0; |
736
028e03e273c8
Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents:
593
diff
changeset
|
332 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
|
333 #ifdef DEBUG_VIDEO_GEM |
028e03e273c8
Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents:
593
diff
changeset
|
334 printf("sdl:video:gem: appl_getinfo() returned 0x%04x\n", errorcode); |
028e03e273c8
Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents:
593
diff
changeset
|
335 #endif |
028e03e273c8
Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents:
593
diff
changeset
|
336 |
028e03e273c8
Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents:
593
diff
changeset
|
337 if (errorcode==0) { |
281
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
338 GEM_wfeatures=ap_gout[0]; |
736
028e03e273c8
Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents:
593
diff
changeset
|
339 |
028e03e273c8
Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents:
593
diff
changeset
|
340 #ifdef DEBUG_VIDEO_GEM |
028e03e273c8
Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents:
593
diff
changeset
|
341 printf("sdl:video:gem: AES wind_*() modes: 0x%04x\n", GEM_wfeatures); |
028e03e273c8
Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents:
593
diff
changeset
|
342 printf("sdl:video:gem: AES window behaviours: 0x%04x\n", ap_gout[3]); |
028e03e273c8
Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents:
593
diff
changeset
|
343 } else { |
028e03e273c8
Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents:
593
diff
changeset
|
344 printf("sdl:video:gem: apgout[]={0x%04x,0x%04x,0x%04x,0x%04x}\n", |
028e03e273c8
Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents:
593
diff
changeset
|
345 ap_gout[0], ap_gout[1], ap_gout[1], ap_gout[3] |
028e03e273c8
Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents:
593
diff
changeset
|
346 ); |
028e03e273c8
Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents:
593
diff
changeset
|
347 #endif |
281
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
348 } |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
349 } |
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 /* Ask VDI physical workstation handle opened by AES */ |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
352 VDI_handle = graf_handle(&dummy, &dummy, &dummy, &dummy); |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
353 if (VDI_handle<1) { |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
354 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
|
355 return 1; |
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 |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
358 /* Open virtual VDI workstation */ |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
359 work_in[0]=Getrez()+2; |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
360 for(i = 1; i < 10; i++) |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
361 work_in[i] = 1; |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
362 work_in[10] = 2; |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
363 |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
364 v_opnvwk(work_in, &VDI_handle, work_out); |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
365 if (VDI_handle == 0) { |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
366 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
|
367 return 1; |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
368 } |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
369 |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
370 /* Read fullscreen size */ |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
371 VDI_w = work_out[0] + 1; |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
372 VDI_h = work_out[1] + 1; |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
373 |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
374 /* Read desktop size and position */ |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
375 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
|
376 fprintf(stderr,"Can not read desktop properties\n"); |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
377 return 1; |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
378 } |
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 /* Read bit depth */ |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
381 vq_extnd(VDI_handle, 1, work_out); |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
382 VDI_bpp = work_out[4]; |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
383 VDI_oldnumcolors=0; |
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 switch(VDI_bpp) { |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
386 case 8: |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
387 VDI_pixelsize=1; |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
388 break; |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
389 case 15: |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
390 case 16: |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
391 VDI_pixelsize=2; |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
392 break; |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
393 case 24: |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
394 VDI_pixelsize=3; |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
395 break; |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
396 case 32: |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
397 VDI_pixelsize=4; |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
398 break; |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
399 default: |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
400 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
|
401 return 1; |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
402 } |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
403 |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
404 /* Setup hardware -> VDI palette mapping */ |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
405 for(i = 16; i < 255; i++) { |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
406 vdi_index[i] = i; |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
407 } |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
408 vdi_index[255] = 1; |
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 /* Save current palette */ |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
411 if (VDI_bpp>8) { |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
412 VDI_oldnumcolors=1<<8; |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
413 } else { |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
414 VDI_oldnumcolors=1<<VDI_bpp; |
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 |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
417 for(i = 0; i < VDI_oldnumcolors; i++) { |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
418 short rgb[3]; |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
419 |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
420 vq_color(VDI_handle, i, 0, rgb); |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
421 |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
422 VDI_oldpalette[i][0] = rgb[0]; |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
423 VDI_oldpalette[i][1] = rgb[1]; |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
424 VDI_oldpalette[i][2] = rgb[2]; |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
425 } |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
426 |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
427 /* Setup screen info */ |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
428 GEM_title_name = empty_name; |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
429 GEM_icon_name = empty_name; |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
430 |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
431 GEM_handle = -1; |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
432 GEM_locked = SDL_FALSE; |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
433 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
|
434 GEM_fullscreen = SDL_FALSE; |
964
d9209754ebee
Prevent redraws till internal buffers are correctly setup
Patrice Mandin <patmandin@gmail.com>
parents:
959
diff
changeset
|
435 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
|
436 |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
437 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
|
438 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
|
439 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
|
440 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
|
441 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
|
442 |
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
|
443 #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
|
444 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
|
445 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
|
446 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
|
447 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
|
448 ); |
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
|
449 #endif |
281
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
450 |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
451 /* Setup destination mfdb */ |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
452 VDI_dst_mfdb.fd_addr = NULL; |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
453 |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
454 /* Update hardware info */ |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
455 this->info.hw_available = 0; |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
456 this->info.video_mem = 0; |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
457 |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
458 /* Determine the screen depth */ |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
459 /* we change this during the SDL_SetVideoMode implementation... */ |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
460 vformat->BitsPerPixel = VDI_bpp; |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
461 |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
462 /* Set mouse cursor to arrow */ |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
463 graf_mouse(ARROW, NULL); |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
464 |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
465 /* Init chunky to planar routine */ |
736
028e03e273c8
Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents:
593
diff
changeset
|
466 SDL_Atari_C2pConvert = SDL_Atari_C2pConvert8; |
028e03e273c8
Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents:
593
diff
changeset
|
467 |
028e03e273c8
Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents:
593
diff
changeset
|
468 /* Setup VDI fill functions */ |
028e03e273c8
Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents:
593
diff
changeset
|
469 vsf_color(VDI_handle,0); |
028e03e273c8
Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents:
593
diff
changeset
|
470 vsf_interior(VDI_handle,1); |
028e03e273c8
Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents:
593
diff
changeset
|
471 vsf_perimeter(VDI_handle,0); |
028e03e273c8
Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents:
593
diff
changeset
|
472 |
902
99f439d6ee4a
Forgot to initialize video mode list
Patrice Mandin <patmandin@gmail.com>
parents:
800
diff
changeset
|
473 /* Fill video modes list */ |
99f439d6ee4a
Forgot to initialize video mode list
Patrice Mandin <patmandin@gmail.com>
parents:
800
diff
changeset
|
474 SDL_modelist[0] = malloc(sizeof(SDL_Rect)); |
99f439d6ee4a
Forgot to initialize video mode list
Patrice Mandin <patmandin@gmail.com>
parents:
800
diff
changeset
|
475 SDL_modelist[0]->x = 0; |
99f439d6ee4a
Forgot to initialize video mode list
Patrice Mandin <patmandin@gmail.com>
parents:
800
diff
changeset
|
476 SDL_modelist[0]->y = 0; |
99f439d6ee4a
Forgot to initialize video mode list
Patrice Mandin <patmandin@gmail.com>
parents:
800
diff
changeset
|
477 SDL_modelist[0]->w = VDI_w; |
99f439d6ee4a
Forgot to initialize video mode list
Patrice Mandin <patmandin@gmail.com>
parents:
800
diff
changeset
|
478 SDL_modelist[0]->h = VDI_h; |
99f439d6ee4a
Forgot to initialize video mode list
Patrice Mandin <patmandin@gmail.com>
parents:
800
diff
changeset
|
479 |
99f439d6ee4a
Forgot to initialize video mode list
Patrice Mandin <patmandin@gmail.com>
parents:
800
diff
changeset
|
480 SDL_modelist[1] = NULL; |
99f439d6ee4a
Forgot to initialize video mode list
Patrice Mandin <patmandin@gmail.com>
parents:
800
diff
changeset
|
481 |
736
028e03e273c8
Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents:
593
diff
changeset
|
482 #ifdef DEBUG_VIDEO_GEM |
028e03e273c8
Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents:
593
diff
changeset
|
483 printf("sdl:video:gem: VideoInit(): done\n"); |
028e03e273c8
Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents:
593
diff
changeset
|
484 #endif |
281
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
485 |
984
44fd54a0ae5f
Add OSMesa OpenGL support to the Atari GEM video driver
Patrice Mandin <patmandin@gmail.com>
parents:
964
diff
changeset
|
486 #ifdef HAVE_OPENGL |
44fd54a0ae5f
Add OSMesa OpenGL support to the Atari GEM video driver
Patrice Mandin <patmandin@gmail.com>
parents:
964
diff
changeset
|
487 this->gl_config.driver_loaded = 1; |
44fd54a0ae5f
Add OSMesa OpenGL support to the Atari GEM video driver
Patrice Mandin <patmandin@gmail.com>
parents:
964
diff
changeset
|
488 #endif |
44fd54a0ae5f
Add OSMesa OpenGL support to the Atari GEM video driver
Patrice Mandin <patmandin@gmail.com>
parents:
964
diff
changeset
|
489 |
281
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
490 /* We're done! */ |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
491 return(0); |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
492 } |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
493 |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
494 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
|
495 { |
902
99f439d6ee4a
Forgot to initialize video mode list
Patrice Mandin <patmandin@gmail.com>
parents:
800
diff
changeset
|
496 if (format->BitsPerPixel != VDI_bpp) { |
281
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
497 return ((SDL_Rect **)NULL); |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
498 } |
902
99f439d6ee4a
Forgot to initialize video mode list
Patrice Mandin <patmandin@gmail.com>
parents:
800
diff
changeset
|
499 |
99f439d6ee4a
Forgot to initialize video mode list
Patrice Mandin <patmandin@gmail.com>
parents:
800
diff
changeset
|
500 if (flags & SDL_FULLSCREEN) { |
99f439d6ee4a
Forgot to initialize video mode list
Patrice Mandin <patmandin@gmail.com>
parents:
800
diff
changeset
|
501 return (SDL_modelist); |
99f439d6ee4a
Forgot to initialize video mode list
Patrice Mandin <patmandin@gmail.com>
parents:
800
diff
changeset
|
502 } |
99f439d6ee4a
Forgot to initialize video mode list
Patrice Mandin <patmandin@gmail.com>
parents:
800
diff
changeset
|
503 |
99f439d6ee4a
Forgot to initialize video mode list
Patrice Mandin <patmandin@gmail.com>
parents:
800
diff
changeset
|
504 return((SDL_Rect **)-1); |
281
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
505 } |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
506 |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
507 static void GEM_FreeBuffers(_THIS) |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
508 { |
984
44fd54a0ae5f
Add OSMesa OpenGL support to the Atari GEM video driver
Patrice Mandin <patmandin@gmail.com>
parents:
964
diff
changeset
|
509 #ifdef HAVE_OPENGL |
44fd54a0ae5f
Add OSMesa OpenGL support to the Atari GEM video driver
Patrice Mandin <patmandin@gmail.com>
parents:
964
diff
changeset
|
510 /* Shutdown OpenGL context */ |
44fd54a0ae5f
Add OSMesa OpenGL support to the Atari GEM video driver
Patrice Mandin <patmandin@gmail.com>
parents:
964
diff
changeset
|
511 if (GEM_ctx) { |
44fd54a0ae5f
Add OSMesa OpenGL support to the Atari GEM video driver
Patrice Mandin <patmandin@gmail.com>
parents:
964
diff
changeset
|
512 OSMesaDestroyContext(GEM_ctx); |
44fd54a0ae5f
Add OSMesa OpenGL support to the Atari GEM video driver
Patrice Mandin <patmandin@gmail.com>
parents:
964
diff
changeset
|
513 GEM_ctx = NULL; |
44fd54a0ae5f
Add OSMesa OpenGL support to the Atari GEM video driver
Patrice Mandin <patmandin@gmail.com>
parents:
964
diff
changeset
|
514 } |
44fd54a0ae5f
Add OSMesa OpenGL support to the Atari GEM video driver
Patrice Mandin <patmandin@gmail.com>
parents:
964
diff
changeset
|
515 #endif |
44fd54a0ae5f
Add OSMesa OpenGL support to the Atari GEM video driver
Patrice Mandin <patmandin@gmail.com>
parents:
964
diff
changeset
|
516 |
281
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
517 /* Release buffer */ |
736
028e03e273c8
Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents:
593
diff
changeset
|
518 if ( GEM_buffer2 ) { |
028e03e273c8
Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents:
593
diff
changeset
|
519 free( GEM_buffer2 ); |
028e03e273c8
Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents:
593
diff
changeset
|
520 GEM_buffer2=NULL; |
028e03e273c8
Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents:
593
diff
changeset
|
521 } |
028e03e273c8
Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents:
593
diff
changeset
|
522 |
028e03e273c8
Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents:
593
diff
changeset
|
523 if ( GEM_buffer1 ) { |
028e03e273c8
Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents:
593
diff
changeset
|
524 free( GEM_buffer1 ); |
028e03e273c8
Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents:
593
diff
changeset
|
525 GEM_buffer1=NULL; |
281
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
526 } |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
527 } |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
528 |
736
028e03e273c8
Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents:
593
diff
changeset
|
529 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
|
530 { |
028e03e273c8
Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents:
593
diff
changeset
|
531 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
|
532 |
028e03e273c8
Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents:
593
diff
changeset
|
533 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
|
534 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
|
535 |
028e03e273c8
Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents:
593
diff
changeset
|
536 vsf_color(VDI_handle,0); |
028e03e273c8
Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents:
593
diff
changeset
|
537 vsf_interior(VDI_handle,1); |
028e03e273c8
Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents:
593
diff
changeset
|
538 vsf_perimeter(VDI_handle,0); |
028e03e273c8
Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents:
593
diff
changeset
|
539 v_bar(VDI_handle, rect); |
028e03e273c8
Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents:
593
diff
changeset
|
540 |
028e03e273c8
Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents:
593
diff
changeset
|
541 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
|
542 } |
028e03e273c8
Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents:
593
diff
changeset
|
543 |
319
189a6a3416c7
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
305
diff
changeset
|
544 static void GEM_ClearScreen(_THIS) |
189a6a3416c7
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
305
diff
changeset
|
545 { |
189a6a3416c7
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
305
diff
changeset
|
546 short pxy[4]; |
189a6a3416c7
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
305
diff
changeset
|
547 |
189a6a3416c7
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
305
diff
changeset
|
548 v_hide_c(VDI_handle); |
189a6a3416c7
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
305
diff
changeset
|
549 |
189a6a3416c7
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
305
diff
changeset
|
550 pxy[0] = pxy[1] = 0; |
189a6a3416c7
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
305
diff
changeset
|
551 pxy[2] = VDI_w - 1; |
189a6a3416c7
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
305
diff
changeset
|
552 pxy[3] = VDI_h - 1; |
736
028e03e273c8
Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents:
593
diff
changeset
|
553 GEM_ClearRect(this, pxy); |
319
189a6a3416c7
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
305
diff
changeset
|
554 |
189a6a3416c7
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
305
diff
changeset
|
555 v_show_c(VDI_handle, 1); |
189a6a3416c7
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
305
diff
changeset
|
556 } |
189a6a3416c7
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
305
diff
changeset
|
557 |
189a6a3416c7
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
305
diff
changeset
|
558 static void GEM_LockScreen(_THIS) |
189a6a3416c7
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
305
diff
changeset
|
559 { |
189a6a3416c7
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
305
diff
changeset
|
560 if (!GEM_locked) { |
189a6a3416c7
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
305
diff
changeset
|
561 /* Lock AES */ |
189a6a3416c7
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
305
diff
changeset
|
562 wind_update(BEG_UPDATE); |
189a6a3416c7
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
305
diff
changeset
|
563 wind_update(BEG_MCTRL); |
917
24852aeb0657
Lock the screen before doing its backup
Patrice Mandin <patmandin@gmail.com>
parents:
902
diff
changeset
|
564 /* 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
|
565 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
|
566 |
189a6a3416c7
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
305
diff
changeset
|
567 GEM_locked=SDL_TRUE; |
189a6a3416c7
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
305
diff
changeset
|
568 } |
189a6a3416c7
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
305
diff
changeset
|
569 } |
189a6a3416c7
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
305
diff
changeset
|
570 |
189a6a3416c7
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
305
diff
changeset
|
571 static void GEM_UnlockScreen(_THIS) |
189a6a3416c7
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
305
diff
changeset
|
572 { |
189a6a3416c7
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
305
diff
changeset
|
573 if (GEM_locked) { |
189a6a3416c7
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
305
diff
changeset
|
574 /* Restore screen memory, and send REDRAW to all apps */ |
189a6a3416c7
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
305
diff
changeset
|
575 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
|
576 /* Unlock AES */ |
189a6a3416c7
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
305
diff
changeset
|
577 wind_update(END_MCTRL); |
189a6a3416c7
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
305
diff
changeset
|
578 wind_update(END_UPDATE); |
189a6a3416c7
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
305
diff
changeset
|
579 |
189a6a3416c7
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
305
diff
changeset
|
580 GEM_locked=SDL_FALSE; |
189a6a3416c7
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
305
diff
changeset
|
581 } |
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 |
281
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
584 SDL_Surface *GEM_SetVideoMode(_THIS, SDL_Surface *current, |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
585 int width, int height, int bpp, Uint32 flags) |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
586 { |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
587 int maxwidth, maxheight; |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
588 Uint32 modeflags, screensize; |
736
028e03e273c8
Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents:
593
diff
changeset
|
589 SDL_bool use_shadow1, use_shadow2; |
281
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
590 |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
591 /*--- Verify if asked mode can be used ---*/ |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
592 if (flags & SDL_FULLSCREEN) { |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
593 maxwidth=VDI_w; |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
594 maxheight=VDI_h; |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
595 } else { |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
596 /* Windowed mode */ |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
597 maxwidth=GEM_desk_w; |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
598 maxheight=GEM_desk_h; |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
599 } |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
600 |
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
|
601 /* 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
|
602 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
|
603 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
|
604 } |
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
|
605 |
281
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
606 if ((maxwidth < width) || (maxheight < height) || (VDI_bpp != bpp)) { |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
607 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
|
608 return(NULL); |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
609 } |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
610 |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
611 /*--- Allocate the new pixel format for the screen ---*/ |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
612 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
|
613 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
|
614 return(NULL); |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
615 } |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
616 |
736
028e03e273c8
Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents:
593
diff
changeset
|
617 screensize = width * height * VDI_pixelsize; |
028e03e273c8
Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents:
593
diff
changeset
|
618 |
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
|
619 #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
|
620 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
|
621 #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
|
622 |
736
028e03e273c8
Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents:
593
diff
changeset
|
623 /*--- 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
|
624 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
|
625 |
736
028e03e273c8
Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents:
593
diff
changeset
|
626 GEM_bufops=0; |
028e03e273c8
Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents:
593
diff
changeset
|
627 use_shadow1=use_shadow2=SDL_FALSE; |
028e03e273c8
Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents:
593
diff
changeset
|
628 if (VDI_screen && (flags & SDL_FULLSCREEN)) { |
028e03e273c8
Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents:
593
diff
changeset
|
629 if (VDI_format==VDI_FORMAT_INTER) { |
028e03e273c8
Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents:
593
diff
changeset
|
630 use_shadow1=SDL_TRUE; |
028e03e273c8
Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents:
593
diff
changeset
|
631 GEM_bufops = B2S_C2P_1TOS; |
281
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
632 } |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
633 } else { |
736
028e03e273c8
Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents:
593
diff
changeset
|
634 use_shadow1=SDL_TRUE; |
028e03e273c8
Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents:
593
diff
changeset
|
635 if (VDI_format==VDI_FORMAT_PACK) { |
028e03e273c8
Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents:
593
diff
changeset
|
636 GEM_bufops = B2S_VROCPYFM_1TOS; |
028e03e273c8
Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents:
593
diff
changeset
|
637 } else { |
028e03e273c8
Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents:
593
diff
changeset
|
638 use_shadow2=SDL_TRUE; |
028e03e273c8
Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents:
593
diff
changeset
|
639 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
|
640 } |
281
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
641 } |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
642 |
736
028e03e273c8
Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents:
593
diff
changeset
|
643 if (use_shadow1) { |
028e03e273c8
Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents:
593
diff
changeset
|
644 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
|
645 if (GEM_buffer1==NULL) { |
920
bbefeed8134d
Use SDL_SetError instead of fprintf
Patrice Mandin <patmandin@gmail.com>
parents:
918
diff
changeset
|
646 SDL_SetError("Unable to allocate shadow buffer"); |
281
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
647 return NULL; |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
648 } |
736
028e03e273c8
Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents:
593
diff
changeset
|
649 memset(GEM_buffer1, 0, screensize); |
028e03e273c8
Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents:
593
diff
changeset
|
650 #ifdef DEBUG_VIDEO_GEM |
028e03e273c8
Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents:
593
diff
changeset
|
651 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
|
652 #endif |
028e03e273c8
Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents:
593
diff
changeset
|
653 } |
028e03e273c8
Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents:
593
diff
changeset
|
654 |
028e03e273c8
Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents:
593
diff
changeset
|
655 if (use_shadow2) { |
028e03e273c8
Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents:
593
diff
changeset
|
656 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
|
657 if (GEM_buffer2==NULL) { |
920
bbefeed8134d
Use SDL_SetError instead of fprintf
Patrice Mandin <patmandin@gmail.com>
parents:
918
diff
changeset
|
658 SDL_SetError("Unable to allocate shadow buffer"); |
736
028e03e273c8
Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents:
593
diff
changeset
|
659 return NULL; |
028e03e273c8
Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents:
593
diff
changeset
|
660 } |
028e03e273c8
Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents:
593
diff
changeset
|
661 memset(GEM_buffer2, 0, screensize); |
028e03e273c8
Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents:
593
diff
changeset
|
662 #ifdef DEBUG_VIDEO_GEM |
028e03e273c8
Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents:
593
diff
changeset
|
663 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
|
664 #endif |
281
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
665 } |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
666 |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
667 /*--- Initialize screen ---*/ |
508
9ff7e90aaa94
Fixed gamma correction in Atari video drivers (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
319
diff
changeset
|
668 modeflags = 0; |
9ff7e90aaa94
Fixed gamma correction in Atari video drivers (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
319
diff
changeset
|
669 if (VDI_bpp == 8) { |
9ff7e90aaa94
Fixed gamma correction in Atari video drivers (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
319
diff
changeset
|
670 modeflags |= SDL_HWPALETTE; |
9ff7e90aaa94
Fixed gamma correction in Atari video drivers (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
319
diff
changeset
|
671 } |
9ff7e90aaa94
Fixed gamma correction in Atari video drivers (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
319
diff
changeset
|
672 |
281
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
673 if (flags & SDL_FULLSCREEN) { |
319
189a6a3416c7
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
305
diff
changeset
|
674 GEM_LockScreen(this); |
281
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
675 |
319
189a6a3416c7
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
305
diff
changeset
|
676 GEM_ClearScreen(this); |
281
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
677 |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
678 modeflags |= SDL_FULLSCREEN; |
736
028e03e273c8
Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents:
593
diff
changeset
|
679 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
|
680 modeflags |= SDL_HWSURFACE; |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
681 } else { |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
682 modeflags |= SDL_SWSURFACE; |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
683 } |
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
|
684 |
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
|
685 GEM_fullscreen = SDL_TRUE; |
281
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
686 } 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
|
687 int old_win_type; |
281
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
688 short x2,y2,w2,h2; |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
689 |
319
189a6a3416c7
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
305
diff
changeset
|
690 GEM_UnlockScreen(this); |
281
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
691 |
923
2748679027ff
Correctly center window on creation
Patrice Mandin <patmandin@gmail.com>
parents:
921
diff
changeset
|
692 /* 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
|
693 old_win_type = GEM_win_type; |
281
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
694 if (!(flags & SDL_NOFRAME)) { |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
695 GEM_win_type=NAME|MOVER|CLOSER|SMALLER; |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
696 if (flags & SDL_RESIZABLE) { |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
697 GEM_win_type |= FULLER|SIZER; |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
698 modeflags |= SDL_RESIZABLE; |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
699 } |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
700 } else { |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
701 GEM_win_type=0; |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
702 modeflags |= SDL_NOFRAME; |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
703 } |
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
|
704 modeflags |= SDL_SWSURFACE; |
281
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
705 |
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
|
706 /* 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
|
707 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
|
708 /* 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
|
709 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
|
710 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
|
711 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
|
712 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
|
713 } |
281
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
714 |
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
|
715 /* 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
|
716 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
|
717 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
|
718 |
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
|
719 /* 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
|
720 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
|
721 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
|
722 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
|
723 } |
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 |
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
|
725 /* 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
|
726 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
|
727 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
|
728 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
|
729 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
|
730 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
|
731 } |
281
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
732 |
736
028e03e273c8
Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents:
593
diff
changeset
|
733 #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
|
734 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
|
735 #endif |
028e03e273c8
Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents:
593
diff
changeset
|
736 |
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
|
737 /* 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
|
738 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
|
739 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
|
740 |
51ec8fc8bedb
No need to close the window when going to fullscreen mode
Patrice Mandin <patmandin@gmail.com>
parents:
926
diff
changeset
|
741 /* Open the window */ |
51ec8fc8bedb
No need to close the window when going to fullscreen mode
Patrice Mandin <patmandin@gmail.com>
parents:
926
diff
changeset
|
742 wind_open(GEM_handle,x2,y2,w2,h2); |
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 } |
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
|
744 |
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
|
745 GEM_fullscreen = SDL_FALSE; |
281
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
746 } |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
747 |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
748 /* Set up the new mode framebuffer */ |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
749 current->w = width; |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
750 current->h = height; |
736
028e03e273c8
Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents:
593
diff
changeset
|
751 if (use_shadow1) { |
028e03e273c8
Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents:
593
diff
changeset
|
752 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
|
753 current->pitch = width * VDI_pixelsize; |
281
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
754 } else { |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
755 current->pixels = VDI_screen; |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
756 current->pixels += VDI_pitch * ((VDI_h - height) >> 1); |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
757 current->pixels += VDI_pixelsize * ((VDI_w - width) >> 1); |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
758 current->pitch = VDI_pitch; |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
759 } |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
760 |
984
44fd54a0ae5f
Add OSMesa OpenGL support to the Atari GEM video driver
Patrice Mandin <patmandin@gmail.com>
parents:
964
diff
changeset
|
761 #ifdef HAVE_OPENGL |
44fd54a0ae5f
Add OSMesa OpenGL support to the Atari GEM video driver
Patrice Mandin <patmandin@gmail.com>
parents:
964
diff
changeset
|
762 if (flags & SDL_OPENGL) { |
986
952ec1ddcb58
Add conversion routines for unsupported screen formats
Patrice Mandin <patmandin@gmail.com>
parents:
984
diff
changeset
|
763 GLenum format = OSMESA_COLOR_INDEX; /* 8 bits */ |
984
44fd54a0ae5f
Add OSMesa OpenGL support to the Atari GEM video driver
Patrice Mandin <patmandin@gmail.com>
parents:
964
diff
changeset
|
764 |
44fd54a0ae5f
Add OSMesa OpenGL support to the Atari GEM video driver
Patrice Mandin <patmandin@gmail.com>
parents:
964
diff
changeset
|
765 /* Init OpenGL context using OSMesa */ |
986
952ec1ddcb58
Add conversion routines for unsupported screen formats
Patrice Mandin <patmandin@gmail.com>
parents:
984
diff
changeset
|
766 GEM_GL_Convert = GEM_GL_ConvertNull; |
984
44fd54a0ae5f
Add OSMesa OpenGL support to the Atari GEM video driver
Patrice Mandin <patmandin@gmail.com>
parents:
964
diff
changeset
|
767 switch (VDI_bpp) { |
44fd54a0ae5f
Add OSMesa OpenGL support to the Atari GEM video driver
Patrice Mandin <patmandin@gmail.com>
parents:
964
diff
changeset
|
768 case 15: |
986
952ec1ddcb58
Add conversion routines for unsupported screen formats
Patrice Mandin <patmandin@gmail.com>
parents:
984
diff
changeset
|
769 /* 1555, big and little endian, unsupported */ |
984
44fd54a0ae5f
Add OSMesa OpenGL support to the Atari GEM video driver
Patrice Mandin <patmandin@gmail.com>
parents:
964
diff
changeset
|
770 format = OSMESA_RGB_565; |
986
952ec1ddcb58
Add conversion routines for unsupported screen formats
Patrice Mandin <patmandin@gmail.com>
parents:
984
diff
changeset
|
771 if (VDI_redmask == 31<<10) { |
952ec1ddcb58
Add conversion routines for unsupported screen formats
Patrice Mandin <patmandin@gmail.com>
parents:
984
diff
changeset
|
772 GEM_GL_Convert = GEM_GL_Convert565To555be; |
952ec1ddcb58
Add conversion routines for unsupported screen formats
Patrice Mandin <patmandin@gmail.com>
parents:
984
diff
changeset
|
773 } else { |
952ec1ddcb58
Add conversion routines for unsupported screen formats
Patrice Mandin <patmandin@gmail.com>
parents:
984
diff
changeset
|
774 GEM_GL_Convert = GEM_GL_Convert565To555le; |
952ec1ddcb58
Add conversion routines for unsupported screen formats
Patrice Mandin <patmandin@gmail.com>
parents:
984
diff
changeset
|
775 } |
984
44fd54a0ae5f
Add OSMesa OpenGL support to the Atari GEM video driver
Patrice Mandin <patmandin@gmail.com>
parents:
964
diff
changeset
|
776 break; |
44fd54a0ae5f
Add OSMesa OpenGL support to the Atari GEM video driver
Patrice Mandin <patmandin@gmail.com>
parents:
964
diff
changeset
|
777 case 16: |
986
952ec1ddcb58
Add conversion routines for unsupported screen formats
Patrice Mandin <patmandin@gmail.com>
parents:
984
diff
changeset
|
778 if (VDI_redmask == 31<<11) { |
952ec1ddcb58
Add conversion routines for unsupported screen formats
Patrice Mandin <patmandin@gmail.com>
parents:
984
diff
changeset
|
779 format = OSMESA_RGB_565; |
952ec1ddcb58
Add conversion routines for unsupported screen formats
Patrice Mandin <patmandin@gmail.com>
parents:
984
diff
changeset
|
780 } else { |
952ec1ddcb58
Add conversion routines for unsupported screen formats
Patrice Mandin <patmandin@gmail.com>
parents:
984
diff
changeset
|
781 /* 565, little endian, unsupported */ |
952ec1ddcb58
Add conversion routines for unsupported screen formats
Patrice Mandin <patmandin@gmail.com>
parents:
984
diff
changeset
|
782 format = OSMESA_RGB_565; |
952ec1ddcb58
Add conversion routines for unsupported screen formats
Patrice Mandin <patmandin@gmail.com>
parents:
984
diff
changeset
|
783 GEM_GL_Convert = GEM_GL_Convert565le; |
952ec1ddcb58
Add conversion routines for unsupported screen formats
Patrice Mandin <patmandin@gmail.com>
parents:
984
diff
changeset
|
784 } |
984
44fd54a0ae5f
Add OSMesa OpenGL support to the Atari GEM video driver
Patrice Mandin <patmandin@gmail.com>
parents:
964
diff
changeset
|
785 break; |
44fd54a0ae5f
Add OSMesa OpenGL support to the Atari GEM video driver
Patrice Mandin <patmandin@gmail.com>
parents:
964
diff
changeset
|
786 case 24: |
44fd54a0ae5f
Add OSMesa OpenGL support to the Atari GEM video driver
Patrice Mandin <patmandin@gmail.com>
parents:
964
diff
changeset
|
787 if (VDI_redmask == 255<<16) { |
44fd54a0ae5f
Add OSMesa OpenGL support to the Atari GEM video driver
Patrice Mandin <patmandin@gmail.com>
parents:
964
diff
changeset
|
788 format = OSMESA_RGB; |
44fd54a0ae5f
Add OSMesa OpenGL support to the Atari GEM video driver
Patrice Mandin <patmandin@gmail.com>
parents:
964
diff
changeset
|
789 } else { |
44fd54a0ae5f
Add OSMesa OpenGL support to the Atari GEM video driver
Patrice Mandin <patmandin@gmail.com>
parents:
964
diff
changeset
|
790 format = OSMESA_BGR; |
44fd54a0ae5f
Add OSMesa OpenGL support to the Atari GEM video driver
Patrice Mandin <patmandin@gmail.com>
parents:
964
diff
changeset
|
791 } |
44fd54a0ae5f
Add OSMesa OpenGL support to the Atari GEM video driver
Patrice Mandin <patmandin@gmail.com>
parents:
964
diff
changeset
|
792 break; |
44fd54a0ae5f
Add OSMesa OpenGL support to the Atari GEM video driver
Patrice Mandin <patmandin@gmail.com>
parents:
964
diff
changeset
|
793 case 32: |
44fd54a0ae5f
Add OSMesa OpenGL support to the Atari GEM video driver
Patrice Mandin <patmandin@gmail.com>
parents:
964
diff
changeset
|
794 if (VDI_redmask == 255<<16) { |
44fd54a0ae5f
Add OSMesa OpenGL support to the Atari GEM video driver
Patrice Mandin <patmandin@gmail.com>
parents:
964
diff
changeset
|
795 format = OSMESA_ARGB; |
44fd54a0ae5f
Add OSMesa OpenGL support to the Atari GEM video driver
Patrice Mandin <patmandin@gmail.com>
parents:
964
diff
changeset
|
796 } else if (VDI_redmask == 255<<8) { |
44fd54a0ae5f
Add OSMesa OpenGL support to the Atari GEM video driver
Patrice Mandin <patmandin@gmail.com>
parents:
964
diff
changeset
|
797 format = OSMESA_BGRA; |
44fd54a0ae5f
Add OSMesa OpenGL support to the Atari GEM video driver
Patrice Mandin <patmandin@gmail.com>
parents:
964
diff
changeset
|
798 } else if (VDI_redmask == 255<<24) { |
44fd54a0ae5f
Add OSMesa OpenGL support to the Atari GEM video driver
Patrice Mandin <patmandin@gmail.com>
parents:
964
diff
changeset
|
799 format = OSMESA_RGBA; |
44fd54a0ae5f
Add OSMesa OpenGL support to the Atari GEM video driver
Patrice Mandin <patmandin@gmail.com>
parents:
964
diff
changeset
|
800 } else { |
44fd54a0ae5f
Add OSMesa OpenGL support to the Atari GEM video driver
Patrice Mandin <patmandin@gmail.com>
parents:
964
diff
changeset
|
801 /* ABGR format unsupported */ |
44fd54a0ae5f
Add OSMesa OpenGL support to the Atari GEM video driver
Patrice Mandin <patmandin@gmail.com>
parents:
964
diff
changeset
|
802 format = OSMESA_BGRA; |
986
952ec1ddcb58
Add conversion routines for unsupported screen formats
Patrice Mandin <patmandin@gmail.com>
parents:
984
diff
changeset
|
803 GEM_GL_Convert = GEM_GL_ConvertBGRAToABGR; |
984
44fd54a0ae5f
Add OSMesa OpenGL support to the Atari GEM video driver
Patrice Mandin <patmandin@gmail.com>
parents:
964
diff
changeset
|
804 } |
44fd54a0ae5f
Add OSMesa OpenGL support to the Atari GEM video driver
Patrice Mandin <patmandin@gmail.com>
parents:
964
diff
changeset
|
805 break; |
44fd54a0ae5f
Add OSMesa OpenGL support to the Atari GEM video driver
Patrice Mandin <patmandin@gmail.com>
parents:
964
diff
changeset
|
806 } |
44fd54a0ae5f
Add OSMesa OpenGL support to the Atari GEM video driver
Patrice Mandin <patmandin@gmail.com>
parents:
964
diff
changeset
|
807 |
44fd54a0ae5f
Add OSMesa OpenGL support to the Atari GEM video driver
Patrice Mandin <patmandin@gmail.com>
parents:
964
diff
changeset
|
808 GEM_ctx = OSMesaCreateContextExt( format, this->gl_config.depth_size, |
44fd54a0ae5f
Add OSMesa OpenGL support to the Atari GEM video driver
Patrice Mandin <patmandin@gmail.com>
parents:
964
diff
changeset
|
809 this->gl_config.stencil_size, this->gl_config.accum_red_size + |
44fd54a0ae5f
Add OSMesa OpenGL support to the Atari GEM video driver
Patrice Mandin <patmandin@gmail.com>
parents:
964
diff
changeset
|
810 this->gl_config.accum_green_size + this->gl_config.accum_blue_size + |
44fd54a0ae5f
Add OSMesa OpenGL support to the Atari GEM video driver
Patrice Mandin <patmandin@gmail.com>
parents:
964
diff
changeset
|
811 this->gl_config.accum_alpha_size, NULL ); |
44fd54a0ae5f
Add OSMesa OpenGL support to the Atari GEM video driver
Patrice Mandin <patmandin@gmail.com>
parents:
964
diff
changeset
|
812 if (!GEM_ctx) { |
44fd54a0ae5f
Add OSMesa OpenGL support to the Atari GEM video driver
Patrice Mandin <patmandin@gmail.com>
parents:
964
diff
changeset
|
813 GEM_FreeBuffers(this); |
44fd54a0ae5f
Add OSMesa OpenGL support to the Atari GEM video driver
Patrice Mandin <patmandin@gmail.com>
parents:
964
diff
changeset
|
814 SDL_SetError("OSMesaCreateContext failed"); |
44fd54a0ae5f
Add OSMesa OpenGL support to the Atari GEM video driver
Patrice Mandin <patmandin@gmail.com>
parents:
964
diff
changeset
|
815 return(NULL); |
44fd54a0ae5f
Add OSMesa OpenGL support to the Atari GEM video driver
Patrice Mandin <patmandin@gmail.com>
parents:
964
diff
changeset
|
816 } |
44fd54a0ae5f
Add OSMesa OpenGL support to the Atari GEM video driver
Patrice Mandin <patmandin@gmail.com>
parents:
964
diff
changeset
|
817 |
44fd54a0ae5f
Add OSMesa OpenGL support to the Atari GEM video driver
Patrice Mandin <patmandin@gmail.com>
parents:
964
diff
changeset
|
818 modeflags |= SDL_OPENGL; |
44fd54a0ae5f
Add OSMesa OpenGL support to the Atari GEM video driver
Patrice Mandin <patmandin@gmail.com>
parents:
964
diff
changeset
|
819 } |
44fd54a0ae5f
Add OSMesa OpenGL support to the Atari GEM video driver
Patrice Mandin <patmandin@gmail.com>
parents:
964
diff
changeset
|
820 #endif |
44fd54a0ae5f
Add OSMesa OpenGL support to the Atari GEM video driver
Patrice Mandin <patmandin@gmail.com>
parents:
964
diff
changeset
|
821 |
44fd54a0ae5f
Add OSMesa OpenGL support to the Atari GEM video driver
Patrice Mandin <patmandin@gmail.com>
parents:
964
diff
changeset
|
822 current->flags = modeflags; |
44fd54a0ae5f
Add OSMesa OpenGL support to the Atari GEM video driver
Patrice Mandin <patmandin@gmail.com>
parents:
964
diff
changeset
|
823 |
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
|
824 #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
|
825 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
|
826 #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
|
827 |
281
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
828 this->UpdateRects = GEM_UpdateRects; |
964
d9209754ebee
Prevent redraws till internal buffers are correctly setup
Patrice Mandin <patmandin@gmail.com>
parents:
959
diff
changeset
|
829 GEM_lock_redraw = SDL_FALSE; /* Enable redraw */ |
281
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
830 |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
831 /* We're done */ |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
832 return(current); |
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 |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
835 static int GEM_AllocHWSurface(_THIS, SDL_Surface *surface) |
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 return -1; |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
838 } |
800
60a4293ffea9
When commiting code, cleanup before doing it
Patrice Mandin <patmandin@gmail.com>
parents:
799
diff
changeset
|
839 |
281
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
840 static void GEM_FreeHWSurface(_THIS, SDL_Surface *surface) |
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 return; |
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 |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
845 static int GEM_LockHWSurface(_THIS, SDL_Surface *surface) |
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 return(0); |
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 |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
850 static void GEM_UnlockHWSurface(_THIS, SDL_Surface *surface) |
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 return; |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
853 } |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
854 |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
855 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
|
856 { |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
857 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
|
858 int i, surf_width; |
281
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
859 |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
860 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
|
861 /* 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
|
862 surf_width=surface->w; |
918
17822f1f9674
Wrongly test if width multiple of 16
Patrice Mandin <patmandin@gmail.com>
parents:
917
diff
changeset
|
863 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
|
864 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
|
865 } |
281
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
866 |
736
028e03e273c8
Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents:
593
diff
changeset
|
867 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
|
868 void *destscr; |
028e03e273c8
Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents:
593
diff
changeset
|
869 int destpitch; |
028e03e273c8
Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents:
593
diff
changeset
|
870 |
028e03e273c8
Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents:
593
diff
changeset
|
871 if (GEM_bufops & B2S_C2P_1TOS) { |
281
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
872 int destx; |
736
028e03e273c8
Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents:
593
diff
changeset
|
873 |
281
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
874 destscr = VDI_screen; |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
875 destscr += VDI_pitch * ((VDI_h - surface->h) >> 1); |
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
|
876 destx = (VDI_w - surf_width) >> 1; |
281
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
877 destx &= ~15; |
319
189a6a3416c7
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
305
diff
changeset
|
878 destscr += destx; |
736
028e03e273c8
Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents:
593
diff
changeset
|
879 destpitch = VDI_pitch; |
028e03e273c8
Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents:
593
diff
changeset
|
880 } else { |
028e03e273c8
Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents:
593
diff
changeset
|
881 destscr = GEM_buffer2; |
028e03e273c8
Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents:
593
diff
changeset
|
882 destpitch = surface->pitch; |
028e03e273c8
Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents:
593
diff
changeset
|
883 } |
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 for (i=0;i<numrects;i++) { |
028e03e273c8
Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents:
593
diff
changeset
|
886 void *source,*destination; |
028e03e273c8
Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents:
593
diff
changeset
|
887 int x1,x2; |
319
189a6a3416c7
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
305
diff
changeset
|
888 |
736
028e03e273c8
Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents:
593
diff
changeset
|
889 x1 = rects[i].x & ~15; |
028e03e273c8
Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents:
593
diff
changeset
|
890 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
|
891 if (x2 & 15) { |
028e03e273c8
Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents:
593
diff
changeset
|
892 x2 = (x2 | 15) +1; |
319
189a6a3416c7
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
305
diff
changeset
|
893 } |
189a6a3416c7
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
305
diff
changeset
|
894 |
736
028e03e273c8
Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents:
593
diff
changeset
|
895 source = surface->pixels; |
028e03e273c8
Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents:
593
diff
changeset
|
896 source += surface->pitch * rects[i].y; |
028e03e273c8
Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents:
593
diff
changeset
|
897 source += x1; |
319
189a6a3416c7
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
305
diff
changeset
|
898 |
736
028e03e273c8
Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents:
593
diff
changeset
|
899 destination = destscr; |
028e03e273c8
Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents:
593
diff
changeset
|
900 destination += destpitch * rects[i].y; |
028e03e273c8
Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents:
593
diff
changeset
|
901 destination += x1; |
028e03e273c8
Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents:
593
diff
changeset
|
902 |
028e03e273c8
Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents:
593
diff
changeset
|
903 SDL_Atari_C2pConvert( |
028e03e273c8
Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents:
593
diff
changeset
|
904 source, destination, |
028e03e273c8
Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents:
593
diff
changeset
|
905 x2-x1, rects[i].h, |
028e03e273c8
Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents:
593
diff
changeset
|
906 SDL_FALSE, |
028e03e273c8
Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents:
593
diff
changeset
|
907 surface->pitch, destpitch |
028e03e273c8
Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents:
593
diff
changeset
|
908 ); |
319
189a6a3416c7
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
305
diff
changeset
|
909 } |
189a6a3416c7
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
305
diff
changeset
|
910 } |
281
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
911 |
736
028e03e273c8
Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents:
593
diff
changeset
|
912 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
|
913 MFDB mfdb_src; |
028e03e273c8
Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents:
593
diff
changeset
|
914 short blitcoords[8]; |
281
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
915 |
736
028e03e273c8
Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents:
593
diff
changeset
|
916 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
|
917 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
|
918 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
|
919 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
|
920 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
|
921 mfdb_src.fd_stand= |
028e03e273c8
Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents:
593
diff
changeset
|
922 mfdb_src.fd_r1= |
028e03e273c8
Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents:
593
diff
changeset
|
923 mfdb_src.fd_r2= |
028e03e273c8
Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents:
593
diff
changeset
|
924 mfdb_src.fd_r3= 0; |
028e03e273c8
Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents:
593
diff
changeset
|
925 if (GEM_bufops & B2S_VROCPYFM_2TOS) { |
028e03e273c8
Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents:
593
diff
changeset
|
926 mfdb_src.fd_addr=GEM_buffer2; |
028e03e273c8
Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents:
593
diff
changeset
|
927 } |
281
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
928 |
736
028e03e273c8
Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents:
593
diff
changeset
|
929 for ( i=0; i<numrects; ++i ) { |
028e03e273c8
Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents:
593
diff
changeset
|
930 blitcoords[0] = rects[i].x; |
028e03e273c8
Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents:
593
diff
changeset
|
931 blitcoords[1] = rects[i].y; |
028e03e273c8
Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents:
593
diff
changeset
|
932 blitcoords[2] = blitcoords[0] + rects[i].w - 1; |
028e03e273c8
Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents:
593
diff
changeset
|
933 blitcoords[3] = blitcoords[1] + rects[i].h - 1; |
319
189a6a3416c7
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
305
diff
changeset
|
934 |
736
028e03e273c8
Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents:
593
diff
changeset
|
935 blitcoords[4] = rects[i].x + ((VDI_w - surface->w) >> 1); |
028e03e273c8
Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents:
593
diff
changeset
|
936 blitcoords[5] = rects[i].y + ((VDI_h - surface->h) >> 1); |
028e03e273c8
Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents:
593
diff
changeset
|
937 blitcoords[6] = blitcoords[4] + rects[i].w - 1; |
028e03e273c8
Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents:
593
diff
changeset
|
938 blitcoords[7] = blitcoords[5] + rects[i].h - 1; |
028e03e273c8
Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents:
593
diff
changeset
|
939 |
028e03e273c8
Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents:
593
diff
changeset
|
940 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
|
941 } |
281
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_UpdateRectsWindowed(_THIS, int numrects, SDL_Rect *rects) |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
946 { |
736
028e03e273c8
Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents:
593
diff
changeset
|
947 short pxy[4], wind_pxy[4]; |
281
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
948 int i; |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
949 |
736
028e03e273c8
Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents:
593
diff
changeset
|
950 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
|
951 return; |
028e03e273c8
Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents:
593
diff
changeset
|
952 } |
281
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
953 |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
954 for ( i=0; i<numrects; ++i ) { |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
955 pxy[0] = wind_pxy[0] + rects[i].x; |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
956 pxy[1] = wind_pxy[1] + rects[i].y; |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
957 pxy[2] = rects[i].w; |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
958 pxy[3] = rects[i].h; |
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 GEM_wind_redraw(this, GEM_handle, pxy); |
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 } |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
963 |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
964 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
|
965 { |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
966 SDL_Surface *surface; |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
967 |
964
d9209754ebee
Prevent redraws till internal buffers are correctly setup
Patrice Mandin <patmandin@gmail.com>
parents:
959
diff
changeset
|
968 if (GEM_lock_redraw) { |
d9209754ebee
Prevent redraws till internal buffers are correctly setup
Patrice Mandin <patmandin@gmail.com>
parents:
959
diff
changeset
|
969 return; |
d9209754ebee
Prevent redraws till internal buffers are correctly setup
Patrice Mandin <patmandin@gmail.com>
parents:
959
diff
changeset
|
970 } |
d9209754ebee
Prevent redraws till internal buffers are correctly setup
Patrice Mandin <patmandin@gmail.com>
parents:
959
diff
changeset
|
971 |
281
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
972 surface = this->screen; |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
973 |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
974 if (surface->flags & SDL_FULLSCREEN) { |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
975 GEM_UpdateRectsFullscreen(this, numrects, rects); |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
976 } else { |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
977 GEM_UpdateRectsWindowed(this, numrects, rects); |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
978 } |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
979 } |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
980 |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
981 static int GEM_FlipHWSurfaceFullscreen(_THIS, SDL_Surface *surface) |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
982 { |
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
|
983 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
|
984 |
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
|
985 /* 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
|
986 surf_width=surface->w; |
918
17822f1f9674
Wrongly test if width multiple of 16
Patrice Mandin <patmandin@gmail.com>
parents:
917
diff
changeset
|
987 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
|
988 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
|
989 } |
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
|
990 |
736
028e03e273c8
Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents:
593
diff
changeset
|
991 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
|
992 void *destscr; |
028e03e273c8
Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents:
593
diff
changeset
|
993 int destpitch; |
319
189a6a3416c7
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
305
diff
changeset
|
994 |
736
028e03e273c8
Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents:
593
diff
changeset
|
995 if (GEM_bufops & B2S_C2P_1TOS) { |
281
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
996 int destx; |
736
028e03e273c8
Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents:
593
diff
changeset
|
997 |
281
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
998 destscr = VDI_screen; |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
999 destscr += VDI_pitch * ((VDI_h - surface->h) >> 1); |
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
|
1000 destx = (VDI_w - surf_width) >> 1; |
281
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1001 destx &= ~15; |
319
189a6a3416c7
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
305
diff
changeset
|
1002 destscr += destx; |
736
028e03e273c8
Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents:
593
diff
changeset
|
1003 destpitch = VDI_pitch; |
028e03e273c8
Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents:
593
diff
changeset
|
1004 } else { |
028e03e273c8
Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents:
593
diff
changeset
|
1005 destscr = GEM_buffer2; |
028e03e273c8
Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents:
593
diff
changeset
|
1006 destpitch = surface->pitch; |
281
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1007 } |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1008 |
736
028e03e273c8
Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents:
593
diff
changeset
|
1009 SDL_Atari_C2pConvert( |
028e03e273c8
Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents:
593
diff
changeset
|
1010 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
|
1011 surf_width, surface->h, |
736
028e03e273c8
Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents:
593
diff
changeset
|
1012 SDL_FALSE, |
028e03e273c8
Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents:
593
diff
changeset
|
1013 surface->pitch, destpitch |
028e03e273c8
Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents:
593
diff
changeset
|
1014 ); |
319
189a6a3416c7
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
305
diff
changeset
|
1015 } |
736
028e03e273c8
Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents:
593
diff
changeset
|
1016 |
028e03e273c8
Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents:
593
diff
changeset
|
1017 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
|
1018 MFDB mfdb_src; |
028e03e273c8
Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents:
593
diff
changeset
|
1019 short blitcoords[8]; |
281
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1020 |
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
|
1021 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
|
1022 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
|
1023 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
|
1024 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
|
1025 mfdb_src.fd_stand= |
028e03e273c8
Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents:
593
diff
changeset
|
1026 mfdb_src.fd_r1= |
028e03e273c8
Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents:
593
diff
changeset
|
1027 mfdb_src.fd_r2= |
028e03e273c8
Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents:
593
diff
changeset
|
1028 mfdb_src.fd_r3= 0; |
028e03e273c8
Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents:
593
diff
changeset
|
1029 if (GEM_bufops & B2S_VROCPYFM_1TOS) { |
028e03e273c8
Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents:
593
diff
changeset
|
1030 mfdb_src.fd_addr=surface->pixels; |
028e03e273c8
Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents:
593
diff
changeset
|
1031 } else { |
028e03e273c8
Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents:
593
diff
changeset
|
1032 mfdb_src.fd_addr=GEM_buffer2; |
028e03e273c8
Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents:
593
diff
changeset
|
1033 } |
281
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1034 |
736
028e03e273c8
Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents:
593
diff
changeset
|
1035 blitcoords[0] = 0; |
028e03e273c8
Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents:
593
diff
changeset
|
1036 blitcoords[1] = 0; |
028e03e273c8
Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents:
593
diff
changeset
|
1037 blitcoords[2] = surface->w - 1; |
028e03e273c8
Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents:
593
diff
changeset
|
1038 blitcoords[3] = surface->h - 1; |
028e03e273c8
Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents:
593
diff
changeset
|
1039 |
028e03e273c8
Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents:
593
diff
changeset
|
1040 blitcoords[4] = (VDI_w - surface->w) >> 1; |
028e03e273c8
Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents:
593
diff
changeset
|
1041 blitcoords[5] = (VDI_h - surface->h) >> 1; |
028e03e273c8
Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents:
593
diff
changeset
|
1042 blitcoords[6] = blitcoords[4] + surface->w - 1; |
028e03e273c8
Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents:
593
diff
changeset
|
1043 blitcoords[7] = blitcoords[5] + surface->h - 1; |
028e03e273c8
Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents:
593
diff
changeset
|
1044 |
028e03e273c8
Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents:
593
diff
changeset
|
1045 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
|
1046 } |
281
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 return(0); |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1049 } |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1050 |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1051 static int GEM_FlipHWSurfaceWindowed(_THIS, SDL_Surface *surface) |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1052 { |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1053 short pxy[8]; |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1054 |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1055 /* Update the whole window */ |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1056 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
|
1057 |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1058 GEM_wind_redraw(this, GEM_handle, pxy); |
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 return(0); |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1061 } |
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 static int GEM_FlipHWSurface(_THIS, SDL_Surface *surface) |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1064 { |
964
d9209754ebee
Prevent redraws till internal buffers are correctly setup
Patrice Mandin <patmandin@gmail.com>
parents:
959
diff
changeset
|
1065 if (GEM_lock_redraw) { |
d9209754ebee
Prevent redraws till internal buffers are correctly setup
Patrice Mandin <patmandin@gmail.com>
parents:
959
diff
changeset
|
1066 return(0); |
d9209754ebee
Prevent redraws till internal buffers are correctly setup
Patrice Mandin <patmandin@gmail.com>
parents:
959
diff
changeset
|
1067 } |
d9209754ebee
Prevent redraws till internal buffers are correctly setup
Patrice Mandin <patmandin@gmail.com>
parents:
959
diff
changeset
|
1068 |
281
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1069 if (surface->flags & SDL_FULLSCREEN) { |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1070 return GEM_FlipHWSurfaceFullscreen(this, surface); |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1071 } else { |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1072 return GEM_FlipHWSurfaceWindowed(this, surface); |
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 } |
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 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
|
1077 { |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1078 int i; |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1079 SDL_Surface *surface; |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1080 |
736
028e03e273c8
Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents:
593
diff
changeset
|
1081 #ifdef DEBUG_VIDEO_GEM |
028e03e273c8
Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents:
593
diff
changeset
|
1082 printf("sdl:video:gem: setcolors()\n"); |
028e03e273c8
Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents:
593
diff
changeset
|
1083 #endif |
028e03e273c8
Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents:
593
diff
changeset
|
1084 |
281
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1085 /* Do not change palette in True Colour */ |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1086 surface = this->screen; |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1087 if (surface->format->BitsPerPixel > 8) { |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1088 return 1; |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1089 } |
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 for(i = 0; i < ncolors; i++) |
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 int r, g, b; |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1094 short rgb[3]; |
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 r = colors[i].r; |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1097 g = colors[i].g; |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1098 b = colors[i].b; |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1099 |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1100 rgb[0] = (1000 * r) / 255; |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1101 rgb[1] = (1000 * g) / 255; |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1102 rgb[2] = (1000 * b) / 255; |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1103 |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1104 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
|
1105 } |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1106 |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1107 return(1); |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1108 } |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1109 |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1110 #if 0 |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1111 static int GEM_ToggleFullScreen(_THIS, int on) |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1112 { |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1113 if (on) { |
319
189a6a3416c7
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
305
diff
changeset
|
1114 GEM_LockScreen(this); |
281
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1115 } else { |
319
189a6a3416c7
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
305
diff
changeset
|
1116 GEM_UnlockScreen(this); |
281
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1117 } |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1118 |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1119 return(1); |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1120 } |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1121 #endif |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1122 |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1123 /* 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
|
1124 another SDL video routine -- notably UpdateRects. |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1125 */ |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1126 void GEM_VideoQuit(_THIS) |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1127 { |
305
9c6613983e85
Atari port cleanups from Patrice
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
1128 SDL_AtariXbios_RestoreVectors(); |
9c6613983e85
Atari port cleanups from Patrice
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
1129 |
281
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1130 GEM_FreeBuffers(this); |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1131 |
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
|
1132 /* 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
|
1133 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
|
1134 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
|
1135 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
|
1136 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
|
1137 } |
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
|
1138 |
319
189a6a3416c7
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
305
diff
changeset
|
1139 GEM_UnlockScreen(this); |
281
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 appl_exit(); |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1142 |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1143 /* Restore palette */ |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1144 if (VDI_oldnumcolors) { |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1145 int i; |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1146 |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1147 for(i = 0; i < VDI_oldnumcolors; i++) { |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1148 short rgb[3]; |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1149 |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1150 rgb[0] = VDI_oldpalette[i][0]; |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1151 rgb[1] = VDI_oldpalette[i][1]; |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1152 rgb[2] = VDI_oldpalette[i][2]; |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1153 |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1154 vs_color(VDI_handle, i, rgb); |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1155 } |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1156 } |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1157 |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1158 /* Close VDI workstation */ |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1159 if (VDI_handle) { |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1160 v_clsvwk(VDI_handle); |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1161 } |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1162 |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1163 /* Free mode list */ |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1164 if (SDL_modelist[0]) { |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1165 free(SDL_modelist[0]); |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1166 SDL_modelist[0]=NULL; |
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 this->screen->pixels = NULL; |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1170 } |
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 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
|
1173 { |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1174 short todo[4]; |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1175 |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1176 /* Tell AES we are going to update */ |
319
189a6a3416c7
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
305
diff
changeset
|
1177 wind_update(BEG_UPDATE); |
281
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1178 |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1179 v_hide_c(VDI_handle); |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1180 |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1181 /* 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
|
1182 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
|
1183 |
736
028e03e273c8
Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents:
593
diff
changeset
|
1184 while (todo[2] && todo[3]) { |
281
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1185 |
736
028e03e273c8
Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents:
593
diff
changeset
|
1186 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
|
1187 todo[2] += todo[0]-1; |
028e03e273c8
Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents:
593
diff
changeset
|
1188 todo[3] += todo[1]-1; |
028e03e273c8
Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents:
593
diff
changeset
|
1189 refresh_window(this, winhandle, todo); |
028e03e273c8
Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents:
593
diff
changeset
|
1190 } |
028e03e273c8
Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents:
593
diff
changeset
|
1191 |
028e03e273c8
Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents:
593
diff
changeset
|
1192 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
|
1193 break; |
028e03e273c8
Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents:
593
diff
changeset
|
1194 } |
281
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1195 } |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1196 |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1197 } |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1198 |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1199 /* Update finished */ |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1200 wind_update(END_UPDATE); |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1201 |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1202 v_show_c(VDI_handle,1); |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1203 } |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1204 |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1205 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
|
1206 { |
736
028e03e273c8
Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents:
593
diff
changeset
|
1207 MFDB mfdb_src; |
028e03e273c8
Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents:
593
diff
changeset
|
1208 short pxy[8],wind_pxy[8]; |
028e03e273c8
Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents:
593
diff
changeset
|
1209 SDL_Surface *surface; |
281
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1210 int iconified; |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1211 |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1212 /* Is window iconified ? */ |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1213 iconified = 0; |
736
028e03e273c8
Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents:
593
diff
changeset
|
1214 /* if (GEM_wfeatures & (1<<WF_ICONIFY))*/ { |
028e03e273c8
Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents:
593
diff
changeset
|
1215 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
|
1216 iconified = wind_pxy[0]; |
028e03e273c8
Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents:
593
diff
changeset
|
1217 } |
028e03e273c8
Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents:
593
diff
changeset
|
1218 } |
028e03e273c8
Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents:
593
diff
changeset
|
1219 |
028e03e273c8
Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents:
593
diff
changeset
|
1220 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
|
1221 return; |
281
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1222 } |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1223 |
736
028e03e273c8
Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents:
593
diff
changeset
|
1224 if (iconified && GEM_icon) { |
028e03e273c8
Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents:
593
diff
changeset
|
1225 short icon_rect[4], dst_rect[4]; |
737
7e4347dd2f9c
Small fix for iconification
Patrice Mandin <patmandin@gmail.com>
parents:
736
diff
changeset
|
1226 short iconx,icony; |
736
028e03e273c8
Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents:
593
diff
changeset
|
1227 |
028e03e273c8
Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents:
593
diff
changeset
|
1228 surface = GEM_icon; |
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 GEM_ClearRect(this, rect); |
028e03e273c8
Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents:
593
diff
changeset
|
1231 |
028e03e273c8
Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents:
593
diff
changeset
|
1232 /* 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
|
1233 iconx = (wind_pxy[2]-surface->w)>>1; |
7e4347dd2f9c
Small fix for iconification
Patrice Mandin <patmandin@gmail.com>
parents:
736
diff
changeset
|
1234 icony = (wind_pxy[3]-surface->h)>>1; |
7e4347dd2f9c
Small fix for iconification
Patrice Mandin <patmandin@gmail.com>
parents:
736
diff
changeset
|
1235 |
7e4347dd2f9c
Small fix for iconification
Patrice Mandin <patmandin@gmail.com>
parents:
736
diff
changeset
|
1236 icon_rect[0] = iconx; |
7e4347dd2f9c
Small fix for iconification
Patrice Mandin <patmandin@gmail.com>
parents:
736
diff
changeset
|
1237 icon_rect[1] = icony; |
736
028e03e273c8
Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents:
593
diff
changeset
|
1238 icon_rect[2] = surface->w; |
028e03e273c8
Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents:
593
diff
changeset
|
1239 icon_rect[3] = surface->h; |
028e03e273c8
Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents:
593
diff
changeset
|
1240 |
028e03e273c8
Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents:
593
diff
changeset
|
1241 /* 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
|
1242 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
|
1243 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
|
1244 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
|
1245 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
|
1246 |
028e03e273c8
Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents:
593
diff
changeset
|
1247 /* 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
|
1248 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
|
1249 return; |
028e03e273c8
Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents:
593
diff
changeset
|
1250 } |
028e03e273c8
Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents:
593
diff
changeset
|
1251 |
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
|
1252 #if DEBUG_VIDEO_GEM |
736
028e03e273c8
Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents:
593
diff
changeset
|
1253 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
|
1254 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
|
1255 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
|
1256 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
|
1257 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
|
1258 #endif |
028e03e273c8
Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents:
593
diff
changeset
|
1259 |
028e03e273c8
Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents:
593
diff
changeset
|
1260 /* 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
|
1261 icon_rect[0] += wind_pxy[0]; |
028e03e273c8
Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents:
593
diff
changeset
|
1262 icon_rect[1] += wind_pxy[1]; |
028e03e273c8
Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents:
593
diff
changeset
|
1263 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
|
1264 icon_rect[3] += icon_rect[1]-1; |
281
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1265 |
736
028e03e273c8
Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents:
593
diff
changeset
|
1266 /* Calculate intersection rectangle to redraw */ |
737
7e4347dd2f9c
Small fix for iconification
Patrice Mandin <patmandin@gmail.com>
parents:
736
diff
changeset
|
1267 pxy[4]=pxy[0]=MAX(icon_rect[0],rect[0]); |
7e4347dd2f9c
Small fix for iconification
Patrice Mandin <patmandin@gmail.com>
parents:
736
diff
changeset
|
1268 pxy[5]=pxy[1]=MAX(icon_rect[1],rect[1]); |
7e4347dd2f9c
Small fix for iconification
Patrice Mandin <patmandin@gmail.com>
parents:
736
diff
changeset
|
1269 pxy[6]=pxy[2]=MIN(icon_rect[2],rect[2]); |
7e4347dd2f9c
Small fix for iconification
Patrice Mandin <patmandin@gmail.com>
parents:
736
diff
changeset
|
1270 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
|
1271 |
737
7e4347dd2f9c
Small fix for iconification
Patrice Mandin <patmandin@gmail.com>
parents:
736
diff
changeset
|
1272 /* Calculate icon source image pos relative to window */ |
7e4347dd2f9c
Small fix for iconification
Patrice Mandin <patmandin@gmail.com>
parents:
736
diff
changeset
|
1273 pxy[0] -= wind_pxy[0]+iconx; |
7e4347dd2f9c
Small fix for iconification
Patrice Mandin <patmandin@gmail.com>
parents:
736
diff
changeset
|
1274 pxy[1] -= wind_pxy[1]+icony; |
7e4347dd2f9c
Small fix for iconification
Patrice Mandin <patmandin@gmail.com>
parents:
736
diff
changeset
|
1275 pxy[2] -= wind_pxy[0]+iconx; |
7e4347dd2f9c
Small fix for iconification
Patrice Mandin <patmandin@gmail.com>
parents:
736
diff
changeset
|
1276 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
|
1277 |
281
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1278 } else { |
736
028e03e273c8
Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents:
593
diff
changeset
|
1279 surface = this->screen; |
028e03e273c8
Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents:
593
diff
changeset
|
1280 |
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
|
1281 #if DEBUG_VIDEO_GEM |
736
028e03e273c8
Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents:
593
diff
changeset
|
1282 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
|
1283 #endif |
028e03e273c8
Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents:
593
diff
changeset
|
1284 |
028e03e273c8
Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents:
593
diff
changeset
|
1285 /* Redraw all window content */ |
028e03e273c8
Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents:
593
diff
changeset
|
1286 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
|
1287 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
|
1288 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
|
1289 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
|
1290 |
028e03e273c8
Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents:
593
diff
changeset
|
1291 pxy[4] = rect[0]; |
028e03e273c8
Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents:
593
diff
changeset
|
1292 pxy[5] = rect[1]; |
028e03e273c8
Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents:
593
diff
changeset
|
1293 pxy[6] = rect[2]; |
028e03e273c8
Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents:
593
diff
changeset
|
1294 pxy[7] = rect[3]; |
281
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1295 } |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1296 |
736
028e03e273c8
Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents:
593
diff
changeset
|
1297 if (GEM_bufops & B2S_C2P_1TO2) { |
028e03e273c8
Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents:
593
diff
changeset
|
1298 void *src, *dest; |
028e03e273c8
Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents:
593
diff
changeset
|
1299 int x1,x2; |
028e03e273c8
Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents:
593
diff
changeset
|
1300 |
028e03e273c8
Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents:
593
diff
changeset
|
1301 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
|
1302 x2 = rect[2]-wind_pxy[0]; |
028e03e273c8
Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents:
593
diff
changeset
|
1303 if (x2 & 15) { |
028e03e273c8
Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents:
593
diff
changeset
|
1304 x2 = (x2 | 15) +1; |
028e03e273c8
Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents:
593
diff
changeset
|
1305 } |
028e03e273c8
Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents:
593
diff
changeset
|
1306 |
028e03e273c8
Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents:
593
diff
changeset
|
1307 src = surface->pixels; |
028e03e273c8
Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents:
593
diff
changeset
|
1308 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
|
1309 src += x1; |
028e03e273c8
Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents:
593
diff
changeset
|
1310 |
028e03e273c8
Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents:
593
diff
changeset
|
1311 dest = GEM_buffer2; |
028e03e273c8
Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents:
593
diff
changeset
|
1312 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
|
1313 dest += x1; |
281
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1314 |
736
028e03e273c8
Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents:
593
diff
changeset
|
1315 SDL_Atari_C2pConvert( |
028e03e273c8
Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents:
593
diff
changeset
|
1316 src, dest, |
028e03e273c8
Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents:
593
diff
changeset
|
1317 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
|
1318 SDL_FALSE, |
028e03e273c8
Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents:
593
diff
changeset
|
1319 surface->pitch, surface->pitch |
028e03e273c8
Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents:
593
diff
changeset
|
1320 ); |
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 |
028e03e273c8
Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents:
593
diff
changeset
|
1323 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
|
1324 { |
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
|
1325 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
|
1326 |
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
|
1327 /* 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
|
1328 width=surface->w; |
918
17822f1f9674
Wrongly test if width multiple of 16
Patrice Mandin <patmandin@gmail.com>
parents:
917
diff
changeset
|
1329 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
|
1330 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
|
1331 } |
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
|
1332 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
|
1333 } |
736
028e03e273c8
Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents:
593
diff
changeset
|
1334 mfdb_src.fd_h=surface->h; |
028e03e273c8
Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents:
593
diff
changeset
|
1335 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
|
1336 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
|
1337 mfdb_src.fd_stand= |
028e03e273c8
Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents:
593
diff
changeset
|
1338 mfdb_src.fd_r1= |
028e03e273c8
Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents:
593
diff
changeset
|
1339 mfdb_src.fd_r2= |
028e03e273c8
Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents:
593
diff
changeset
|
1340 mfdb_src.fd_r3= 0; |
028e03e273c8
Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents:
593
diff
changeset
|
1341 |
028e03e273c8
Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents:
593
diff
changeset
|
1342 if (GEM_bufops & B2S_VROCPYFM_2TOS) { |
028e03e273c8
Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents:
593
diff
changeset
|
1343 mfdb_src.fd_addr=GEM_buffer2; |
028e03e273c8
Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents:
593
diff
changeset
|
1344 } |
028e03e273c8
Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents:
593
diff
changeset
|
1345 |
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
|
1346 #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
|
1347 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
|
1348 surface->w, surface->h, |
736
028e03e273c8
Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents:
593
diff
changeset
|
1349 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
|
1350 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
|
1351 ); |
028e03e273c8
Use new C2P routine + corrections for iconification window
Patrice Mandin <patmandin@gmail.com>
parents:
593
diff
changeset
|
1352 #endif |
281
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1353 |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1354 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
|
1355 } |
984
44fd54a0ae5f
Add OSMesa OpenGL support to the Atari GEM video driver
Patrice Mandin <patmandin@gmail.com>
parents:
964
diff
changeset
|
1356 |
44fd54a0ae5f
Add OSMesa OpenGL support to the Atari GEM video driver
Patrice Mandin <patmandin@gmail.com>
parents:
964
diff
changeset
|
1357 #ifdef HAVE_OPENGL |
44fd54a0ae5f
Add OSMesa OpenGL support to the Atari GEM video driver
Patrice Mandin <patmandin@gmail.com>
parents:
964
diff
changeset
|
1358 |
44fd54a0ae5f
Add OSMesa OpenGL support to the Atari GEM video driver
Patrice Mandin <patmandin@gmail.com>
parents:
964
diff
changeset
|
1359 static int GEM_GL_LoadLibrary(_THIS, const char *path) |
44fd54a0ae5f
Add OSMesa OpenGL support to the Atari GEM video driver
Patrice Mandin <patmandin@gmail.com>
parents:
964
diff
changeset
|
1360 { |
44fd54a0ae5f
Add OSMesa OpenGL support to the Atari GEM video driver
Patrice Mandin <patmandin@gmail.com>
parents:
964
diff
changeset
|
1361 /* Library is always opened */ |
44fd54a0ae5f
Add OSMesa OpenGL support to the Atari GEM video driver
Patrice Mandin <patmandin@gmail.com>
parents:
964
diff
changeset
|
1362 this->gl_config.driver_loaded = 1; |
44fd54a0ae5f
Add OSMesa OpenGL support to the Atari GEM video driver
Patrice Mandin <patmandin@gmail.com>
parents:
964
diff
changeset
|
1363 |
44fd54a0ae5f
Add OSMesa OpenGL support to the Atari GEM video driver
Patrice Mandin <patmandin@gmail.com>
parents:
964
diff
changeset
|
1364 return 0; |
44fd54a0ae5f
Add OSMesa OpenGL support to the Atari GEM video driver
Patrice Mandin <patmandin@gmail.com>
parents:
964
diff
changeset
|
1365 } |
44fd54a0ae5f
Add OSMesa OpenGL support to the Atari GEM video driver
Patrice Mandin <patmandin@gmail.com>
parents:
964
diff
changeset
|
1366 |
44fd54a0ae5f
Add OSMesa OpenGL support to the Atari GEM video driver
Patrice Mandin <patmandin@gmail.com>
parents:
964
diff
changeset
|
1367 static void *GEM_GL_GetProcAddress(_THIS, const char *proc) |
44fd54a0ae5f
Add OSMesa OpenGL support to the Atari GEM video driver
Patrice Mandin <patmandin@gmail.com>
parents:
964
diff
changeset
|
1368 { |
44fd54a0ae5f
Add OSMesa OpenGL support to the Atari GEM video driver
Patrice Mandin <patmandin@gmail.com>
parents:
964
diff
changeset
|
1369 void *func = NULL; |
44fd54a0ae5f
Add OSMesa OpenGL support to the Atari GEM video driver
Patrice Mandin <patmandin@gmail.com>
parents:
964
diff
changeset
|
1370 |
44fd54a0ae5f
Add OSMesa OpenGL support to the Atari GEM video driver
Patrice Mandin <patmandin@gmail.com>
parents:
964
diff
changeset
|
1371 if (GEM_ctx != NULL) { |
44fd54a0ae5f
Add OSMesa OpenGL support to the Atari GEM video driver
Patrice Mandin <patmandin@gmail.com>
parents:
964
diff
changeset
|
1372 func = OSMesaGetProcAddress(proc); |
44fd54a0ae5f
Add OSMesa OpenGL support to the Atari GEM video driver
Patrice Mandin <patmandin@gmail.com>
parents:
964
diff
changeset
|
1373 } |
44fd54a0ae5f
Add OSMesa OpenGL support to the Atari GEM video driver
Patrice Mandin <patmandin@gmail.com>
parents:
964
diff
changeset
|
1374 |
44fd54a0ae5f
Add OSMesa OpenGL support to the Atari GEM video driver
Patrice Mandin <patmandin@gmail.com>
parents:
964
diff
changeset
|
1375 return func; |
44fd54a0ae5f
Add OSMesa OpenGL support to the Atari GEM video driver
Patrice Mandin <patmandin@gmail.com>
parents:
964
diff
changeset
|
1376 } |
44fd54a0ae5f
Add OSMesa OpenGL support to the Atari GEM video driver
Patrice Mandin <patmandin@gmail.com>
parents:
964
diff
changeset
|
1377 |
44fd54a0ae5f
Add OSMesa OpenGL support to the Atari GEM video driver
Patrice Mandin <patmandin@gmail.com>
parents:
964
diff
changeset
|
1378 static int GEM_GL_GetAttribute(_THIS, SDL_GLattr attrib, int* value) |
44fd54a0ae5f
Add OSMesa OpenGL support to the Atari GEM video driver
Patrice Mandin <patmandin@gmail.com>
parents:
964
diff
changeset
|
1379 { |
44fd54a0ae5f
Add OSMesa OpenGL support to the Atari GEM video driver
Patrice Mandin <patmandin@gmail.com>
parents:
964
diff
changeset
|
1380 GLenum mesa_attrib; |
44fd54a0ae5f
Add OSMesa OpenGL support to the Atari GEM video driver
Patrice Mandin <patmandin@gmail.com>
parents:
964
diff
changeset
|
1381 |
44fd54a0ae5f
Add OSMesa OpenGL support to the Atari GEM video driver
Patrice Mandin <patmandin@gmail.com>
parents:
964
diff
changeset
|
1382 if (GEM_ctx == NULL) { |
44fd54a0ae5f
Add OSMesa OpenGL support to the Atari GEM video driver
Patrice Mandin <patmandin@gmail.com>
parents:
964
diff
changeset
|
1383 return -1; |
44fd54a0ae5f
Add OSMesa OpenGL support to the Atari GEM video driver
Patrice Mandin <patmandin@gmail.com>
parents:
964
diff
changeset
|
1384 } |
44fd54a0ae5f
Add OSMesa OpenGL support to the Atari GEM video driver
Patrice Mandin <patmandin@gmail.com>
parents:
964
diff
changeset
|
1385 |
44fd54a0ae5f
Add OSMesa OpenGL support to the Atari GEM video driver
Patrice Mandin <patmandin@gmail.com>
parents:
964
diff
changeset
|
1386 switch(attrib) { |
44fd54a0ae5f
Add OSMesa OpenGL support to the Atari GEM video driver
Patrice Mandin <patmandin@gmail.com>
parents:
964
diff
changeset
|
1387 case SDL_GL_RED_SIZE: |
44fd54a0ae5f
Add OSMesa OpenGL support to the Atari GEM video driver
Patrice Mandin <patmandin@gmail.com>
parents:
964
diff
changeset
|
1388 mesa_attrib = GL_RED_BITS; |
44fd54a0ae5f
Add OSMesa OpenGL support to the Atari GEM video driver
Patrice Mandin <patmandin@gmail.com>
parents:
964
diff
changeset
|
1389 break; |
44fd54a0ae5f
Add OSMesa OpenGL support to the Atari GEM video driver
Patrice Mandin <patmandin@gmail.com>
parents:
964
diff
changeset
|
1390 case SDL_GL_GREEN_SIZE: |
44fd54a0ae5f
Add OSMesa OpenGL support to the Atari GEM video driver
Patrice Mandin <patmandin@gmail.com>
parents:
964
diff
changeset
|
1391 mesa_attrib = GL_GREEN_BITS; |
44fd54a0ae5f
Add OSMesa OpenGL support to the Atari GEM video driver
Patrice Mandin <patmandin@gmail.com>
parents:
964
diff
changeset
|
1392 break; |
44fd54a0ae5f
Add OSMesa OpenGL support to the Atari GEM video driver
Patrice Mandin <patmandin@gmail.com>
parents:
964
diff
changeset
|
1393 case SDL_GL_BLUE_SIZE: |
44fd54a0ae5f
Add OSMesa OpenGL support to the Atari GEM video driver
Patrice Mandin <patmandin@gmail.com>
parents:
964
diff
changeset
|
1394 mesa_attrib = GL_BLUE_BITS; |
44fd54a0ae5f
Add OSMesa OpenGL support to the Atari GEM video driver
Patrice Mandin <patmandin@gmail.com>
parents:
964
diff
changeset
|
1395 break; |
44fd54a0ae5f
Add OSMesa OpenGL support to the Atari GEM video driver
Patrice Mandin <patmandin@gmail.com>
parents:
964
diff
changeset
|
1396 case SDL_GL_ALPHA_SIZE: |
44fd54a0ae5f
Add OSMesa OpenGL support to the Atari GEM video driver
Patrice Mandin <patmandin@gmail.com>
parents:
964
diff
changeset
|
1397 mesa_attrib = GL_ALPHA_BITS; |
44fd54a0ae5f
Add OSMesa OpenGL support to the Atari GEM video driver
Patrice Mandin <patmandin@gmail.com>
parents:
964
diff
changeset
|
1398 break; |
44fd54a0ae5f
Add OSMesa OpenGL support to the Atari GEM video driver
Patrice Mandin <patmandin@gmail.com>
parents:
964
diff
changeset
|
1399 case SDL_GL_DOUBLEBUFFER: |
44fd54a0ae5f
Add OSMesa OpenGL support to the Atari GEM video driver
Patrice Mandin <patmandin@gmail.com>
parents:
964
diff
changeset
|
1400 mesa_attrib = GL_DOUBLEBUFFER; |
44fd54a0ae5f
Add OSMesa OpenGL support to the Atari GEM video driver
Patrice Mandin <patmandin@gmail.com>
parents:
964
diff
changeset
|
1401 break; |
44fd54a0ae5f
Add OSMesa OpenGL support to the Atari GEM video driver
Patrice Mandin <patmandin@gmail.com>
parents:
964
diff
changeset
|
1402 case SDL_GL_DEPTH_SIZE: |
44fd54a0ae5f
Add OSMesa OpenGL support to the Atari GEM video driver
Patrice Mandin <patmandin@gmail.com>
parents:
964
diff
changeset
|
1403 mesa_attrib = GL_DEPTH_BITS; |
44fd54a0ae5f
Add OSMesa OpenGL support to the Atari GEM video driver
Patrice Mandin <patmandin@gmail.com>
parents:
964
diff
changeset
|
1404 break; |
44fd54a0ae5f
Add OSMesa OpenGL support to the Atari GEM video driver
Patrice Mandin <patmandin@gmail.com>
parents:
964
diff
changeset
|
1405 case SDL_GL_STENCIL_SIZE: |
44fd54a0ae5f
Add OSMesa OpenGL support to the Atari GEM video driver
Patrice Mandin <patmandin@gmail.com>
parents:
964
diff
changeset
|
1406 mesa_attrib = GL_STENCIL_BITS; |
44fd54a0ae5f
Add OSMesa OpenGL support to the Atari GEM video driver
Patrice Mandin <patmandin@gmail.com>
parents:
964
diff
changeset
|
1407 break; |
44fd54a0ae5f
Add OSMesa OpenGL support to the Atari GEM video driver
Patrice Mandin <patmandin@gmail.com>
parents:
964
diff
changeset
|
1408 case SDL_GL_ACCUM_RED_SIZE: |
44fd54a0ae5f
Add OSMesa OpenGL support to the Atari GEM video driver
Patrice Mandin <patmandin@gmail.com>
parents:
964
diff
changeset
|
1409 mesa_attrib = GL_ACCUM_RED_BITS; |
44fd54a0ae5f
Add OSMesa OpenGL support to the Atari GEM video driver
Patrice Mandin <patmandin@gmail.com>
parents:
964
diff
changeset
|
1410 break; |
44fd54a0ae5f
Add OSMesa OpenGL support to the Atari GEM video driver
Patrice Mandin <patmandin@gmail.com>
parents:
964
diff
changeset
|
1411 case SDL_GL_ACCUM_GREEN_SIZE: |
44fd54a0ae5f
Add OSMesa OpenGL support to the Atari GEM video driver
Patrice Mandin <patmandin@gmail.com>
parents:
964
diff
changeset
|
1412 mesa_attrib = GL_ACCUM_GREEN_BITS; |
44fd54a0ae5f
Add OSMesa OpenGL support to the Atari GEM video driver
Patrice Mandin <patmandin@gmail.com>
parents:
964
diff
changeset
|
1413 break; |
44fd54a0ae5f
Add OSMesa OpenGL support to the Atari GEM video driver
Patrice Mandin <patmandin@gmail.com>
parents:
964
diff
changeset
|
1414 case SDL_GL_ACCUM_BLUE_SIZE: |
44fd54a0ae5f
Add OSMesa OpenGL support to the Atari GEM video driver
Patrice Mandin <patmandin@gmail.com>
parents:
964
diff
changeset
|
1415 mesa_attrib = GL_ACCUM_BLUE_BITS; |
44fd54a0ae5f
Add OSMesa OpenGL support to the Atari GEM video driver
Patrice Mandin <patmandin@gmail.com>
parents:
964
diff
changeset
|
1416 break; |
44fd54a0ae5f
Add OSMesa OpenGL support to the Atari GEM video driver
Patrice Mandin <patmandin@gmail.com>
parents:
964
diff
changeset
|
1417 case SDL_GL_ACCUM_ALPHA_SIZE: |
44fd54a0ae5f
Add OSMesa OpenGL support to the Atari GEM video driver
Patrice Mandin <patmandin@gmail.com>
parents:
964
diff
changeset
|
1418 mesa_attrib = GL_ACCUM_ALPHA_BITS; |
44fd54a0ae5f
Add OSMesa OpenGL support to the Atari GEM video driver
Patrice Mandin <patmandin@gmail.com>
parents:
964
diff
changeset
|
1419 break; |
44fd54a0ae5f
Add OSMesa OpenGL support to the Atari GEM video driver
Patrice Mandin <patmandin@gmail.com>
parents:
964
diff
changeset
|
1420 default : |
44fd54a0ae5f
Add OSMesa OpenGL support to the Atari GEM video driver
Patrice Mandin <patmandin@gmail.com>
parents:
964
diff
changeset
|
1421 return -1; |
44fd54a0ae5f
Add OSMesa OpenGL support to the Atari GEM video driver
Patrice Mandin <patmandin@gmail.com>
parents:
964
diff
changeset
|
1422 } |
44fd54a0ae5f
Add OSMesa OpenGL support to the Atari GEM video driver
Patrice Mandin <patmandin@gmail.com>
parents:
964
diff
changeset
|
1423 |
44fd54a0ae5f
Add OSMesa OpenGL support to the Atari GEM video driver
Patrice Mandin <patmandin@gmail.com>
parents:
964
diff
changeset
|
1424 glGetIntegerv(mesa_attrib, value); |
44fd54a0ae5f
Add OSMesa OpenGL support to the Atari GEM video driver
Patrice Mandin <patmandin@gmail.com>
parents:
964
diff
changeset
|
1425 return 0; |
44fd54a0ae5f
Add OSMesa OpenGL support to the Atari GEM video driver
Patrice Mandin <patmandin@gmail.com>
parents:
964
diff
changeset
|
1426 } |
44fd54a0ae5f
Add OSMesa OpenGL support to the Atari GEM video driver
Patrice Mandin <patmandin@gmail.com>
parents:
964
diff
changeset
|
1427 |
44fd54a0ae5f
Add OSMesa OpenGL support to the Atari GEM video driver
Patrice Mandin <patmandin@gmail.com>
parents:
964
diff
changeset
|
1428 static int GEM_GL_MakeCurrent(_THIS) |
44fd54a0ae5f
Add OSMesa OpenGL support to the Atari GEM video driver
Patrice Mandin <patmandin@gmail.com>
parents:
964
diff
changeset
|
1429 { |
44fd54a0ae5f
Add OSMesa OpenGL support to the Atari GEM video driver
Patrice Mandin <patmandin@gmail.com>
parents:
964
diff
changeset
|
1430 SDL_Surface *surface; |
44fd54a0ae5f
Add OSMesa OpenGL support to the Atari GEM video driver
Patrice Mandin <patmandin@gmail.com>
parents:
964
diff
changeset
|
1431 GLenum type; |
44fd54a0ae5f
Add OSMesa OpenGL support to the Atari GEM video driver
Patrice Mandin <patmandin@gmail.com>
parents:
964
diff
changeset
|
1432 |
44fd54a0ae5f
Add OSMesa OpenGL support to the Atari GEM video driver
Patrice Mandin <patmandin@gmail.com>
parents:
964
diff
changeset
|
1433 if (GEM_ctx == NULL) { |
44fd54a0ae5f
Add OSMesa OpenGL support to the Atari GEM video driver
Patrice Mandin <patmandin@gmail.com>
parents:
964
diff
changeset
|
1434 return -1; |
44fd54a0ae5f
Add OSMesa OpenGL support to the Atari GEM video driver
Patrice Mandin <patmandin@gmail.com>
parents:
964
diff
changeset
|
1435 } |
44fd54a0ae5f
Add OSMesa OpenGL support to the Atari GEM video driver
Patrice Mandin <patmandin@gmail.com>
parents:
964
diff
changeset
|
1436 |
44fd54a0ae5f
Add OSMesa OpenGL support to the Atari GEM video driver
Patrice Mandin <patmandin@gmail.com>
parents:
964
diff
changeset
|
1437 surface = this->screen; |
44fd54a0ae5f
Add OSMesa OpenGL support to the Atari GEM video driver
Patrice Mandin <patmandin@gmail.com>
parents:
964
diff
changeset
|
1438 |
44fd54a0ae5f
Add OSMesa OpenGL support to the Atari GEM video driver
Patrice Mandin <patmandin@gmail.com>
parents:
964
diff
changeset
|
1439 if ((surface->format->BitsPerPixel == 15) || (surface->format->BitsPerPixel == 16)) { |
44fd54a0ae5f
Add OSMesa OpenGL support to the Atari GEM video driver
Patrice Mandin <patmandin@gmail.com>
parents:
964
diff
changeset
|
1440 type = GL_UNSIGNED_SHORT_5_6_5; |
44fd54a0ae5f
Add OSMesa OpenGL support to the Atari GEM video driver
Patrice Mandin <patmandin@gmail.com>
parents:
964
diff
changeset
|
1441 } else { |
44fd54a0ae5f
Add OSMesa OpenGL support to the Atari GEM video driver
Patrice Mandin <patmandin@gmail.com>
parents:
964
diff
changeset
|
1442 type = GL_UNSIGNED_BYTE; |
44fd54a0ae5f
Add OSMesa OpenGL support to the Atari GEM video driver
Patrice Mandin <patmandin@gmail.com>
parents:
964
diff
changeset
|
1443 } |
44fd54a0ae5f
Add OSMesa OpenGL support to the Atari GEM video driver
Patrice Mandin <patmandin@gmail.com>
parents:
964
diff
changeset
|
1444 |
44fd54a0ae5f
Add OSMesa OpenGL support to the Atari GEM video driver
Patrice Mandin <patmandin@gmail.com>
parents:
964
diff
changeset
|
1445 if (!OSMesaMakeCurrent(GEM_ctx, surface->pixels, type, surface->w, surface->h)) { |
44fd54a0ae5f
Add OSMesa OpenGL support to the Atari GEM video driver
Patrice Mandin <patmandin@gmail.com>
parents:
964
diff
changeset
|
1446 SDL_SetError("Can not make OpenGL context current"); |
44fd54a0ae5f
Add OSMesa OpenGL support to the Atari GEM video driver
Patrice Mandin <patmandin@gmail.com>
parents:
964
diff
changeset
|
1447 return -1; |
44fd54a0ae5f
Add OSMesa OpenGL support to the Atari GEM video driver
Patrice Mandin <patmandin@gmail.com>
parents:
964
diff
changeset
|
1448 } |
44fd54a0ae5f
Add OSMesa OpenGL support to the Atari GEM video driver
Patrice Mandin <patmandin@gmail.com>
parents:
964
diff
changeset
|
1449 |
44fd54a0ae5f
Add OSMesa OpenGL support to the Atari GEM video driver
Patrice Mandin <patmandin@gmail.com>
parents:
964
diff
changeset
|
1450 /* OSMesa draws upside down */ |
44fd54a0ae5f
Add OSMesa OpenGL support to the Atari GEM video driver
Patrice Mandin <patmandin@gmail.com>
parents:
964
diff
changeset
|
1451 OSMesaPixelStore(OSMESA_Y_UP, 0); |
44fd54a0ae5f
Add OSMesa OpenGL support to the Atari GEM video driver
Patrice Mandin <patmandin@gmail.com>
parents:
964
diff
changeset
|
1452 |
44fd54a0ae5f
Add OSMesa OpenGL support to the Atari GEM video driver
Patrice Mandin <patmandin@gmail.com>
parents:
964
diff
changeset
|
1453 return 0; |
44fd54a0ae5f
Add OSMesa OpenGL support to the Atari GEM video driver
Patrice Mandin <patmandin@gmail.com>
parents:
964
diff
changeset
|
1454 } |
44fd54a0ae5f
Add OSMesa OpenGL support to the Atari GEM video driver
Patrice Mandin <patmandin@gmail.com>
parents:
964
diff
changeset
|
1455 |
44fd54a0ae5f
Add OSMesa OpenGL support to the Atari GEM video driver
Patrice Mandin <patmandin@gmail.com>
parents:
964
diff
changeset
|
1456 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
|
1457 { |
986
952ec1ddcb58
Add conversion routines for unsupported screen formats
Patrice Mandin <patmandin@gmail.com>
parents:
984
diff
changeset
|
1458 GEM_GL_Convert(this->screen); |
984
44fd54a0ae5f
Add OSMesa OpenGL support to the Atari GEM video driver
Patrice Mandin <patmandin@gmail.com>
parents:
964
diff
changeset
|
1459 GEM_FlipHWSurface(this, this->screen); |
44fd54a0ae5f
Add OSMesa OpenGL support to the Atari GEM video driver
Patrice Mandin <patmandin@gmail.com>
parents:
964
diff
changeset
|
1460 } |
44fd54a0ae5f
Add OSMesa OpenGL support to the Atari GEM video driver
Patrice Mandin <patmandin@gmail.com>
parents:
964
diff
changeset
|
1461 |
986
952ec1ddcb58
Add conversion routines for unsupported screen formats
Patrice Mandin <patmandin@gmail.com>
parents:
984
diff
changeset
|
1462 static void GEM_GL_ConvertNull(SDL_Surface *surface) |
952ec1ddcb58
Add conversion routines for unsupported screen formats
Patrice Mandin <patmandin@gmail.com>
parents:
984
diff
changeset
|
1463 { |
952ec1ddcb58
Add conversion routines for unsupported screen formats
Patrice Mandin <patmandin@gmail.com>
parents:
984
diff
changeset
|
1464 } |
952ec1ddcb58
Add conversion routines for unsupported screen formats
Patrice Mandin <patmandin@gmail.com>
parents:
984
diff
changeset
|
1465 |
952ec1ddcb58
Add conversion routines for unsupported screen formats
Patrice Mandin <patmandin@gmail.com>
parents:
984
diff
changeset
|
1466 static void GEM_GL_Convert565To555be(SDL_Surface *surface) |
952ec1ddcb58
Add conversion routines for unsupported screen formats
Patrice Mandin <patmandin@gmail.com>
parents:
984
diff
changeset
|
1467 { |
952ec1ddcb58
Add conversion routines for unsupported screen formats
Patrice Mandin <patmandin@gmail.com>
parents:
984
diff
changeset
|
1468 int x,y, pitch; |
952ec1ddcb58
Add conversion routines for unsupported screen formats
Patrice Mandin <patmandin@gmail.com>
parents:
984
diff
changeset
|
1469 unsigned short *line, *pixel; |
952ec1ddcb58
Add conversion routines for unsupported screen formats
Patrice Mandin <patmandin@gmail.com>
parents:
984
diff
changeset
|
1470 |
952ec1ddcb58
Add conversion routines for unsupported screen formats
Patrice Mandin <patmandin@gmail.com>
parents:
984
diff
changeset
|
1471 line = surface->pixels; |
952ec1ddcb58
Add conversion routines for unsupported screen formats
Patrice Mandin <patmandin@gmail.com>
parents:
984
diff
changeset
|
1472 pitch = surface->pitch >> 1; |
952ec1ddcb58
Add conversion routines for unsupported screen formats
Patrice Mandin <patmandin@gmail.com>
parents:
984
diff
changeset
|
1473 for (y=0; y<surface->h; y++) { |
952ec1ddcb58
Add conversion routines for unsupported screen formats
Patrice Mandin <patmandin@gmail.com>
parents:
984
diff
changeset
|
1474 pixel = line; |
952ec1ddcb58
Add conversion routines for unsupported screen formats
Patrice Mandin <patmandin@gmail.com>
parents:
984
diff
changeset
|
1475 for (x=0; x<surface->w; x++) { |
952ec1ddcb58
Add conversion routines for unsupported screen formats
Patrice Mandin <patmandin@gmail.com>
parents:
984
diff
changeset
|
1476 unsigned short color = *pixel; |
952ec1ddcb58
Add conversion routines for unsupported screen formats
Patrice Mandin <patmandin@gmail.com>
parents:
984
diff
changeset
|
1477 |
952ec1ddcb58
Add conversion routines for unsupported screen formats
Patrice Mandin <patmandin@gmail.com>
parents:
984
diff
changeset
|
1478 *pixel++ = (color & 0x1f)|((color>>1) & 0xffe0); |
952ec1ddcb58
Add conversion routines for unsupported screen formats
Patrice Mandin <patmandin@gmail.com>
parents:
984
diff
changeset
|
1479 } |
952ec1ddcb58
Add conversion routines for unsupported screen formats
Patrice Mandin <patmandin@gmail.com>
parents:
984
diff
changeset
|
1480 |
952ec1ddcb58
Add conversion routines for unsupported screen formats
Patrice Mandin <patmandin@gmail.com>
parents:
984
diff
changeset
|
1481 line += pitch; |
952ec1ddcb58
Add conversion routines for unsupported screen formats
Patrice Mandin <patmandin@gmail.com>
parents:
984
diff
changeset
|
1482 } |
952ec1ddcb58
Add conversion routines for unsupported screen formats
Patrice Mandin <patmandin@gmail.com>
parents:
984
diff
changeset
|
1483 } |
952ec1ddcb58
Add conversion routines for unsupported screen formats
Patrice Mandin <patmandin@gmail.com>
parents:
984
diff
changeset
|
1484 |
952ec1ddcb58
Add conversion routines for unsupported screen formats
Patrice Mandin <patmandin@gmail.com>
parents:
984
diff
changeset
|
1485 static void GEM_GL_Convert565To555le(SDL_Surface *surface) |
952ec1ddcb58
Add conversion routines for unsupported screen formats
Patrice Mandin <patmandin@gmail.com>
parents:
984
diff
changeset
|
1486 { |
952ec1ddcb58
Add conversion routines for unsupported screen formats
Patrice Mandin <patmandin@gmail.com>
parents:
984
diff
changeset
|
1487 int x,y, pitch; |
952ec1ddcb58
Add conversion routines for unsupported screen formats
Patrice Mandin <patmandin@gmail.com>
parents:
984
diff
changeset
|
1488 unsigned short *line, *pixel; |
952ec1ddcb58
Add conversion routines for unsupported screen formats
Patrice Mandin <patmandin@gmail.com>
parents:
984
diff
changeset
|
1489 |
952ec1ddcb58
Add conversion routines for unsupported screen formats
Patrice Mandin <patmandin@gmail.com>
parents:
984
diff
changeset
|
1490 line = surface->pixels; |
952ec1ddcb58
Add conversion routines for unsupported screen formats
Patrice Mandin <patmandin@gmail.com>
parents:
984
diff
changeset
|
1491 pitch = surface->pitch >>1; |
952ec1ddcb58
Add conversion routines for unsupported screen formats
Patrice Mandin <patmandin@gmail.com>
parents:
984
diff
changeset
|
1492 for (y=0; y<surface->h; y++) { |
952ec1ddcb58
Add conversion routines for unsupported screen formats
Patrice Mandin <patmandin@gmail.com>
parents:
984
diff
changeset
|
1493 pixel = line; |
952ec1ddcb58
Add conversion routines for unsupported screen formats
Patrice Mandin <patmandin@gmail.com>
parents:
984
diff
changeset
|
1494 for (x=0; x<surface->w; x++) { |
952ec1ddcb58
Add conversion routines for unsupported screen formats
Patrice Mandin <patmandin@gmail.com>
parents:
984
diff
changeset
|
1495 unsigned short color = *pixel; |
952ec1ddcb58
Add conversion routines for unsupported screen formats
Patrice Mandin <patmandin@gmail.com>
parents:
984
diff
changeset
|
1496 |
952ec1ddcb58
Add conversion routines for unsupported screen formats
Patrice Mandin <patmandin@gmail.com>
parents:
984
diff
changeset
|
1497 color = (color & 0x1f)|((color>>1) & 0xffe0); |
952ec1ddcb58
Add conversion routines for unsupported screen formats
Patrice Mandin <patmandin@gmail.com>
parents:
984
diff
changeset
|
1498 *pixel++ = SDL_Swap16(color); |
952ec1ddcb58
Add conversion routines for unsupported screen formats
Patrice Mandin <patmandin@gmail.com>
parents:
984
diff
changeset
|
1499 } |
952ec1ddcb58
Add conversion routines for unsupported screen formats
Patrice Mandin <patmandin@gmail.com>
parents:
984
diff
changeset
|
1500 |
952ec1ddcb58
Add conversion routines for unsupported screen formats
Patrice Mandin <patmandin@gmail.com>
parents:
984
diff
changeset
|
1501 line += pitch; |
952ec1ddcb58
Add conversion routines for unsupported screen formats
Patrice Mandin <patmandin@gmail.com>
parents:
984
diff
changeset
|
1502 } |
952ec1ddcb58
Add conversion routines for unsupported screen formats
Patrice Mandin <patmandin@gmail.com>
parents:
984
diff
changeset
|
1503 } |
952ec1ddcb58
Add conversion routines for unsupported screen formats
Patrice Mandin <patmandin@gmail.com>
parents:
984
diff
changeset
|
1504 |
952ec1ddcb58
Add conversion routines for unsupported screen formats
Patrice Mandin <patmandin@gmail.com>
parents:
984
diff
changeset
|
1505 static void GEM_GL_Convert565le(SDL_Surface *surface) |
952ec1ddcb58
Add conversion routines for unsupported screen formats
Patrice Mandin <patmandin@gmail.com>
parents:
984
diff
changeset
|
1506 { |
952ec1ddcb58
Add conversion routines for unsupported screen formats
Patrice Mandin <patmandin@gmail.com>
parents:
984
diff
changeset
|
1507 int x,y, pitch; |
952ec1ddcb58
Add conversion routines for unsupported screen formats
Patrice Mandin <patmandin@gmail.com>
parents:
984
diff
changeset
|
1508 unsigned short *line, *pixel; |
952ec1ddcb58
Add conversion routines for unsupported screen formats
Patrice Mandin <patmandin@gmail.com>
parents:
984
diff
changeset
|
1509 |
952ec1ddcb58
Add conversion routines for unsupported screen formats
Patrice Mandin <patmandin@gmail.com>
parents:
984
diff
changeset
|
1510 line = surface->pixels; |
952ec1ddcb58
Add conversion routines for unsupported screen formats
Patrice Mandin <patmandin@gmail.com>
parents:
984
diff
changeset
|
1511 pitch = surface->pitch >>1; |
952ec1ddcb58
Add conversion routines for unsupported screen formats
Patrice Mandin <patmandin@gmail.com>
parents:
984
diff
changeset
|
1512 for (y=0; y<surface->h; y++) { |
952ec1ddcb58
Add conversion routines for unsupported screen formats
Patrice Mandin <patmandin@gmail.com>
parents:
984
diff
changeset
|
1513 pixel = line; |
952ec1ddcb58
Add conversion routines for unsupported screen formats
Patrice Mandin <patmandin@gmail.com>
parents:
984
diff
changeset
|
1514 for (x=0; x<surface->w; x++) { |
988
24b5c3ad4852
Remove ambiguous/useless code
Patrice Mandin <patmandin@gmail.com>
parents:
986
diff
changeset
|
1515 unsigned short color = *pixel; |
24b5c3ad4852
Remove ambiguous/useless code
Patrice Mandin <patmandin@gmail.com>
parents:
986
diff
changeset
|
1516 |
24b5c3ad4852
Remove ambiguous/useless code
Patrice Mandin <patmandin@gmail.com>
parents:
986
diff
changeset
|
1517 *pixel++ = SDL_Swap16(color); |
986
952ec1ddcb58
Add conversion routines for unsupported screen formats
Patrice Mandin <patmandin@gmail.com>
parents:
984
diff
changeset
|
1518 } |
952ec1ddcb58
Add conversion routines for unsupported screen formats
Patrice Mandin <patmandin@gmail.com>
parents:
984
diff
changeset
|
1519 |
952ec1ddcb58
Add conversion routines for unsupported screen formats
Patrice Mandin <patmandin@gmail.com>
parents:
984
diff
changeset
|
1520 line += pitch; |
952ec1ddcb58
Add conversion routines for unsupported screen formats
Patrice Mandin <patmandin@gmail.com>
parents:
984
diff
changeset
|
1521 } |
952ec1ddcb58
Add conversion routines for unsupported screen formats
Patrice Mandin <patmandin@gmail.com>
parents:
984
diff
changeset
|
1522 } |
952ec1ddcb58
Add conversion routines for unsupported screen formats
Patrice Mandin <patmandin@gmail.com>
parents:
984
diff
changeset
|
1523 |
952ec1ddcb58
Add conversion routines for unsupported screen formats
Patrice Mandin <patmandin@gmail.com>
parents:
984
diff
changeset
|
1524 static void GEM_GL_ConvertBGRAToABGR(SDL_Surface *surface) |
952ec1ddcb58
Add conversion routines for unsupported screen formats
Patrice Mandin <patmandin@gmail.com>
parents:
984
diff
changeset
|
1525 { |
952ec1ddcb58
Add conversion routines for unsupported screen formats
Patrice Mandin <patmandin@gmail.com>
parents:
984
diff
changeset
|
1526 int x,y, pitch; |
952ec1ddcb58
Add conversion routines for unsupported screen formats
Patrice Mandin <patmandin@gmail.com>
parents:
984
diff
changeset
|
1527 unsigned long *line, *pixel; |
952ec1ddcb58
Add conversion routines for unsupported screen formats
Patrice Mandin <patmandin@gmail.com>
parents:
984
diff
changeset
|
1528 |
952ec1ddcb58
Add conversion routines for unsupported screen formats
Patrice Mandin <patmandin@gmail.com>
parents:
984
diff
changeset
|
1529 line = surface->pixels; |
952ec1ddcb58
Add conversion routines for unsupported screen formats
Patrice Mandin <patmandin@gmail.com>
parents:
984
diff
changeset
|
1530 pitch = surface->pitch >>2; |
952ec1ddcb58
Add conversion routines for unsupported screen formats
Patrice Mandin <patmandin@gmail.com>
parents:
984
diff
changeset
|
1531 for (y=0; y<surface->h; y++) { |
952ec1ddcb58
Add conversion routines for unsupported screen formats
Patrice Mandin <patmandin@gmail.com>
parents:
984
diff
changeset
|
1532 pixel = line; |
952ec1ddcb58
Add conversion routines for unsupported screen formats
Patrice Mandin <patmandin@gmail.com>
parents:
984
diff
changeset
|
1533 for (x=0; x<surface->w; x++) { |
952ec1ddcb58
Add conversion routines for unsupported screen formats
Patrice Mandin <patmandin@gmail.com>
parents:
984
diff
changeset
|
1534 unsigned long color = *pixel; |
952ec1ddcb58
Add conversion routines for unsupported screen formats
Patrice Mandin <patmandin@gmail.com>
parents:
984
diff
changeset
|
1535 |
952ec1ddcb58
Add conversion routines for unsupported screen formats
Patrice Mandin <patmandin@gmail.com>
parents:
984
diff
changeset
|
1536 *pixel++ = (color<<24)|(color>>8); |
952ec1ddcb58
Add conversion routines for unsupported screen formats
Patrice Mandin <patmandin@gmail.com>
parents:
984
diff
changeset
|
1537 } |
952ec1ddcb58
Add conversion routines for unsupported screen formats
Patrice Mandin <patmandin@gmail.com>
parents:
984
diff
changeset
|
1538 |
952ec1ddcb58
Add conversion routines for unsupported screen formats
Patrice Mandin <patmandin@gmail.com>
parents:
984
diff
changeset
|
1539 line += pitch; |
952ec1ddcb58
Add conversion routines for unsupported screen formats
Patrice Mandin <patmandin@gmail.com>
parents:
984
diff
changeset
|
1540 } |
952ec1ddcb58
Add conversion routines for unsupported screen formats
Patrice Mandin <patmandin@gmail.com>
parents:
984
diff
changeset
|
1541 } |
952ec1ddcb58
Add conversion routines for unsupported screen formats
Patrice Mandin <patmandin@gmail.com>
parents:
984
diff
changeset
|
1542 |
984
44fd54a0ae5f
Add OSMesa OpenGL support to the Atari GEM video driver
Patrice Mandin <patmandin@gmail.com>
parents:
964
diff
changeset
|
1543 #endif |