annotate src/video/wscons/SDL_wsconsvideo.c @ 2728:2768bd7281e0

Fixed Visual Studio compilation problems
author Sam Lantinga <slouken@libsdl.org>
date Tue, 26 Aug 2008 07:34:49 +0000
parents c121d94672cb
children e1da92da346c
rev   line source
1187
19d8949b4584 To: sdl@libsdl.org
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1 /*
19d8949b4584 To: sdl@libsdl.org
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
2 SDL - Simple DirectMedia Layer
1312
c9b51268668f Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents: 1187
diff changeset
3 Copyright (C) 1997-2006 Sam Lantinga
1187
19d8949b4584 To: sdl@libsdl.org
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
4
19d8949b4584 To: sdl@libsdl.org
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
5 This library is free software; you can redistribute it and/or
1312
c9b51268668f Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents: 1187
diff changeset
6 modify it under the terms of the GNU Lesser General Public
1187
19d8949b4584 To: sdl@libsdl.org
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
7 License as published by the Free Software Foundation; either
1312
c9b51268668f Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents: 1187
diff changeset
8 version 2.1 of the License, or (at your option) any later version.
1187
19d8949b4584 To: sdl@libsdl.org
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
9
19d8949b4584 To: sdl@libsdl.org
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
10 This library is distributed in the hope that it will be useful,
19d8949b4584 To: sdl@libsdl.org
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
19d8949b4584 To: sdl@libsdl.org
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
1312
c9b51268668f Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents: 1187
diff changeset
13 Lesser General Public License for more details.
1187
19d8949b4584 To: sdl@libsdl.org
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
14
1312
c9b51268668f Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents: 1187
diff changeset
15 You should have received a copy of the GNU Lesser General Public
c9b51268668f Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents: 1187
diff changeset
16 License along with this library; if not, write to the Free Software
c9b51268668f Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents: 1187
diff changeset
17 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
1187
19d8949b4584 To: sdl@libsdl.org
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
18
19d8949b4584 To: sdl@libsdl.org
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
19 Sam Lantinga
19d8949b4584 To: sdl@libsdl.org
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
20 slouken@libsdl.org
19d8949b4584 To: sdl@libsdl.org
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
21 */
1402
d910939febfa Use consistent identifiers for the various platforms we support.
Sam Lantinga <slouken@libsdl.org>
parents: 1383
diff changeset
22 #include "SDL_config.h"
1187
19d8949b4584 To: sdl@libsdl.org
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
23
19d8949b4584 To: sdl@libsdl.org
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
24 #include <sys/time.h>
19d8949b4584 To: sdl@libsdl.org
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
25 #include <sys/mman.h>
19d8949b4584 To: sdl@libsdl.org
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
26 #include <sys/ioctl.h>
19d8949b4584 To: sdl@libsdl.org
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
27 #include <dev/wscons/wsdisplay_usl_io.h>
19d8949b4584 To: sdl@libsdl.org
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
28 #include <fcntl.h>
19d8949b4584 To: sdl@libsdl.org
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
29 #include <unistd.h>
19d8949b4584 To: sdl@libsdl.org
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
30 #include <errno.h>
19d8949b4584 To: sdl@libsdl.org
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
31
19d8949b4584 To: sdl@libsdl.org
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
32 #include "SDL_video.h"
19d8949b4584 To: sdl@libsdl.org
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
33 #include "SDL_mouse.h"
1361
19418e4422cb New configure-based build system. Still work in progress, but much improved
Sam Lantinga <slouken@libsdl.org>
parents: 1358
diff changeset
34 #include "../SDL_sysvideo.h"
19418e4422cb New configure-based build system. Still work in progress, but much improved
Sam Lantinga <slouken@libsdl.org>
parents: 1358
diff changeset
35 #include "../SDL_pixels_c.h"
19418e4422cb New configure-based build system. Still work in progress, but much improved
Sam Lantinga <slouken@libsdl.org>
parents: 1358
diff changeset
36 #include "../../events/SDL_events_c.h"
1187
19d8949b4584 To: sdl@libsdl.org
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
37
19d8949b4584 To: sdl@libsdl.org
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
38 #include "SDL_wsconsvideo.h"
19d8949b4584 To: sdl@libsdl.org
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
39 #include "SDL_wsconsevents_c.h"
19d8949b4584 To: sdl@libsdl.org
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
40 #include "SDL_wsconsmouse_c.h"
19d8949b4584 To: sdl@libsdl.org
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
41
19d8949b4584 To: sdl@libsdl.org
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
42 #define WSCONSVID_DRIVER_NAME "wscons"
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
43 enum
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
44 {
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
45 WSCONS_ROTATE_NONE = 0,
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
46 WSCONS_ROTATE_CCW = 90,
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
47 WSCONS_ROTATE_UD = 180,
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
48 WSCONS_ROTATE_CW = 270
1187
19d8949b4584 To: sdl@libsdl.org
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
49 };
19d8949b4584 To: sdl@libsdl.org
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
50
19d8949b4584 To: sdl@libsdl.org
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
51 #define min(a,b) ((a)<(b)?(a):(b))
19d8949b4584 To: sdl@libsdl.org
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
52
19d8949b4584 To: sdl@libsdl.org
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
53 /* Initialization/Query functions */
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
54 static int WSCONS_VideoInit(_THIS, SDL_PixelFormat * vformat);
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
55 static SDL_Rect **WSCONS_ListModes(_THIS, SDL_PixelFormat * format,
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
56 Uint32 flags);
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
57 static SDL_Surface *WSCONS_SetVideoMode(_THIS, SDL_Surface * current,
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
58 int width, int height, int bpp,
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
59 Uint32 flags);
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
60 static int WSCONS_SetColors(_THIS, int firstcolor, int ncolors,
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
61 SDL_Color * colors);
1187
19d8949b4584 To: sdl@libsdl.org
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
62 static void WSCONS_VideoQuit(_THIS);
19d8949b4584 To: sdl@libsdl.org
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
63
19d8949b4584 To: sdl@libsdl.org
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
64 /* Hardware surface functions */
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
65 static int WSCONS_AllocHWSurface(_THIS, SDL_Surface * surface);
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
66 static int WSCONS_LockHWSurface(_THIS, SDL_Surface * surface);
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
67 static void WSCONS_UnlockHWSurface(_THIS, SDL_Surface * surface);
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
68 static void WSCONS_FreeHWSurface(_THIS, SDL_Surface * surface);
1187
19d8949b4584 To: sdl@libsdl.org
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
69
19d8949b4584 To: sdl@libsdl.org
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
70 /* etc. */
19d8949b4584 To: sdl@libsdl.org
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
71 static WSCONS_bitBlit WSCONS_blit16;
19d8949b4584 To: sdl@libsdl.org
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
72 static WSCONS_bitBlit WSCONS_blit16blocked;
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
73 static void WSCONS_UpdateRects(_THIS, int numrects, SDL_Rect * rects);
1187
19d8949b4584 To: sdl@libsdl.org
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
74
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
75 void
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
76 WSCONS_ReportError(char *fmt, ...)
1187
19d8949b4584 To: sdl@libsdl.org
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
77 {
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
78 char message[200];
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
79 va_list vaArgs;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
80
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
81 message[199] = '\0';
1187
19d8949b4584 To: sdl@libsdl.org
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
82
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
83 va_start(vaArgs, fmt);
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
84 vsnprintf(message, 199, fmt, vaArgs);
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
85 va_end(vaArgs);
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
86
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
87 SDL_SetError(message);
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
88 fprintf(stderr, "WSCONS error: %s\n", message);
1187
19d8949b4584 To: sdl@libsdl.org
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
89 }
19d8949b4584 To: sdl@libsdl.org
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
90
19d8949b4584 To: sdl@libsdl.org
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
91 /* WSCONS driver bootstrap functions */
19d8949b4584 To: sdl@libsdl.org
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
92
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
93 static int
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
94 WSCONS_Available(void)
1187
19d8949b4584 To: sdl@libsdl.org
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
95 {
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
96 return 1;
1187
19d8949b4584 To: sdl@libsdl.org
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
97 }
19d8949b4584 To: sdl@libsdl.org
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
98
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
99 static void
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
100 WSCONS_DeleteDevice(SDL_VideoDevice * device)
1187
19d8949b4584 To: sdl@libsdl.org
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
101 {
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
102 SDL_free(device->hidden);
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
103 SDL_free(device);
1187
19d8949b4584 To: sdl@libsdl.org
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
104 }
19d8949b4584 To: sdl@libsdl.org
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
105
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
106 static SDL_VideoDevice *
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
107 WSCONS_CreateDevice(int devindex)
1187
19d8949b4584 To: sdl@libsdl.org
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
108 {
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
109 SDL_VideoDevice *device;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
110
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
111 /* Initialize all variables that we clean on shutdown */
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
112 device = (SDL_VideoDevice *) SDL_malloc(sizeof(SDL_VideoDevice));
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
113 if (device == NULL) {
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
114 SDL_OutOfMemory();
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
115 return 0;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
116 }
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
117 SDL_memset(device, 0, (sizeof *device));
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
118 device->hidden =
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
119 (struct SDL_PrivateVideoData *) SDL_malloc((sizeof *device->hidden));
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
120 if (device->hidden == NULL) {
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
121 SDL_OutOfMemory();
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
122 SDL_free(device);
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
123 return (0);
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
124 }
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
125 SDL_memset(device->hidden, 0, (sizeof *device->hidden));
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
126 device->hidden->fd = -1;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
127
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
128 /* Set the function pointers */
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
129 device->VideoInit = WSCONS_VideoInit;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
130 device->ListModes = WSCONS_ListModes;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
131 device->SetVideoMode = WSCONS_SetVideoMode;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
132 device->SetColors = WSCONS_SetColors;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
133 device->UpdateRects = WSCONS_UpdateRects;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
134 device->VideoQuit = WSCONS_VideoQuit;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
135 device->AllocHWSurface = WSCONS_AllocHWSurface;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
136 device->LockHWSurface = WSCONS_LockHWSurface;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
137 device->UnlockHWSurface = WSCONS_UnlockHWSurface;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
138 device->FreeHWSurface = WSCONS_FreeHWSurface;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
139 device->InitOSKeymap = WSCONS_InitOSKeymap;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
140 device->PumpEvents = WSCONS_PumpEvents;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
141 device->free = WSCONS_DeleteDevice;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
142
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
143 return device;
1187
19d8949b4584 To: sdl@libsdl.org
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
144 }
19d8949b4584 To: sdl@libsdl.org
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
145
19d8949b4584 To: sdl@libsdl.org
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
146 VideoBootStrap WSCONS_bootstrap = {
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
147 WSCONSVID_DRIVER_NAME,
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
148 "SDL wscons video driver",
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
149 WSCONS_Available,
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
150 WSCONS_CreateDevice
1187
19d8949b4584 To: sdl@libsdl.org
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
151 };
19d8949b4584 To: sdl@libsdl.org
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
152
19d8949b4584 To: sdl@libsdl.org
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
153 #define WSCONSDEV_FORMAT "/dev/ttyC%01x"
19d8949b4584 To: sdl@libsdl.org
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
154
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
155 int
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
156 WSCONS_VideoInit(_THIS, SDL_PixelFormat * vformat)
1187
19d8949b4584 To: sdl@libsdl.org
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
157 {
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
158 char devnamebuf[30];
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
159 char *devname;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
160 char *rotation;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
161 int wstype;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
162 int wsmode = WSDISPLAYIO_MODE_DUMBFB;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
163 size_t len, mapsize;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
164 int pagemask;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
165 int width, height;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
166
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
167 devname = SDL_getenv("SDL_WSCONSDEV");
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
168 if (devname == NULL) {
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
169 int activeVT;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
170 if (ioctl(STDIN_FILENO, VT_GETACTIVE, &activeVT) == -1) {
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
171 WSCONS_ReportError("Unable to determine active terminal: %s",
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
172 strerror(errno));
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
173 return -1;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
174 }
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
175 SDL_snprintf(devnamebuf, sizeof(devnamebuf), WSCONSDEV_FORMAT,
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
176 activeVT - 1);
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
177 devname = devnamebuf;
1187
19d8949b4584 To: sdl@libsdl.org
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
178 }
19d8949b4584 To: sdl@libsdl.org
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
179
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
180 private->fd = open(devname, O_RDWR | O_NONBLOCK, 0);
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
181 if (private->fd == -1) {
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
182 WSCONS_ReportError("open %s: %s", devname, strerror(errno));
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
183 return -1;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
184 }
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
185 if (ioctl(private->fd, WSDISPLAYIO_GINFO, &private->info) == -1) {
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
186 WSCONS_ReportError("ioctl WSDISPLAY_GINFO: %s", strerror(errno));
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
187 return -1;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
188 }
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
189 if (ioctl(private->fd, WSDISPLAYIO_GTYPE, &wstype) == -1) {
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
190 WSCONS_ReportError("ioctl WSDISPLAY_GTYPE: %s", strerror(errno));
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
191 return -1;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
192 }
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
193 if (ioctl(private->fd, WSDISPLAYIO_LINEBYTES, &private->physlinebytes) ==
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
194 -1) {
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
195 WSCONS_ReportError("ioctl WSDISPLAYIO_LINEBYTES: %s",
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
196 strerror(errno));
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
197 return -1;
1187
19d8949b4584 To: sdl@libsdl.org
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
198 }
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
199 if (private->info.depth > 8) {
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
200 if (wstype == WSDISPLAY_TYPE_SUN24 ||
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
201 wstype == WSDISPLAY_TYPE_SUNCG12 ||
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
202 wstype == WSDISPLAY_TYPE_SUNCG14 ||
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
203 wstype == WSDISPLAY_TYPE_SUNTCX ||
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
204 wstype == WSDISPLAY_TYPE_SUNFFB) {
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
205 private->redMask = 0x0000ff;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
206 private->greenMask = 0x00ff00;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
207 private->blueMask = 0xff0000;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
208 #ifdef WSDISPLAY_TYPE_PXALCD
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
209 } else if (wstype == WSDISPLAY_TYPE_PXALCD) {
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
210 private->redMask = 0x1f << 11;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
211 private->greenMask = 0x3f << 5;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
212 private->blueMask = 0x1f;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
213 #endif
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
214 } else {
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
215 WSCONS_ReportError("Unknown video hardware");
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
216 return -1;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
217 }
1187
19d8949b4584 To: sdl@libsdl.org
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
218 } else {
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
219 WSCONS_ReportError("Displays with 8 bpp or less are not supported");
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
220 return -1;
1187
19d8949b4584 To: sdl@libsdl.org
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
221 }
19d8949b4584 To: sdl@libsdl.org
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
222
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
223 private->rotate = WSCONS_ROTATE_NONE;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
224 rotation = SDL_getenv("SDL_VIDEO_WSCONS_ROTATION");
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
225 if (rotation != NULL) {
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
226 if (SDL_strlen(rotation) == 0) {
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
227 private->shadowFB = 0;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
228 private->rotate = WSCONS_ROTATE_NONE;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
229 printf("Not rotating, no shadow\n");
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
230 } else if (!SDL_strcmp(rotation, "NONE")) {
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
231 private->shadowFB = 1;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
232 private->rotate = WSCONS_ROTATE_NONE;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
233 printf("Not rotating, but still using shadow\n");
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
234 } else if (!SDL_strcmp(rotation, "CW")) {
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
235 private->shadowFB = 1;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
236 private->rotate = WSCONS_ROTATE_CW;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
237 printf("Rotating screen clockwise\n");
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
238 } else if (!SDL_strcmp(rotation, "CCW")) {
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
239 private->shadowFB = 1;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
240 private->rotate = WSCONS_ROTATE_CCW;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
241 printf("Rotating screen counter clockwise\n");
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
242 } else if (!SDL_strcmp(rotation, "UD")) {
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
243 private->shadowFB = 1;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
244 private->rotate = WSCONS_ROTATE_UD;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
245 printf("Rotating screen upside down\n");
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
246 } else {
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
247 WSCONS_ReportError("\"%s\" is not a valid value for "
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
248 "SDL_VIDEO_WSCONS_ROTATION", rotation);
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
249 return -1;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
250 }
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
251 }
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
252
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
253 switch (private->info.depth) {
1187
19d8949b4584 To: sdl@libsdl.org
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
254 case 1:
19d8949b4584 To: sdl@libsdl.org
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
255 case 4:
19d8949b4584 To: sdl@libsdl.org
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
256 case 8:
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
257 len = private->physlinebytes * private->info.height;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
258 break;
1187
19d8949b4584 To: sdl@libsdl.org
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
259 case 16:
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
260 if (private->physlinebytes == private->info.width) {
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
261 len = private->info.width * private->info.height * sizeof(short);
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
262 } else {
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
263 len = private->physlinebytes * private->info.height;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
264 }
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
265 if (private->rotate == WSCONS_ROTATE_NONE ||
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
266 private->rotate == WSCONS_ROTATE_UD) {
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
267 private->blitFunc = WSCONS_blit16;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
268 } else {
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
269 private->blitFunc = WSCONS_blit16blocked;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
270 }
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
271 break;
1187
19d8949b4584 To: sdl@libsdl.org
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
272 case 32:
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
273 if (private->physlinebytes == private->info.width) {
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
274 len = private->info.width * private->info.height * sizeof(int);
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
275 } else {
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
276 len = private->physlinebytes * private->info.height;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
277 }
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
278 break;
1187
19d8949b4584 To: sdl@libsdl.org
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
279 default:
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
280 WSCONS_ReportError("unsupported depth %d", private->info.depth);
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
281 return -1;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
282 }
1187
19d8949b4584 To: sdl@libsdl.org
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
283
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
284 if (private->shadowFB && private->blitFunc == NULL) {
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
285 WSCONS_ReportError
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
286 ("Using software buffer, but no blitter function is "
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
287 "available for this %d bpp.", private->info.depth);
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
288 return -1;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
289 }
1187
19d8949b4584 To: sdl@libsdl.org
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
290
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
291 if (ioctl(private->fd, WSDISPLAYIO_SMODE, &wsmode) == -1) {
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
292 WSCONS_ReportError("ioctl SMODE");
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
293 return -1;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
294 }
1187
19d8949b4584 To: sdl@libsdl.org
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
295
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
296 pagemask = getpagesize() - 1;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
297 mapsize = ((int) len + pagemask) & ~pagemask;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
298 private->physmem = (Uint8 *) mmap(NULL, mapsize,
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
299 PROT_READ | PROT_WRITE, MAP_SHARED,
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
300 private->fd, (off_t) 0);
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
301 if (private->physmem == (Uint8 *) MAP_FAILED) {
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
302 private->physmem = NULL;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
303 WSCONS_ReportError("mmap: %s", strerror(errno));
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
304 return -1;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
305 }
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
306 private->fbmem_len = len;
1187
19d8949b4584 To: sdl@libsdl.org
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
307
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
308 if (private->rotate == WSCONS_ROTATE_CW ||
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
309 private->rotate == WSCONS_ROTATE_CCW) {
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
310 width = private->info.height;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
311 height = private->info.width;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
312 } else {
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
313 width = private->info.width;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
314 height = private->info.height;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
315 }
1187
19d8949b4584 To: sdl@libsdl.org
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
316
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
317 this->info.current_w = width;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
318 this->info.current_h = height;
1545
8d9bb0cf2c2a Added current_w and current_h to the SDL_VideoInfo structure, which is set to the desktop resolution during video intialization, and then set to the current resolution when a video mode is set.
Sam Lantinga <slouken@libsdl.org>
parents: 1402
diff changeset
319
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
320 if (private->shadowFB) {
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
321 private->shadowmem = (Uint8 *) SDL_malloc(len);
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
322 if (private->shadowmem == NULL) {
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
323 WSCONS_ReportError("No memory for shadow");
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
324 return -1;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
325 }
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
326 private->fbstart = private->shadowmem;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
327 private->fblinebytes = width * ((private->info.depth + 7) / 8);
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
328 } else {
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
329 private->fbstart = private->physmem;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
330 private->fblinebytes = private->physlinebytes;
1187
19d8949b4584 To: sdl@libsdl.org
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
331 }
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
332
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
333 private->SDL_modelist[0] = (SDL_Rect *) SDL_malloc(sizeof(SDL_Rect));
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
334 private->SDL_modelist[0]->w = width;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
335 private->SDL_modelist[0]->h = height;
1187
19d8949b4584 To: sdl@libsdl.org
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
336
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
337 vformat->BitsPerPixel = private->info.depth;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
338 vformat->BytesPerPixel = private->info.depth / 8;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
339
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
340 if (WSCONS_InitKeyboard(this) == -1) {
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
341 return -1;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
342 }
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
343
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
344 return 0;
1187
19d8949b4584 To: sdl@libsdl.org
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
345 }
19d8949b4584 To: sdl@libsdl.org
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
346
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
347 SDL_Rect **
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
348 WSCONS_ListModes(_THIS, SDL_PixelFormat * format, Uint32 flags)
1187
19d8949b4584 To: sdl@libsdl.org
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
349 {
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
350 if (format->BitsPerPixel == private->info.depth) {
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
351 return private->SDL_modelist;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
352 } else {
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
353 return NULL;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
354 }
1187
19d8949b4584 To: sdl@libsdl.org
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
355 }
19d8949b4584 To: sdl@libsdl.org
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
356
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
357 SDL_Surface *
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
358 WSCONS_SetVideoMode(_THIS, SDL_Surface * current,
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
359 int width, int height, int bpp, Uint32 flags)
1187
19d8949b4584 To: sdl@libsdl.org
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
360 {
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
361 if (width != private->SDL_modelist[0]->w ||
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
362 height != private->SDL_modelist[0]->h) {
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
363 WSCONS_ReportError("Requested video mode %dx%d not supported.",
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
364 width, height);
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
365 return NULL;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
366 }
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
367 if (bpp != private->info.depth) {
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
368 WSCONS_ReportError("Requested video depth %d bpp not supported.",
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
369 bpp);
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
370 return NULL;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
371 }
1187
19d8949b4584 To: sdl@libsdl.org
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
372
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
373 if (!SDL_ReallocFormat(current,
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
374 bpp,
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
375 private->redMask,
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
376 private->greenMask, private->blueMask, 0)) {
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
377 WSCONS_ReportError("Couldn't allocate new pixel format");
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
378 return NULL;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
379 }
1187
19d8949b4584 To: sdl@libsdl.org
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
380
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
381 current->flags &= SDL_FULLSCREEN;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
382 if (private->shadowFB) {
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
383 current->flags |= SDL_SWSURFACE;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
384 } else {
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
385 current->flags |= SDL_HWSURFACE;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
386 }
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
387 current->w = width;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
388 current->h = height;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
389 current->pitch = private->fblinebytes;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
390 current->pixels = private->fbstart;
1187
19d8949b4584 To: sdl@libsdl.org
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
391
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
392 SDL_memset(private->fbstart, 0, private->fbmem_len);
1187
19d8949b4584 To: sdl@libsdl.org
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
393
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
394 return current;
1187
19d8949b4584 To: sdl@libsdl.org
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
395 }
19d8949b4584 To: sdl@libsdl.org
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
396
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
397 static int
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
398 WSCONS_AllocHWSurface(_THIS, SDL_Surface * surface)
1187
19d8949b4584 To: sdl@libsdl.org
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
399 {
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
400 return -1;
1187
19d8949b4584 To: sdl@libsdl.org
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
401 }
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
402 static void
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
403 WSCONS_FreeHWSurface(_THIS, SDL_Surface * surface)
1187
19d8949b4584 To: sdl@libsdl.org
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
404 {
19d8949b4584 To: sdl@libsdl.org
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
405 }
19d8949b4584 To: sdl@libsdl.org
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
406
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
407 static int
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
408 WSCONS_LockHWSurface(_THIS, SDL_Surface * surface)
1187
19d8949b4584 To: sdl@libsdl.org
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
409 {
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
410 return 0;
1187
19d8949b4584 To: sdl@libsdl.org
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
411 }
19d8949b4584 To: sdl@libsdl.org
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
412
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
413 static void
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
414 WSCONS_UnlockHWSurface(_THIS, SDL_Surface * surface)
1187
19d8949b4584 To: sdl@libsdl.org
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
415 {
19d8949b4584 To: sdl@libsdl.org
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
416 }
19d8949b4584 To: sdl@libsdl.org
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
417
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
418 static void
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
419 WSCONS_blit16(Uint8 * byte_src_pos,
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
420 int srcRightDelta,
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
421 int srcDownDelta,
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
422 Uint8 * byte_dst_pos, int dst_linebytes, int width, int height)
1187
19d8949b4584 To: sdl@libsdl.org
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
423 {
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
424 int w;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
425 Uint16 *src_pos = (Uint16 *) byte_src_pos;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
426 Uint16 *dst_pos = (Uint16 *) byte_dst_pos;
1187
19d8949b4584 To: sdl@libsdl.org
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
427
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
428 while (height) {
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
429 Uint16 *src = src_pos;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
430 Uint16 *dst = dst_pos;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
431 for (w = width; w != 0; w--) {
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
432 *dst = *src;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
433 src += srcRightDelta;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
434 dst++;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
435 }
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
436 dst_pos = (Uint16 *) ((Uint8 *) dst_pos + dst_linebytes);
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
437 src_pos += srcDownDelta;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
438 height--;
1187
19d8949b4584 To: sdl@libsdl.org
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
439 }
19d8949b4584 To: sdl@libsdl.org
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
440 }
19d8949b4584 To: sdl@libsdl.org
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
441
19d8949b4584 To: sdl@libsdl.org
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
442 #define BLOCKSIZE_W 32
19d8949b4584 To: sdl@libsdl.org
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
443 #define BLOCKSIZE_H 32
19d8949b4584 To: sdl@libsdl.org
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
444
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
445 static void
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
446 WSCONS_blit16blocked(Uint8 * byte_src_pos,
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
447 int srcRightDelta,
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
448 int srcDownDelta,
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
449 Uint8 * byte_dst_pos,
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
450 int dst_linebytes, int width, int height)
1187
19d8949b4584 To: sdl@libsdl.org
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
451 {
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
452 int w;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
453 Uint16 *src_pos = (Uint16 *) byte_src_pos;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
454 Uint16 *dst_pos = (Uint16 *) byte_dst_pos;
1187
19d8949b4584 To: sdl@libsdl.org
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
455
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
456 while (height > 0) {
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
457 Uint16 *src = src_pos;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
458 Uint16 *dst = dst_pos;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
459 for (w = width; w > 0; w -= BLOCKSIZE_W) {
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
460 WSCONS_blit16((Uint8 *) src,
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
461 srcRightDelta,
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
462 srcDownDelta,
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
463 (Uint8 *) dst,
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
464 dst_linebytes,
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
465 min(w, BLOCKSIZE_W), min(height, BLOCKSIZE_H));
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
466 src += srcRightDelta * BLOCKSIZE_W;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
467 dst += BLOCKSIZE_W;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
468 }
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
469 dst_pos =
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
470 (Uint16 *) ((Uint8 *) dst_pos + dst_linebytes * BLOCKSIZE_H);
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
471 src_pos += srcDownDelta * BLOCKSIZE_H;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
472 height -= BLOCKSIZE_H;
1187
19d8949b4584 To: sdl@libsdl.org
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
473 }
19d8949b4584 To: sdl@libsdl.org
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
474 }
19d8949b4584 To: sdl@libsdl.org
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
475
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
476 static void
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
477 WSCONS_UpdateRects(_THIS, int numrects, SDL_Rect * rects)
1187
19d8949b4584 To: sdl@libsdl.org
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
478 {
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
479 int width = private->SDL_modelist[0]->w;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
480 int height = private->SDL_modelist[0]->h;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
481 int bytesPerPixel = (private->info.depth + 7) / 8;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
482 int i;
1187
19d8949b4584 To: sdl@libsdl.org
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
483
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
484 if (!private->shadowFB) {
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
485 return;
1187
19d8949b4584 To: sdl@libsdl.org
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
486 }
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
487
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
488 if (private->info.depth != 16) {
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
489 WSCONS_ReportError("Shadow copy only implemented for 16 bpp");
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
490 return;
1187
19d8949b4584 To: sdl@libsdl.org
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
491 }
19d8949b4584 To: sdl@libsdl.org
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
492
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
493 for (i = 0; i < numrects; i++) {
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
494 int x1, y1, x2, y2;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
495 int scr_x1, scr_y1, scr_x2, scr_y2;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
496 int sha_x1, sha_y1;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
497 int shadowRightDelta; /* Address change when moving right in dest */
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
498 int shadowDownDelta; /* Address change when moving down in dest */
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
499 Uint8 *src_start;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
500 Uint8 *dst_start;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
501
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
502 x1 = rects[i].x;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
503 y1 = rects[i].y;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
504 x2 = x1 + rects[i].w;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
505 y2 = y1 + rects[i].h;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
506
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
507 if (x1 < 0) {
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
508 x1 = 0;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
509 } else if (x1 > width) {
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
510 x1 = width;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
511 }
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
512 if (x2 < 0) {
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
513 x2 = 0;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
514 } else if (x2 > width) {
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
515 x2 = width;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
516 }
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
517 if (y1 < 0) {
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
518 y1 = 0;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
519 } else if (y1 > height) {
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
520 y1 = height;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
521 }
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
522 if (y2 < 0) {
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
523 y2 = 0;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
524 } else if (y2 > height) {
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
525 y2 = height;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
526 }
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
527 if (x2 <= x1 || y2 <= y1) {
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
528 continue;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
529 }
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
530
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
531 switch (private->rotate) {
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
532 case WSCONS_ROTATE_NONE:
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
533 sha_x1 = scr_x1 = x1;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
534 sha_y1 = scr_y1 = y1;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
535 scr_x2 = x2;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
536 scr_y2 = y2;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
537 shadowRightDelta = 1;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
538 shadowDownDelta = width;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
539 break;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
540 case WSCONS_ROTATE_CCW:
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
541 scr_x1 = y1;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
542 scr_y1 = width - x2;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
543 scr_x2 = y2;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
544 scr_y2 = width - x1;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
545 sha_x1 = x2 - 1;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
546 sha_y1 = y1;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
547 shadowRightDelta = width;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
548 shadowDownDelta = -1;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
549 break;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
550 case WSCONS_ROTATE_UD:
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
551 scr_x1 = width - x2;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
552 scr_y1 = height - y2;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
553 scr_x2 = width - x1;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
554 scr_y2 = height - y1;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
555 sha_x1 = x2 - 1;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
556 sha_y1 = y2 - 1;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
557 shadowRightDelta = -1;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
558 shadowDownDelta = -width;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
559 break;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
560 case WSCONS_ROTATE_CW:
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
561 scr_x1 = height - y2;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
562 scr_y1 = x1;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
563 scr_x2 = height - y1;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
564 scr_y2 = x2;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
565 sha_x1 = x1;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
566 sha_y1 = y2 - 1;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
567 shadowRightDelta = -width;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
568 shadowDownDelta = 1;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
569 break;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
570 default:
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
571 WSCONS_ReportError("Unknown rotation");
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
572 return;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
573 }
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
574
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
575 src_start =
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
576 private->shadowmem + (sha_y1 * width + sha_x1) * bytesPerPixel;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
577 dst_start =
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
578 private->physmem + scr_y1 * private->physlinebytes +
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
579 scr_x1 * bytesPerPixel;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
580
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
581 private->blitFunc(src_start,
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
582 shadowRightDelta,
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
583 shadowDownDelta,
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
584 dst_start,
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
585 private->physlinebytes,
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
586 scr_x2 - scr_x1, scr_y2 - scr_y1);
1187
19d8949b4584 To: sdl@libsdl.org
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
587 }
19d8949b4584 To: sdl@libsdl.org
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
588 }
19d8949b4584 To: sdl@libsdl.org
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
589
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
590 int
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
591 WSCONS_SetColors(_THIS, int firstcolor, int ncolors, SDL_Color * colors)
1187
19d8949b4584 To: sdl@libsdl.org
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
592 {
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
593 return 0;
1187
19d8949b4584 To: sdl@libsdl.org
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
594 }
19d8949b4584 To: sdl@libsdl.org
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
595
19d8949b4584 To: sdl@libsdl.org
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
596 /*
19d8949b4584 To: sdl@libsdl.org
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
597 * Note: If we are terminated, this could be called in the middle of
19d8949b4584 To: sdl@libsdl.org
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
598 * another SDL video routine -- notably UpdateRects.
19d8949b4584 To: sdl@libsdl.org
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
599 */
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
600 void
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
601 WSCONS_VideoQuit(_THIS)
1187
19d8949b4584 To: sdl@libsdl.org
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
602 {
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
603 int mode = WSDISPLAYIO_MODE_EMUL;
1187
19d8949b4584 To: sdl@libsdl.org
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
604
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
605 if (private->shadowmem != NULL) {
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
606 SDL_free(private->shadowmem);
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
607 private->shadowmem = NULL;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
608 }
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
609 private->fbstart = NULL;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
610 if (this->screen != NULL) {
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
611 this->screen->pixels = NULL;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
612 }
1187
19d8949b4584 To: sdl@libsdl.org
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
613
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
614 if (private->SDL_modelist[0] != NULL) {
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
615 SDL_free(private->SDL_modelist[0]);
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
616 private->SDL_modelist[0] = NULL;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
617 }
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
618
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
619 if (ioctl(private->fd, WSDISPLAYIO_SMODE, &mode) == -1) {
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
620 WSCONS_ReportError("ioctl SMODE");
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
621 }
1187
19d8949b4584 To: sdl@libsdl.org
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
622
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
623 WSCONS_ReleaseKeyboard(this);
1187
19d8949b4584 To: sdl@libsdl.org
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
624
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
625 if (private->fd != -1) {
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
626 close(private->fd);
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
627 private->fd = -1;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
628 }
1187
19d8949b4584 To: sdl@libsdl.org
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
629 }
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
630
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1596
diff changeset
631 /* vi: set ts=4 sw=4 expandtab: */