--- SheepShaver/src/include/video.h 2002/02/04 16:58:13 1.1.1.1 +++ SheepShaver/src/include/video.h 2004/11/13 14:09:16 1.8 @@ -1,7 +1,7 @@ /* * video.h - Video/graphics emulation * - * SheepShaver (C) 1997-2002 Marc Hellwig and Christian Bauer + * SheepShaver (C) 1997-2004 Marc Hellwig and Christian Bauer * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -24,7 +24,7 @@ extern bool VideoActivated(void); extern bool VideoSnapshot(int xsize, int ysize, uint8 *p); -extern int16 VideoDoDriverIO(void *spaceID, void *commandID, void *commandContents, uint32 commandCode, uint32 commandKind); +extern int16 VideoDoDriverIO(uint32 spaceID, uint32 commandID, uint32 commandContents, uint32 commandCode, uint32 commandKind); // System specific and internal functions/data struct VideoInfo { @@ -46,12 +46,47 @@ enum { // viAppleMode APPLE_32_BIT }; +// 1, 2, 4 and 8 bit depths use a color palette +inline bool IsDirectMode(int mode) +{ + return mode == APPLE_16_BIT || mode == APPLE_32_BIT; +} + +// Return the depth code that corresponds to the specified bits-per-pixel value +inline int DepthModeForPixelDepth(int depth) +{ + switch (depth) { + case 1: return APPLE_1_BIT; + case 2: return APPLE_2_BIT; + case 4: return APPLE_4_BIT; + case 8: return APPLE_8_BIT; + case 15: case 16: return APPLE_16_BIT; + case 24: case 32: return APPLE_32_BIT; + default: return APPLE_1_BIT; + } +} + +// Return a bytes-per-row value (assuming no padding) for the specified depth and pixel width +inline uint32 TrivialBytesPerRow(uint32 width, int mode) +{ + switch (mode) { + case APPLE_1_BIT: return width / 8; + case APPLE_2_BIT: return width / 4; + case APPLE_4_BIT: return width / 2; + case APPLE_8_BIT: return width; + case APPLE_16_BIT: return width * 2; + case APPLE_32_BIT: return width * 4; + default: return width; + } +} + enum { // viAppleID APPLE_640x480 = 0x81, APPLE_W_640x480, APPLE_800x600, APPLE_W_800x600, APPLE_1024x768, + APPLE_1152x768, APPLE_1152x900, APPLE_1280x1024, APPLE_1600x1200, @@ -103,10 +138,19 @@ extern void VideoQuitFullScreen(void); extern void video_set_palette(void); extern void video_set_cursor(void); +extern bool video_can_change_cursor(void); extern int16 video_mode_change(VidLocals *csSave, uint32 ParamPtr); extern int16 VSLDoInterruptService(uint32 arg1); -extern void NQDMisc(uint32 arg1, void *arg2); +extern void NQDMisc(uint32 arg1, uintptr arg2); + +// Native QuickDraw acceleration callbacks +extern bool NQD_sync_hook(uint32); +extern bool NQD_bitblt_hook(uint32); +extern bool NQD_fillrect_hook(uint32); +extern void NQD_bitblt(uint32); +extern void NQD_invrect(uint32); +extern void NQD_fillrect(uint32); extern bool keyfile_valid;