mirror of
https://github.com/sheumann/VNCviewGS.git
synced 2024-12-28 00:29:23 +00:00
d1b2e10489
The logic for making sure the color table was complete before connecting was slightly broken due to wraparound, so it would cause all entries to be generated, re-generating any that already had been. This fixes it, which should make the initial connection process slightly faster on slow systems.
185 lines
9.0 KiB
C++
185 lines
9.0 KiB
C++
#if __ORCAC__
|
|
#pragma lint -1
|
|
#pragma noroot
|
|
segment "VNCview GS";
|
|
#endif
|
|
|
|
#include <types.h>
|
|
#include <stdlib.h>
|
|
#include "colortables.h"
|
|
|
|
const unsigned char coltab320[] = {
|
|
/* bbgggrrr - incoming pixel data */
|
|
/* 00000 */ 0x00,0x00,0x00,0x22,0x77,0x77,0x77,0x77,
|
|
/* 00001 */ 0x00,0x00,0x22,0x22,0x22,0x77,0x77,0x77,
|
|
/* 00010 */ 0x55,0x55,0x22,0x22,0x22,0x22,0x66,0x66,
|
|
/* 00011 */ 0x55,0x55,0x22,0x22,0x22,0x22,0x66,0x66,
|
|
/* 00100 */ 0x55,0x55,0x55,0x22,0x22,0x66,0x66,0x66,
|
|
/* 00101 */ 0x55,0x55,0x55,0x55,0x22,0x66,0x66,0x66,
|
|
/* 00110 */ 0xAA,0xAA,0xAA,0xAA,0x99,0x99,0x99,0x99,
|
|
/* 00111 */ 0xAA,0xAA,0xAA,0xAA,0x99,0x99,0x99,0x99,
|
|
/* 01000 */ 0x00,0x00,0x22,0x22,0x22,0x77,0x77,0x77,
|
|
/* 01001 */ 0x00,0x00,0x22,0x22,0x22,0x22,0x77,0x77,
|
|
/* 01010 */ 0x55,0x11,0x11,0x11,0x11,0x22,0x66,0x66,
|
|
/* 01011 */ 0x55,0x11,0x11,0x11,0x11,0x11,0x66,0x66,
|
|
/* 01100 */ 0x55,0x55,0x11,0x11,0x11,0x11,0x88,0x88,
|
|
/* 01101 */ 0x55,0x55,0x11,0x11,0x11,0x88,0x88,0x88,
|
|
/* 01110 */ 0xAA,0xAA,0xAA,0x11,0x11,0x99,0x99,0x99,
|
|
/* 01111 */ 0xAA,0xAA,0xAA,0xAA,0x99,0x99,0x99,0x99,
|
|
/* 10000 */ 0x44,0x44,0x33,0x33,0x33,0x33,0x33,0x33,
|
|
/* 10001 */ 0x44,0x33,0x33,0x33,0x33,0x33,0x33,0x88,
|
|
/* 10010 */ 0x44,0x33,0x33,0x33,0x33,0x33,0x88,0x88,
|
|
/* 10011 */ 0x44,0x33,0x33,0x33,0x33,0x33,0x88,0x88,
|
|
/* 10100 */ 0xBB,0xBB,0x11,0x11,0x11,0xEE,0x88,0x88,
|
|
/* 10101 */ 0xBB,0xBB,0xBB,0x11,0xEE,0xEE,0x88,0x88,
|
|
/* 10110 */ 0xBB,0xBB,0xBB,0xBB,0xEE,0xEE,0xEE,0x88,
|
|
/* 10111 */ 0xBB,0xBB,0xBB,0xBB,0xEE,0xEE,0xEE,0xFF,
|
|
/* 11000 */ 0x44,0x44,0x44,0x33,0x33,0x33,0x33,0x33,
|
|
/* 11001 */ 0x44,0x44,0x33,0x33,0x33,0x33,0x33,0xCC,
|
|
/* 11010 */ 0x44,0x44,0xDD,0xDD,0xDD,0xDD,0xCC,0xCC,
|
|
/* 11011 */ 0x44,0xDD,0xDD,0xDD,0xDD,0xCC,0xCC,0xCC,
|
|
/* 11100 */ 0xBB,0xBB,0xDD,0xDD,0xDD,0xCC,0xCC,0xCC,
|
|
/* 11101 */ 0xBB,0xBB,0xBB,0xDD,0xDD,0xCC,0xCC,0xCC,
|
|
/* 11110 */ 0xBB,0xBB,0xBB,0xBB,0xEE,0xEE,0xFF,0xFF,
|
|
/* 11111 */ 0xBB,0xBB,0xBB,0xBB,0xBB,0xFF,0xFF,0xFF
|
|
};
|
|
|
|
/* Based on grayscale palette */
|
|
|
|
const unsigned char coltab640[] = {
|
|
/* bbgggrrr - incoming pixel data */
|
|
/* 00000 */ 0x00,0x00,0x00,0x00,0x55,0x55,0x55,0x55,
|
|
/* 00001 */ 0x00,0x00,0x55,0x55,0x55,0x55,0x55,0x55,
|
|
/* 00010 */ 0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,
|
|
/* 00011 */ 0x55,0x55,0x55,0x55,0x55,0x55,0xAA,0xAA,
|
|
/* 00100 */ 0x55,0x55,0x55,0x55,0xAA,0xAA,0xAA,0xAA,
|
|
/* 00101 */ 0x55,0x55,0xAA,0xAA,0xAA,0xAA,0xAA,0xAA,
|
|
/* 00110 */ 0xAA,0xAA,0xAA,0xAA,0xAA,0xAA,0xAA,0xAA,
|
|
/* 00111 */ 0xAA,0xAA,0xAA,0xAA,0xAA,0xAA,0xFF,0xFF,
|
|
/* 01000 */ 0x00,0x00,0x00,0x00,0x55,0x55,0x55,0x55,
|
|
/* 01001 */ 0x00,0x00,0x55,0x55,0x55,0x55,0x55,0x55,
|
|
/* 01010 */ 0x55,0x55,0x55,0x55,0x55,0x55,0x55,0xAA,
|
|
/* 01011 */ 0x55,0x55,0x55,0x55,0x55,0xAA,0xAA,0xAA,
|
|
/* 01100 */ 0x55,0x55,0x55,0xAA,0xAA,0xAA,0xAA,0xAA,
|
|
/* 01101 */ 0x55,0xAA,0xAA,0xAA,0xAA,0xAA,0xAA,0xAA,
|
|
/* 01110 */ 0xAA,0xAA,0xAA,0xAA,0xAA,0xAA,0xAA,0xFF,
|
|
/* 01111 */ 0xAA,0xAA,0xAA,0xAA,0xAA,0xFF,0xFF,0xFF,
|
|
/* 10000 */ 0x00,0x00,0x00,0x55,0x55,0x55,0x55,0x55,
|
|
/* 10001 */ 0x00,0x55,0x55,0x55,0x55,0x55,0x55,0x55,
|
|
/* 10010 */ 0x55,0x55,0x55,0x55,0x55,0x55,0x55,0xAA,
|
|
/* 10011 */ 0x55,0x55,0x55,0x55,0x55,0xAA,0xAA,0xAA,
|
|
/* 10100 */ 0x55,0x55,0x55,0xAA,0xAA,0xAA,0xAA,0xAA,
|
|
/* 10101 */ 0x55,0xAA,0xAA,0xAA,0xAA,0xAA,0xAA,0xAA,
|
|
/* 10110 */ 0xAA,0xAA,0xAA,0xAA,0xAA,0xAA,0xAA,0xFF,
|
|
/* 10111 */ 0xAA,0xAA,0xAA,0xAA,0xAA,0xFF,0xFF,0xFF,
|
|
/* 11000 */ 0x00,0x00,0x55,0x55,0x55,0x55,0x55,0x55,
|
|
/* 11001 */ 0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,
|
|
/* 11010 */ 0x55,0x55,0x55,0x55,0x55,0x55,0xAA,0xAA,
|
|
/* 11011 */ 0x55,0x55,0x55,0x55,0xAA,0xAA,0xAA,0xAA,
|
|
/* 11100 */ 0x55,0x55,0xAA,0xAA,0xAA,0xAA,0xAA,0xAA,
|
|
/* 11101 */ 0xAA,0xAA,0xAA,0xAA,0xAA,0xAA,0xAA,0xAA,
|
|
/* 11110 */ 0xAA,0xAA,0xAA,0xAA,0xAA,0xAA,0xFF,0xFF,
|
|
/* 11111 */ 0xAA,0xAA,0xAA,0xAA,0xFF,0xFF,0xFF,0xFF
|
|
};
|
|
|
|
/* iters = number of iterations to do (0 means run to completion) */
|
|
BOOLEAN MakeBigColorTables (unsigned int iters)
|
|
{
|
|
static unsigned int i = 0;
|
|
unsigned int iMax = i + iters;
|
|
if (iMax <= i) /* Deal with wraparound */
|
|
iMax = 0;
|
|
|
|
/* The addressing scheme here depends on the IIgs's little-endianness */
|
|
do {
|
|
bigcoltab320[i] = (coltab320[i&0xFF]&0xF0) + (coltab320[i>>8]&0x0F);
|
|
bigcoltab640a[i] = (coltab640[i&0xFF]&0xC0) + (coltab640[i>>8]&0x30);
|
|
bigcoltab640b[i] = (coltab640[i&0xFF]&0x0C) + (coltab640[i>>8]&0x03);
|
|
i++;
|
|
} while (i != iMax);
|
|
|
|
if (iMax == 0)
|
|
return TRUE; /* Done */
|
|
else
|
|
return FALSE; /* In progress */
|
|
}
|
|
|
|
#if 0
|
|
/* Old 640-mode color tables for dithered color (with alternating tables
|
|
* used in alternating display columns); based on standard 640-mode palette.
|
|
*/
|
|
|
|
const unsigned char coltab640[] = {
|
|
/* bbgggrrr - incoming pixel data */
|
|
/* 00000 */ 0x00,0x00,0x00,0x44,0x44,0x44,0x44,0x44,
|
|
/* 00001 */ 0x00,0x00,0x00,0x44,0x44,0x44,0x44,0x66,
|
|
/* 00010 */ 0x00,0x00,0x22,0x22,0x22,0x22,0x66,0x66,
|
|
/* 00011 */ 0x88,0x88,0x22,0x22,0x22,0x22,0x66,0x66,
|
|
/* 00100 */ 0x88,0x88,0x22,0x22,0x22,0x22,0x66,0x66,
|
|
/* 00101 */ 0x88,0x88,0x88,0x22,0x22,0x22,0x66,0x66,
|
|
/* 00110 */ 0x88,0x88,0xAA,0xAA,0xAA,0xAA,0x66,0x66,
|
|
/* 00111 */ 0x88,0xAA,0xAA,0xAA,0xAA,0xAA,0xAA,0x66,
|
|
/* 01000 */ 0x11,0x11,0x11,0x44,0x44,0x44,0x44,0x44,
|
|
/* 01001 */ 0x11,0x11,0x11,0x55,0x55,0x55,0x55,0x77,
|
|
/* 01010 */ 0x11,0x11,0x22,0x22,0x22,0x22,0x77,0x77,
|
|
/* 01011 */ 0x99,0x99,0x22,0x22,0x22,0x22,0x77,0x77,
|
|
/* 01100 */ 0x99,0x99,0x22,0x22,0x22,0x22,0x77,0x77,
|
|
/* 01101 */ 0x99,0x99,0x22,0x22,0x22,0x22,0x77,0x77,
|
|
/* 01110 */ 0x99,0x99,0xBB,0xBB,0xBB,0xBB,0xEE,0xEE,
|
|
/* 01111 */ 0x99,0xBB,0xBB,0xBB,0xBB,0xBB,0xEE,0xEE,
|
|
/* 10000 */ 0x11,0x11,0x55,0x55,0x55,0x55,0x55,0x55,
|
|
/* 10001 */ 0x11,0x11,0x55,0x55,0x55,0x55,0x55,0x77,
|
|
/* 10010 */ 0x11,0x11,0x33,0x33,0x55,0x55,0x77,0x77,
|
|
/* 10011 */ 0x99,0x99,0x33,0x33,0x33,0x33,0x77,0x77,
|
|
/* 10100 */ 0x99,0x99,0x33,0x33,0x33,0x33,0x77,0x77,
|
|
/* 10101 */ 0x99,0x99,0x99,0x33,0x33,0x33,0x77,0x77,
|
|
/* 10110 */ 0x99,0x99,0xBB,0xBB,0xBB,0xBB,0xEE,0xEE,
|
|
/* 10111 */ 0x99,0x99,0xBB,0xBB,0xBB,0xBB,0xEE,0xEE,
|
|
/* 11000 */ 0x11,0x11,0x55,0x55,0x55,0x55,0x55,0x55,
|
|
/* 11001 */ 0x11,0x11,0x55,0x55,0x55,0x55,0x55,0x55,
|
|
/* 11010 */ 0x99,0x99,0xDD,0xDD,0xDD,0xDD,0xDD,0xDD,
|
|
/* 11011 */ 0x99,0x99,0xDD,0xDD,0xDD,0xDD,0xDD,0xDD,
|
|
/* 11100 */ 0x99,0x99,0xDD,0xDD,0xDD,0xDD,0xDD,0xFF,
|
|
/* 11101 */ 0x99,0x99,0xDD,0xDD,0xDD,0xDD,0xFF,0xFF,
|
|
/* 11110 */ 0x99,0x99,0xDD,0xDD,0xDD,0xFF,0xFF,0xFF,
|
|
/* 11111 */ 0x99,0x99,0xDD,0xDD,0xFF,0xFF,0xFF,0xFF
|
|
};
|
|
|
|
const unsigned char coltab640alt[] = {
|
|
/* bbgggrrr - incoming pixel data */
|
|
/* 00000 */ 0x00,0x00,0x00,0x11,0x11,0x11,0x11,0x11,
|
|
/* 00001 */ 0x00,0x00,0x00,0x11,0x11,0x11,0x11,0x99,
|
|
/* 00010 */ 0x00,0x00,0x88,0x88,0x88,0x88,0x99,0x99,
|
|
/* 00011 */ 0x22,0x22,0x88,0x88,0x88,0x88,0x99,0x99,
|
|
/* 00100 */ 0x22,0x22,0x88,0x88,0x88,0x88,0x99,0x99,
|
|
/* 00101 */ 0x22,0x22,0x22,0x88,0x88,0x88,0x99,0x99,
|
|
/* 00110 */ 0x22,0x22,0xAA,0xAA,0xAA,0xAA,0x99,0x99,
|
|
/* 00111 */ 0x22,0xAA,0xAA,0xAA,0xAA,0xAA,0xAA,0x99,
|
|
/* 01000 */ 0x44,0x44,0x44,0x11,0x11,0x11,0x11,0x11,
|
|
/* 01001 */ 0x44,0x44,0x44,0x55,0x55,0x55,0x55,0xDD,
|
|
/* 01010 */ 0x44,0x44,0x88,0x88,0x88,0x88,0xDD,0xDD,
|
|
/* 01011 */ 0x66,0x66,0x88,0x88,0x88,0x88,0xDD,0xDD,
|
|
/* 01100 */ 0x66,0x66,0x88,0x88,0x88,0x88,0xDD,0xDD,
|
|
/* 01101 */ 0x66,0x66,0x88,0x88,0x88,0x88,0xDD,0xDD,
|
|
/* 01110 */ 0x66,0x66,0xEE,0xEE,0xEE,0xEE,0xBB,0xBB,
|
|
/* 01111 */ 0x66,0xEE,0xEE,0xEE,0xEE,0xEE,0xBB,0xBB,
|
|
/* 10000 */ 0x44,0x44,0x55,0x55,0x55,0x55,0x55,0x55,
|
|
/* 10001 */ 0x44,0x44,0x55,0x55,0x55,0x55,0x55,0xDD,
|
|
/* 10010 */ 0x44,0x44,0xCC,0xCC,0x55,0x55,0xDD,0xDD,
|
|
/* 10011 */ 0x66,0x66,0xCC,0xCC,0xCC,0xCC,0xDD,0xDD,
|
|
/* 10100 */ 0x66,0x66,0xCC,0xCC,0xCC,0xCC,0xDD,0xDD,
|
|
/* 10101 */ 0x66,0x66,0x66,0xCC,0xCC,0xCC,0xDD,0xDD,
|
|
/* 10110 */ 0x66,0x66,0xEE,0xEE,0xEE,0xEE,0xBB,0xBB,
|
|
/* 10111 */ 0x66,0x66,0xEE,0xEE,0xEE,0xEE,0xBB,0xBB,
|
|
/* 11000 */ 0x44,0x44,0x55,0x55,0x55,0x55,0x55,0x55,
|
|
/* 11001 */ 0x44,0x44,0x55,0x55,0x55,0x55,0x55,0x55,
|
|
/* 11010 */ 0x66,0x66,0x77,0x77,0x77,0x77,0x77,0x77,
|
|
/* 11011 */ 0x66,0x66,0x77,0x77,0x77,0x77,0x77,0x77,
|
|
/* 11100 */ 0x66,0x66,0x77,0x77,0x77,0x77,0x77,0xFF,
|
|
/* 11101 */ 0x66,0x66,0x77,0x77,0x77,0x77,0xFF,0xFF,
|
|
/* 11110 */ 0x66,0x66,0x77,0x77,0x77,0xFF,0xFF,0xFF,
|
|
/* 11111 */ 0x66,0x66,0x77,0x77,0xFF,0xFF,0xFF,0xFF
|
|
};
|
|
|
|
#endif /* 0 */
|