ViewVC Help
View File | Revision Log | Show Annotations | Revision Graph | Root Listing
root/cebix/BasiliskII/src/include/video.h
(Generate patch)

Comparing BasiliskII/src/include/video.h (file contents):
Revision 1.5 by cebix, 2001-02-02T20:52:59Z vs.
Revision 1.8 by cebix, 2001-06-28T21:20:00Z

# Line 21 | Line 21
21   #ifndef VIDEO_H
22   #define VIDEO_H
23  
24 < // Description for one (possibly virtual) monitor
25 < enum {
26 <        VMODE_1BIT,
27 <        VMODE_2BIT,
28 <        VMODE_4BIT,
29 <        VMODE_8BIT,
30 <        VMODE_16BIT,
31 <        VMODE_32BIT
24 > #include <vector>
25 >
26 > // Color depth codes
27 > enum video_depth {
28 >        VDEPTH_1BIT,  // 2 colors
29 >        VDEPTH_2BIT,  // 4 colors
30 >        VDEPTH_4BIT,  // 16 colors
31 >        VDEPTH_8BIT,  // 256 colors
32 >        VDEPTH_16BIT, // "Thousands"
33 >        VDEPTH_32BIT  // "Millions"
34   };
35  
36 < #define IsDirectMode(x) ((x) == VMODE_16BIT || (x) == VMODE_32BIT)
36 > inline uint16 DepthToAppleMode(video_depth depth)
37 > {
38 >        return depth + 0x80;
39 > }
40 >
41 > inline video_depth AppleModeToDepth(uint16 mode)
42 > {
43 >        return video_depth(mode - 0x80);
44 > }
45 >
46 > inline bool IsDirectMode(video_depth depth)
47 > {
48 >        return depth == VDEPTH_16BIT || depth == VDEPTH_32BIT;
49 > }
50 >
51 > inline bool IsDirectMode(uint16 mode)
52 > {
53 >        return IsDirectMode(AppleModeToDepth(mode));
54 > }
55 >
56 > inline video_depth DepthModeForPixelDepth(int depth)
57 > {
58 >        switch (depth) {
59 >                case 1: return VDEPTH_1BIT;
60 >                case 2: return VDEPTH_2BIT;
61 >                case 4: return VDEPTH_4BIT;
62 >                case 8: return VDEPTH_8BIT;
63 >                case 15: case 16: return VDEPTH_16BIT;
64 >                case 24: case 32: return VDEPTH_32BIT;
65 >                default: return VDEPTH_1BIT;
66 >        }
67 > }
68 >
69 > // Return a bytes-per-row value that assumes no padding for specified depth and pixel width
70 > inline uint32 TrivialBytesPerRow(uint32 width, video_depth depth)
71 > {
72 >        switch (depth) {
73 >                case VDEPTH_1BIT: return width / 8;
74 >                case VDEPTH_2BIT: return width / 4;
75 >                case VDEPTH_4BIT: return width / 2;
76 >                case VDEPTH_8BIT: return width;
77 >                case VDEPTH_16BIT: return width * 2;
78 >                case VDEPTH_32BIT: return width * 4;
79 >        }
80 > }
81  
82 < struct video_desc {
83 <        uint32 mac_frame_base;  // Mac frame buffer address
38 <        uint32 bytes_per_row;   // Bytes per row
82 > // Description of one video mode
83 > struct video_mode {
84          uint32 x;                               // X size of screen (pixels)
85          uint32 y;                               // Y size of screen (pixels)
86 <        int mode;                               // Video mode
86 >        uint32 resolution_id;   // Resolution ID (should be >= 0x80 and uniquely identify the sets of modes with the same X/Y size)
87 >        uint32 bytes_per_row;   // Bytes per row of frame buffer
88 >        video_depth depth;              // Color depth (see definitions above)
89 > };
90 >
91 > inline bool IsDirectMode(const video_mode &mode)
92 > {
93 >        return IsDirectMode(mode.depth);
94 > }
95 >
96 > // List of all supported video modes
97 > extern std::vector<video_mode> VideoModes;
98 >
99 > // Description for one (possibly virtual) monitor
100 > struct monitor_desc {
101 >        uint32 mac_frame_base;  // Mac frame buffer address
102 >        video_mode mode;                // Currently selected video mode description
103   };
104  
105 < extern struct video_desc VideoMonitor;  // Description of the main monitor, set by VideoInit()
105 > extern monitor_desc VideoMonitor;       // Description of the main monitor, set by VideoInit()
106  
107   extern int16 VideoDriverOpen(uint32 pb, uint32 dce);
108   extern int16 VideoDriverControl(uint32 pb, uint32 dce);
# Line 56 | Line 117 | extern void VideoQuitFullScreen(void);
117   extern void VideoInterrupt(void);
118   extern void VideoRefresh(void);
119  
120 + extern void video_switch_to_mode(const video_mode &mode);
121   extern void video_set_palette(uint8 *pal);
122  
123   #endif

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines