Chameleon

Chameleon Commit Details

Date:2015-07-31 03:37:37 (4 years 6 months ago)
Author:ErmaC
Commit:2743
Parents: 2742
Message:Use LZVN packed logo data instead of old RLE data (Credits to Pike R. Alpha)
Changes:
M/branches/ErmaC/Enoch/i386/boot2/gui.h
M/branches/ErmaC/Enoch/i386/boot2/graphics.c
M/branches/ErmaC/Enoch/i386/boot2/gui.c
M/branches/ErmaC/Enoch/i386/boot2/graphics.h
M/branches/ErmaC/Enoch/i386/boot2/boot.h

File differences

branches/ErmaC/Enoch/i386/boot2/graphics.c
108108
109109
110110
111
112
111
113112
114113
115114
......
233232
234233
235234
236
237
235
238236
239237
240238
......
380378
381379
382380
383
381
384382
385383
386384
......
422420
423421
424422
425
426
423
427424
428425
429426
......
497494
498495
499496
500
497
501498
502499
503500
......
565562
566563
567564
568
569
565
570566
571567
572568
......
619615
620616
621617
622
618
619
623620
624621
625622
......
649646
650647
651648
652
653
649
654650
655651
656652
......
785781
786782
787783
788
789
790
784
785
786
791787
788
789
790
791
792792
793793
794794
......
826826
827827
828828
829
830
831
832
833
829
834830
835
836
837
831
832
838833
839
840
834
835
841836
842
843
837
838
844839
840
841
845842
846843
847
848
849
850
851
852
853
844
854845
855846
856847
......
875866
876867
877868
878
869
879870
880871
881872
......
931922
932923
933924
934
925
935926
936927
937928
......
966957
967958
968959
969
960
970961
971962
972963
......
10261017
10271018
10281019
1029
1020
10301021
10311022
10321023
......
11241115
11251116
11261117
1127
1118
11281119
11291120
11301121
//==========================================================================
//
void
printVBEModeInfo()
void printVBEModeInfo()
{
VBEInfoBlock vbeInfo;
unsigned short * modePtr;
// 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 shortwidth,
static unsigned short getVESAModeWithProperties( unsigned shortwidth,
unsigned shortheight,
unsigned charbitsPerPixel,
unsigned shortattributesSet,
//==========================================================================
// 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;
//==========================================================================
// setVESAGraphicsMode
static int
setVESAGraphicsMode( unsigned short width,
static int setVESAGraphicsMode( unsigned short width,
unsigned short height,
unsigned char bitsPerPixel,
unsigned short refreshRate )
if ( minfo.BitsPerPixel == 8 )
{
VBEPalette palette;
setupPalette( &palette, appleClut8 );
setupPalette( &palette, AppleLogoClut );
if ((err = setVBEPalette(palette)) != errSuccess)
{
break;
//==============================================================================
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;
//==============================================================================
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;
//==============================================================================
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;
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 :
//==============================================================================
void drawColorRectangle( unsigned short x,
unsigned short y,
unsigned short width,
unsigned short height,
unsigned char colorIndex )
void drawColorRectangle( uint32_t color )
{
longpixelBytes;
longcolor = lookUpCLUTIndex( colorIndex, VIDEO(depth) );
char*vram;
longpixelBytes = 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);
}
}
while ( height-- )
{
bcopy( data, vram, drawWidth * pixelBytes );
bcopy( data, vram, width * pixelBytes );
vram += VIDEO(rowBytes);
data += width * pixelBytes;
}
DECLARE_IOHIBERNATEPROGRESSALPHA
void drawPreview(void *src, uint8_t * saveunder)
void drawPreview(void *src, uint8_t *saveunder)
{
uint8_t *screen;
uint32_t rowBytes, pixelShift;
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;
//==============================================================================
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_trowBytes, pixelShift;
//==========================================================================
// getNumberArrayFromProperty
static int getNumberArrayFromProperty( const char * propKey,
static int getNumberArrayFromProperty( const char *propKey,
unsigned long numbers[],
unsigned long maxArrayCount )
{
branches/ErmaC/Enoch/i386/boot2/graphics.h
2222
2323
2424
25
25
2626
2727
2828
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 );
branches/ErmaC/Enoch/i386/boot2/boot.h
270270
271271
272272
273
274
275
276
277
278
279
273
280274
281275
282276
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,
branches/ErmaC/Enoch/i386/boot2/gui.c
24192419
24202420
24212421
2422
2422
24232423
24242424
24252425
......
24322432
24332433
24342434
2435
2436
2437
2438
2435
2436
24392437
2440
2441
2442
2438
2439
2440
2441
2442
2443
2444
2445
24432446
2444
2445
2447
24462448
2447
2448
2449
2450
2449
2450
2451
24512452
2452
2453
24532454
24542455
24552456
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))
}
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);
}
}
}
branches/ErmaC/Enoch/i386/boot2/gui.h
3333
3434
3535
36
37
38
39
40
41
3642
3743
3844
#define MENU_SHOW_VIDEO_INFO5
#define MENU_SHOW_HELP6
#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 {

Archive Download the corresponding diff file

Revision: 2743