From af008560fea31dff76f6d7df3e386cf2af623a8d Mon Sep 17 00:00:00 2001 From: Glenn Morris Date: Mon, 6 Feb 2012 19:31:29 -0800 Subject: [PATCH] imagemagick-render-type fixes * src/image.c (imagemagick-render-type): Change it from a lisp object to an integer. Move the doc here from the lisp manual. Treat all values not equal to 0 the same. * doc/lispref/display.texi (ImageMagick Images): Move most details of imagemagick-render-type to the variable's doc. * lisp/cus-start.el (imagemagick-render-type): Add it. --- doc/lispref/ChangeLog | 5 +++++ doc/lispref/display.texi | 10 +++------- lisp/ChangeLog | 4 ++++ lisp/cus-start.el | 4 ++++ src/ChangeLog | 6 ++++++ src/image.c | 22 ++++++++++++++-------- 6 files changed, 36 insertions(+), 15 deletions(-) diff --git a/doc/lispref/ChangeLog b/doc/lispref/ChangeLog index 5de2251c19f..163ab80e8b8 100644 --- a/doc/lispref/ChangeLog +++ b/doc/lispref/ChangeLog @@ -1,3 +1,8 @@ +2012-02-07 Glenn Morris + + * display.texi (ImageMagick Images): + Move most details of imagemagick-render-type to the variable's doc. + 2012-02-06 Glenn Morris * keymaps.texi (Tool Bar): Mention separators. diff --git a/doc/lispref/display.texi b/doc/lispref/display.texi index e97e6c264a3..e1b2f57e507 100644 --- a/doc/lispref/display.texi +++ b/doc/lispref/display.texi @@ -4543,14 +4543,10 @@ loader will be used in practice depends on the priority of the loaders). For example, if you never want to use the ImageMagick loader to use JPEG files, add @code{JPG} to this list. +@c Not sure this should even be in the manual at all. @vindex imagemagick-render-type -You can set the variable @code{imagemagick-render-type} to choose -between screen render methods for the ImageMagick loader. The options -are: @code{0}, a conservative method which works with older -@c FIXME details of this "newer method"? -@c Presumably it is faster but may be less "robust"? -ImageMagick versions (it is a bit slow, but robust); and @code{1}, -a newer ImageMagick method. +If you wish to experiment with the performance of the ImageMagick +loader, see the variable @code{imagemagick-render-type}. Images loaded with ImageMagick support a few new display specifications: diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 2f21d9e046e..c90d0ac7ea1 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,7 @@ +2012-02-07 Glenn Morris + + * cus-start.el (imagemagick-render-type): Add it. + 2012-02-06 Lars Ingebrigtsen * progmodes/cc-mode.el diff --git a/lisp/cus-start.el b/lisp/cus-start.el index 2cee72d717e..a5032cf99e7 100644 --- a/lisp/cus-start.el +++ b/lisp/cus-start.el @@ -237,6 +237,8 @@ Leaving \"Default\" unchecked is equivalent with specifying a default of :set custom-set-minor-mode) ;; fringe.c (overflow-newline-into-fringe fringe boolean) + ;; image.c + (imagemagick-render-type image integer "24.1") ;; indent.c (indent-tabs-mode indent boolean) ;; keyboard.c @@ -504,6 +506,8 @@ since it could result in memory overflow and make Emacs crash." (fboundp 'x-selection-exists-p)) ((string-match "fringe" (symbol-name symbol)) (fboundp 'define-fringe-bitmap)) + ((string-match "\\`imagemagick" (symbol-name symbol)) + (fboundp 'imagemagick-types)) ((equal "font-use-system-font" (symbol-name symbol)) (featurep 'system-font-setting)) ;; Conditioned on x-create-frame, because that's diff --git a/src/ChangeLog b/src/ChangeLog index 860a0592e29..6438f054432 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,9 @@ +2012-02-07 Glenn Morris + + * image.c (imagemagick-render-type): Change it from a lisp object + to an integer. Move the doc here from the lisp manual. + Treat all values not equal to 0 the same. + 2012-02-06 Chong Yidong * doc.c (store_function_docstring): Avoid applying docstring of diff --git a/src/image.c b/src/image.c index f4def3e681e..21f97c32a0c 100644 --- a/src/image.c +++ b/src/image.c @@ -7617,7 +7617,6 @@ imagemagick_load_image (struct frame *f, struct image *img, EMACS_INT ino; int desired_width, desired_height; double rotation; - EMACS_INT imagemagick_rendermethod; int pixelwidth; ImageInfo *image_info; ExceptionInfo *exception; @@ -7798,9 +7797,8 @@ imagemagick_load_image (struct frame *f, struct image *img, went ok. */ init_color_table (); - imagemagick_rendermethod = (INTEGERP (Vimagemagick_render_type) - ? XINT (Vimagemagick_render_type) : 0); - if (imagemagick_rendermethod == 0) + + if (imagemagick_render_type == 0) { size_t image_height; @@ -7850,8 +7848,7 @@ imagemagick_load_image (struct frame *f, struct image *img, } DestroyPixelIterator (iterator); } - - if (imagemagick_rendermethod == 1) + else /* imagemagick_render_type != 0 */ { /* Magicexportimage is normally faster than pixelpushing. This method is also well tested. Some aspects of this method are @@ -8958,8 +8955,17 @@ The value can also be nil, meaning the cache is never cleared. The function `clear-image-cache' disregards this variable. */); Vimage_cache_eviction_delay = make_number (300); #ifdef HAVE_IMAGEMAGICK - DEFVAR_LISP ("imagemagick-render-type", Vimagemagick_render_type, - doc: /* Choose between ImageMagick render methods. */); + DEFVAR_INT ("imagemagick-render-type", imagemagick_render_type, + doc: /* Integer indicating which ImageMagick rendering method to use. +The options are: + 0 -- the default method (pixel pushing) + 1 -- a newer method ("MagickExportImagePixels") that may perform + better (speed etc) in some cases, but has not been as thoroughly + tested with Emacs as the default method. This method requires + ImageMagick version 6.4.6 (approximately) or later. +*/); + /* MagickExportImagePixels is in 6.4.6-9, but not 6.4.4-10. */ + imagemagick_render_type = 0; #endif } -- 2.39.2