From: cristy Date: Wed, 15 Aug 2012 00:58:25 +0000 (+0000) Subject: (no commit message) X-Git-Tag: 7.0.1-0~5133 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=1164d5fe59e7fef3f1d4784043d68a4c65c582cf;p=imagemagick --- diff --git a/MagickCore/magick-config.h b/MagickCore/magick-config.h index 8cf8e8989..6bde21aa0 100644 --- a/MagickCore/magick-config.h +++ b/MagickCore/magick-config.h @@ -20,9 +20,7 @@ #endif /* Define if you have CAIRO library */ -#ifndef MAGICKCORE_CAIRO_DELEGATE -#define MAGICKCORE_CAIRO_DELEGATE 1 -#endif +/* #undef CAIRO_DELEGATE */ /* permit enciphering and deciphering image pixels */ #ifndef MAGICKCORE_CIPHER_SUPPORT @@ -1373,9 +1371,7 @@ #endif /* Define if you have RSVG library */ -#ifndef MAGICKCORE_RSVG_DELEGATE -#define MAGICKCORE_RSVG_DELEGATE 1 -#endif +/* #undef RSVG_DELEGATE */ /* Define to the type of arg 1 for `select'. */ #ifndef MAGICKCORE_SELECT_TYPE_ARG1 diff --git a/MagickCore/version.h b/MagickCore/version.h index 4c88a3ede..1c4c72f23 100644 --- a/MagickCore/version.h +++ b/MagickCore/version.h @@ -27,7 +27,7 @@ extern "C" { */ #define MagickPackageName "ImageMagick" #define MagickCopyright "Copyright (C) 1999-2012 ImageMagick Studio LLC" -#define MagickSVNRevision "8934:8947M" +#define MagickSVNRevision "8934:8953M" #define MagickLibVersion 0x700 #define MagickLibVersionText "7.0.0" #define MagickLibVersionNumber 7,0,0 diff --git a/PerlMagick/Makefile.PL b/PerlMagick/Makefile.PL index dba861d4f..8356d5bf6 100644 --- a/PerlMagick/Makefile.PL +++ b/PerlMagick/Makefile.PL @@ -156,7 +156,7 @@ foreach my $delegate (@tested_delegates) { } # defaults for LIBS & INC & CCFLAGS params that we later pass to Writemakefile -my $INC_magick = '-I../ -I.. -I/usr/include/cairo -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include -I/usr/include/pixman-1 -I/usr/include/freetype2 -I/usr/include/libpng15 -pthread -I/usr/include/librsvg-2.0 -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/cairo -I/usr/include/libpng15 -I/usr/include/pixman-1 -I/usr/include/freetype2 -pthread -I/usr/include/pango-1.0 -I/usr/include/cairo -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include -I/usr/include/pixman-1 -I/usr/include/freetype2 -I/usr/include/libpng15 -I/usr/include/freetype2 -I/usr/include/libxml2 -I"' . $Config{'usrinc'} . '/ImageMagick"'; +my $INC_magick = '-I../ -I.. -pthread -I/usr/include/pango-1.0 -I/usr/include/cairo -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include -I/usr/include/pixman-1 -I/usr/include/freetype2 -I/usr/include/libpng15 -I/usr/include/freetype2 -I/usr/include/libxml2 -I"' . $Config{'usrinc'} . '/ImageMagick"'; my $LIBS_magick = '-L../MagickCore/.libs -lMagickCore -lperl -lm'; my $CCFLAGS_magick = "$Config{'ccflags'} -pthread -I/usr/include/OpenEXR -fopenmp -g -O2 -Wall -pthread"; my $LDFLAGS_magick = "-L../MagickCore/.libs -lMagickCore $Config{'ldflags'} -L/usr/lib"; @@ -201,7 +201,7 @@ WriteMakefile #'CC' => 'gcc -std=gnu99 -std=gnu99', # C pre-processor flags (e.g. -I & -D options) - # 'CPPFLAGS' => "$Config{'cppflags'} -I/usr/include/cairo -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include -I/usr/include/pixman-1 -I/usr/include/freetype2 -I/usr/include/libpng15 -pthread -I/usr/include/librsvg-2.0 -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/cairo -I/usr/include/libpng15 -I/usr/include/pixman-1 -I/usr/include/freetype2 -pthread -I/usr/include/pango-1.0 -I/usr/include/cairo -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include -I/usr/include/pixman-1 -I/usr/include/freetype2 -I/usr/include/libpng15 -I/usr/include/freetype2 -I/usr/include/libxml2", + # 'CPPFLAGS' => "$Config{'cppflags'} -pthread -I/usr/include/pango-1.0 -I/usr/include/cairo -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include -I/usr/include/pixman-1 -I/usr/include/freetype2 -I/usr/include/libpng15 -I/usr/include/freetype2 -I/usr/include/libxml2", # C compiler flags (e.g. -O -g) 'CCFLAGS' => $CCFLAGS_magick, diff --git a/coders/svg.c b/coders/svg.c index ae475cb19..487d68ec2 100644 --- a/coders/svg.c +++ b/coders/svg.c @@ -49,6 +49,8 @@ #include "MagickCore/cache.h" #include "MagickCore/constitute.h" #include "MagickCore/composite-private.h" +#include "MagickCore/delegate.h" +#include "MagickCore/delegate-private.h" #include "MagickCore/draw.h" #include "MagickCore/exception.h" #include "MagickCore/exception-private.h" @@ -2787,188 +2789,245 @@ static Image *ReadSVGImage(const ImageInfo *image_info,ExceptionInfo *exception) } if (LocaleCompare(image_info->magick,"MSVG") != 0) { + const DelegateInfo + *delegate_info; + + delegate_info=GetDelegateInfo("svg:decode",(char *) NULL,exception); + if (delegate_info != (const DelegateInfo *) NULL) + { + char + background[MaxTextExtent], + command[MaxTextExtent], + density[MaxTextExtent], + filename[MaxTextExtent], + opacity[MaxTextExtent], + unique[MaxTextExtent]; + + int + status; + + /* + Our best hope for compliance to the SVG standard. + */ + (void) AcquireUniqueFilename(filename); + (void) AcquireUniqueFilename(unique); + (void) FormatLocaleString(density,MaxTextExtent,"%.20g,%.20g", + image->resolution.x,image->resolution.y); + (void) FormatLocaleString(background,MaxTextExtent, + "rgb(%.20g%%,%.20g%%,%.20g%%)", + 100.0*QuantumScale*image->background_color.red, + 100.0*QuantumScale*image->background_color.green, + 100.0*QuantumScale*image->background_color.blue); + (void) FormatLocaleString(opacity,MaxTextExtent,"%.20g", + QuantumScale*image->background_color.alpha); + (void) FormatLocaleString(command,MaxTextExtent, + GetDelegateCommands(delegate_info),image->filename,filename,density, + background,opacity,unique); + status=SystemCommand(MagickFalse,image_info->verbose,command, + exception); + (void) RelinquishUniqueFileResource(unique); + if (status == 0) + { + ImageInfo + *read_info; + + read_info=CloneImageInfo(image_info); + (void) CopyMagickString(read_info->filename,filename, + MaxTextExtent); + image=ReadImage(read_info,exception); + read_info=DestroyImageInfo(read_info); + (void) RelinquishUniqueFileResource(filename); + if (image != (Image *) NULL) + return(image); + } + (void) RelinquishUniqueFileResource(filename); + } + { #if defined(MAGICKCORE_RSVG_DELEGATE) #if defined(MAGICKCORE_CAIRO_DELEGATE) - cairo_surface_t - *cairo_surface; + cairo_surface_t + *cairo_surface; - cairo_t - *cairo_image; + cairo_t + *cairo_image; - register unsigned char - *p; + register unsigned char + *p; - RsvgDimensionData - dimension_info; + RsvgDimensionData + dimension_info; - unsigned char - *pixels; + unsigned char + *pixels; #else - GdkPixbuf - *pixel_info; + GdkPixbuf + *pixel_info; - register const guchar - *p; + register const guchar + *p; #endif - GError - *error; + GError + *error; - ssize_t - y; + ssize_t + y; - PixelInfo - fill_color; + PixelInfo + fill_color; - register ssize_t - x; + register ssize_t + x; - register Quantum - *q; + register Quantum + *q; - RsvgHandle - *svg_handle; + RsvgHandle + *svg_handle; - svg_handle=rsvg_handle_new(); - if (svg_handle == (RsvgHandle *) NULL) - ThrowReaderException(ResourceLimitError,"MemoryAllocationFailed"); - rsvg_handle_set_base_uri(svg_handle,image_info->filename); - if ((image->resolution.x != 72.0) && (image->resolution.y != 72.0)) - rsvg_handle_set_dpi_x_y(svg_handle,image->resolution.x, - image->resolution.y); - while ((n=ReadBlob(image,MaxTextExtent,message)) != 0) - { + svg_handle=rsvg_handle_new(); + if (svg_handle == (RsvgHandle *) NULL) + ThrowReaderException(ResourceLimitError,"MemoryAllocationFailed"); + rsvg_handle_set_base_uri(svg_handle,image_info->filename); + if ((image->resolution.x != 72.0) && (image->resolution.y != 72.0)) + rsvg_handle_set_dpi_x_y(svg_handle,image->resolution.x, + image->resolution.y); + while ((n=ReadBlob(image,MaxTextExtent,message)) != 0) + { + error=(GError *) NULL; + (void) rsvg_handle_write(svg_handle,message,n,&error); + if (error != (GError *) NULL) + g_error_free(error); + } error=(GError *) NULL; - (void) rsvg_handle_write(svg_handle,message,n,&error); + rsvg_handle_close(svg_handle,&error); if (error != (GError *) NULL) g_error_free(error); - } - error=(GError *) NULL; - rsvg_handle_close(svg_handle,&error); - if (error != (GError *) NULL) - g_error_free(error); #if defined(MAGICKCORE_CAIRO_DELEGATE) - rsvg_handle_get_dimensions(svg_handle,&dimension_info); - image->columns=image->resolution.x*dimension_info.width/72.0; - image->rows=image->resolution.y*dimension_info.height/72.0; - pixels=(unsigned char *) NULL; + rsvg_handle_get_dimensions(svg_handle,&dimension_info); + image->columns=image->resolution.x*dimension_info.width/72.0; + image->rows=image->resolution.y*dimension_info.height/72.0; + pixels=(unsigned char *) NULL; #else - pixel_info=rsvg_handle_get_pixbuf(svg_handle); - rsvg_handle_free(svg_handle); - image->columns=gdk_pixbuf_get_width(pixel_info); - image->rows=gdk_pixbuf_get_height(pixel_info); + pixel_info=rsvg_handle_get_pixbuf(svg_handle); + rsvg_handle_free(svg_handle); + image->columns=gdk_pixbuf_get_width(pixel_info); + image->rows=gdk_pixbuf_get_height(pixel_info); #endif - image->matte=MagickTrue; - SetImageProperty(image,"svg:base-uri", - rsvg_handle_get_base_uri(svg_handle),exception); - if ((image->columns == 0) || (image->rows == 0)) - { + image->matte=MagickTrue; + SetImageProperty(image,"svg:base-uri", + rsvg_handle_get_base_uri(svg_handle),exception); + if ((image->columns == 0) || (image->rows == 0)) + { #if !defined(MAGICKCORE_CAIRO_DELEGATE) - g_object_unref(G_OBJECT(pixel_info)); + g_object_unref(G_OBJECT(pixel_info)); #endif - g_object_unref(svg_handle); - ThrowReaderException(MissingDelegateError, - "NoDecodeDelegateForThisImageFormat"); - } - if (image_info->ping == MagickFalse) - { - size_t - stride; + g_object_unref(svg_handle); + ThrowReaderException(MissingDelegateError, + "NoDecodeDelegateForThisImageFormat"); + } + if (image_info->ping == MagickFalse) + { + size_t + stride; #if defined(MAGICKCORE_CAIRO_DELEGATE) - stride=4*image->columns; + stride=4*image->columns; #if defined(MAGICKCORE_PANGOCAIRO_DELEGATE) - stride=(size_t) cairo_format_stride_for_width(CAIRO_FORMAT_ARGB32, - image->columns); + stride=(size_t) cairo_format_stride_for_width(CAIRO_FORMAT_ARGB32, + image->columns); #endif - pixels=(unsigned char *) AcquireQuantumMemory(stride,image->rows* - sizeof(*pixels)); - if (pixels == (unsigned char *) NULL) - { - g_object_unref(svg_handle); - ThrowReaderException(ResourceLimitError,"MemoryAllocationFailed"); - } + pixels=(unsigned char *) AcquireQuantumMemory(stride,image->rows* + sizeof(*pixels)); + if (pixels == (unsigned char *) NULL) + { + g_object_unref(svg_handle); + ThrowReaderException(ResourceLimitError, + "MemoryAllocationFailed"); + } #endif - (void) SetImageBackgroundColor(image,exception); + (void) SetImageBackgroundColor(image,exception); #if defined(MAGICKCORE_CAIRO_DELEGATE) - cairo_surface=cairo_image_surface_create_for_data(pixels, - CAIRO_FORMAT_ARGB32,image->columns,image->rows,stride); - if (cairo_surface == (cairo_surface_t *) NULL) - { - pixels=(unsigned char *) RelinquishMagickMemory(pixels); - g_object_unref(svg_handle); - ThrowReaderException(ResourceLimitError,"MemoryAllocationFailed"); - } - cairo_image=cairo_create(cairo_surface); - cairo_set_operator(cairo_image,CAIRO_OPERATOR_CLEAR); - cairo_paint(cairo_image); - cairo_set_operator(cairo_image,CAIRO_OPERATOR_OVER); - cairo_scale(cairo_image,image->resolution.x/72.0,image->resolution.y/ - 72.0); - rsvg_handle_render_cairo(svg_handle,cairo_image); - cairo_destroy(cairo_image); - cairo_surface_destroy(cairo_surface); - g_object_unref(svg_handle); - p=pixels; + cairo_surface=cairo_image_surface_create_for_data(pixels, + CAIRO_FORMAT_ARGB32,image->columns,image->rows,stride); + if (cairo_surface == (cairo_surface_t *) NULL) + { + pixels=(unsigned char *) RelinquishMagickMemory(pixels); + g_object_unref(svg_handle); + ThrowReaderException(ResourceLimitError, + "MemoryAllocationFailed"); + } + cairo_image=cairo_create(cairo_surface); + cairo_set_operator(cairo_image,CAIRO_OPERATOR_CLEAR); + cairo_paint(cairo_image); + cairo_set_operator(cairo_image,CAIRO_OPERATOR_OVER); + cairo_scale(cairo_image,image->resolution.x/72.0, + image->resolution.y/72.0); + rsvg_handle_render_cairo(svg_handle,cairo_image); + cairo_destroy(cairo_image); + cairo_surface_destroy(cairo_surface); + g_object_unref(svg_handle); + p=pixels; #else - p=gdk_pixbuf_get_pixels(pixel_info); + p=gdk_pixbuf_get_pixels(pixel_info); #endif - GetPixelInfo(image,&fill_color); - for (y=0; y < (ssize_t) image->rows; y++) - { - q=GetAuthenticPixels(image,0,y,image->columns,1,exception); - if (q == (Quantum *) NULL) - break; - for (x=0; x < (ssize_t) image->columns; x++) + GetPixelInfo(image,&fill_color); + for (y=0; y < (ssize_t) image->rows; y++) { + q=GetAuthenticPixels(image,0,y,image->columns,1,exception); + if (q == (Quantum *) NULL) + break; + for (x=0; x < (ssize_t) image->columns; x++) + { #if defined(MAGICKCORE_CAIRO_DELEGATE) - fill_color.blue=ScaleCharToQuantum(*p++); - fill_color.green=ScaleCharToQuantum(*p++); - fill_color.red=ScaleCharToQuantum(*p++); + fill_color.blue=ScaleCharToQuantum(*p++); + fill_color.green=ScaleCharToQuantum(*p++); + fill_color.red=ScaleCharToQuantum(*p++); #else - fill_color.red=ScaleCharToQuantum(*p++); - fill_color.green=ScaleCharToQuantum(*p++); - fill_color.blue=ScaleCharToQuantum(*p++); + fill_color.red=ScaleCharToQuantum(*p++); + fill_color.green=ScaleCharToQuantum(*p++); + fill_color.blue=ScaleCharToQuantum(*p++); #endif - fill_color.alpha=ScaleCharToQuantum(*p++); + fill_color.alpha=ScaleCharToQuantum(*p++); #if defined(MAGICKCORE_CAIRO_DELEGATE) - { - double - gamma; - - gamma=QuantumScale*fill_color.alpha; - gamma=MagickEpsilonReciprocal(gamma); - fill_color.blue*=gamma; - fill_color.green*=gamma; - fill_color.red*=gamma; - } + { + double + gamma; + + gamma=QuantumScale*fill_color.alpha; + gamma=MagickEpsilonReciprocal(gamma); + fill_color.blue*=gamma; + fill_color.green*=gamma; + fill_color.red*=gamma; + } #endif - CompositePixelOver(image,&fill_color,fill_color.alpha,q, - (double) GetPixelAlpha(image,q),q); - q+=GetPixelChannels(image); - } - if (SyncAuthenticPixels(image,exception) == MagickFalse) - break; - if (image->previous == (Image *) NULL) - { - status=SetImageProgress(image,LoadImageTag,(MagickOffsetType) y, - image->rows); - if (status == MagickFalse) - break; + CompositePixelOver(image,&fill_color,fill_color.alpha,q, + (double) GetPixelAlpha(image,q),q); + q+=GetPixelChannels(image); } + if (SyncAuthenticPixels(image,exception) == MagickFalse) + break; + if (image->previous == (Image *) NULL) + { + status=SetImageProgress(image,LoadImageTag,(MagickOffsetType) + y,image->rows); + if (status == MagickFalse) + break; + } + } } - } #if defined(MAGICKCORE_CAIRO_DELEGATE) - if (pixels != (unsigned char *) NULL) - pixels=(unsigned char *) RelinquishMagickMemory(pixels); + if (pixels != (unsigned char *) NULL) + pixels=(unsigned char *) RelinquishMagickMemory(pixels); #else - g_object_unref(G_OBJECT(pixel_info)); + g_object_unref(G_OBJECT(pixel_info)); #endif - (void) CloseBlob(image); - return(GetFirstImageInList(image)); + (void) CloseBlob(image); + return(GetFirstImageInList(image)); #endif + } } /* Open draw file. diff --git a/config/configure.xml b/config/configure.xml index 671025e4c..e64a693f3 100644 --- a/config/configure.xml +++ b/config/configure.xml @@ -10,7 +10,7 @@ - + @@ -29,16 +29,16 @@ - + - + - + diff --git a/config/delegates.xml b/config/delegates.xml index 7a4423577..cc62787a4 100644 --- a/config/delegates.xml +++ b/config/delegates.xml @@ -112,6 +112,7 @@ + diff --git a/config/delegates.xml.in b/config/delegates.xml.in index ea399f47d..489690bc9 100644 --- a/config/delegates.xml.in +++ b/config/delegates.xml.in @@ -112,7 +112,7 @@ - + diff --git a/configure b/configure index 57259ceb8..e93a85546 100755 --- a/configure +++ b/configure @@ -1945,7 +1945,7 @@ Optional Packages: --without-openexr disable OpenEXR support --without-pango disable PANGO support --without-png disable PNG support - --without-rsvg disable RSVG support + --without-rsvg enable RSVG support --without-tiff disable TIFF support --without-webp disable WEBP support --with-windows-font-dir=DIR @@ -3667,7 +3667,7 @@ MAGICK_LIBRARY_CURRENT_MIN=`expr $MAGICK_LIBRARY_CURRENT - $MAGICK_LIBRARY_AGE` MAGICK_LIBRARY_VERSION_INFO=$MAGICK_LIBRARY_CURRENT:$MAGICK_LIBRARY_REVISION:$MAGICK_LIBRARY_AGE -MAGICK_SVN_REVISION=8934:8947M +MAGICK_SVN_REVISION=8934:8953M @@ -31546,7 +31546,7 @@ fi if test "${with_rsvg+set}" = set; then : withval=$with_rsvg; with_rsvg=$withval else - with_rsvg='yes' + with_rsvg='no' fi diff --git a/configure.ac b/configure.ac index f47b74612..2d7268d98 100755 --- a/configure.ac +++ b/configure.ac @@ -2621,9 +2621,9 @@ dnl =========================================================================== # AC_ARG_WITH([rsvg], [AC_HELP_STRING([--without-rsvg], - [disable RSVG support])], + [enable RSVG support])], [with_rsvg=$withval], - [with_rsvg='yes']) + [with_rsvg='no']) if test "$with_rsvg" != 'yes'; then DISTCHECK_CONFIG_FLAGS="${DISTCHECK_CONFIG_FLAGS} --with-rsvg=$with_rsvg "