Unbreak freeimage on BE_ARCHS

PluginBMP.cpp had compiler errors before I added this patch.

fixed PluginBMP, PluginDDS for compilation under Big Endian OS (see
FREEIMAGE_BIGENDIAN)
https://sourceforge.net/p/freeimage/svn/1809/

ok tb@
This commit is contained in:
gkoehler 2022-08-11 20:50:12 +00:00
parent a000274d97
commit fd2de2c6ec
3 changed files with 66 additions and 1 deletions

View File

@ -3,7 +3,7 @@ COMMENT= c++ library for common image format
DISTNAME= FreeImage3180
PKGNAME= freeimage-3.18.0
CATEGORIES= graphics
REVISION= 0
REVISION= 1
SHARED_LIBS+= freeimage 3.0

View File

@ -0,0 +1,43 @@
fixed PluginBMP, PluginDDS for compilation under Big Endian OS (see
FREEIMAGE_BIGENDIAN)
https://sourceforge.net/p/freeimage/svn/1809/
Index: Source/FreeImage/PluginBMP.cpp
--- Source/FreeImage/PluginBMP.cpp.orig
+++ Source/FreeImage/PluginBMP.cpp
@@ -518,7 +518,7 @@ LoadWindowsBMP(FreeImageIO *io, fi_handle handle, int
io->read_proc(FreeImage_GetPalette(dib), used_colors * sizeof(RGBQUAD), 1, handle);
#if FREEIMAGE_COLORORDER == FREEIMAGE_COLORORDER_RGB
RGBQUAD *pal = FreeImage_GetPalette(dib);
- for(int i = 0; i < used_colors; i++) {
+ for(unsigned i = 0; i < used_colors; i++) {
INPLACESWAP(pal[i].rgbRed, pal[i].rgbBlue);
}
#endif
@@ -1419,7 +1419,7 @@ Save(FreeImageIO *io, FIBITMAP *dib, fi_handle handle,
free(buffer);
#ifdef FREEIMAGE_BIGENDIAN
- } else if (bpp == 16) {
+ } else if (dst_bpp == 16) {
int padding = dst_pitch - dst_width * sizeof(WORD);
WORD pad = 0;
WORD pixel;
@@ -1440,7 +1440,7 @@ Save(FreeImageIO *io, FIBITMAP *dib, fi_handle handle,
}
#endif
#if FREEIMAGE_COLORORDER == FREEIMAGE_COLORORDER_RGB
- } else if (bpp == 24) {
+ } else if (dst_bpp == 24) {
int padding = dst_pitch - dst_width * sizeof(FILE_BGR);
DWORD pad = 0;
FILE_BGR bgr;
@@ -1461,7 +1461,7 @@ Save(FreeImageIO *io, FIBITMAP *dib, fi_handle handle,
}
}
}
- } else if (bpp == 32) {
+ } else if (dst_bpp == 32) {
FILE_BGRA bgra;
for(unsigned y = 0; y < dst_height; y++) {
BYTE *line = FreeImage_GetScanLine(dib, y);

View File

@ -0,0 +1,22 @@
fixed PluginBMP, PluginDDS for compilation under Big Endian OS (see
FREEIMAGE_BIGENDIAN)
https://sourceforge.net/p/freeimage/svn/1809/
Index: Source/FreeImage/PluginDDS.cpp
--- Source/FreeImage/PluginDDS.cpp.orig
+++ Source/FreeImage/PluginDDS.cpp
@@ -356,14 +356,6 @@ SwapHeader(DDSHEADER *header) {
for(int i=0; i<11; i++) {
SwapLong(&header->surfaceDesc.dwReserved1[i]);
}
- SwapLong(&header->surfaceDesc.ddpfPixelFormat.dwSize);
- SwapLong(&header->surfaceDesc.ddpfPixelFormat.dwFlags);
- SwapLong(&header->surfaceDesc.ddpfPixelFormat.dwFourCC);
- SwapLong(&header->surfaceDesc.ddpfPixelFormat.dwRGBBitCount);
- SwapLong(&header->surfaceDesc.ddpfPixelFormat.dwRBitMask);
- SwapLong(&header->surfaceDesc.ddpfPixelFormat.dwGBitMask);
- SwapLong(&header->surfaceDesc.ddpfPixelFormat.dwBBitMask);
- SwapLong(&header->surfaceDesc.ddpfPixelFormat.dwRGBAlphaBitMask);
SwapLong(&header->surfaceDesc.ddsCaps.dwCaps1);
SwapLong(&header->surfaceDesc.ddsCaps.dwCaps2);
SwapLong(&header->surfaceDesc.ddsCaps.dwReserved[0]);