--- kernel/bsd/dev/ppc/FBConsole.c 2018/04/24 18:26:03 1.1 +++ kernel/bsd/dev/ppc/FBConsole.c 2018/04/24 18:29:49 1.1.1.2 @@ -494,8 +494,8 @@ static void Erase(ConsolePtr console) extern unsigned char appleClut8[ 768 ]; -static void Expand4ToN( ConsolePtr console, int x, int y, int width, int height, - unsigned char * dataPtr, unsigned char colors[ 16 ]) +static void Expand4Or8ToN( ConsolePtr console, int x, int y, int width, int height, + unsigned char * dataPtr, unsigned char * map16) { unsigned char *dst; int line, col, bit = 4; @@ -504,10 +504,13 @@ static void Expand4ToN( ConsolePtr conso dst = (unsigned char *) PixelAddress(console, x, y); for( line = 0; line < height; line++) { for( col = 0; col < width; col++, bit ^= 4) { - if( bit) - data8 = *dataPtr++; - data = colors[ (data8 >> bit) & 15]; - + if( map16) { + if( bit) + data8 = *dataPtr++; + data = map16[ (data8 >> bit) & 15]; + } else { + data = data8 = *dataPtr++; + } switch (console->display.bitsPerPixel) { case IO_8BitsPerPixel: if (console->display.colorSpace != IO_OneIsWhiteColorSpace) @@ -540,8 +543,17 @@ static void Expand4ToN( ConsolePtr conso } } +static void Expand4ToN( ConsolePtr console, int x, int y, int width, int height, + unsigned char * dataPtr, unsigned char * map16) +{ + Expand4Or8ToN(console, x, y, width, height, dataPtr, map16); +} - +static void Expand8ToN( ConsolePtr console, int x, int y, int width, int height, + unsigned char * dataPtr) +{ + Expand4Or8ToN(console, x, y, width, height, dataPtr, 0); +} static void DrawColorRect( ConsolePtr console, int x, int y, int width, int height, unsigned char * dataPtr) { @@ -1352,12 +1364,17 @@ static void Init( cx = console->display.width / 2; cy = console->display.height / 2; +#if 0 Expand4ToN( console, cx + RIGHT_DX, cy + RIGHT_DY, RIGHT_WIDTH, RIGHT_HEIGHT, rightData, rightBotColors ); Expand4ToN( console, cx + CENTER_DX, cy + CENTER_DY, CENTER_WIDTH, CENTER_HEIGHT, centerData, centerColors ); Expand4ToN( console, cx + BOTTOM_DX, cy + BOTTOM_DY, BOTTOM_WIDTH, BOTTOM_HEIGHT, bottomData, rightBotColors ); +#else + Expand8ToN( console, cx + CENTER_DX, cy + CENTER_DY, + CENTER_WIDTH, CENTER_HEIGHT, centerData ); +#endif } break; @@ -1443,7 +1460,7 @@ static int DrawRect(IOConsoleInfo *cso, bgH = (y - bgY) & -2; if( bgH > 0) { bgY += bgH; - bg = centerData + (bgH * CENTER_WIDTH) / 2; + bg = centerData + (bgH * CENTER_WIDTH); bgH = CENTER_HEIGHT - bgH; } else bg = (unsigned char *)0; @@ -1491,12 +1508,10 @@ static int DrawRect(IOConsoleInfo *cso, for ( y = 0; y < rect->height; ++y ) { fb = dst; #if TEXTURE_BACKGND - if( ((y & 1) == 0) && bg) { - Expand4ToN( console, bgX, bgY, - CENTER_WIDTH, 2, bg, centerColors ); - bgY += 2; - bg += CENTER_WIDTH; - } + Expand8ToN( console, bgX, bgY, + CENTER_WIDTH, 1, bg ); + bgY += 1; + bg += CENTER_WIDTH; #endif for ( x = 0; x < rect->width; x += 4) { value = *data++; @@ -1532,12 +1547,10 @@ static int DrawRect(IOConsoleInfo *cso, for ( y = 0; y < rect->height; ++y ) { fb = dst; #if TEXTURE_BACKGND - if( ((y & 1) == 0) && bg) { - Expand4ToN( console, bgX, bgY, - CENTER_WIDTH, 2, bg, centerColors ); - bgY += 2; - bg += CENTER_WIDTH; - } + Expand8ToN( console, bgX, bgY, + CENTER_WIDTH, 1, bg ); + bgY += 1; + bg += CENTER_WIDTH; #endif for ( x = 0; x < rect->width; x += 4) { value = *data++; @@ -1572,12 +1585,10 @@ static int DrawRect(IOConsoleInfo *cso, for ( y = 0; y < rect->height; ++y ) { fb = dst; #if TEXTURE_BACKGND - if( ((y & 1) == 0) && bg) { - Expand4ToN( console, bgX, bgY, - CENTER_WIDTH, 2, bg, centerColors ); - bgY += 2; - bg += CENTER_WIDTH; - } + Expand8ToN( console, bgX, bgY, + CENTER_WIDTH, 1, bg ); + bgY += 1; + bg += CENTER_WIDTH; #endif for ( x = 0; x < rect->width; x += 4) { value = *data++; @@ -1646,7 +1657,7 @@ static int EraseRect(IOConsoleInfo *cso, bgH = (y - bgY) & -2; if( bgH > 0) { bgY += bgH; - bg = centerData + (bgH * CENTER_WIDTH) / 2; + bg = centerData + (bgH * CENTER_WIDTH); bgH = CENTER_HEIGHT - bgH; Expand4ToN( console, bgX, bgY, CENTER_WIDTH, bgH, bg, centerColors );