Skip to content

Commit

Permalink
More GraphicsMagick compatibility and deprecation fixes
Browse files Browse the repository at this point in the history
Now compatible with GraphicsMagick 1.3.30 and ImageMagick 6.9.10.
No more IM/GM related deprecation warnings (with the usual #if ugliness)

Fixed several mis-spellings of HAVE_GRAPHICSMAGICK (an extra underscore)
that I had introduced.
  • Loading branch information
ChocolateFrogsNuts committed Jul 19, 2018
1 parent 1832107 commit 7815dd9
Show file tree
Hide file tree
Showing 3 changed files with 55 additions and 7 deletions.
30 changes: 23 additions & 7 deletions src/map_OSM.c
Original file line number Diff line number Diff line change
Expand Up @@ -518,7 +518,7 @@ static void draw_image(
}


#if defined(HAVE_GRAPHICS_MAGICK) || (MagickLibVersion < 0x0669)
#if defined(HAVE_GRAPHICSMAGICK) || (MagickLibVersion < 0x0669)
pixel_pack = GetImagePixels(image, 0, 0, image->columns, image->rows);
#else
pixel_pack = GetAuthenticPixels(image, 0, 0, image->columns, image->rows, except_ptr);
Expand All @@ -528,10 +528,18 @@ static void draw_image(
return;
}

#if defined(HAVE_GRAPHICS_MAGICK) || (MagickLibVersion < 0x0669)
#if defined(HAVE_GRAPHICSMAGICK)
#if (MagickLibVersion < 0x211801)
index_pack = GetIndexes(image);
#else
index_pack = AccessMutableIndexes(image);
#endif
#else
#if (MagickLibVersion < 0x0669)
index_pack = GetIndexes(image);
#else
index_pack = GetAuthenticIndexQueue(image);
#endif
#endif
if (image->storage_class == PseudoClass && !index_pack) {
fprintf(stderr,"PseudoClass && index_pack == NULL!!!");
Expand Down Expand Up @@ -719,7 +727,7 @@ static void draw_OSM_image(
}


#if defined(HAVE_GRAPHICS_MAGICK) || (MagickLibVersion < 0x669)
#if defined(HAVE_GRAPHICSMAGICK) || (MagickLibVersion < 0x669)
pixel_pack = GetImagePixels(image, 0, 0, image->columns, image->rows);
#else
pixel_pack = GetAuthenticPixels(image, 0, 0, image->columns, image->rows, except_ptr);
Expand All @@ -729,10 +737,18 @@ static void draw_OSM_image(
return;
}

#if defined(HAVE_GRAPHICS_MAGICK) || (MagickLibVersion <0x669)
#if defined(HAVE_GRAPHICSMAGICK)
#if (MagickLibVersion < 0x211801)
index_pack = GetIndexes(image);
#else
index_pack = AccessMutableIndexes(image);
#endif
#else
#if (MagickLibVersion < 0x0669)
index_pack = GetIndexes(image);
#else
index_pack = GetAuthenticIndexQueue(image);
#endif
#endif
if (image->storage_class == PseudoClass && !index_pack) {
fprintf(stderr,"PseudoClass && index_pack == NULL!!!");
Expand Down Expand Up @@ -1202,7 +1218,7 @@ void draw_OSM_tiles (Widget w,
canvas->background_color.green = MATTE_GREEN;
canvas->background_color.blue = MATTE_BLUE;
canvas->background_color.opacity = MATTE_OPACITY;
#if defined(HAVE_GRAPHICS_MAGICK) || (MagickLibVersion < 0x0669)
#if defined(HAVE_GRAPHICSMAGICK) || (MagickLibVersion < 0x0669)
SetImage(canvas, MATTE_OPACITY);
#else
SetImageBackgroundColor(canvas);
Expand Down Expand Up @@ -1235,7 +1251,7 @@ void draw_OSM_tiles (Widget w,
//fprintf(stderr,"Exception severity:%d\n", exception.severity);
if (exception.severity==FileOpenError) {
//fprintf(stderr, "%s NOT available\n", tile_info->filename);
#if !defined(HAVE_GRAPHICS_MAGICK) && (MagickLibVersion > 0x0669)
#if !defined(HAVE_GRAPHICSMAGICK) && (MagickLibVersion > 0x0669)
ClearMagickException(&exception);
#endif
} else {
Expand Down Expand Up @@ -1271,7 +1287,7 @@ void draw_OSM_tiles (Widget w,
canvas->matte_color.blue = MATTE_BLUE;

if (debug_level & 512) {
#if defined(HAVE_GRAPHICS_MAGICK) || (MagickLibVersion < 0x0669)
#if defined(HAVE_GRAPHICSMAGICK) || (MagickLibVersion < 0x0669)
DescribeImage(canvas, stderr, 0);
#else
IdentifyImage(canvas, stderr, 0);
Expand Down
16 changes: 16 additions & 0 deletions src/map_WMS.c
Original file line number Diff line number Diff line change
Expand Up @@ -721,7 +721,11 @@ void draw_WMS_map (Widget w,
}


#if defined(HAVE_GRAPHICSMAGICK) || (MagickLibVersion < 0x0669)
pixel_pack = GetImagePixels(image, 0, 0, image->columns, image->rows);
#else
pixel_pack = GetAuthenticPixels(image, 0, 0, image->columns, image->rows, &exception);
#endif
if (!pixel_pack) {
fprintf(stderr,"pixel_pack == NULL!!!");
if (image)
Expand All @@ -733,7 +737,19 @@ void draw_WMS_map (Widget w,
}


#if defined(HAVE_GRAPHICSMAGICK)
#if (MagickLibVersion < 0x211801)
index_pack = GetIndexes(image);
#else
index_pack = AccessMutableIndexes(image);
#endif
#else
#if (MagickLibVersion < 0x0669)
index_pack = GetIndexes(image);
#else
index_pack = GetAuthenticIndexQueue(image);
#endif
#endif
if (image->storage_class == PseudoClass && !index_pack) {
fprintf(stderr,"PseudoClass && index_pack == NULL!!!");
if (image)
Expand Down
16 changes: 16 additions & 0 deletions src/map_tiger.c
Original file line number Diff line number Diff line change
Expand Up @@ -666,7 +666,11 @@ void draw_tiger_map (Widget w,
}


#if defined(HAVE_GRAPHICSMAGICK) || (MagickLibVersion < 0x0669)
pixel_pack = GetImagePixels(image, 0, 0, image->columns, image->rows);
#else
pixel_pack = GetAuthenticPixels(image, 0, 0, image->columns, image->rows, &exception);
#endif
if (!pixel_pack) {
fprintf(stderr,"pixel_pack == NULL!!!");
if (image)
Expand All @@ -678,7 +682,19 @@ void draw_tiger_map (Widget w,
}


#if defined(HAVE_GRAPHICSMAGICK)
#if (MagickLibVersion < 0x211801)
index_pack = GetIndexes(image);
#else
index_pack = AccessMutableIndexes(image);
#endif
#else
#if (MagickLibVersion < 0x0669)
index_pack = GetIndexes(image);
#else
index_pack = GetAuthenticIndexQueue(image);
#endif
#endif
if (image->storage_class == PseudoClass && !index_pack) {
fprintf(stderr,"PseudoClass && index_pack == NULL!!!");
if (image)
Expand Down

0 comments on commit 7815dd9

Please sign in to comment.