Subject: bug#47819: 8.0.50; When :height/:width image attribute is specified, :scale factor is not applied

From: Alan Third <[email-masked]>
Date: Fri, 16 Apr 2021 19:14:50 +0100

On Fri, Apr 16, 2021 at 08:16:20AM +0200, David Ponce wrote:
> Hello,
> 
> For the image :scale attribute the Elisp reference manual say that:
> 
>      If both ‘:scale’ and ‘:height’/‘:width’ are
>      specified, the height/width will be adjusted by the specified
>      scaling factor.
> 
> It seems, however, that this is not true, when the :height or :width
> or both attributes of an image are specified, the :scale factor is not
> applied.

Hmm, I'm not sure which is the more desirable behaviour, but fixing it
to match the documentation appears to be trivial. See attached.
-- 
Alan Third
>From 6ffcd0d934e028732484ac1f9085901d1515036a Mon Sep 17 00:00:00 2001
From: Alan Third <[email-masked]>
Date: Fri, 16 Apr 2021 19:12:23 +0100
Subject: [PATCH] Make :scale affect :width and :height (bug#47819)

* src/image.c (compute_image_size): Multiply width and height values
by scale.
---
 src/image.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/image.c b/src/image.c
index 1619886f5a..ff4ef01804 100644
--- a/src/image.c
+++ b/src/image.c
@@ -2040,7 +2040,7 @@ compute_image_size (size_t width, size_t height,
   int_value = image_get_dimension (img, QCwidth);
   if (int_value >= 0)
     {
-      desired_width = int_value;
+      desired_width = int_value * scale;
       /* :width overrides :max-width. */
       max_width = -1;
     }
@@ -2048,7 +2048,7 @@ compute_image_size (size_t width, size_t height,
   int_value = image_get_dimension (img, QCheight);
   if (int_value >= 0)
     {
-      desired_height = int_value;
+      desired_height = int_value * scale;
       /* :height overrides :max-height. */
       max_height = -1;
     }
-- 
2.29.2