0003-fix-big-endian-os.patch 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. fixed PluginBMP, PluginDDS for compilation under Big Endian OS
  2. Downloaded from upstream commit:
  3. https://sourceforge.net/p/freeimage/svn/1809/
  4. Signed-off-by: Bernd Kuhls <bernd.kuhls@t-online.de>
  5. diff -uNr FreeImage.orig/Source/FreeImage/PluginBMP.cpp FreeImage/Source/FreeImage/PluginBMP.cpp
  6. --- FreeImage.orig/Source/FreeImage/PluginBMP.cpp 2016-06-15 12:35:30.000000000 +0200
  7. +++ FreeImage/Source/FreeImage/PluginBMP.cpp 2019-08-31 16:00:27.813378612 +0200
  8. @@ -518,7 +518,7 @@
  9. io->read_proc(FreeImage_GetPalette(dib), used_colors * sizeof(RGBQUAD), 1, handle);
  10. #if FREEIMAGE_COLORORDER == FREEIMAGE_COLORORDER_RGB
  11. RGBQUAD *pal = FreeImage_GetPalette(dib);
  12. - for(int i = 0; i < used_colors; i++) {
  13. + for(unsigned int i = 0; i < used_colors; i++) {
  14. INPLACESWAP(pal[i].rgbRed, pal[i].rgbBlue);
  15. }
  16. #endif
  17. @@ -1419,7 +1419,7 @@
  18. free(buffer);
  19. #ifdef FREEIMAGE_BIGENDIAN
  20. - } else if (bpp == 16) {
  21. + } else if (dst_bpp == 16) {
  22. int padding = dst_pitch - dst_width * sizeof(WORD);
  23. WORD pad = 0;
  24. WORD pixel;
  25. @@ -1440,7 +1440,7 @@
  26. }
  27. #endif
  28. #if FREEIMAGE_COLORORDER == FREEIMAGE_COLORORDER_RGB
  29. - } else if (bpp == 24) {
  30. + } else if (dst_bpp == 24) {
  31. int padding = dst_pitch - dst_width * sizeof(FILE_BGR);
  32. DWORD pad = 0;
  33. FILE_BGR bgr;
  34. @@ -1461,7 +1461,7 @@
  35. }
  36. }
  37. }
  38. - } else if (bpp == 32) {
  39. + } else if (dst_bpp == 32) {
  40. FILE_BGRA bgra;
  41. for(unsigned y = 0; y < dst_height; y++) {
  42. BYTE *line = FreeImage_GetScanLine(dib, y);
  43. diff -uNr FreeImage.orig/Source/FreeImage/PluginDDS.cpp FreeImage/Source/FreeImage/PluginDDS.cpp
  44. --- FreeImage.orig/Source/FreeImage/PluginDDS.cpp 2018-07-31 17:04:58.000000000 +0200
  45. +++ FreeImage/Source/FreeImage/PluginDDS.cpp 2019-08-31 16:00:39.213465120 +0200
  46. @@ -356,14 +356,6 @@
  47. for(int i=0; i<11; i++) {
  48. SwapLong(&header->surfaceDesc.dwReserved1[i]);
  49. }
  50. - SwapLong(&header->surfaceDesc.ddpfPixelFormat.dwSize);
  51. - SwapLong(&header->surfaceDesc.ddpfPixelFormat.dwFlags);
  52. - SwapLong(&header->surfaceDesc.ddpfPixelFormat.dwFourCC);
  53. - SwapLong(&header->surfaceDesc.ddpfPixelFormat.dwRGBBitCount);
  54. - SwapLong(&header->surfaceDesc.ddpfPixelFormat.dwRBitMask);
  55. - SwapLong(&header->surfaceDesc.ddpfPixelFormat.dwGBitMask);
  56. - SwapLong(&header->surfaceDesc.ddpfPixelFormat.dwBBitMask);
  57. - SwapLong(&header->surfaceDesc.ddpfPixelFormat.dwRGBAlphaBitMask);
  58. SwapLong(&header->surfaceDesc.ddsCaps.dwCaps1);
  59. SwapLong(&header->surfaceDesc.ddsCaps.dwCaps2);
  60. SwapLong(&header->surfaceDesc.ddsCaps.dwReserved[0]);