rss-glx-0.9.1-imagemagick-7.patch 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179
  1. --- a/configure.in
  2. +++ b/configure.in
  3. @@ -38,6 +38,8 @@
  4. AC_PROG_LIBTOOL
  5. AC_PROG_LN_S
  6. +PKG_PROG_PKG_CONFIG
  7. +
  8. # Checks for libraries.
  9. AC_CHECK_LIB([m], [pow],,AC_MSG_ERROR(-lm was not found but required.))
  10. @@ -81,7 +83,15 @@
  11. AC_CHECK_FUNCS(random_r nrand48)
  12. # Check for ImageMagick.
  13. -PKG_CHECK_MODULES(Wand, Wand >= 6.4)
  14. +PKG_CHECK_MODULES(Wand, [Wand >= 6.4],,
  15. + [PKG_CHECK_MODULES(Wand, MagickWand >= 6.4)]
  16. +)
  17. +
  18. +old_CPPFLAGS="$CPPFLAGS"; CPPFLAGS="$Wand_CFLAGS"
  19. +AC_CHECK_HEADERS([magick/api.h] [wand/magick-wand.h],,
  20. + AC_CHECK_HEADERS([MagickCore/MagickCore.h] [MagickWand/MagickWand.h])
  21. +)
  22. +CPPFLAGS="$old_CPPFLAGS"
  23. if test -d src/skyrocket_sounds ; then
  24. AC_ARG_ENABLE(sound, [ --disable-sound Don't compile with sound.])
  25. --- a/src/TexMgr.cpp
  26. +++ b/src/TexMgr.cpp
  27. @@ -25,8 +25,19 @@
  28. #endif
  29. #include <cstdlib>
  30. +#ifdef HAVE_MAGICK_API_H
  31. +#ifdef HAVE_WAND_MAGICK_WAND_H
  32. #include <magick/api.h>
  33. #include <wand/magick-wand.h>
  34. +#endif /* HAVE_WAND_MAGICK_WAND_H */
  35. +#endif /* HAVE_MAGICK_API_H */
  36. +#ifdef HAVE_MAGICKCORE_MAGICKCORE_H
  37. +#ifdef HAVE_MAGICKWAND_MAGICKWAND_H
  38. +#include <MagickCore/MagickCore.h>
  39. +#include <MagickWand/MagickWand.h>
  40. +#endif /* HAVE_MAGICKWAND_MAGICKWAND_H */
  41. +#endif /* HAVE_MAGICKCORE_MAGICKCORE_H */
  42. +
  43. #include <dirent.h>
  44. #include <sys/types.h>
  45. #include <sys/stat.h>
  46. @@ -255,10 +266,18 @@
  47. // Directory scanning + image loading code in a separate function callable either from loadNextImage or another thread if pthreads is available.
  48. void TexMgr::loadNextImageFromDisk() {
  49. MagickWand *magick_wand = NewMagickWand();
  50. +#ifdef HAVE_MAGICKCORE_MAGICKCORE_H
  51. + ExceptionInfo *exception;
  52. +#else
  53. ExceptionInfo exception;
  54. +#endif
  55. int dirLoop = 0;
  56. +#ifdef HAVE_MAGICKCORE_MAGICKCORE_H
  57. + exception = AcquireExceptionInfo ();
  58. +#else
  59. GetExceptionInfo (&exception);
  60. +#endif
  61. int imageLoaded = 0;
  62. do {
  63. @@ -317,7 +336,11 @@
  64. nextH = ohh;
  65. }
  66. +#ifdef HAVE_MAGICKCORE_MAGICKCORE_H
  67. + ExportImagePixels (GetImageFromMagickWand(magick_wand), 0, 0, oww, ohh, "RGBA", CharPixel, nextTex, exception);
  68. +#else
  69. ExportImagePixels (GetImageFromMagickWand(magick_wand), 0, 0, oww, ohh, "RGBA", CharPixel, nextTex, &exception);
  70. +#endif
  71. magick_wand = DestroyMagickWand (magick_wand);
  72. --- a/src/matrixview.c
  73. +++ b/src/matrixview.c
  74. @@ -84,8 +84,19 @@
  75. float *texcoords;
  76. unsigned char *colors;
  77. +#ifdef HAVE_MAGICK_API_H
  78. +#ifdef HAVE_WAND_MAGICK_WAND_H
  79. #include <magick/api.h>
  80. #include <wand/magick-wand.h>
  81. +#endif /* HAVE_WAND_MAGICK_WAND_H */
  82. +#endif /* HAVE_MAGICK_API_H */
  83. +#ifdef HAVE_MAGICKCORE_MAGICKCORE_H
  84. +#ifdef HAVE_MAGICKWAND_MAGICKWAND_H
  85. +#include <MagickCore/MagickCore.h>
  86. +#include <MagickWand/MagickWand.h>
  87. +#endif /* HAVE_MAGICKWAND_MAGICKWAND_H */
  88. +#endif /* HAVE_MAGICKCORE_MAGICKCORE_H */
  89. +
  90. #include <dirent.h>
  91. #include <sys/types.h>
  92. #include <sys/stat.h>
  93. @@ -99,10 +110,18 @@
  94. // Directory scanning + image loading code in a separate function callable either from loadNextImage or another thread if pthreads is available.
  95. void loadNextImageFromDisk() {
  96. MagickWand *magick_wand = NewMagickWand();
  97. +#ifdef HAVE_MAGICKCORE_MAGICKCORE_H
  98. + ExceptionInfo *exception;
  99. +#else
  100. ExceptionInfo exception;
  101. +#endif
  102. int dirLoop = 0;
  103. +#ifdef HAVE_MAGICKCORE_MAGICKCORE_H
  104. + exception = AcquireExceptionInfo ();
  105. +#else
  106. GetExceptionInfo (&exception);
  107. +#endif
  108. int imageLoaded = 0;
  109. do {
  110. @@ -159,7 +178,11 @@
  111. if (!next_pic)
  112. next_pic = (unsigned char *)malloc (text_x * text_y);
  113. +#ifdef HAVE_MAGICKCORE_MAGICKCORE_H
  114. + ExportImagePixels (GetImageFromMagickWand(magick_wand), 0, 0, text_x, text_y, "I", CharPixel, next_pic, exception);
  115. +#else
  116. ExportImagePixels (GetImageFromMagickWand(magick_wand), 0, 0, text_x, text_y, "I", CharPixel, next_pic, &exception);
  117. +#endif
  118. magick_wand = DestroyMagickWand (magick_wand);
  119. }
  120. @@ -211,11 +234,19 @@
  121. pthread_cond_signal(next_pic_cond);
  122. }
  123. } else {
  124. +#ifdef HAVE_MAGICKCORE_MAGICKCORE_H
  125. + ExceptionInfo *exception;
  126. +#else
  127. ExceptionInfo exception;
  128. +#endif
  129. Image *image = NULL, *scaled_image;
  130. ImageInfo *image_info;
  131. +#ifdef HAVE_MAGICKCORE_MAGICKCORE_H
  132. + exception = AcquireExceptionInfo ();
  133. +#else
  134. GetExceptionInfo (&exception);
  135. +#endif
  136. if (!pics)
  137. LOAD_TEXTURE (pics, cpics, cpics_compressedsize, cpics_size)
  138. @@ -227,6 +258,15 @@
  139. image_info = CloneImageInfo ((ImageInfo *) NULL);
  140. image_info->size = AcquireMagickMemory(sizeof("90x70"));
  141. strcpy(image_info->size, "90x70");
  142. +#ifdef HAVE_MAGICKCORE_MAGICKCORE_H
  143. + image = AcquireImage(image_info, exception);
  144. +
  145. + ImportImagePixels(image, 0, 0, 90, 70, "I", CharPixel, (unsigned char *)(pics + ((random () & 15) * (90 * 70))), exception);
  146. +
  147. + scaled_image = ScaleImage (image, text_x, text_y, exception);
  148. +
  149. + ExportImagePixels (scaled_image, 0, 0, text_x, text_y, "I", CharPixel, pic, exception);
  150. +#else
  151. image = AcquireImage(image_info);
  152. ImportImagePixels(image, 0, 0, 90, 70, "I", CharPixel, (unsigned char *)(pics + ((random () & 15) * (90 * 70))));
  153. @@ -234,6 +274,7 @@
  154. scaled_image = ScaleImage (image, text_x, text_y, &exception);
  155. ExportImagePixels (scaled_image, 0, 0, text_x, text_y, "I", CharPixel, pic, &exception);
  156. +#endif
  157. DestroyImage (image);
  158. DestroyImage (scaled_image);