/[emacs]/emacs/src/image.c
ViewVC logotype

Diff of /emacs/src/image.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.37 by cyd, Wed Oct 19 03:54:56 2005 UTC revision 1.38 by kfstorm, Wed Oct 19 21:52:13 2005 UTC
# Line 1163  check_image_size (f, width, height) Line 1163  check_image_size (f, width, height)
1163       int width;       int width;
1164       int height;       int height;
1165  {  {
1166    if (width <= 0 || height <=0)    int w, h;
     return 0;  
1167    
1168    if (FLOATP (Vmax_image_size) && f    if (width <= 0 || height <= 0)
       && ((width > (int)(XFLOAT_DATA (Vmax_image_size)  
                          * FRAME_PIXEL_WIDTH (f)))  
           || (height > (int)(XFLOAT_DATA (Vmax_image_size)  
                              * FRAME_PIXEL_HEIGHT (f)))))  
1169      return 0;      return 0;
1170    
1171    return 1;    if (INTEGERP (Vmax_image_size))
1172        w = h = XINT (Vmax_image_size);
1173      else if (FLOATP (Vmax_image_size))
1174        {
1175          if (f != NULL)
1176            {
1177              w = FRAME_PIXEL_WIDTH (f);
1178              h = FRAME_PIXEL_HEIGHT (f);
1179            }
1180          else
1181            w = h = 1024;  /* Arbitrary size for unknown frame. */
1182          w = (int) (XFLOAT_DATA (Vmax_image_size) * w);
1183          h = (int) (XFLOAT_DATA (Vmax_image_size) * h);
1184        }
1185      else
1186        return 1;
1187    
1188      return (width <= w && height <= h);
1189  }  }
1190    
1191  /* Prepare image IMG for display on frame F.  Must be called before  /* Prepare image IMG for display on frame F.  Must be called before
# Line 8289  listed; they're always supported.  */); Line 8301  listed; they're always supported.  */);
8301    Fput (intern ("image-library-alist"), Qrisky_local_variable, Qt);    Fput (intern ("image-library-alist"), Qrisky_local_variable, Qt);
8302    
8303    DEFVAR_LISP ("max-image-size", &Vmax_image_size,    DEFVAR_LISP ("max-image-size", &Vmax_image_size,
8304      doc: /* Maximum size of an image, relative to the selected frame.      doc: /* Maximum size of images.
8305    Emacs will not load an image into memory if its pixel width or
8306  This is a floating point number that is multiplied by the width and  pixel height exceeds this limit.
8307  height of the selected frame, to give the maximum width and height for  
8308  images.  Emacs will not load an image into memory if its width or  If the value is an integer, it directly specifies the maximum
8309  height exceeds this limit. */);  image height and width, measured in pixels.  If it is a floating
8310    point number, it specifies the maximum image height and width
8311    as a ratio to the frame height and width.  If the value is
8312    non-numeric, there is no explicit limit on the size of images.  */);
8313    Vmax_image_size = make_float (MAX_IMAGE_SIZE);    Vmax_image_size = make_float (MAX_IMAGE_SIZE);
8314    
8315    Vimage_type_cache = Qnil;    Vimage_type_cache = Qnil;

Legend:
Removed from v.1.37  
changed lines
  Added in v.1.38

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26