ViewVC Help
View File | Revision Log | Show Annotations | Revision Graph | Root Listing
root/cebix/SheepShaver/src/include/video.h
Revision: 1.15
Committed: 2008-06-25T02:52:22Z (15 years, 10 months ago) by asvitkine
Content type: text/plain
Branch: MAIN
CVS Tags: HEAD
Changes since 1.14: +5 -1 lines
Log Message:
[patch from Kelvin Delbarre]
Software cursor mode is now supported, although currently the existing hardware
cursor mode is used whenever possible. (Software mode will be used if you are
running with a recent version of SDL's Quartz video driver, since a bug in SDL
1.2.11 and later prevents the hardware cursor from working properly with that
driver.)

In hardware cursor mode, the hot-spot is now determined heuristically. Formerly
it could not be determined and was always (1,1), an annoyance for many cursors
other than the arrow.

In hardware cursor mode, the cursor will now be hidden when requested by the
emulated OS (such as when you are typing in a text field).

In hardware cursor mode, some cursor image formats that the code does not handle
correctly will now be rejected, causing the emulated OS to revert temporarily to
software cursor mode. Formerly you would just end up with random garbage for a
cursor. This typically happened for grayscale or color cursors; rejecting images
with rowBytes != 2 eliminates the worst cases.

File Contents

# Content
1 /*
2 * video.h - Video/graphics emulation
3 *
4 * SheepShaver (C) 1997-2008 Marc Hellwig and Christian Bauer
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 */
20
21 #ifndef VIDEO_H
22 #define VIDEO_H
23
24 extern bool VideoActivated(void);
25 extern bool VideoSnapshot(int xsize, int ysize, uint8 *p);
26
27 extern int16 VideoDoDriverIO(uint32 spaceID, uint32 commandID, uint32 commandContents, uint32 commandCode, uint32 commandKind);
28
29 // System specific and internal functions/data
30 struct VideoInfo {
31 int viType; // Screen/Window
32 uint32 viRowBytes; // width of each row in memory
33 uint16 viXsize,viYsize; // Window
34 uint32 viAppleMode; // Screen Color Depth
35 uint32 viAppleID; // Screen DisplayID
36 };
37
38 extern struct VideoInfo VModes[]; // List of available video modes
39
40 enum { // viAppleMode
41 APPLE_1_BIT = 0x80,
42 APPLE_2_BIT,
43 APPLE_4_BIT,
44 APPLE_8_BIT,
45 APPLE_16_BIT,
46 APPLE_32_BIT
47 };
48
49 // 1, 2, 4 and 8 bit depths use a color palette
50 inline bool IsDirectMode(int mode)
51 {
52 return mode == APPLE_16_BIT || mode == APPLE_32_BIT;
53 }
54
55 // Return the depth code that corresponds to the specified bits-per-pixel value
56 inline int DepthModeForPixelDepth(int depth)
57 {
58 switch (depth) {
59 case 1: return APPLE_1_BIT;
60 case 2: return APPLE_2_BIT;
61 case 4: return APPLE_4_BIT;
62 case 8: return APPLE_8_BIT;
63 case 15: case 16: return APPLE_16_BIT;
64 case 24: case 32: return APPLE_32_BIT;
65 default: return APPLE_1_BIT;
66 }
67 }
68
69 // Return a bytes-per-row value (assuming no padding) for the specified depth and pixel width
70 inline uint32 TrivialBytesPerRow(uint32 width, int mode)
71 {
72 switch (mode) {
73 case APPLE_1_BIT: return width / 8;
74 case APPLE_2_BIT: return width / 4;
75 case APPLE_4_BIT: return width / 2;
76 case APPLE_8_BIT: return width;
77 case APPLE_16_BIT: return width * 2;
78 case APPLE_32_BIT: return width * 4;
79 default: return width;
80 }
81 }
82
83 enum { // viAppleID
84 APPLE_640x480 = 0x81,
85 APPLE_W_640x480,
86 APPLE_800x600,
87 APPLE_W_800x600,
88 APPLE_1024x768,
89 APPLE_1152x768,
90 APPLE_1152x900,
91 APPLE_1280x1024,
92 APPLE_1600x1200,
93 APPLE_CUSTOM,
94 APPLE_ID_MIN = APPLE_640x480,
95 APPLE_ID_MAX = APPLE_CUSTOM
96 };
97
98 enum { // Display type
99 DIS_INVALID,
100 DIS_SCREEN,
101 DIS_WINDOW
102 };
103
104 extern bool video_activated; // Flag: video display activated, mouse and keyboard data valid
105 extern uint32 screen_base; // Frame buffer base address
106 extern int cur_mode; // Number of current video mode (index in VModes array)
107 extern int display_type; // Current display type (see above)
108 extern rgb_color mac_pal[256];
109 extern uint8 remap_mac_be[256];
110 extern uint8 MacCursor[68];
111
112 struct VidLocals{
113 uint16 saveMode;
114 uint32 saveData;
115 uint16 savePage;
116 uint32 saveBaseAddr;
117 uint32 gammaTable; // Mac address of gamma tble
118 uint32 maxGammaTableSize; // Biggest gamma table allocated
119 uint32 saveVidParms;
120 bool luminanceMapping; // Luminance mapping on/off
121 bool cursorHardware; // True if using hardware cursor
122 int32 cursorX; // Hardware cursor state
123 int32 cursorY;
124 uint32 cursorVisible;
125 uint32 cursorSet;
126 bool cursorHotFlag;
127 uint8 cursorHotX;
128 uint8 cursorHotY;
129 uint32 vslServiceID; // VSL interrupt service ID
130 bool interruptsEnabled; // VBL interrupts on/off
131 uint32 regEntryID; // Mac address of the service owner
132 };
133
134 extern VidLocals *private_data; // Pointer to driver local variables (there is only one display, so this is ok)
135
136 extern bool VideoInit(void);
137 extern void VideoExit(void);
138 extern void VideoVBL(void);
139 extern void VideoInstallAccel(void);
140 extern void VideoQuitFullScreen(void);
141
142 extern void video_set_palette(void);
143 extern void video_set_cursor(void);
144 extern bool video_can_change_cursor(void);
145 extern int16 video_mode_change(VidLocals *csSave, uint32 ParamPtr);
146 extern void video_set_dirty_area(int x, int y, int w, int h);
147
148 extern int16 VSLDoInterruptService(uint32 arg1);
149 extern void NQDMisc(uint32 arg1, uintptr arg2);
150
151 // Native QuickDraw acceleration callbacks
152 extern bool NQD_sync_hook(uint32);
153 extern bool NQD_bitblt_hook(uint32);
154 extern bool NQD_fillrect_hook(uint32);
155 extern bool NQD_unknown_hook(uint32);
156 extern void NQD_bitblt(uint32);
157 extern void NQD_invrect(uint32);
158 extern void NQD_fillrect(uint32);
159
160 extern bool keyfile_valid;
161
162 #endif