selection images to fail.
0.8.6 (?/??/2016):
------------------
0.8.6 (?/??/2016):
------------------
+- Reverted rEFIt commit r472, introduced in rEFInd 0.8.5 to support more
+ BMP images because I've received bug reports that it's causing existing
+ selection images to fail to load.
+
- Fixed install.sh bug that caused misidentification of installation
directory under OS X if an already-mounted ESP has spaces in its path.
- Fixed install.sh bug that caused misidentification of installation
directory under OS X if an already-mounted ESP has spaces in its path.
typedef struct {
CHAR8 CharB;
CHAR8 CharM;
typedef struct {
CHAR8 CharB;
CHAR8 CharM;
- INT32 Size;
- INT16 Reserved[2];
- INT32 ImageOffset;
- INT32 HeaderSize;
- INT32 PixelWidth;
- INT32 PixelHeight;
- INT16 Planes; // Must be 1
- INT16 BitPerPixel; // 1, 4, 8, or 24
- INT32 CompressionType;
- INT32 ImageSize; // Compressed image size in bytes
- INT32 XPixelsPerMeter;
- INT32 YPixelsPerMeter;
- INT32 NumberOfColors;
- INT32 ImportantColors;
+ UINT32 Size;
+ UINT16 Reserved[2];
+ UINT32 ImageOffset;
+ UINT32 HeaderSize;
+ UINT32 PixelWidth;
+ UINT32 PixelHeight;
+ UINT16 Planes; // Must be 1
+ UINT16 BitPerPixel; // 1, 4, 8, or 24
+ UINT32 CompressionType;
+ UINT32 ImageSize; // Compressed image size in bytes
+ UINT32 XPixelsPerMeter;
+ UINT32 YPixelsPerMeter;
+ UINT32 NumberOfColors;
+ UINT32 ImportantColors;
} BMP_IMAGE_HEADER;
#pragma pack()
} BMP_IMAGE_HEADER;
#pragma pack()
UINTN x, y;
UINT8 *ImagePtr;
UINT8 *ImagePtrBase;
UINTN x, y;
UINT8 *ImagePtr;
UINT8 *ImagePtrBase;
- UINTN PixelWidth, PixelHeight, ImageLineOffset;
UINT8 ImageValue = 0, AlphaValue;
UINT8 ImageValue = 0, AlphaValue;
EG_PIXEL *PixelPtr;
UINTN Index, BitIndex;
EG_PIXEL *PixelPtr;
UINTN Index, BitIndex;
if (BmpHeader->BitPerPixel != 1 && BmpHeader->BitPerPixel != 4 &&
BmpHeader->BitPerPixel != 8 && BmpHeader->BitPerPixel != 24)
return NULL;
if (BmpHeader->BitPerPixel != 1 && BmpHeader->BitPerPixel != 4 &&
BmpHeader->BitPerPixel != 8 && BmpHeader->BitPerPixel != 24)
return NULL;
- if (BmpHeader->PixelWidth < 1 || BmpHeader->PixelWidth > 4096 ||
- BmpHeader->PixelHeight < -4096 || BmpHeader->PixelHeight == 0 ||
- BmpHeader->PixelHeight > 4096)
- return NULL;
- PixelWidth = BmpHeader->PixelWidth;
- UpsideDown = BmpHeader->PixelHeight >= 0;
- if (BmpHeader->PixelHeight < 0)
- PixelHeight = -BmpHeader->PixelHeight;
- else
- PixelHeight = BmpHeader->PixelHeight;
- ImageLineOffset = PixelWidth;
+ ImageLineOffset = BmpHeader->PixelWidth;
if (BmpHeader->BitPerPixel == 24)
ImageLineOffset *= 3;
else if (BmpHeader->BitPerPixel == 1)
if (BmpHeader->BitPerPixel == 24)
ImageLineOffset *= 3;
else if (BmpHeader->BitPerPixel == 1)
if ((ImageLineOffset % 4) != 0)
ImageLineOffset = ImageLineOffset + (4 - (ImageLineOffset % 4));
// check bounds
if ((ImageLineOffset % 4) != 0)
ImageLineOffset = ImageLineOffset + (4 - (ImageLineOffset % 4));
// check bounds
- if (BmpHeader->ImageOffset + ImageLineOffset * PixelHeight > FileDataLength)
+ if (BmpHeader->ImageOffset + ImageLineOffset * BmpHeader->PixelHeight > FileDataLength)
return NULL;
// allocate image structure and buffer
return NULL;
// allocate image structure and buffer
- NewImage = egCreateImage(PixelWidth, PixelHeight, WantAlpha);
+ NewImage = egCreateImage(BmpHeader->PixelWidth, BmpHeader->PixelHeight, WantAlpha);
if (NewImage == NULL)
return NULL;
AlphaValue = WantAlpha ? 255 : 0;
if (NewImage == NULL)
return NULL;
AlphaValue = WantAlpha ? 255 : 0;
// convert image
BmpColorMap = (BMP_COLOR_MAP *)(FileData + sizeof(BMP_IMAGE_HEADER));
ImagePtrBase = FileData + BmpHeader->ImageOffset;
// convert image
BmpColorMap = (BMP_COLOR_MAP *)(FileData + sizeof(BMP_IMAGE_HEADER));
ImagePtrBase = FileData + BmpHeader->ImageOffset;
- for (y = 0; y < PixelHeight; y++) {
+ for (y = 0; y < BmpHeader->PixelHeight; y++) {
ImagePtr = ImagePtrBase;
ImagePtrBase += ImageLineOffset;
ImagePtr = ImagePtrBase;
ImagePtrBase += ImageLineOffset;
- if (UpsideDown)
- PixelPtr = NewImage->PixelData + (PixelHeight - 1 - y) * PixelWidth;
- else
- PixelPtr = NewImage->PixelData + y * PixelWidth;
+ PixelPtr = NewImage->PixelData + (BmpHeader->PixelHeight - 1 - y) * BmpHeader->PixelWidth;
switch (BmpHeader->BitPerPixel) {
case 1:
switch (BmpHeader->BitPerPixel) {
case 1:
- for (x = 0; x < PixelWidth; x++) {
+ for (x = 0; x < BmpHeader->PixelWidth; x++) {
BitIndex = x & 0x07;
if (BitIndex == 0)
ImageValue = *ImagePtr++;
BitIndex = x & 0x07;
if (BitIndex == 0)
ImageValue = *ImagePtr++;
- for (x = 0; x <= PixelWidth - 2; x += 2) {
+ for (x = 0; x <= BmpHeader->PixelWidth - 2; x += 2) {
ImageValue = *ImagePtr++;
Index = ImageValue >> 4;
ImageValue = *ImagePtr++;
Index = ImageValue >> 4;
PixelPtr->a = AlphaValue;
PixelPtr++;
}
PixelPtr->a = AlphaValue;
PixelPtr++;
}
+ if (x < BmpHeader->PixelWidth) {
ImageValue = *ImagePtr++;
Index = ImageValue >> 4;
ImageValue = *ImagePtr++;
Index = ImageValue >> 4;
- for (x = 0; x < PixelWidth; x++) {
+ for (x = 0; x < BmpHeader->PixelWidth; x++) {
Index = *ImagePtr++;
PixelPtr->b = BmpColorMap[Index].Blue;
PixelPtr->g = BmpColorMap[Index].Green;
Index = *ImagePtr++;
PixelPtr->b = BmpColorMap[Index].Blue;
PixelPtr->g = BmpColorMap[Index].Green;
- for (x = 0; x < PixelWidth; x++) {
+ for (x = 0; x < BmpHeader->PixelWidth; x++) {
PixelPtr->b = *ImagePtr++;
PixelPtr->g = *ImagePtr++;
PixelPtr->r = *ImagePtr++;
PixelPtr->b = *ImagePtr++;
PixelPtr->g = *ImagePtr++;
PixelPtr->r = *ImagePtr++;
BmpHeader = (BMP_IMAGE_HEADER *)FileData;
BmpHeader->CharB = 'B';
BmpHeader->CharM = 'M';
BmpHeader = (BMP_IMAGE_HEADER *)FileData;
BmpHeader->CharB = 'B';
BmpHeader->CharM = 'M';
- BmpHeader->Size = (INT32)FileDataLength;
+ BmpHeader->Size = FileDataLength;
BmpHeader->ImageOffset = sizeof(BMP_IMAGE_HEADER);
BmpHeader->HeaderSize = 40;
BmpHeader->ImageOffset = sizeof(BMP_IMAGE_HEADER);
BmpHeader->HeaderSize = 40;
- BmpHeader->PixelWidth = (INT32)Image->Width;
- BmpHeader->PixelHeight = (INT32)Image->Height;
+ BmpHeader->PixelWidth = Image->Width;
+ BmpHeader->PixelHeight = Image->Height;
BmpHeader->Planes = 1;
BmpHeader->BitPerPixel = 24;
BmpHeader->CompressionType = 0;
BmpHeader->Planes = 1;
BmpHeader->BitPerPixel = 24;
BmpHeader->CompressionType = 0;
if (AboutMenu.EntryCount == 0) {
AboutMenu.TitleImage = BuiltinIcon(BUILTIN_ICON_FUNC_ABOUT);
if (AboutMenu.EntryCount == 0) {
AboutMenu.TitleImage = BuiltinIcon(BUILTIN_ICON_FUNC_ABOUT);
- AddMenuInfoLine(&AboutMenu, L"rEFInd Version 0.8.5");
+ AddMenuInfoLine(&AboutMenu, L"rEFInd Version 0.8.5.1");
AddMenuInfoLine(&AboutMenu, L"");
AddMenuInfoLine(&AboutMenu, L"Copyright (c) 2006-2010 Christoph Pfisterer");
AddMenuInfoLine(&AboutMenu, L"Copyright (c) 2012-2014 Roderick W. Smith");
AddMenuInfoLine(&AboutMenu, L"");
AddMenuInfoLine(&AboutMenu, L"Copyright (c) 2006-2010 Christoph Pfisterer");
AddMenuInfoLine(&AboutMenu, L"Copyright (c) 2012-2014 Roderick W. Smith");