Index: branches/ErmaC/Enoch/i386/boot2/graphics.c =================================================================== --- branches/ErmaC/Enoch/i386/boot2/graphics.c (revision 2742) +++ branches/ErmaC/Enoch/i386/boot2/graphics.c (revision 2743) @@ -108,8 +108,7 @@ //========================================================================== // -void -printVBEModeInfo() +void printVBEModeInfo() { VBEInfoBlock vbeInfo; unsigned short * modePtr; @@ -233,8 +232,7 @@ // Return the VESA mode that matches the properties specified. // If a mode is not found, then return the "best" available mode. -static unsigned short -getVESAModeWithProperties( unsigned short width, +static unsigned short getVESAModeWithProperties( unsigned short width, unsigned short height, unsigned char bitsPerPixel, unsigned short attributesSet, @@ -380,7 +378,7 @@ //========================================================================== // setupPalette -static void setupPalette( VBEPalette * p, const unsigned char * g ) +static void setupPalette( VBEPalette *p, const unsigned char *g ) { int i; unsigned char * source = (unsigned char *) g; @@ -422,8 +420,7 @@ //========================================================================== // setVESAGraphicsMode -static int -setVESAGraphicsMode( unsigned short width, +static int setVESAGraphicsMode( unsigned short width, unsigned short height, unsigned char bitsPerPixel, unsigned short refreshRate ) @@ -497,7 +494,7 @@ if ( minfo.BitsPerPixel == 8 ) { VBEPalette palette; - setupPalette( &palette, appleClut8 ); + setupPalette( &palette, AppleLogoClut ); if ((err = setVBEPalette(palette)) != errSuccess) { break; @@ -565,8 +562,7 @@ //============================================================================== -int loadPngImage(const char *filename, uint16_t *width, uint16_t *height, - uint8_t **imageData) +int loadPngImage(const char *filename, uint16_t *width, uint16_t *height, uint8_t **imageData) { uint8_t *pngData = NULL; int pngFile = 0, pngSize; @@ -619,7 +615,8 @@ //============================================================================== -int loadEmbeddedPngImage(uint8_t *pngData, int pngSize, uint16_t *width, uint16_t *height, uint8_t **imageData) { +int loadEmbeddedPngImage(uint8_t *pngData, int pngSize, uint16_t *width, uint16_t *height, uint8_t **imageData) +{ PNG_info_t *info; int error = 0; @@ -649,8 +646,7 @@ //============================================================================== -void blendImage(uint16_t x, uint16_t y, uint16_t width, uint16_t height, - uint8_t *data) +void blendImage(uint16_t x, uint16_t y, uint16_t width, uint16_t height, uint8_t *data) { uint16_t drawWidth; uint8_t *vram = (uint8_t *) VIDEO(baseAddr) + VIDEO(rowBytes) * y + 4 * x; @@ -785,10 +781,14 @@ long result; long colorIndex = (index * 3); - long red = appleClut8[ colorIndex ]; - long green = appleClut8[ colorIndex++ ]; - long blue = appleClut8[ colorIndex++ ]; + long red; + long green; + long blue; + red = AppleLogoClut[ colorIndex ]; + green = AppleLogoClut[ colorIndex++ ]; + blue = AppleLogoClut[ colorIndex++ ]; + switch (depth) { case 16 : @@ -826,31 +826,22 @@ //============================================================================== -void drawColorRectangle( unsigned short x, - unsigned short y, - unsigned short width, - unsigned short height, - unsigned char colorIndex ) +void drawColorRectangle( uint32_t color ) { - long pixelBytes; - long color = lookUpCLUTIndex( colorIndex, VIDEO(depth) ); - char *vram; + long pixelBytes = VIDEO(depth) / 8; + char *vram = (char *) VIDEO(baseAddr) + VIDEO(rowBytes) + pixelBytes; - pixelBytes = VIDEO(depth) / 8; - vram = (char *) VIDEO(baseAddr) + VIDEO(rowBytes) * y + pixelBytes * x; + int width = VIDEO(width); + int height = VIDEO(height); - width = MIN(width, VIDEO(width) - x); - height = MIN(height, VIDEO(height) - y); + int rem = ( pixelBytes * width ) % 4; + int length = pixelBytes * width / 4; + bcopy( &color, vram, rem ); + while ( height-- ) { - int rem = ( pixelBytes * width ) % 4; - if ( rem ) - { - bcopy( &color, vram, rem ); - } - - stosl( vram + rem, color, pixelBytes * width / 4 ); + stosl( vram + rem, color, length ); vram += VIDEO(rowBytes); } } @@ -875,7 +866,7 @@ while ( height-- ) { - bcopy( data, vram, drawWidth * pixelBytes ); + bcopy( data, vram, width * pixelBytes ); vram += VIDEO(rowBytes); data += width * pixelBytes; } @@ -931,7 +922,7 @@ DECLARE_IOHIBERNATEPROGRESSALPHA -void drawPreview(void *src, uint8_t * saveunder) +void drawPreview(void *src, uint8_t *saveunder) { uint8_t *screen; uint32_t rowBytes, pixelShift; @@ -966,7 +957,7 @@ rowBytes = VIDEO (rowBytes); // Set the screen to 75% grey. - drawColorRectangle(0, 0, VIDEO(width), VIDEO(height), 0x01 /* color index */); + drawColorRectangle(0xffbfbfbf); } pixelShift = VIDEO (depth) >> 4; @@ -1026,7 +1017,7 @@ //============================================================================== -void updateProgressBar(uint8_t * saveunder, int32_t firstBlob, int32_t select) +void updateProgressBar(uint8_t *saveunder, int32_t firstBlob, int32_t select) { uint8_t *screen; uint32_t rowBytes, pixelShift; @@ -1124,7 +1115,7 @@ //========================================================================== // getNumberArrayFromProperty -static int getNumberArrayFromProperty( const char * propKey, +static int getNumberArrayFromProperty( const char *propKey, unsigned long numbers[], unsigned long maxArrayCount ) { Index: branches/ErmaC/Enoch/i386/boot2/graphics.h =================================================================== --- branches/ErmaC/Enoch/i386/boot2/graphics.h (revision 2742) +++ branches/ErmaC/Enoch/i386/boot2/graphics.h (revision 2743) @@ -22,7 +22,7 @@ unsigned long lookUpCLUTIndex( unsigned char index, unsigned char depth ); -void drawColorRectangle( unsigned short x, unsigned short y, unsigned short width, unsigned short height, unsigned char colorIndex ); +void drawColorRectangle( uint32_t color ); void drawDataRectangle( unsigned short x, unsigned short y, unsigned short width, unsigned short height, unsigned char * data ); int convertImage( unsigned short width, unsigned short height, const unsigned char *imageData, unsigned char **newImageData ); Index: branches/ErmaC/Enoch/i386/boot2/boot.h =================================================================== --- branches/ErmaC/Enoch/i386/boot2/boot.h (revision 2742) +++ branches/ErmaC/Enoch/i386/boot2/boot.h (revision 2743) @@ -270,13 +270,7 @@ extern int getVideoMode(); extern void spinActivityIndicator(); extern void clearActivityIndicator(); -extern void drawColorRectangle( - unsigned short x, - unsigned short y, - unsigned short width, - unsigned short height, - unsigned char colorIndex - ); +extern void drawColorRectangle( uint32_t color ); extern void drawDataRectangle( unsigned short x, unsigned short y, Index: branches/ErmaC/Enoch/i386/boot2/gui.c =================================================================== --- branches/ErmaC/Enoch/i386/boot2/gui.c (revision 2742) +++ branches/ErmaC/Enoch/i386/boot2/gui.c (revision 2743) @@ -2419,7 +2419,7 @@ else { // Fill the background to 75% grey (same as BootX). - drawColorRectangle(0, 0, screen_params[0], screen_params[1], 0x01); + drawColorRectangle(0xffbfbfbf); } if ((bootImageData) && (usePngImage)) @@ -2432,24 +2432,25 @@ } else { - uint8_t *appleBootPict; - bootImageData = NULL; - bootImageWidth = kAppleBootWidth; - bootImageHeight = kAppleBootHeight; + // Standard size (Width 84 Height 103) + // TODO HiDPI size (Width 168 Height 206) - // Prepare the data for the default Apple boot image. - appleBootPict = (uint8_t *) decodeRLE(gAppleBootPictRLE, kAppleBootRLEBlocks, bootImageWidth * bootImageHeight); - if (appleBootPict) + int logoSize = (APPLE_LOGO_WIDTH * APPLE_LOGO_HEIGHT); + + void *dst = malloc(logoSize); + + void *logoData = (void *)AppleLogoPacked; + uint32_t src_size = sizeof(AppleLogoPacked); + + if (dst) { - convertImage(bootImageWidth, bootImageHeight, appleBootPict, &bootImageData); - if (bootImageData) + if (lzvn_decode(dst, logoSize, logoData, src_size) == logoSize) { - x = (screen_params[0] - MIN(kAppleBootWidth, screen_params[0])) / 2; - y = (screen_params[1] - MIN(kAppleBootHeight, screen_params[1])) / 2; - drawDataRectangle(x, y, kAppleBootWidth, kAppleBootHeight, bootImageData); - free(bootImageData); + uint8_t *bootImageData = NULL; + convertImage(APPLE_LOGO_WIDTH, APPLE_LOGO_HEIGHT, dst, &bootImageData); + drawDataRectangle(APPLE_LOGO_X, APPLE_LOGO_Y, APPLE_LOGO_WIDTH, APPLE_LOGO_HEIGHT, bootImageData); } - free(appleBootPict); + free(dst); } } } Index: branches/ErmaC/Enoch/i386/boot2/gui.h =================================================================== --- branches/ErmaC/Enoch/i386/boot2/gui.h (revision 2742) +++ branches/ErmaC/Enoch/i386/boot2/gui.h (revision 2743) @@ -33,6 +33,12 @@ #define MENU_SHOW_VIDEO_INFO 5 #define MENU_SHOW_HELP 6 +#define APPLE_LOGO_WIDTH 84 +#define APPLE_LOGO_HEIGHT 103 + +#define APPLE_LOGO_X ((VIDEO(width) - APPLE_LOGO_WIDTH) / 2) +#define APPLE_LOGO_Y ((VIDEO(height) - APPLE_LOGO_HEIGHT) / 2) + // ==================================================================== enum {