[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] master ad1951d 2/3: Get explicit width/height + scale comp
From: |
Lars Ingebrigtsen |
Subject: |
[Emacs-diffs] master ad1951d 2/3: Get explicit width/height + scale computations right |
Date: |
Sat, 20 Feb 2016 07:04:10 +0000 |
branch: master
commit ad1951dbfb7e289553c25474efdfa02f83c16e71
Author: Lars Ingebrigtsen <address@hidden>
Commit: Lars Ingebrigtsen <address@hidden>
Get explicit width/height + scale computations right
* src/image.c (compute_image_size): :scale should also be
taken into account when :width and :height are explicitly names.
---
src/image.c | 13 ++++++++-----
1 files changed, 8 insertions(+), 5 deletions(-)
diff --git a/src/image.c b/src/image.c
index af65fde..9ba1a79 100644
--- a/src/image.c
+++ b/src/image.c
@@ -8075,18 +8075,21 @@ compute_image_size (size_t width, size_t height,
int desired_width, desired_height;
double scale = 1;
+ value = image_spec_value (spec, QCscale, NULL);
+ if (NUMBERP (value))
+ scale = extract_float (value);
+
/* If width and/or height is set in the display spec assume we want
to scale to those values. If either h or w is unspecified, the
unspecified should be calculated from the specified to preserve
aspect ratio. */
value = image_spec_value (spec, QCwidth, NULL);
- desired_width = NATNUMP (value) ? min (XFASTINT (value), INT_MAX) : -1;
+ desired_width = NATNUMP (value) ?
+ min (XFASTINT (value) * scale, INT_MAX) : -1;
value = image_spec_value (spec, QCheight, NULL);
- desired_height = NATNUMP (value) ? min (XFASTINT (value), INT_MAX) : -1;
+ desired_height = NATNUMP (value) ?
+ min (XFASTINT (value) * scale, INT_MAX) : -1;
- value = image_spec_value (spec, QCscale, NULL);
- if (NUMBERP (value))
- scale = extract_float (value);
width = width * scale;
height = height * scale;