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 |
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; |