diff options
| author | Paul Eggert | 2017-03-02 13:48:47 -0800 |
|---|---|---|
| committer | Paul Eggert | 2017-03-02 13:50:03 -0800 |
| commit | 56aaaf9bbaf9772ea714b16aa7ed2a9693ac92e3 (patch) | |
| tree | 00d5a4ce84331590cbb4b11b532f054585922219 /src/image.c | |
| parent | dacafa8c30cdae92f934512664fd2d322d91432b (diff) | |
| download | emacs-56aaaf9bbaf9772ea714b16aa7ed2a9693ac92e3.tar.gz emacs-56aaaf9bbaf9772ea714b16aa7ed2a9693ac92e3.zip | |
Restore XFLOATINT but with restricted args
Turn instances of extract_float into XFLOAT_DATA when possible,
and to a resurrected XFLOATINT when the arg is a number.
The resurrected XFLOATINT is more like XFLOAT and XINT in
that is valid only if its arg is a number. This clarifies
the ways in which floats can be extracted at the C level.
* src/editfns.c (styled_format):
* src/floatfns.c (extract_float, Fexpt):
Use XFLOATINT rather than open-coding it.
* src/fns.c (internal_equal):
* src/image.c (imagemagick_load_image):
* src/xdisp.c (resize_mini_window):
Prefer XFLOAT_DATA to extract_float on values known to be floats.
* src/frame.c (x_set_screen_gamma):
* src/frame.h (NUMVAL):
* src/image.c (x_edge_detection, compute_image_size):
* src/lread.c (read_filtered_event):
* src/window.c (Fset_window_vscroll):
* src/xdisp.c (handle_single_display_spec, try_scrolling)
(redisplay_window, calc_pixel_width_or_height, x_produce_glyphs)
(on_hot_spot_p):
Prefer XFLOATINT to extract_float on values known to be numbers.
* src/lisp.h (XFLOATINT): Bring back this function, except
it now assumes its argument is a number.
Diffstat (limited to 'src/image.c')
| -rw-r--r-- | src/image.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/image.c b/src/image.c index 3711dd18d69..3ebf469e8b3 100644 --- a/src/image.c +++ b/src/image.c | |||
| @@ -4915,19 +4915,19 @@ x_edge_detection (struct frame *f, struct image *img, Lisp_Object matrix, | |||
| 4915 | for (i = 0; | 4915 | for (i = 0; |
| 4916 | i < 9 && CONSP (matrix) && NUMBERP (XCAR (matrix)); | 4916 | i < 9 && CONSP (matrix) && NUMBERP (XCAR (matrix)); |
| 4917 | ++i, matrix = XCDR (matrix)) | 4917 | ++i, matrix = XCDR (matrix)) |
| 4918 | trans[i] = extract_float (XCAR (matrix)); | 4918 | trans[i] = XFLOATINT (XCAR (matrix)); |
| 4919 | } | 4919 | } |
| 4920 | else if (VECTORP (matrix) && ASIZE (matrix) >= 9) | 4920 | else if (VECTORP (matrix) && ASIZE (matrix) >= 9) |
| 4921 | { | 4921 | { |
| 4922 | for (i = 0; i < 9 && NUMBERP (AREF (matrix, i)); ++i) | 4922 | for (i = 0; i < 9 && NUMBERP (AREF (matrix, i)); ++i) |
| 4923 | trans[i] = extract_float (AREF (matrix, i)); | 4923 | trans[i] = XFLOATINT (AREF (matrix, i)); |
| 4924 | } | 4924 | } |
| 4925 | 4925 | ||
| 4926 | if (NILP (color_adjust)) | 4926 | if (NILP (color_adjust)) |
| 4927 | color_adjust = make_number (0xffff / 2); | 4927 | color_adjust = make_number (0xffff / 2); |
| 4928 | 4928 | ||
| 4929 | if (i == 9 && NUMBERP (color_adjust)) | 4929 | if (i == 9 && NUMBERP (color_adjust)) |
| 4930 | x_detect_edges (f, img, trans, extract_float (color_adjust)); | 4930 | x_detect_edges (f, img, trans, XFLOATINT (color_adjust)); |
| 4931 | } | 4931 | } |
| 4932 | 4932 | ||
| 4933 | 4933 | ||
| @@ -8077,7 +8077,7 @@ compute_image_size (size_t width, size_t height, | |||
| 8077 | 8077 | ||
| 8078 | value = image_spec_value (spec, QCscale, NULL); | 8078 | value = image_spec_value (spec, QCscale, NULL); |
| 8079 | if (NUMBERP (value)) | 8079 | if (NUMBERP (value)) |
| 8080 | scale = extract_float (value); | 8080 | scale = XFLOATINT (value); |
| 8081 | 8081 | ||
| 8082 | /* If width and/or height is set in the display spec assume we want | 8082 | /* If width and/or height is set in the display spec assume we want |
| 8083 | to scale to those values. If either h or w is unspecified, the | 8083 | to scale to those values. If either h or w is unspecified, the |
| @@ -8684,7 +8684,7 @@ imagemagick_load_image (struct frame *f, struct image *img, | |||
| 8684 | value = image_spec_value (img->spec, QCrotation, NULL); | 8684 | value = image_spec_value (img->spec, QCrotation, NULL); |
| 8685 | if (FLOATP (value)) | 8685 | if (FLOATP (value)) |
| 8686 | { | 8686 | { |
| 8687 | rotation = extract_float (value); | 8687 | rotation = XFLOAT_DATA (value); |
| 8688 | status = MagickRotateImage (image_wand, bg_wand, rotation); | 8688 | status = MagickRotateImage (image_wand, bg_wand, rotation); |
| 8689 | if (status == MagickFalse) | 8689 | if (status == MagickFalse) |
| 8690 | { | 8690 | { |