From unknown Sun Jun 22 03:54:54 2025 X-Loop: help-debbugs@gnu.org Subject: bug#74725: 31.0.50; image-scaling-factor is ignored by create-image Resent-From: David Ponce Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 07 Dec 2024 12:15:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 74725 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: 74725@debbugs.gnu.org X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.17335736534480 (code B ref -1); Sat, 07 Dec 2024 12:15:02 +0000 Received: (at submit) by debbugs.gnu.org; 7 Dec 2024 12:14:13 +0000 Received: from localhost ([127.0.0.1]:45659 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tJthM-0001AB-T6 for submit@debbugs.gnu.org; Sat, 07 Dec 2024 07:14:13 -0500 Received: from lists.gnu.org ([209.51.188.17]:49248) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tJthI-0001A2-Tc for submit@debbugs.gnu.org; Sat, 07 Dec 2024 07:14:10 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tJthI-0001YE-MK for bug-gnu-emacs@gnu.org; Sat, 07 Dec 2024 07:14:08 -0500 Received: from smtp-25.smtpout.orange.fr ([80.12.242.25] helo=smtp.smtpout.orange.fr) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tJthF-0008BF-KH for bug-gnu-emacs@gnu.org; Sat, 07 Dec 2024 07:14:08 -0500 Received: from [192.168.1.21] ([90.112.40.65]) by smtp.orange.fr with ESMTPA id Jth9tn99801M2Jth9tHXWp; Sat, 07 Dec 2024 13:14:00 +0100 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=orange.fr; s=t20230301; t=1733573640; bh=mMGZYJ4e0Jo+KExxqmgyXNnw2l408XFRVIabrWGhPso=; h=Message-ID:Date:MIME-Version:To:From:Subject; b=GwdzY3b+a2YQNnUtn8MflWH7yz5gMzW/6k3Duvp5RFsFU1QL6FP1RdpqyMZNJIGaC uPTGqOjffGZv1MsXq+7++LZmRVIOE2VcGdFu9Wpv9qIeo73Bn0QRZAmThHVmP+aKDk 7Hv3Sxil+ojj5YYcQXCqYo0ysqm9Jktv3FmEpXGrHj+czbyQY4Gk/YqHDXgE94MdC3 ZBBHwBVd2hm868hnpGkQjR0+kE3gMv2lq8ikHuPYxaJC5cqWq+ruyEeQgsp0ietmjd FfsPoq5lglzThNb99+/PrG4kzed/F3am0t9JpBis/QT1nVLHH8MNS7LvKSDrghCCBJ vrDUe7AVdxi3A== X-ME-Helo: [192.168.1.21] X-ME-Auth: ZGFfdmlkQHdhbmFkb28uZnI= X-ME-Date: Sat, 07 Dec 2024 13:14:00 +0100 X-ME-IP: 90.112.40.65 Message-ID: <2304cad6-884f-4528-a85e-ab9c06b80016@orange.fr> Date: Sat, 7 Dec 2024 13:13:58 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Content-Language: fr, en-US From: David Ponce Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Received-SPF: pass client-ip=80.12.242.25; envelope-from=da_vid@orange.fr; helo=smtp.smtpout.orange.fr X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: -1.3 (-) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.3 (--) Hello, While working with images, I found what seems an issue to me with `create-image' which unconditionally set the :scale image property to 'default' when not specified, ignoring the value of the option `image-scaling-factor'. Here is an illustration: (let ((image-scaling-factor 1.0)) (image-size (find-image '((:file "icons/hicolor/scalable/apps/emacs.svg"))) t)) => (63 . 63) (let ((image-scaling-factor 2.0)) (image-size (find-image '((:file "icons/hicolor/scalable/apps/emacs.svg"))) t)) => (63 . 63) (image-size (find-image '((:file "icons/hicolor/scalable/apps/emacs.svg" :scale 1))) t) => (48 . 48) (image-size (find-image '((:file "icons/hicolor/scalable/apps/emacs.svg" :scale 2))) t) => (96 . 96) You can replace `image-size' with `insert-image' and observe the same. Here is a simple patch which fix the issue for me: diff --git a/lisp/image.el b/lisp/image.el index ce97eeb3ca1..2c1e865c336 100644 --- a/lisp/image.el +++ b/lisp/image.el @@ -536,7 +536,9 @@ create-image file-or-data) (and (not (plist-get props :scale)) ;; Add default scaling. - (list :scale 'default)) + (list :scale (if (numberp image-scaling-factor) + image-scaling-factor + 'default))) props))) ;; Add default smoothing. (unless (plist-member props :transform-smoothing) Thanks! In GNU Emacs 31.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.43, cairo version 1.18.0) of 2024-12-02 Repository revision: 8cd4ab7abde87ac04e05442196b4646ab46df9a7 Repository branch: master Windowing system distributor 'The X.Org Foundation', version 11.0.12014000 System Description: Fedora Linux 40 (KDE Plasma) Configured using: 'configure --with-native-compilation=no PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:/usr/lib/pkgconfig' Configured features: ACL CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS GPM GSETTINGS HARFBUZZ JPEG LCMS2 LIBOTF LIBSELINUX LIBSYSTEMD LIBXML2 M17N_FLT MODULES NOTIFY INOTIFY PDUMPER PNG RSVG SECCOMP SOUND SQLITE3 THREADS TIFF TOOLKIT_SCROLL_BARS TREE_SITTER WEBP X11 XDBE XIM XINPUT2 XPM GTK3 ZLIB Important settings: value of $LC_TIME: fr_FR.utf8 value of $LANG: fr_FR.UTF-8 locale-coding-system: utf-8-unix From unknown Sun Jun 22 03:54:54 2025 X-Loop: help-debbugs@gnu.org Subject: bug#74725: 31.0.50; image-scaling-factor is ignored by create-image References: <2304cad6-884f-4528-a85e-ab9c06b80016@orange.fr> In-Reply-To: <2304cad6-884f-4528-a85e-ab9c06b80016@orange.fr> Resent-From: David Ponce Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 07 Dec 2024 12:42:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 74725 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: 74725@debbugs.gnu.org Received: via spool by 74725-submit@debbugs.gnu.org id=B74725.173357530310737 (code B ref 74725); Sat, 07 Dec 2024 12:42:01 +0000 Received: (at 74725) by debbugs.gnu.org; 7 Dec 2024 12:41:43 +0000 Received: from localhost ([127.0.0.1]:45838 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tJu7z-0002n7-3n for submit@debbugs.gnu.org; Sat, 07 Dec 2024 07:41:43 -0500 Received: from smtp-19.smtpout.orange.fr ([80.12.242.19]:49005 helo=smtp.smtpout.orange.fr) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tJu7v-0002mv-0M for 74725@debbugs.gnu.org; Sat, 07 Dec 2024 07:41:41 -0500 Received: from [192.168.1.21] ([90.112.40.65]) by smtp.orange.fr with ESMTPA id Ju7ttPbH5ixoAJu7tt23zg; Sat, 07 Dec 2024 13:41:37 +0100 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=orange.fr; s=t20230301; t=1733575297; bh=xdn/LHDi2g1k4twbhOqZpyQ0n62LmG+U7U7maSBCaoQ=; h=Message-ID:Date:MIME-Version:To:From:Subject; b=UvbsaimEjmjwgjZlewRwjh19oFRuigrxNfR/Pw0wGDQOKuwRPk36add37MfsJEG1N oEEj44ncllk29IsLtER8gmORDej2UoWmQzRV9jss6O+oCPU9thul08VSZ5I2F5DSUC +e+Np8TFo6Vr4Rg/RaKoHncFbaVLCPeS8cmSFxOnAveuZ1QsW6MRqrNIFKCusqPITI MNPD7aVaYggmADgnLPJq7yx5xSi3zow3/Mv3pcNXzE426qjBtoaC3KVpc7jJ/PEoYx ghs7VrE7dNXCQp84FbmRwlnd2Tar4sabeetVROJ+8DCk2RMzfDx6BSSpbpGDcFskpp 6AYbIFi5V/Z6Q== X-ME-Helo: [192.168.1.21] X-ME-Auth: ZGFfdmlkQHdhbmFkb28uZnI= X-ME-Date: Sat, 07 Dec 2024 13:41:37 +0100 X-ME-IP: 90.112.40.65 Message-ID: Date: Sat, 7 Dec 2024 13:41:37 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Content-Language: fr, en-US From: David Ponce Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Score: 0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Hello, After more investigation I found the issue is not in image.el, but is due to image caching. If I flush the image cache when I change the value of `image-scaling-factor' the result is as expected: (let* ((image-scaling-factor 2.0) (image (find-image '((:file "icons/hicolor/scalable/apps/emacs.svg"))))) (image-flush image t) (image-size (find-image '((:file "icons/hicolor/scalable/apps/emacs.svg"))) t)) (96 . 96) ;; Image is used from cache, size is not updated. (let* ((image-scaling-factor 3.0) (image (find-image '((:file "icons/hicolor/scalable/apps/emacs.svg"))))) ;; (image-flush image t) (image-size (find-image '((:file "icons/hicolor/scalable/apps/emacs.svg"))) t)) (96 . 96) ;; Image not in cache, size is updated. (let* ((image-scaling-factor 3.0) (image (find-image '((:file "icons/hicolor/scalable/apps/emacs.svg"))))) (image-flush image t) (image-size (find-image '((:file "icons/hicolor/scalable/apps/emacs.svg"))) t)) (144 . 144) Thanks! From unknown Sun Jun 22 03:54:54 2025 X-Loop: help-debbugs@gnu.org Subject: bug#74725: 31.0.50; image-scaling-factor is ignored by create-image Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 07 Dec 2024 14:50:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 74725 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: David Ponce , Alan Third Cc: 74725@debbugs.gnu.org Received: via spool by 74725-submit@debbugs.gnu.org id=B74725.17335829963589 (code B ref 74725); Sat, 07 Dec 2024 14:50:01 +0000 Received: (at 74725) by debbugs.gnu.org; 7 Dec 2024 14:49:56 +0000 Received: from localhost ([127.0.0.1]:46119 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tJw84-0000vm-1q for submit@debbugs.gnu.org; Sat, 07 Dec 2024 09:49:56 -0500 Received: from eggs.gnu.org ([209.51.188.92]:35890) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tJw80-0000vT-H4 for 74725@debbugs.gnu.org; Sat, 07 Dec 2024 09:49:53 -0500 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tJw7t-0004rm-4w; Sat, 07 Dec 2024 09:49:45 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=W71A/P3rcldCSpjI3s99955/XVc3vKR9toaDqbi9Xss=; b=YMLnrpQNgAef errxwnUJ1up5tV4g89OLjOgTsF4NiqoEvw/55MumtcdqMHWPCA9mqfY0RZQw/r7WLlxUEzS3F3JZz Bi8SWSAA/SFO3U/B0TbQn/CdTNeZnv57cq76CWKRkDiORB5XUiF2n1cYR0f1rPMBpR5RW02lDkNaB nUQSHUX5Z9j6fLedalhZkFIn+PzSa7ZfbljVFMXMSO4JbnZ0+DHwjETtM9tkTEbytrNWzW8UtaVvx ZSmbPZMO1UCWHSGlRexyzJEB5oBNda1LpLf/S5Yfy96hfClxo/YgFgdy3Zx0b64AzR1DZNGWgjrXG h3qUIFKdLSvNrB1iYplEMA==; Date: Sat, 07 Dec 2024 16:49:41 +0200 Message-Id: <868qsrim4a.fsf@gnu.org> From: Eli Zaretskii In-Reply-To: <2304cad6-884f-4528-a85e-ab9c06b80016@orange.fr> (bug-gnu-emacs@gnu.org) References: <2304cad6-884f-4528-a85e-ab9c06b80016@orange.fr> X-Spam-Score: -2.3 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > Date: Sat, 7 Dec 2024 13:13:58 +0100 > From: David Ponce via "Bug reports for GNU Emacs, > the Swiss army knife of text editors" > > While working with images, I found what seems an issue to me with > `create-image' which unconditionally set the :scale image property to > 'default' when not specified, ignoring the value of the option > `image-scaling-factor'. > > Here is an illustration: > > (let ((image-scaling-factor 1.0)) > (image-size > (find-image '((:file "icons/hicolor/scalable/apps/emacs.svg"))) > t)) > => (63 . 63) > > (let ((image-scaling-factor 2.0)) > (image-size > (find-image '((:file "icons/hicolor/scalable/apps/emacs.svg"))) > t)) > => (63 . 63) > > (image-size > (find-image '((:file "icons/hicolor/scalable/apps/emacs.svg" :scale 1))) > t) > => (48 . 48) > > (image-size > (find-image '((:file "icons/hicolor/scalable/apps/emacs.svg" :scale 2))) > t) > => (96 . 96) > > You can replace `image-size' with `insert-image' and observe the same. > > Here is a simple patch which fix the issue for me: > > diff --git a/lisp/image.el b/lisp/image.el > index ce97eeb3ca1..2c1e865c336 100644 > --- a/lisp/image.el > +++ b/lisp/image.el > @@ -536,7 +536,9 @@ create-image > file-or-data) > (and (not (plist-get props :scale)) > ;; Add default scaling. > - (list :scale 'default)) > + (list :scale (if (numberp image-scaling-factor) > + image-scaling-factor > + 'default))) > props))) > ;; Add default smoothing. > (unless (plist-member props :transform-smoothing) AFAIU, this is supposed to be taken care of in image.c. Alan, any ideas why this doesn't seem to work? From unknown Sun Jun 22 03:54:54 2025 X-Loop: help-debbugs@gnu.org Subject: bug#74725: 31.0.50; image-scaling-factor is ignored by create-image Resent-From: Alan Third Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 07 Dec 2024 15:50:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 74725 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Eli Zaretskii Cc: 74725@debbugs.gnu.org, David Ponce Received: via spool by 74725-submit@debbugs.gnu.org id=B74725.173358659916414 (code B ref 74725); Sat, 07 Dec 2024 15:50:02 +0000 Received: (at 74725) by debbugs.gnu.org; 7 Dec 2024 15:49:59 +0000 Received: from localhost ([127.0.0.1]:48232 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tJx4B-0004Gf-0I for submit@debbugs.gnu.org; Sat, 07 Dec 2024 10:49:59 -0500 Received: from dane.soverin.net ([185.233.34.25]:41589) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tJx49-0004GO-9a for 74725@debbugs.gnu.org; Sat, 07 Dec 2024 10:49:58 -0500 Received: from smtp.soverin.net (unknown [10.10.4.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by dane.soverin.net (Postfix) with ESMTPS id 4Y5CHd66YGzySw; Sat, 7 Dec 2024 15:49:49 +0000 (UTC) Received: from smtp.soverin.net (smtp.soverin.net [10.10.4.100]) by soverin.net (Postfix) with ESMTPSA id 4Y5CHd1MhrzF2; Sat, 7 Dec 2024 15:49:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=idiocy.org; s=soverin; t=1733586589; bh=CdkPRAOujNtVLl5LvTp+bqbUNbgOyZKz8sfQxEVPtds=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=nbQd3V1pXAlDd01XFpZQj12tesBnOeO8iLNPQzkwtkmudBwCvJhElDpCKsURffr9x BSNn8BDtxI+WZ1HEvYdaST/UrpHxUleKwQytJqr9yJ9+r1o8guZe+X9YQWICNhJJtt f7owQFrRn7grNMeQY8lQaxVBXDGKJgmtI2PfRaCukWPB8W4NIZnk6cPSt88pvqte1L tGBSEzLM0FrtWlgFXmDLss6RgtyeMdTzLGmzK43Ud+ZRScfMWzsHRVpjNpG+rlWme6 f8gukedoTLQrY/4F+jGYMKZQUXtmLv2hgHhzPGGI6KMBbK0A9NBoU3x0ucjM41J4Y4 EWXuyZCFA5Nww== Received: from localhost (faroe.holly.idiocy.org [local]) by faroe.holly.idiocy.org (OpenSMTPD) with ESMTPA id 75ce5f7b; Sat, 7 Dec 2024 15:49:47 +0000 (UTC) Date: Sat, 7 Dec 2024 15:49:47 +0000 From: Alan Third Message-ID: Mail-Followup-To: Alan Third , Eli Zaretskii , David Ponce , 74725@debbugs.gnu.org References: <2304cad6-884f-4528-a85e-ab9c06b80016@orange.fr> <868qsrim4a.fsf@gnu.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <868qsrim4a.fsf@gnu.org> X-Spampanel-Class: ham X-Spam-Score: 0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) On Sat, Dec 07, 2024 at 04:49:41PM +0200, Eli Zaretskii wrote: > > Date: Sat, 7 Dec 2024 13:13:58 +0100 > > From: David Ponce via "Bug reports for GNU Emacs, > > the Swiss army knife of text editors" > > > > While working with images, I found what seems an issue to me with > > `create-image' which unconditionally set the :scale image property to > > 'default' when not specified, ignoring the value of the option > > `image-scaling-factor'. > > > > Here is an illustration: > > > > (let ((image-scaling-factor 1.0)) > > (image-size > > (find-image '((:file "icons/hicolor/scalable/apps/emacs.svg"))) > > t)) > > => (63 . 63) > > > > (let ((image-scaling-factor 2.0)) > > (image-size > > (find-image '((:file "icons/hicolor/scalable/apps/emacs.svg"))) > > t)) > > => (63 . 63) > > > > (image-size > > (find-image '((:file "icons/hicolor/scalable/apps/emacs.svg" :scale 1))) > > t) > > => (48 . 48) > > > > (image-size > > (find-image '((:file "icons/hicolor/scalable/apps/emacs.svg" :scale 2))) > > t) > > => (96 . 96) > > > > You can replace `image-size' with `insert-image' and observe the same. > > > > Here is a simple patch which fix the issue for me: > > > > diff --git a/lisp/image.el b/lisp/image.el > > index ce97eeb3ca1..2c1e865c336 100644 > > --- a/lisp/image.el > > +++ b/lisp/image.el > > @@ -536,7 +536,9 @@ create-image > > file-or-data) > > (and (not (plist-get props :scale)) > > ;; Add default scaling. > > - (list :scale 'default)) > > + (list :scale (if (numberp image-scaling-factor) > > + image-scaling-factor > > + 'default))) > > props))) > > ;; Add default smoothing. > > (unless (plist-member props :transform-smoothing) > > AFAIU, this is supposed to be taken care of in image.c. > > Alan, any ideas why this doesn't seem to work? It's because the image spec doesn't change so the image is pulled from the cache each time. Flushing the image between calls to image-size fixes it: (image-flush (find-image '((:file "icons/hicolor/scalable/apps/emacs.svg")))) I'm not sure what the solution is here. My feeling is that image-scaling-factor isn't intended as something you set for each image as you load it, it's a set-and-forget setting, so perhaps we just need to document that in order for it to take effect the image cache needs to be flushed. Alternatively we make the image cache aware of it. Perhaps we can flush the cache automatically when it changes? That might give unexpected results too. -- Alan Third From unknown Sun Jun 22 03:54:54 2025 X-Loop: help-debbugs@gnu.org Subject: bug#74725: 31.0.50; image-scaling-factor is ignored by create-image Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 07 Dec 2024 16:22:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 74725 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Alan Third Cc: 74725@debbugs.gnu.org, da_vid@orange.fr Received: via spool by 74725-submit@debbugs.gnu.org id=B74725.173358851622484 (code B ref 74725); Sat, 07 Dec 2024 16:22:02 +0000 Received: (at 74725) by debbugs.gnu.org; 7 Dec 2024 16:21:56 +0000 Received: from localhost ([127.0.0.1]:48278 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tJxZ6-0005qa-B4 for submit@debbugs.gnu.org; Sat, 07 Dec 2024 11:21:56 -0500 Received: from eggs.gnu.org ([209.51.188.92]:50350) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tJxZ1-0005qF-KR for 74725@debbugs.gnu.org; Sat, 07 Dec 2024 11:21:54 -0500 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tJxYt-0006PT-GN; Sat, 07 Dec 2024 11:21:44 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=cyKOPtbOl8BDXErVUXy3M7j4dQlWjywe6x65XgBAM/8=; b=HJieaeMuew9j se/+We2QzPf1qKQJG+58pPHBA/NzVsFEGFvlggu6hdjmTmPqBGfVl+Arl+v1TjLqoTGP4pXz30N5g x3s4ItY0DIGndx7HAtjdjaH9/1ZBZXTSrMkPOAeLp211pLFYKD3D+VZMHnoajw7owqsWWiM1m+Kke jfcx/YyyS316R5KFk4+hqbTo8V8cp4NOODRmdl7sCi0Yzy5scXTtArdKC3V+aelb8Nfa7yV6mYp9u Bp3fbNpihjGeQI2zViumeH4QdlvrquVVTgzpVG/sl4vVwbLazO1CYdHiCLrdGxGXD0+dhFoE6Sh9r UF0jw65HjzNghIq52Kh4+w==; Date: Sat, 07 Dec 2024 18:21:25 +0200 Message-Id: <861pyjihve.fsf@gnu.org> From: Eli Zaretskii In-Reply-To: (message from Alan Third on Sat, 7 Dec 2024 15:49:47 +0000) References: <2304cad6-884f-4528-a85e-ab9c06b80016@orange.fr> <868qsrim4a.fsf@gnu.org> X-Spam-Score: -1.6 (-) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.6 (--) > Date: Sat, 7 Dec 2024 15:49:47 +0000 > From: Alan Third > Cc: David Ponce , 74725@debbugs.gnu.org > > On Sat, Dec 07, 2024 at 04:49:41PM +0200, Eli Zaretskii wrote: > > > Date: Sat, 7 Dec 2024 13:13:58 +0100 > > > From: David Ponce via "Bug reports for GNU Emacs, > > > the Swiss army knife of text editors" > > > > > > While working with images, I found what seems an issue to me with > > > `create-image' which unconditionally set the :scale image property to > > > 'default' when not specified, ignoring the value of the option > > > `image-scaling-factor'. > > > > > > Here is an illustration: > > > > > > (let ((image-scaling-factor 1.0)) > > > (image-size > > > (find-image '((:file "icons/hicolor/scalable/apps/emacs.svg"))) > > > t)) > > > => (63 . 63) > > > > > > (let ((image-scaling-factor 2.0)) > > > (image-size > > > (find-image '((:file "icons/hicolor/scalable/apps/emacs.svg"))) > > > t)) > > > => (63 . 63) > > > > > > (image-size > > > (find-image '((:file "icons/hicolor/scalable/apps/emacs.svg" :scale 1))) > > > t) > > > => (48 . 48) > > > > > > (image-size > > > (find-image '((:file "icons/hicolor/scalable/apps/emacs.svg" :scale 2))) > > > t) > > > => (96 . 96) > > > > > > You can replace `image-size' with `insert-image' and observe the same. > > > > > > Here is a simple patch which fix the issue for me: > > > > > > diff --git a/lisp/image.el b/lisp/image.el > > > index ce97eeb3ca1..2c1e865c336 100644 > > > --- a/lisp/image.el > > > +++ b/lisp/image.el > > > @@ -536,7 +536,9 @@ create-image > > > file-or-data) > > > (and (not (plist-get props :scale)) > > > ;; Add default scaling. > > > - (list :scale 'default)) > > > + (list :scale (if (numberp image-scaling-factor) > > > + image-scaling-factor > > > + 'default))) > > > props))) > > > ;; Add default smoothing. > > > (unless (plist-member props :transform-smoothing) > > > > AFAIU, this is supposed to be taken care of in image.c. > > > > Alan, any ideas why this doesn't seem to work? > > It's because the image spec doesn't change so the image is pulled from > the cache each time. > > Flushing the image between calls to image-size fixes it: > > (image-flush (find-image '((:file "icons/hicolor/scalable/apps/emacs.svg")))) > > I'm not sure what the solution is here. My feeling is that > image-scaling-factor isn't intended as something you set for each > image as you load it, it's a set-and-forget setting, so perhaps we > just need to document that in order for it to take effect the image > cache needs to be flushed. > > Alternatively we make the image cache aware of it. > > Perhaps we can flush the cache automatically when it changes? That > might give unexpected results too. I think recording the scale in the cache, and rejecting the cached image if the scale doesn't match, will cause the least surprise. But I'm open to other opinions and suggestions. Thanks. From unknown Sun Jun 22 03:54:54 2025 X-Loop: help-debbugs@gnu.org Subject: bug#74725: 31.0.50; image-scaling-factor is ignored by create-image Resent-From: David Ponce Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 07 Dec 2024 16:28:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 74725 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Alan Third , Eli Zaretskii , 74725@debbugs.gnu.org Received: via spool by 74725-submit@debbugs.gnu.org id=B74725.173358883923493 (code B ref 74725); Sat, 07 Dec 2024 16:28:01 +0000 Received: (at 74725) by debbugs.gnu.org; 7 Dec 2024 16:27:19 +0000 Received: from localhost ([127.0.0.1]:48286 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tJxeJ-00066r-AI for submit@debbugs.gnu.org; Sat, 07 Dec 2024 11:27:19 -0500 Received: from smtp-24.smtpout.orange.fr ([80.12.242.24]:47175 helo=smtp.smtpout.orange.fr) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tJxeG-00066g-TX for 74725@debbugs.gnu.org; Sat, 07 Dec 2024 11:27:18 -0500 Received: from [192.168.1.21] ([90.112.40.65]) by smtp.orange.fr with ESMTPA id JxeDtKcbce9OfJxeEtw2uf; Sat, 07 Dec 2024 17:27:15 +0100 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=orange.fr; s=t20230301; t=1733588835; bh=I6T4MmXuKWGtCGlvmMO2ULPlQZn1BjyvBHcIRObjgZE=; h=Message-ID:Date:MIME-Version:Subject:To:From; b=ik+/2WClY6HFQs93O7e1qFCVF6uhUNxJk8NRRJMviKo7JZ2wfFHjV+qIc4S3Kq3Ha vfiCmbXRmv95iqEkYRBVTjyB2GeRV6SUU36tDDwvQlrQeFFv6EktjrKwVy3KcPSRC/ JRPSJIfnr+xKxbhNOpnxUncJjCJlREv49DOodF6t/GDQ51eaz2gE8oIlnumIhQS87g erA1J5hLqvhsxBct4q+QUMVMdXwFXdCRrHfQnouXumSyPxGRVYzgHYE+8/HI74c1ui khWC3DC+NDyp2EnjSFdRhstsnSHQU0JvB1Vfa14SxpdaJu+NHIhke47VVafVGlfICb /KHwTCYvk9/+A== X-ME-Helo: [192.168.1.21] X-ME-Auth: ZGFfdmlkQHdhbmFkb28uZnI= X-ME-Date: Sat, 07 Dec 2024 17:27:15 +0100 X-ME-IP: 90.112.40.65 Message-ID: <2793f551-8715-4679-8f52-b4673dd6802d@orange.fr> Date: Sat, 7 Dec 2024 17:27:13 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird References: <2304cad6-884f-4528-a85e-ab9c06b80016@orange.fr> <868qsrim4a.fsf@gnu.org> Content-Language: fr, en-US From: David Ponce In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Score: 0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) On 2024-12-07 16:49, Alan Third wrote: > On Sat, Dec 07, 2024 at 04:49:41PM +0200, Eli Zaretskii wrote: >>> Date: Sat, 7 Dec 2024 13:13:58 +0100 >>> From: David Ponce via "Bug reports for GNU Emacs, >>> the Swiss army knife of text editors" >>> >>> While working with images, I found what seems an issue to me with >>> `create-image' which unconditionally set the :scale image property to >>> 'default' when not specified, ignoring the value of the option >>> `image-scaling-factor'. >>> >>> Here is an illustration: >>> >>> (let ((image-scaling-factor 1.0)) >>> (image-size >>> (find-image '((:file "icons/hicolor/scalable/apps/emacs.svg"))) >>> t)) >>> => (63 . 63) >>> >>> (let ((image-scaling-factor 2.0)) >>> (image-size >>> (find-image '((:file "icons/hicolor/scalable/apps/emacs.svg"))) >>> t)) >>> => (63 . 63) >>> >>> (image-size >>> (find-image '((:file "icons/hicolor/scalable/apps/emacs.svg" :scale 1))) >>> t) >>> => (48 . 48) >>> >>> (image-size >>> (find-image '((:file "icons/hicolor/scalable/apps/emacs.svg" :scale 2))) >>> t) >>> => (96 . 96) >>> >>> You can replace `image-size' with `insert-image' and observe the same. >>> >>> Here is a simple patch which fix the issue for me: >>> >>> diff --git a/lisp/image.el b/lisp/image.el >>> index ce97eeb3ca1..2c1e865c336 100644 >>> --- a/lisp/image.el >>> +++ b/lisp/image.el >>> @@ -536,7 +536,9 @@ create-image >>> file-or-data) >>> (and (not (plist-get props :scale)) >>> ;; Add default scaling. >>> - (list :scale 'default)) >>> + (list :scale (if (numberp image-scaling-factor) >>> + image-scaling-factor >>> + 'default))) >>> props))) >>> ;; Add default smoothing. >>> (unless (plist-member props :transform-smoothing) >> >> AFAIU, this is supposed to be taken care of in image.c. >> >> Alan, any ideas why this doesn't seem to work? > > It's because the image spec doesn't change so the image is pulled from > the cache each time. > > Flushing the image between calls to image-size fixes it: > > (image-flush (find-image '((:file "icons/hicolor/scalable/apps/emacs.svg")))) > > I'm not sure what the solution is here. My feeling is that > image-scaling-factor isn't intended as something you set for each > image as you load it, it's a set-and-forget setting, so perhaps we > just need to document that in order for it to take effect the image > cache needs to be flushed. > > Alternatively we make the image cache aware of it. > > Perhaps we can flush the cache automatically when it changes? That > might give unexpected results too. This is exactly what I also observe. It seems due to this change: author Po Lu 2024-06-03 16:34:51 +0800 committer Po Lu 2024-06-03 16:36:29 +0800 commit 56376585134d627f96c71b7b063ec51548d3ad3f (patch) Which replaced - (list :scale - (image-compute-scaling-factor - image-scaling-factor))) By this + (list :scale 'default)) In create-image. With the side effect that the image spec don't change when the scaling factor changes, so the same cached image in always used. Not sure either what a solution could be. From unknown Sun Jun 22 03:54:54 2025 X-Loop: help-debbugs@gnu.org Subject: bug#74725: 31.0.50; image-scaling-factor is ignored by create-image Resent-From: David Ponce Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 07 Dec 2024 16:33:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 74725 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Eli Zaretskii , Alan Third Cc: 74725@debbugs.gnu.org Received: via spool by 74725-submit@debbugs.gnu.org id=B74725.173358914624520 (code B ref 74725); Sat, 07 Dec 2024 16:33:02 +0000 Received: (at 74725) by debbugs.gnu.org; 7 Dec 2024 16:32:26 +0000 Received: from localhost ([127.0.0.1]:48296 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tJxjG-0006NP-7e for submit@debbugs.gnu.org; Sat, 07 Dec 2024 11:32:26 -0500 Received: from smtp-22.smtpout.orange.fr ([80.12.242.22]:47185 helo=smtp.smtpout.orange.fr) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tJxjD-0006NG-U8 for 74725@debbugs.gnu.org; Sat, 07 Dec 2024 11:32:24 -0500 Received: from [192.168.1.21] ([90.112.40.65]) by smtp.orange.fr with ESMTPA id JxjAth4tA60jWJxjBtiotE; Sat, 07 Dec 2024 17:32:23 +0100 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=orange.fr; s=t20230301; t=1733589143; bh=JUmihdT1EzzILTO/A2gtc/OvhUP1R0X/EKVqGzvW+WY=; h=Message-ID:Date:MIME-Version:Subject:To:From; b=C3IFHSvmc5JCVDpIuNg2Uag5lusERntE4XoKRZA0eDjHXbu0sdNBIhAAKkgEWTqCi qnV8Cf6I7OMqkLVfgPVyFZrdfCY59QyMD2NvAuYXrU3x6Dy5OHrKJrLQ7551P2zOty CsmOTZnjHga7uwNA0U6yMr0Sr0OX397UjCq8AoUdmYP1RRlA880SEPmNGK5iJFF+Xb GL+a4hTKmwLez7kIhXIt7Nsbl3Cl1F45+ZRfe/F2BqpEfCduU1Hs7/OnyOEbLk+3VC ta9sqsm6MNdElk4sc3vtL7bhma5QuQyPPfAbuR1Q/9gaMcK+0Li0SZ4VMDzAo4Glbz g5+BWlf7umpUA== X-ME-Helo: [192.168.1.21] X-ME-Auth: ZGFfdmlkQHdhbmFkb28uZnI= X-ME-Date: Sat, 07 Dec 2024 17:32:23 +0100 X-ME-IP: 90.112.40.65 Message-ID: <35011415-9a37-4825-93d7-133948ceccbf@orange.fr> Date: Sat, 7 Dec 2024 17:32:20 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird References: <2304cad6-884f-4528-a85e-ab9c06b80016@orange.fr> <868qsrim4a.fsf@gnu.org> <861pyjihve.fsf@gnu.org> Content-Language: fr, en-US From: David Ponce In-Reply-To: <861pyjihve.fsf@gnu.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Score: 0.7 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.3 (/) On 2024-12-07 17:21, Eli Zaretskii wrote: >> Date: Sat, 7 Dec 2024 15:49:47 +0000 >> From: Alan Third >> Cc: David Ponce , 74725@debbugs.gnu.org >> >> On Sat, Dec 07, 2024 at 04:49:41PM +0200, Eli Zaretskii wrote: >>>> Date: Sat, 7 Dec 2024 13:13:58 +0100 >>>> From: David Ponce via "Bug reports for GNU Emacs, >>>> the Swiss army knife of text editors" >>>> >>>> While working with images, I found what seems an issue to me with >>>> `create-image' which unconditionally set the :scale image property to >>>> 'default' when not specified, ignoring the value of the option >>>> `image-scaling-factor'. >>>> >>>> Here is an illustration: >>>> >>>> (let ((image-scaling-factor 1.0)) >>>> (image-size >>>> (find-image '((:file "icons/hicolor/scalable/apps/emacs.svg"))) >>>> t)) >>>> => (63 . 63) >>>> >>>> (let ((image-scaling-factor 2.0)) >>>> (image-size >>>> (find-image '((:file "icons/hicolor/scalable/apps/emacs.svg"))) >>>> t)) >>>> => (63 . 63) >>>> >>>> (image-size >>>> (find-image '((:file "icons/hicolor/scalable/apps/emacs.svg" :scale 1))) >>>> t) >>>> => (48 . 48) >>>> >>>> (image-size >>>> (find-image '((:file "icons/hicolor/scalable/apps/emacs.svg" :scale 2))) >>>> t) >>>> => (96 . 96) >>>> >>>> You can replace `image-size' with `insert-image' and observe the same. >>>> >>>> Here is a simple patch which fix the issue for me: >>>> >>>> diff --git a/lisp/image.el b/lisp/image.el >>>> index ce97eeb3ca1..2c1e865c336 100644 >>>> --- a/lisp/image.el >>>> +++ b/lisp/image.el >>>> @@ -536,7 +536,9 @@ create-image >>>> file-or-data) >>>> (and (not (plist-get props :scale)) >>>> ;; Add default scaling. >>>> - (list :scale 'default)) >>>> + (list :scale (if (numberp image-scaling-factor) >>>> + image-scaling-factor >>>> + 'default))) >>>> props))) >>>> ;; Add default smoothing. >>>> (unless (plist-member props :transform-smoothing) >>> >>> AFAIU, this is supposed to be taken care of in image.c. >>> >>> Alan, any ideas why this doesn't seem to work? >> >> It's because the image spec doesn't change so the image is pulled from >> the cache each time. >> >> Flushing the image between calls to image-size fixes it: >> >> (image-flush (find-image '((:file "icons/hicolor/scalable/apps/emacs.svg")))) >> >> I'm not sure what the solution is here. My feeling is that >> image-scaling-factor isn't intended as something you set for each >> image as you load it, it's a set-and-forget setting, so perhaps we >> just need to document that in order for it to take effect the image >> cache needs to be flushed. >> >> Alternatively we make the image cache aware of it. >> >> Perhaps we can flush the cache automatically when it changes? That >> might give unexpected results too. > > I think recording the scale in the cache, and rejecting the cached > image if the scale doesn't match, will cause the least surprise. But > I'm open to other opinions and suggestions. > Seems like a good idea. From unknown Sun Jun 22 03:54:54 2025 X-Loop: help-debbugs@gnu.org Subject: bug#74725: 31.0.50; image-scaling-factor is ignored by create-image Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 07 Dec 2024 16:46:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 74725 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: David Ponce , Po Lu Cc: 74725@debbugs.gnu.org, alan@idiocy.org Received: via spool by 74725-submit@debbugs.gnu.org id=B74725.173358996027142 (code B ref 74725); Sat, 07 Dec 2024 16:46:02 +0000 Received: (at 74725) by debbugs.gnu.org; 7 Dec 2024 16:46:00 +0000 Received: from localhost ([127.0.0.1]:48317 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tJxwO-00073h-4p for submit@debbugs.gnu.org; Sat, 07 Dec 2024 11:46:00 -0500 Received: from eggs.gnu.org ([209.51.188.92]:53812) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tJxwL-00073S-Mb for 74725@debbugs.gnu.org; Sat, 07 Dec 2024 11:45:58 -0500 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tJxwA-0000SF-Dw; Sat, 07 Dec 2024 11:45:51 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=K5d5VyYmvgJ1pzsfmAxM56NAF+C4BEJb6sa3r/aVb3M=; b=Qm28MacyfIMw pImcsP9ruMF9rO8pE4dPSFPIyAfE51GqpQ2tlo+kCqSDyojawQd3DA+HPQIo77VL6g8KY25ZoVCRs uNm/Wuwt/ihsNUtyhnlpVD5y3nRFNUh1WkkFNMAFwjvyRPnkARDRYeIjjVm84oyaujDFI41dil9+M q4PGvFDa0En+lGvS6VFetq/TCI+sZabLQHrcEEIvxbu0oKfpYyByk/ZOMDYAlR4dP3U+zacuRLav4 CR6G736g0zF00QRO2aYy+z2WZw2dQpY94+UtBinu41QdF4JmYoa7qjNr2rlfS5SjcrF8caezZ27aX wXXO9CGXtyJw9pbIz3oMVQ==; Date: Sat, 07 Dec 2024 18:45:37 +0200 Message-Id: <86y10rh26m.fsf@gnu.org> From: Eli Zaretskii In-Reply-To: <2793f551-8715-4679-8f52-b4673dd6802d@orange.fr> (message from David Ponce on Sat, 7 Dec 2024 17:27:13 +0100) References: <2304cad6-884f-4528-a85e-ab9c06b80016@orange.fr> <868qsrim4a.fsf@gnu.org> <2793f551-8715-4679-8f52-b4673dd6802d@orange.fr> X-Spam-Score: -2.3 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > Date: Sat, 7 Dec 2024 17:27:13 +0100 > From: David Ponce > > On 2024-12-07 16:49, Alan Third wrote: > > On Sat, Dec 07, 2024 at 04:49:41PM +0200, Eli Zaretskii wrote: > >>> Date: Sat, 7 Dec 2024 13:13:58 +0100 > >>> From: David Ponce via "Bug reports for GNU Emacs, > >>> the Swiss army knife of text editors" > >>> > >>> While working with images, I found what seems an issue to me with > >>> `create-image' which unconditionally set the :scale image property to > >>> 'default' when not specified, ignoring the value of the option > >>> `image-scaling-factor'. > >>> > >>> Here is an illustration: > >>> > >>> (let ((image-scaling-factor 1.0)) > >>> (image-size > >>> (find-image '((:file "icons/hicolor/scalable/apps/emacs.svg"))) > >>> t)) > >>> => (63 . 63) > >>> > >>> (let ((image-scaling-factor 2.0)) > >>> (image-size > >>> (find-image '((:file "icons/hicolor/scalable/apps/emacs.svg"))) > >>> t)) > >>> => (63 . 63) > >>> > >>> (image-size > >>> (find-image '((:file "icons/hicolor/scalable/apps/emacs.svg" :scale 1))) > >>> t) > >>> => (48 . 48) > >>> > >>> (image-size > >>> (find-image '((:file "icons/hicolor/scalable/apps/emacs.svg" :scale 2))) > >>> t) > >>> => (96 . 96) > >>> > >>> You can replace `image-size' with `insert-image' and observe the same. > >>> > >>> Here is a simple patch which fix the issue for me: > >>> > >>> diff --git a/lisp/image.el b/lisp/image.el > >>> index ce97eeb3ca1..2c1e865c336 100644 > >>> --- a/lisp/image.el > >>> +++ b/lisp/image.el > >>> @@ -536,7 +536,9 @@ create-image > >>> file-or-data) > >>> (and (not (plist-get props :scale)) > >>> ;; Add default scaling. > >>> - (list :scale 'default)) > >>> + (list :scale (if (numberp image-scaling-factor) > >>> + image-scaling-factor > >>> + 'default))) > >>> props))) > >>> ;; Add default smoothing. > >>> (unless (plist-member props :transform-smoothing) > >> > >> AFAIU, this is supposed to be taken care of in image.c. > >> > >> Alan, any ideas why this doesn't seem to work? > > > > It's because the image spec doesn't change so the image is pulled from > > the cache each time. > > > > Flushing the image between calls to image-size fixes it: > > > > (image-flush (find-image '((:file "icons/hicolor/scalable/apps/emacs.svg")))) > > > > I'm not sure what the solution is here. My feeling is that > > image-scaling-factor isn't intended as something you set for each > > image as you load it, it's a set-and-forget setting, so perhaps we > > just need to document that in order for it to take effect the image > > cache needs to be flushed. > > > > Alternatively we make the image cache aware of it. > > > > Perhaps we can flush the cache automatically when it changes? That > > might give unexpected results too. > > This is exactly what I also observe. > It seems due to this change: > > author Po Lu 2024-06-03 16:34:51 +0800 > committer Po Lu 2024-06-03 16:36:29 +0800 > commit 56376585134d627f96c71b7b063ec51548d3ad3f (patch) > > Which replaced > > - (list :scale > - (image-compute-scaling-factor > - image-scaling-factor))) > > By this > > + (list :scale 'default)) > > In create-image. > > With the side effect that the image spec don't change when the scaling > factor changes, so the same cached image in always used. Po Lu, what were the reasons for that particular part of the commit? From unknown Sun Jun 22 03:54:54 2025 X-Loop: help-debbugs@gnu.org Subject: bug#74725: 31.0.50; image-scaling-factor is ignored by create-image Resent-From: Po Lu Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 08 Dec 2024 00:02:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 74725 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Eli Zaretskii Cc: 74725@debbugs.gnu.org, David Ponce , alan@idiocy.org Received: via spool by 74725-submit@debbugs.gnu.org id=B74725.173361611813216 (code B ref 74725); Sun, 08 Dec 2024 00:02:02 +0000 Received: (at 74725) by debbugs.gnu.org; 8 Dec 2024 00:01:58 +0000 Received: from localhost ([127.0.0.1]:48979 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tK4kH-0003R2-Bc for submit@debbugs.gnu.org; Sat, 07 Dec 2024 19:01:58 -0500 Received: from sonic305-22.consmr.mail.ne1.yahoo.com ([66.163.185.148]:40019) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tK4kF-0003Qm-GD for 74725@debbugs.gnu.org; Sat, 07 Dec 2024 19:01:56 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1733616110; bh=g6pXb9+D+WpXq58KjW8aTn8IZmKQJFB/Y/MsBUK9JNs=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From:Subject:Reply-To; b=F5kjYzojSeCVoN6VL43PUZfTUSKpRn04PwpuqI0juL4X/5t3d6JU45q3ACwd9sTBFQ4PobbeRT2fRAt600XAd+XFfZnsE0ignwMUqPM7fU7MmUzBzacVZbpMwW36iOBQj+S32uapHj8+hquDU0Q2STIBSk44iOor33jgm7J21L4v0J2JgJt7ucHymsfeuF9vpl2Ch4kMjke5JHSMIOngvhMXu72sn/k3PO0OOxmyUot3Dg66P23OaRrVOrsytoS64Oyh55MLmOPKcJ1kq+WD0aj5wLBZ0jZnRl3Fkzgbnsgtld6rLZGgYV2SCbneFGUWHOIX1O7Lf11TMWqq4oXoWQ== X-SONIC-DKIM-SIGN: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1733616110; bh=UwNsXwSGZBFND5Qaz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U_06aUOBYWf5 uN62rcDQCoiKCrUlY__bIu68xxZl2dXltMj9ixFiZMcck8iE8Rink1uGLr9cGjhjtYmVqrAewrL7 qNGnskdCyQ4npo2ANQYiErhXrOUGfh5ugQpVcrGfmTWbSsLOYGNP0adsU2Qjh5CjmM8RMCAHz543 xEIVhKhhf9Uyhs5CuDH9hcWe_ouu_o9v1jFy9WX.CD6Z_YCo36oJHVEf1UM9JLGkn6lYMorAb8F6 ZIsP.htP.A29eIImbydhBQUL7NWitpbc5iXEbObzzfmpslQco_eX.eQUR7mxYDk5vmotZ9LgoIC1 Z1sPSe_Lz2LT.ZLmvmmMAEaWrpPAcu5Mpr2h089a8.pwkiNtS6Le_7AGsRkzWDR6Lmfrn1xTD4SC f2hURNv26tJJfnjag2.MU7u0WFubsNDIk9iJpBKKGBEDLHcfy4Bdj6neVzJUQ__ZlnfavQ3ieNOb 0sMi8iUduXnFrAAd8cr61JdplWgY9IYrxKRIGueUuaCG4_e0WtEA.uZzSX_45.cbEosWEe1nE3uB SYpLvhxqQeBVRLEqlqz5U.mc20hsj.DqTrB8.D5vrRslA2v3NVMbd1aA- X-Sonic-MF: X-Sonic-ID: 07ede4cc-f632-4367-b23c-3b654f70bdd6 Received: from sonic.gate.mail.ne1.yahoo.com by sonic305.consmr.mail.ne1.yahoo.com with HTTP; Sun, 8 Dec 2024 00:01:50 +0000 Received: by hermes--production-sg3-5b7954b588-bfzf8 (Yahoo Inc. Hermes SMTP Server) with ESMTPA ID fd8bb382651edc6e7f92ce987d1d4030; Sun, 08 Dec 2024 00:01:45 +0000 (UTC) From: Po Lu In-Reply-To: <86y10rh26m.fsf@gnu.org> (Eli Zaretskii's message of "Sat, 07 Dec 2024 18:45:37 +0200") References: <2304cad6-884f-4528-a85e-ab9c06b80016@orange.fr> <868qsrim4a.fsf@gnu.org> <2793f551-8715-4679-8f52-b4673dd6802d@orange.fr> <86y10rh26m.fsf@gnu.org> Date: Sun, 08 Dec 2024 08:01:39 +0800 Message-ID: <87plm3ghzw.fsf@yahoo.com> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain X-Mailer: WebService/1.1.23040 mail.backend.jedi.jws.acl:role.jedi.acl.token.atz.jws.hermes.yahoo Content-Length: 4411 X-Spam-Score: 0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Eli Zaretskii writes: >> Date: Sat, 7 Dec 2024 17:27:13 +0100 >> From: David Ponce >> >> On 2024-12-07 16:49, Alan Third wrote: >> > On Sat, Dec 07, 2024 at 04:49:41PM +0200, Eli Zaretskii wrote: >> >>> Date: Sat, 7 Dec 2024 13:13:58 +0100 >> >>> From: David Ponce via "Bug reports for GNU Emacs, >> >>> the Swiss army knife of text editors" >> >>> >> >>> While working with images, I found what seems an issue to me with >> >>> `create-image' which unconditionally set the :scale image property to >> >>> 'default' when not specified, ignoring the value of the option >> >>> `image-scaling-factor'. >> >>> >> >>> Here is an illustration: >> >>> >> >>> (let ((image-scaling-factor 1.0)) >> >>> (image-size >> >>> (find-image '((:file "icons/hicolor/scalable/apps/emacs.svg"))) >> >>> t)) >> >>> => (63 . 63) >> >>> >> >>> (let ((image-scaling-factor 2.0)) >> >>> (image-size >> >>> (find-image '((:file "icons/hicolor/scalable/apps/emacs.svg"))) >> >>> t)) >> >>> => (63 . 63) >> >>> >> >>> (image-size >> >>> (find-image '((:file "icons/hicolor/scalable/apps/emacs.svg" :scale 1))) >> >>> t) >> >>> => (48 . 48) >> >>> >> >>> (image-size >> >>> (find-image '((:file "icons/hicolor/scalable/apps/emacs.svg" :scale 2))) >> >>> t) >> >>> => (96 . 96) >> >>> >> >>> You can replace `image-size' with `insert-image' and observe the same. >> >>> >> >>> Here is a simple patch which fix the issue for me: >> >>> >> >>> diff --git a/lisp/image.el b/lisp/image.el >> >>> index ce97eeb3ca1..2c1e865c336 100644 >> >>> --- a/lisp/image.el >> >>> +++ b/lisp/image.el >> >>> @@ -536,7 +536,9 @@ create-image >> >>> file-or-data) >> >>> (and (not (plist-get props :scale)) >> >>> ;; Add default scaling. >> >>> - (list :scale 'default)) >> >>> + (list :scale (if (numberp image-scaling-factor) >> >>> + image-scaling-factor >> >>> + 'default))) >> >>> props))) >> >>> ;; Add default smoothing. >> >>> (unless (plist-member props :transform-smoothing) >> >> >> >> AFAIU, this is supposed to be taken care of in image.c. >> >> >> >> Alan, any ideas why this doesn't seem to work? >> > >> > It's because the image spec doesn't change so the image is pulled from >> > the cache each time. >> > >> > Flushing the image between calls to image-size fixes it: >> > >> > (image-flush (find-image '((:file "icons/hicolor/scalable/apps/emacs.svg")))) >> > >> > I'm not sure what the solution is here. My feeling is that >> > image-scaling-factor isn't intended as something you set for each >> > image as you load it, it's a set-and-forget setting, so perhaps we >> > just need to document that in order for it to take effect the image >> > cache needs to be flushed. >> > >> > Alternatively we make the image cache aware of it. >> > >> > Perhaps we can flush the cache automatically when it changes? That >> > might give unexpected results too. >> >> This is exactly what I also observe. >> It seems due to this change: >> >> author Po Lu 2024-06-03 16:34:51 +0800 >> committer Po Lu 2024-06-03 16:36:29 +0800 >> commit 56376585134d627f96c71b7b063ec51548d3ad3f (patch) >> >> Which replaced >> >> - (list :scale >> - (image-compute-scaling-factor >> - image-scaling-factor))) >> >> By this >> >> + (list :scale 'default)) >> >> In create-image. >> >> With the side effect that the image spec don't change when the scaling >> factor changes, so the same cached image in always used. > > Po Lu, what were the reasons for that particular part of the commit? The scale applied by image-scaling-factor is liable to differ by display, and computing the default scale in Lisp would result in images being displayed with an incorrect scale in the presence of multiple displays. Image caches must be flushed when image-scaling-factor is modified, unless it is set to `auto' and a display's scale changes, because image.c has no means of detecting variable modifications and so only the latter event can be automatically detected. From unknown Sun Jun 22 03:54:54 2025 X-Loop: help-debbugs@gnu.org Subject: bug#74725: 31.0.50; image-scaling-factor is ignored by create-image Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 08 Dec 2024 06:04:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 74725 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Po Lu Cc: 74725@debbugs.gnu.org, da_vid@orange.fr, alan@idiocy.org Received: via spool by 74725-submit@debbugs.gnu.org id=B74725.173363783817154 (code B ref 74725); Sun, 08 Dec 2024 06:04:02 +0000 Received: (at 74725) by debbugs.gnu.org; 8 Dec 2024 06:03:58 +0000 Received: from localhost ([127.0.0.1]:49369 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tKAOc-0004Sb-7q for submit@debbugs.gnu.org; Sun, 08 Dec 2024 01:03:58 -0500 Received: from eggs.gnu.org ([209.51.188.92]:52840) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tKAOZ-0004SO-MC for 74725@debbugs.gnu.org; Sun, 08 Dec 2024 01:03:56 -0500 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tKAOS-0000O9-LS; Sun, 08 Dec 2024 01:03:48 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=7o2qxFm3IrIgolUpSjp4cmL1phTI14vP4QgbJ4B5p0s=; b=BPmZFZVD/Xmb f+l+SstmsI2vQ4bLLLnLtz78TdGT9nzZp5khKXlGDe+0IboDHmlgdSyfU5VIAWqFd8B/rREGIAD6h oHI1DK6JUB7KHlfJRF0geKCysdmIEi4G/kOoarrEAyzX1ORo3cWPfdAlctd4XwYCTrB9/L/8qwQCX jU9ccg4f14uPT7TP1c1y7U84Sl2qcm7Nt13gfWzo9AyYL2DFTOQWfeJf6xSXWgINLc5X+m9O5qpY2 GbBkgdautk8keJUNoZvlra/UgMbVX+Fc3sSqEprdu0626cQa/C/zbDorL0a4Zh01N8GZIM4ogFcvC IcKOYKrK286jeS1n8Rqx8A==; Date: Sun, 08 Dec 2024 08:03:47 +0200 Message-Id: <86frmyhfss.fsf@gnu.org> From: Eli Zaretskii In-Reply-To: <87plm3ghzw.fsf@yahoo.com> (message from Po Lu on Sun, 08 Dec 2024 08:01:39 +0800) References: <2304cad6-884f-4528-a85e-ab9c06b80016@orange.fr> <868qsrim4a.fsf@gnu.org> <2793f551-8715-4679-8f52-b4673dd6802d@orange.fr> <86y10rh26m.fsf@gnu.org> <87plm3ghzw.fsf@yahoo.com> X-Spam-Score: -1.6 (-) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.6 (--) > From: Po Lu > Cc: David Ponce , alan@idiocy.org, 74725@debbugs.gnu.org > Date: Sun, 08 Dec 2024 08:01:39 +0800 > > Eli Zaretskii writes: > > >> author Po Lu 2024-06-03 16:34:51 +0800 > >> committer Po Lu 2024-06-03 16:36:29 +0800 > >> commit 56376585134d627f96c71b7b063ec51548d3ad3f (patch) > >> > >> Which replaced > >> > >> - (list :scale > >> - (image-compute-scaling-factor > >> - image-scaling-factor))) > >> > >> By this > >> > >> + (list :scale 'default)) > >> > >> In create-image. > >> > >> With the side effect that the image spec don't change when the scaling > >> factor changes, so the same cached image in always used. > > > > Po Lu, what were the reasons for that particular part of the commit? > > The scale applied by image-scaling-factor is liable to differ by > display How so? Please elaborate. > and computing the default scale in Lisp would result in images > being displayed with an incorrect scale in the presence of multiple > displays. How does the above changeset solve this problem, then? > Image caches must be flushed when image-scaling-factor is modified, > unless it is set to `auto' and a display's scale changes, because > image.c has no means of detecting variable modifications and so only the > latter event can be automatically detected. Please describe the issue in more detail, as I don't think I follow what you are saying here. If we need to detect changes in variables, we can use the add-variable-watcher technique, similar to what we do in frame.el with variables that need to force redisplay (but maybe I don't understand the problem you are describing). In any case, I don't think changes in image-scaling-factor are supposed to be immediately reflected on display, if that's what you have in mind. This is not the documented effect of this variable. From unknown Sun Jun 22 03:54:54 2025 X-Loop: help-debbugs@gnu.org Subject: bug#74725: 31.0.50; image-scaling-factor is ignored by create-image Resent-From: Po Lu Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 08 Dec 2024 08:04:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 74725 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Eli Zaretskii Cc: 74725@debbugs.gnu.org, da_vid@orange.fr, alan@idiocy.org Received: via spool by 74725-submit@debbugs.gnu.org id=B74725.17336450279472 (code B ref 74725); Sun, 08 Dec 2024 08:04:02 +0000 Received: (at 74725) by debbugs.gnu.org; 8 Dec 2024 08:03:47 +0000 Received: from localhost ([127.0.0.1]:49595 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tKCGZ-0002Sf-0j for submit@debbugs.gnu.org; Sun, 08 Dec 2024 03:03:47 -0500 Received: from sonic311-23.consmr.mail.ne1.yahoo.com ([66.163.188.204]:44015) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tKCGW-0002SQ-Qu for 74725@debbugs.gnu.org; Sun, 08 Dec 2024 03:03:45 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1733645019; bh=Hw5hZB+94e7iFrBAXZLVr+0YrVclLl6Vy3Dklk7Ejvk=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From:Subject:Reply-To; b=OexbcaD9sftY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Sonic-ID: adb98941-c9da-4d3a-af15-cac1233a273e Received: from sonic.gate.mail.ne1.yahoo.com by sonic311.consmr.mail.ne1.yahoo.com with HTTP; Sun, 8 Dec 2024 08:03:39 +0000 Received: by hermes--production-sg3-5b7954b588-f8smd (Yahoo Inc. Hermes SMTP Server) with ESMTPA ID c0e1d59d150c2c9e36f5710865cb69c7; Sun, 08 Dec 2024 08:03:33 +0000 (UTC) From: Po Lu In-Reply-To: <86frmyhfss.fsf@gnu.org> (Eli Zaretskii's message of "Sun, 08 Dec 2024 08:03:47 +0200") References: <2304cad6-884f-4528-a85e-ab9c06b80016@orange.fr> <868qsrim4a.fsf@gnu.org> <2793f551-8715-4679-8f52-b4673dd6802d@orange.fr> <86y10rh26m.fsf@gnu.org> <87plm3ghzw.fsf@yahoo.com> <86frmyhfss.fsf@gnu.org> Date: Sun, 08 Dec 2024 16:03:28 +0800 Message-ID: <87h67eha9b.fsf@yahoo.com> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain X-Mailer: WebService/1.1.23040 mail.backend.jedi.jws.acl:role.jedi.acl.token.atz.jws.hermes.yahoo Content-Length: 2773 X-Spam-Score: 0.7 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.3 (/) Eli Zaretskii writes: >> From: Po Lu >> Cc: David Ponce , alan@idiocy.org, 74725@debbugs.gnu.org >> Date: Sun, 08 Dec 2024 08:01:39 +0800 >> >> Eli Zaretskii writes: >> >> >> author Po Lu 2024-06-03 16:34:51 +0800 >> >> committer Po Lu 2024-06-03 16:36:29 +0800 >> >> commit 56376585134d627f96c71b7b063ec51548d3ad3f (patch) >> >> >> >> Which replaced >> >> >> >> - (list :scale >> >> - (image-compute-scaling-factor >> >> - image-scaling-factor))) >> >> >> >> By this >> >> >> >> + (list :scale 'default)) >> >> >> >> In create-image. >> >> >> >> With the side effect that the image spec don't change when the scaling >> >> factor changes, so the same cached image in always used. >> > >> > Po Lu, what were the reasons for that particular part of the commit? >> >> The scale applied by image-scaling-factor is liable to differ by >> display > > How so? Please elaborate. When it is set to `auto' (the default value), the scaling factor to be applied is decided by the configuration of a frame, namely, its FRAME_COLUMN_WIDTH. >> and computing the default scale in Lisp would result in images >> being displayed with an incorrect scale in the presence of multiple >> displays. > > How does the above changeset solve this problem, then? By moving its application to image.c, which knows where an image is being displayed and can apply specific scales for each frame. >> Image caches must be flushed when image-scaling-factor is modified, >> unless it is set to `auto' and a display's scale changes, because >> image.c has no means of detecting variable modifications and so only the >> latter event can be automatically detected. > > Please describe the issue in more detail, as I don't think I follow > what you are saying here. If we need to detect changes in variables, > we can use the add-variable-watcher technique, similar to what we do > in frame.el with variables that need to force redisplay (but maybe I > don't understand the problem you are describing). > > In any case, I don't think changes in image-scaling-factor are > supposed to be immediately reflected on display, if that's what you > have in mind. This is not the documented effect of this variable. What I am trying to communicate is that changes to `image-scaling-factor' must be accompanied by flushing the image cache if it is to take effect on all previously displayed images. This isn't a problem, and the OP should simply flush the image cache after modifying image-scaling-factor, rather than rely on the erroneous behavior of find-image which was removed. From unknown Sun Jun 22 03:54:54 2025 X-Loop: help-debbugs@gnu.org Subject: bug#74725: 31.0.50; image-scaling-factor is ignored by create-image Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 08 Dec 2024 12:16:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 74725 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Po Lu Cc: 74725@debbugs.gnu.org, da_vid@orange.fr, alan@idiocy.org Received: via spool by 74725-submit@debbugs.gnu.org id=B74725.173366012923033 (code B ref 74725); Sun, 08 Dec 2024 12:16:02 +0000 Received: (at 74725) by debbugs.gnu.org; 8 Dec 2024 12:15:29 +0000 Received: from localhost ([127.0.0.1]:49913 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tKGC9-0005zR-59 for submit@debbugs.gnu.org; Sun, 08 Dec 2024 07:15:29 -0500 Received: from eggs.gnu.org ([209.51.188.92]:46088) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tKGC6-0005z4-7e for 74725@debbugs.gnu.org; Sun, 08 Dec 2024 07:15:27 -0500 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tKGBt-0005lp-Ed; Sun, 08 Dec 2024 07:15:14 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=mzkQRG6KCv8kjtCq000W7laHzP7dCNuiEq1+7ZLlOdI=; b=r0YIZHXO7c+W CIEb/2wbCYyO3Nh2rL4ZpJTOASUfotBPbT/kViwf2VhRBuBDL6YCTV9nVM6n7X7+OB+4WZYB86Cxl EuTkZPDqDTHpXycDNT9A7u7npL9rLVPH73d/YQBf8mc0O58XJg5e73C32K32AJrJoZLXpPePigrfh LbpWKTP7167Oxti6PhkEb/WBkrea2PyUaRFiqNMMDmpjrvfl+qBYRr1NmGqqR8P1lesYTPaMM6G7L NDvjnhRGYiF81oypF17lKMyWR74Cqe8Z0AMUmrNGQby4+ormPyeBiZz5rwnrywBDq66TFr5QDv6qU TsGttHwop717p/FDuirs4w==; Date: Sun, 08 Dec 2024 14:15:02 +0200 Message-Id: <86plm2fk1l.fsf@gnu.org> From: Eli Zaretskii In-Reply-To: <87h67eha9b.fsf@yahoo.com> (message from Po Lu on Sun, 08 Dec 2024 16:03:28 +0800) References: <2304cad6-884f-4528-a85e-ab9c06b80016@orange.fr> <868qsrim4a.fsf@gnu.org> <2793f551-8715-4679-8f52-b4673dd6802d@orange.fr> <86y10rh26m.fsf@gnu.org> <87plm3ghzw.fsf@yahoo.com> <86frmyhfss.fsf@gnu.org> <87h67eha9b.fsf@yahoo.com> X-Spam-Score: -1.6 (-) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.6 (--) > From: Po Lu > Cc: da_vid@orange.fr, alan@idiocy.org, 74725@debbugs.gnu.org > Date: Sun, 08 Dec 2024 16:03:28 +0800 > > Eli Zaretskii writes: > > >> > Po Lu, what were the reasons for that particular part of the commit? > >> > >> The scale applied by image-scaling-factor is liable to differ by > >> display > > > > How so? Please elaborate. > > When it is set to `auto' (the default value), the scaling factor to be > applied is decided by the configuration of a frame, namely, its > FRAME_COLUMN_WIDTH. So when the default font changes, all the images are supposed to be resized? Does that really happen, and if so, is that a good idea in all cases? > >> and computing the default scale in Lisp would result in images > >> being displayed with an incorrect scale in the presence of multiple > >> displays. > > > > How does the above changeset solve this problem, then? > > By moving its application to image.c, which knows where an image is > being displayed and can apply specific scales for each frame. But, as this bug seems to indicate, that solution doesn't always work? > >> Image caches must be flushed when image-scaling-factor is modified, > >> unless it is set to `auto' and a display's scale changes, because > >> image.c has no means of detecting variable modifications and so only the > >> latter event can be automatically detected. > > > > Please describe the issue in more detail, as I don't think I follow > > what you are saying here. If we need to detect changes in variables, > > we can use the add-variable-watcher technique, similar to what we do > > in frame.el with variables that need to force redisplay (but maybe I > > don't understand the problem you are describing). > > > > In any case, I don't think changes in image-scaling-factor are > > supposed to be immediately reflected on display, if that's what you > > have in mind. This is not the documented effect of this variable. > > What I am trying to communicate is that changes to > `image-scaling-factor' must be accompanied by flushing the image cache > if it is to take effect on all previously displayed images. This isn't > a problem, and the OP should simply flush the image cache after > modifying image-scaling-factor, rather than rely on the erroneous > behavior of find-image which was removed. OK, so do you consider the solution of recording the scale factor in the cache a reasonable one? From unknown Sun Jun 22 03:54:54 2025 X-Loop: help-debbugs@gnu.org Subject: bug#74725: 31.0.50; image-scaling-factor is ignored by create-image Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 21 Dec 2024 09:16:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 74725 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: luangruo@yahoo.com Cc: 74725@debbugs.gnu.org, da_vid@orange.fr, alan@idiocy.org Received: via spool by 74725-submit@debbugs.gnu.org id=B74725.173477250425208 (code B ref 74725); Sat, 21 Dec 2024 09:16:02 +0000 Received: (at 74725) by debbugs.gnu.org; 21 Dec 2024 09:15:04 +0000 Received: from localhost ([127.0.0.1]:45252 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tOvZf-0006YU-Nx for submit@debbugs.gnu.org; Sat, 21 Dec 2024 04:15:04 -0500 Received: from eggs.gnu.org ([209.51.188.92]:55706) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tOvZd-0006Xh-DI for 74725@debbugs.gnu.org; Sat, 21 Dec 2024 04:15:02 -0500 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tOvZW-00025q-4x; Sat, 21 Dec 2024 04:14:54 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=xgz7bAhHfEtMc0RMXsgYDSwTc793kQpqULwwIC7g3/Q=; b=ou8V6z06/vSX HN8IF3xQwiEuanmyAbLWIPPCY/roPZOTiF4gDuycuoGRr69JogXY91F3TD6g+Ac5iEQmFdqXmTVfe xcr3WprN5PP3jRK/MJTy1zRp4dEH9XjGpC5tj0H62OK/K2unmEhvJGFh0nrsGq5nXkgOZ2twgXzzc O4DCviE3lD38jvxEiG9D4jVYQ2+IgkYZyr0xRNvtksLk97SXvDEoHFBunGiMyg6P1yIOJ1Jes9TVP jIRQTrq66Ppt8hBCtVk2yoE8pJnJaNh0OElM4SR3YzhkYJ9Hi/e2gNsJRunOPB1RKlSlw1Rhl+iDB dZ13iDmQ1+xr5GU1iBv47w==; Date: Sat, 21 Dec 2024 11:14:50 +0200 Message-Id: <86frmh8kj9.fsf@gnu.org> From: Eli Zaretskii In-Reply-To: <86plm2fk1l.fsf@gnu.org> (message from Eli Zaretskii on Sun, 08 Dec 2024 14:15:02 +0200) References: <2304cad6-884f-4528-a85e-ab9c06b80016@orange.fr> <868qsrim4a.fsf@gnu.org> <2793f551-8715-4679-8f52-b4673dd6802d@orange.fr> <86y10rh26m.fsf@gnu.org> <87plm3ghzw.fsf@yahoo.com> <86frmyhfss.fsf@gnu.org> <87h67eha9b.fsf@yahoo.com> <86plm2fk1l.fsf@gnu.org> X-Spam-Score: -1.6 (-) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.6 (--) Ping! > Cc: 74725@debbugs.gnu.org, da_vid@orange.fr, alan@idiocy.org > Date: Sun, 08 Dec 2024 14:15:02 +0200 > From: Eli Zaretskii > > > From: Po Lu > > Cc: da_vid@orange.fr, alan@idiocy.org, 74725@debbugs.gnu.org > > Date: Sun, 08 Dec 2024 16:03:28 +0800 > > > > Eli Zaretskii writes: > > > > >> > Po Lu, what were the reasons for that particular part of the commit? > > >> > > >> The scale applied by image-scaling-factor is liable to differ by > > >> display > > > > > > How so? Please elaborate. > > > > When it is set to `auto' (the default value), the scaling factor to be > > applied is decided by the configuration of a frame, namely, its > > FRAME_COLUMN_WIDTH. > > So when the default font changes, all the images are supposed to be > resized? Does that really happen, and if so, is that a good idea in > all cases? > > > >> and computing the default scale in Lisp would result in images > > >> being displayed with an incorrect scale in the presence of multiple > > >> displays. > > > > > > How does the above changeset solve this problem, then? > > > > By moving its application to image.c, which knows where an image is > > being displayed and can apply specific scales for each frame. > > But, as this bug seems to indicate, that solution doesn't always work? > > > >> Image caches must be flushed when image-scaling-factor is modified, > > >> unless it is set to `auto' and a display's scale changes, because > > >> image.c has no means of detecting variable modifications and so only the > > >> latter event can be automatically detected. > > > > > > Please describe the issue in more detail, as I don't think I follow > > > what you are saying here. If we need to detect changes in variables, > > > we can use the add-variable-watcher technique, similar to what we do > > > in frame.el with variables that need to force redisplay (but maybe I > > > don't understand the problem you are describing). > > > > > > In any case, I don't think changes in image-scaling-factor are > > > supposed to be immediately reflected on display, if that's what you > > > have in mind. This is not the documented effect of this variable. > > > > What I am trying to communicate is that changes to > > `image-scaling-factor' must be accompanied by flushing the image cache > > if it is to take effect on all previously displayed images. This isn't > > a problem, and the OP should simply flush the image cache after > > modifying image-scaling-factor, rather than rely on the erroneous > > behavior of find-image which was removed. > > OK, so do you consider the solution of recording the scale factor in > the cache a reasonable one? > > > > From unknown Sun Jun 22 03:54:54 2025 X-Loop: help-debbugs@gnu.org Subject: bug#74725: 31.0.50; image-scaling-factor is ignored by create-image Resent-From: Po Lu Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 22 Dec 2024 00:27:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 74725 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Eli Zaretskii Cc: 74725@debbugs.gnu.org, da_vid@orange.fr, alan@idiocy.org Received: via spool by 74725-submit@debbugs.gnu.org id=B74725.17348272043390 (code B ref 74725); Sun, 22 Dec 2024 00:27:02 +0000 Received: (at 74725) by debbugs.gnu.org; 22 Dec 2024 00:26:44 +0000 Received: from localhost ([127.0.0.1]:48389 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tP9nw-0000sc-IQ for submit@debbugs.gnu.org; Sat, 21 Dec 2024 19:26:44 -0500 Received: from sonic316-21.consmr.mail.ne1.yahoo.com ([66.163.187.147]:36359) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tP9nu-0000sK-1f for 74725@debbugs.gnu.org; Sat, 21 Dec 2024 19:26:42 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1734827196; bh=N4/cf8wbFp7s/jnF0Jd1igl8RahFAaogMVVn54r+Ca8=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From:Subject:Reply-To; b=orqeM9sSJhH3Tu7HMlskCHIQrtwp9Yzvo1LRQ+EznTkk1eHg9DWEaRzBtmks2aKu/HA990CAU9ckmeyXm+S+hN35aPDRlvy5gpPwv/g2ZyUMbcX5Qf14EAcljSEP7KIbyR2/BvXWosWgeRSbEdXBZwLfEq43BeL47FWELm9mtfXpR7rJ1MdhaR1bxVQNEECc1SbOsQj2DgeU7DdlKQs+PO/DAHT8HSHFgQgJR9BfQl+p2HhIbIF9WLwQrg5XiQLEWueLOYry8nGeZRE6Url8bLe5jE4Oj9P0Pe6CdDD2Ap2W1VgmWDp7tgTdYolo9BWRlaI02upR0hXJ/7DqJ5qPcw== X-SONIC-DKIM-SIGN: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1734827196; bh=W+4ThnJ31e3Hylvs4KeanJZElzfsaC1//Jx1LPcFugw=; h=X-Sonic-MF:From:To:Subject:Date:From:Subject; b=io8/+hFXIxxbBWUtP5mLAYF7D/Wh0yySIKJ0mbBTzo2utl1Wqfi03KzcZONmDLjfZ9QNEL569WjXlX+8mhFNJld/2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cvVloiw3tLhY O9Wck_bcD883s7ylf95crwWbsBqOiOnF3Ms6.l.C64mqQdKOgHG67WWg8_ZzfenrnYj8JOennaTW XJMWevYCeRJDkpHkhc0OjCTlyAC9G4IMOkv_wUA-- X-Sonic-MF: X-Sonic-ID: 526990c2-ffa9-448f-8639-a9570491ad9c Received: from sonic.gate.mail.ne1.yahoo.com by sonic316.consmr.mail.ne1.yahoo.com with HTTP; Sun, 22 Dec 2024 00:26:36 +0000 Received: by hermes--production-sg3-5b7954b588-sgpdh (Yahoo Inc. Hermes SMTP Server) with ESMTPA ID 658ee0c2ecf7b403ddc0c3ab7ef7936d; Sun, 22 Dec 2024 00:26:30 +0000 (UTC) From: Po Lu In-Reply-To: <86frmh8kj9.fsf@gnu.org> (Eli Zaretskii's message of "Sat, 21 Dec 2024 11:14:50 +0200") References: <2304cad6-884f-4528-a85e-ab9c06b80016@orange.fr> <868qsrim4a.fsf@gnu.org> <2793f551-8715-4679-8f52-b4673dd6802d@orange.fr> <86y10rh26m.fsf@gnu.org> <87plm3ghzw.fsf@yahoo.com> <86frmyhfss.fsf@gnu.org> <87h67eha9b.fsf@yahoo.com> <86plm2fk1l.fsf@gnu.org> <86frmh8kj9.fsf@gnu.org> Date: Sun, 22 Dec 2024 08:26:25 +0800 Message-ID: <87o714pnpq.fsf@yahoo.com> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain X-Mailer: WebService/1.1.23040 mail.backend.jedi.jws.acl:role.jedi.acl.token.atz.jws.hermes.yahoo Content-Length: 527 X-Spam-Score: 0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Eli Zaretskii writes: >> So when the default font changes, all the images are supposed to be >> resized? Does that really happen, and if so, is that a good idea in >> all cases? IMHO, yes, considering that most images are scaled by default. >> But, as this bug seems to indicate, that solution doesn't always work? Not when image-scaling-factor is not configured to `auto', yes. >> OK, so do you consider the solution of recording the scale factor in >> the cache a reasonable one? That is alright by me. From unknown Sun Jun 22 03:54:54 2025 X-Loop: help-debbugs@gnu.org Subject: bug#74725: 31.0.50; image-scaling-factor is ignored by create-image Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 22 Dec 2024 06:49:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 74725 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Po Lu , alan@idiocy.org Cc: 74725@debbugs.gnu.org, da_vid@orange.fr Received: via spool by 74725-submit@debbugs.gnu.org id=B74725.17348500966823 (code B ref 74725); Sun, 22 Dec 2024 06:49:02 +0000 Received: (at 74725) by debbugs.gnu.org; 22 Dec 2024 06:48:16 +0000 Received: from localhost ([127.0.0.1]:48829 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tPFlA-0001ly-A1 for submit@debbugs.gnu.org; Sun, 22 Dec 2024 01:48:16 -0500 Received: from eggs.gnu.org ([209.51.188.92]:52860) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tPFl8-0001ll-9f for 74725@debbugs.gnu.org; Sun, 22 Dec 2024 01:48:15 -0500 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tPFl1-0003oR-2N; Sun, 22 Dec 2024 01:48:07 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=v7wA1Ui3KEOQfAGk3TOx7vwLZSx7JcFvgbBb4rjm9Ec=; b=WhMARwotkrjc VubQTxpYrVAJqgYlB6U96XwoX2eu1QNI+AlMHJ8pNwqQmDtnxfyC5yyK95+MUFuh7MIU5dzDUA117 uS7YMR+OU+Z97ltOxPSpmetldd5FDQWW+kAz0PoQnDS9cjVoSOFzlmMpqGwx4sD+DYI1l1M9RimA7 d+APbVbTS4vRN2RbhXu+tMC1snuAcBxPcO5kzJ39QZy24tlyJZCn7sDI7+QcxEIrOZrZklCCCWevg Sz4o4WkrxqU1BG9zwA78RHSPWQhSW/jC7oT4Ky3D6S2TyjZa0xL9PXo/Xnijd3jidgjQ1Ww3Zp/ra WHw+F+aOcsaH0Y6XpVu46w==; Date: Sun, 22 Dec 2024 08:48:04 +0200 Message-Id: <86a5co6wnv.fsf@gnu.org> From: Eli Zaretskii In-Reply-To: <87o714pnpq.fsf@yahoo.com> (message from Po Lu on Sun, 22 Dec 2024 08:26:25 +0800) References: <2304cad6-884f-4528-a85e-ab9c06b80016@orange.fr> <868qsrim4a.fsf@gnu.org> <2793f551-8715-4679-8f52-b4673dd6802d@orange.fr> <86y10rh26m.fsf@gnu.org> <87plm3ghzw.fsf@yahoo.com> <86frmyhfss.fsf@gnu.org> <87h67eha9b.fsf@yahoo.com> <86plm2fk1l.fsf@gnu.org> <86frmh8kj9.fsf@gnu.org> <87o714pnpq.fsf@yahoo.com> X-Spam-Score: -1.6 (-) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.6 (--) > From: Po Lu > Cc: 74725@debbugs.gnu.org, da_vid@orange.fr, alan@idiocy.org > Date: Sun, 22 Dec 2024 08:26:25 +0800 > > Eli Zaretskii writes: > > >> So when the default font changes, all the images are supposed to be > >> resized? Does that really happen, and if so, is that a good idea in > >> all cases? > > IMHO, yes, considering that most images are scaled by default. > > >> But, as this bug seems to indicate, that solution doesn't always work? > > Not when image-scaling-factor is not configured to `auto', yes. > > >> OK, so do you consider the solution of recording the scale factor in > >> the cache a reasonable one? > > That is alright by me. OK, thanks. Alan, could you please prepare a patch (for the master branch) that records the scaling factor in the image cache and rejects a cache hit with a different scaling factor? From unknown Sun Jun 22 03:54:54 2025 X-Loop: help-debbugs@gnu.org Subject: bug#74725: 31.0.50; image-scaling-factor is ignored by create-image Resent-From: Alan Third Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 27 Dec 2024 12:13:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 74725 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Eli Zaretskii Cc: Po Lu , 74725@debbugs.gnu.org, da_vid@orange.fr Received: via spool by 74725-submit@debbugs.gnu.org id=B74725.173530153420342 (code B ref 74725); Fri, 27 Dec 2024 12:13:02 +0000 Received: (at 74725) by debbugs.gnu.org; 27 Dec 2024 12:12:14 +0000 Received: from localhost ([127.0.0.1]:44933 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tR9CQ-0005I1-88 for submit@debbugs.gnu.org; Fri, 27 Dec 2024 07:12:14 -0500 Received: from dane.soverin.net ([185.233.34.30]:33595) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tR9CN-0005Hc-Ow for 74725@debbugs.gnu.org; Fri, 27 Dec 2024 07:12:12 -0500 Received: from smtp.soverin.net (c04smtp-lb01.int.sover.in [10.10.4.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by dane.soverin.net (Postfix) with ESMTPS id 4YKPVb4k8Pz2xRp; Fri, 27 Dec 2024 12:11:35 +0000 (UTC) Received: from smtp.soverin.net (smtp.soverin.net [10.10.4.99]) by soverin.net (Postfix) with ESMTPSA id 4YKPVZ6MHzz3j; Fri, 27 Dec 2024 12:11:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=idiocy.org; s=soverin; t=1735301495; bh=OcZ1l3gna1iGJUBwF6mlzk6V+sVC79EIP0Rn06N/PYs=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=WMBfvaf4bIf4uj5Mt62SgCTUzRjto3GR0SsCjodi0nMveuz9QBi8dMq55HkDbOMg3 9XXRGZhJrS9P3Z24P5LtickxmLxMNtCh7xk60ihlYWyx5BuXk9J65ltHx5VV+OaCyl AUdhfsh6VY8gcrnkVf7xVMJoQx0jXplQ3C5t345j4voX45cVJR/d+p6kEK+M8ilZni vuQwbqg0YoKcyjV1rQ27Qf2Rvuhy1FtAKOeW8us4unWgTFqQlB5Se4AbmIoqeURM6d QOjx90i0YvlRERl/Q4LkUrP9t3bEy0zAEOrG1qChEuhpXRCjllhuSzVoMO8VbOgL8Q LR/ud7xqdUB+Q== X-CM-Analysis: v=2.4 cv=UsCZN/wB c=1 sm=1 tr=0 ts=676e9977 a=UbsBXRcqaZ6D9kgPt/Dvnw==:617 a=xqWC_Br6kY4A:10 a=RZcAm9yDv7YA:10 a=R7BhWrPTDGdg7BwyDvQA:9 a=CjuIK1q_8ugA:10 a=hIj89exaAAAA:8 a=0hYpY6NHeaUfjtZdIXwA:9 a=lS9wXHQM5UdnNJ4u63Ry:22 a=9MSFP0l5Dcwi9NrB_JPx:22 X-CM-Envelope: MS4xfFahzdcRVRxRPqeo12oL1yb8DS7V099nwQSCPt81TYu99yO383EmJet54OdLYq+54xCa8H59467On8pBTZ78Yx0EN0ejccRFWT6ham31IpdMnK9SO5VY 0Yd8pisy4RCfeY8rKrCEt4/7tZBdXVbXom1G8E1FFOJz2Jv93vF3Mz9tiFD0sHkkQmcQvrZ8cV813JXQNWDgw/LtFzr6+AHPdf4IWEcsCgL0W8yPd/vkYA2s ltQRIPxghiCadslak/6XHRy5uUe7zYeLTAMPBNS5jAsZikmYSx/6ox2F5l+lZhtr Received: from localhost (faroe.holly.idiocy.org [local]) by faroe.holly.idiocy.org (OpenSMTPD) with ESMTPA id 89768e60; Fri, 27 Dec 2024 12:11:33 +0000 (UTC) Date: Fri, 27 Dec 2024 12:11:33 +0000 From: Alan Third Message-ID: Mail-Followup-To: Alan Third , Eli Zaretskii , Po Lu , 74725@debbugs.gnu.org, da_vid@orange.fr References: <2793f551-8715-4679-8f52-b4673dd6802d@orange.fr> <86y10rh26m.fsf@gnu.org> <87plm3ghzw.fsf@yahoo.com> <86frmyhfss.fsf@gnu.org> <87h67eha9b.fsf@yahoo.com> <86plm2fk1l.fsf@gnu.org> <86frmh8kj9.fsf@gnu.org> <87o714pnpq.fsf@yahoo.com> <86a5co6wnv.fsf@gnu.org> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="IIgiI55B3t49kIfn" Content-Disposition: inline In-Reply-To: <86a5co6wnv.fsf@gnu.org> X-Spampanel-Class: ham X-Spam-Score: 0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) --IIgiI55B3t49kIfn Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Sun, Dec 22, 2024 at 08:48:04AM +0200, Eli Zaretskii wrote: > Alan, could you please prepare a patch (for the master branch) that > records the scaling factor in the image cache and rejects a cache hit > with a different scaling factor? Hi Eli, patch attached. I named a new function image_compute_scale because most of the other functions in that file start image_, however I wasn't sure if I should name it compute_image_scale to mirror compute_image_size. Let me know if you think I should change it. -- Alan Third --IIgiI55B3t49kIfn Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="0001-Make-image-cache-aware-of-image-scaling-factor-bug-7.patch" >From 30699b3ab509662dc1ca3bdbccc4269227ef28c8 Mon Sep 17 00:00:00 2001 From: Alan Third Date: Fri, 27 Dec 2024 11:46:45 +0000 Subject: [PATCH] Make image cache aware of image-scaling-factor (bug#74725) * src/dispextern.h (struct image): Add scale so it can be compared in search_image_cache. * src/image.c (search_image_cache): Calculate the scale factor and compare with the cached value. (image_compute_scale): Compute the image's scale factor and optionally store it in the image struct. (compute_image_size): Move scale calculation code into image_compute_scale and use it. --- src/dispextern.h | 3 +++ src/image.c | 45 ++++++++++++++++++++++++++++++++++----------- 2 files changed, 37 insertions(+), 11 deletions(-) diff --git a/src/dispextern.h b/src/dispextern.h index ea7b0399adc..c876856717a 100644 --- a/src/dispextern.h +++ b/src/dispextern.h @@ -3257,6 +3257,9 @@ reset_mouse_highlight (Mouse_HLInfo *hlinfo) /* Width and height of the image. */ int width, height; + /* The scale factor applied to the image. */ + double scale; + /* These values are used for the rectangles displayed for images that can't be loaded. */ #define DEFAULT_IMAGE_WIDTH 30 diff --git a/src/image.c b/src/image.c index 0012abcb451..7b34b24ada9 100644 --- a/src/image.c +++ b/src/image.c @@ -210,6 +210,9 @@ #define n_planes n_image_planes static void image_edge_detection (struct frame *, struct image *, Lisp_Object, Lisp_Object); +static double image_compute_scale (struct frame *f, Lisp_Object spec, + struct image *img); + static void init_color_table (void); static unsigned long lookup_rgb_color (struct frame *f, int r, int g, int b); #ifdef COLOR_TABLE_SUPPORT @@ -2222,9 +2225,12 @@ search_image_cache (struct frame *f, Lisp_Object spec, EMACS_UINT hash, image spec specifies :background. However, the extra memory usage is probably negligible in practice, so we don't bother. */ + double scale = image_compute_scale (f, spec, NULL); + for (img = c->buckets[i]; img; img = img->next) if (img->hash == hash && !NILP (Fequal (img->spec, spec)) + && scale == img->scale && (ignore_colors || (img->face_foreground == foreground && img->face_background == background && img->face_font_size == font_size @@ -2667,18 +2673,15 @@ image_get_dimension (struct image *img, Lisp_Object symbol) return -1; } -/* Compute the desired size of an image with native size WIDTH x HEIGHT, - which is to be displayed on F. Use IMG to deduce the size. Store - the desired size into *D_WIDTH x *D_HEIGHT. Store -1 x -1 if the - native size is OK. */ - -static void -compute_image_size (struct frame *f, double width, double height, - struct image *img, - int *d_width, int *d_height) +/* Calculate the scale of the image. IMG may be null as it is only + required when creating an image, and this function is called from + image cache related functions that do not have access to the image + structure. */ +static double +image_compute_scale (struct frame *f, Lisp_Object spec, struct image *img) { double scale = 1; - Lisp_Object value = image_spec_value (img->spec, QCscale, NULL); + Lisp_Object value = image_spec_value (spec, QCscale, NULL); if (EQ (value, Qdefault)) { @@ -2692,7 +2695,9 @@ compute_image_size (struct frame *f, double width, double height, { /* This is a tag with which callers of `clear_image_cache' can refer to this image and its likenesses. */ - img->dependencies = Fcons (Qauto, img->dependencies); + if (img) + img->dependencies = Fcons (Qauto, img->dependencies); + scale = (FRAME_COLUMN_WIDTH (f) > 10 ? (FRAME_COLUMN_WIDTH (f) / 10.0f) : 1); } @@ -2716,6 +2721,24 @@ compute_image_size (struct frame *f, double width, double height, scale = dval; } + if (img) + img->scale = scale; + + return scale; +} + +/* Compute the desired size of an image with native size WIDTH x HEIGHT, + which is to be displayed on F. Use IMG to deduce the size. Store + the desired size into *D_WIDTH x *D_HEIGHT. Store -1 x -1 if the + native size is OK. */ + +static void +compute_image_size (struct frame *f, double width, double height, + struct image *img, + int *d_width, int *d_height) +{ + double scale = image_compute_scale(f, img->spec, img); + /* 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 -- 2.45.2 --IIgiI55B3t49kIfn-- From unknown Sun Jun 22 03:54:54 2025 X-Loop: help-debbugs@gnu.org Subject: bug#74725: 31.0.50; image-scaling-factor is ignored by create-image Resent-From: David Ponce Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 27 Dec 2024 16:12:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 74725 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Alan Third , Eli Zaretskii , Po Lu , 74725@debbugs.gnu.org Received: via spool by 74725-submit@debbugs.gnu.org id=B74725.17353159006341 (code B ref 74725); Fri, 27 Dec 2024 16:12:01 +0000 Received: (at 74725) by debbugs.gnu.org; 27 Dec 2024 16:11:40 +0000 Received: from localhost ([127.0.0.1]:47314 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tRCw7-0001eD-OB for submit@debbugs.gnu.org; Fri, 27 Dec 2024 11:11:39 -0500 Received: from smtp-16.smtpout.orange.fr ([80.12.242.16]:37007 helo=smtp.smtpout.orange.fr) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tRCw4-0001e3-IP for 74725@debbugs.gnu.org; Fri, 27 Dec 2024 11:11:39 -0500 Received: from [192.168.1.21] ([90.112.40.65]) by smtp.orange.fr with ESMTPA id RCvytS1QHjlXXRCw1t92yC; Fri, 27 Dec 2024 17:11:35 +0100 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=orange.fr; s=t20230301; t=1735315895; bh=9+7zrtK5+mNIcY9obZfTLjLAA8NqacxvX2ZFkHKa7y8=; h=Message-ID:Date:MIME-Version:Subject:To:From; b=HCMIQrBlAbNwlpy77fnchsIAK97Hj3Cj4iHxmkjUPoCyTa7kTP2PWUMcUIN1HebTl ffO+ifdQFCML1SUWraQegPmGtneOAtYdGjyDiUYp7VWt2ntyRUme7UzBhIGubxhsCR TuJgBR2NUqNNG95zQJx1MFQ6zsw8ADwehaEDITrYOfX+G3Qs38uNPR1J8BFMr7z44J YSm5+La82ctAABo5CSabmqFK4DIvADM3fd8R774rO80lBp+QPfzqc7bPa0FtHLo6+H Jxpd5uZ59Vguy4kDjmMBUwkRhKQ7ZX1jKW4pPBiCU40Wd1zRRU2JJWgwQpFKkVPjWi vN6TT4kKQt05Q== X-ME-Helo: [192.168.1.21] X-ME-Auth: ZGFfdmlkQHdhbmFkb28uZnI= X-ME-Date: Fri, 27 Dec 2024 17:11:35 +0100 X-ME-IP: 90.112.40.65 Message-ID: <0c671511-12e0-4764-91bc-9df5959ce319@orange.fr> Date: Fri, 27 Dec 2024 17:11:30 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird References: <2793f551-8715-4679-8f52-b4673dd6802d@orange.fr> <86y10rh26m.fsf@gnu.org> <87plm3ghzw.fsf@yahoo.com> <86frmyhfss.fsf@gnu.org> <87h67eha9b.fsf@yahoo.com> <86plm2fk1l.fsf@gnu.org> <86frmh8kj9.fsf@gnu.org> <87o714pnpq.fsf@yahoo.com> <86a5co6wnv.fsf@gnu.org> Content-Language: fr, en-US From: David Ponce In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Score: 0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) On 2024-12-27 13:11, Alan Third wrote: > On Sun, Dec 22, 2024 at 08:48:04AM +0200, Eli Zaretskii wrote: >> Alan, could you please prepare a patch (for the master branch) that >> records the scaling factor in the image cache and rejects a cache hit >> with a different scaling factor? > > Hi Eli, patch attached. > > I named a new function image_compute_scale because most of the other > functions in that file start image_, however I wasn't sure if I should > name it compute_image_scale to mirror compute_image_size. Let me know > if you think I should change it. Hi Alan, FYI, I applied your patch and it fixes the issue for me with the initial examples I provided. Many thanks Alan, and to all of you! From unknown Sun Jun 22 03:54:54 2025 X-Loop: help-debbugs@gnu.org Subject: bug#74725: 31.0.50; image-scaling-factor is ignored by create-image Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 28 Dec 2024 12:27:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 74725 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Alan Third Cc: luangruo@yahoo.com, 74725@debbugs.gnu.org, da_vid@orange.fr Received: via spool by 74725-submit@debbugs.gnu.org id=B74725.17353888188586 (code B ref 74725); Sat, 28 Dec 2024 12:27:02 +0000 Received: (at 74725) by debbugs.gnu.org; 28 Dec 2024 12:26:58 +0000 Received: from localhost ([127.0.0.1]:49665 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tRVuE-0002EP-1o for submit@debbugs.gnu.org; Sat, 28 Dec 2024 07:26:58 -0500 Received: from eggs.gnu.org ([209.51.188.92]:41948) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tRVuC-0002EC-0q for 74725@debbugs.gnu.org; Sat, 28 Dec 2024 07:26:56 -0500 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tRVu5-0005i5-C1; Sat, 28 Dec 2024 07:26:49 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=EyPU7A00nLYgpctHDuvS/25wjDYdbwJ3wTIU7opUPAI=; b=VfwbX5TndlCD 2nrE43ouMz0hHau/gKvbzMum562LP7jjKgiKSccHzgKMg5jI6J+e12cDbpWWqL1MLRWbhQXb7AQU2 rb/ZrHNFa0aVyMew5ZrxdPrxRf1Wu5G6VQ91yGLikEUKzcwIZWwTTESTXyBKSyFQpzEP297XYwKxY 1JFPWVhnTJ5Oie75VSw0WH/OzPMZe41tZr03KML9Kozf7lVHyUVhhr/5xRdIPONq2vKbkfElt7sQc Z7gN1oI3zlB7pf7hyKePBQZf3llpQKImH21Vh2E92+AmC4ogbEKpUXphUvZmDS8l72DUIb9JnDwSF RNIaGl6hvvE9D24wSJkwXg==; Date: Sat, 28 Dec 2024 14:26:47 +0200 Message-Id: <86pllcro1k.fsf@gnu.org> From: Eli Zaretskii In-Reply-To: (message from Alan Third on Fri, 27 Dec 2024 12:11:33 +0000) References: <2793f551-8715-4679-8f52-b4673dd6802d@orange.fr> <86y10rh26m.fsf@gnu.org> <87plm3ghzw.fsf@yahoo.com> <86frmyhfss.fsf@gnu.org> <87h67eha9b.fsf@yahoo.com> <86plm2fk1l.fsf@gnu.org> <86frmh8kj9.fsf@gnu.org> <87o714pnpq.fsf@yahoo.com> <86a5co6wnv.fsf@gnu.org> X-Spam-Score: -1.6 (-) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.6 (--) > Date: Fri, 27 Dec 2024 12:11:33 +0000 > From: Alan Third > Cc: Po Lu , 74725@debbugs.gnu.org, da_vid@orange.fr > > > Alan, could you please prepare a patch (for the master branch) that > > records the scaling factor in the image cache and rejects a cache hit > > with a different scaling factor? > > Hi Eli, patch attached. Thanks, LGTM. > I named a new function image_compute_scale because most of the other > functions in that file start image_, however I wasn't sure if I should > name it compute_image_scale to mirror compute_image_size. Let me know > if you think I should change it. Static functions can have any names we see fit, so feel free to rename if you think compute_image_scale would be better. Feel free to install on master, when you are satisfied with the code. From unknown Sun Jun 22 03:54:54 2025 MIME-Version: 1.0 X-Mailer: MIME-tools 5.505 (Entity 5.505) X-Loop: help-debbugs@gnu.org From: help-debbugs@gnu.org (GNU bug Tracking System) To: David Ponce Subject: bug#74725: closed (Re: bug#74725: 31.0.50; image-scaling-factor is ignored by create-image) Message-ID: References: <2304cad6-884f-4528-a85e-ab9c06b80016@orange.fr> X-Gnu-PR-Message: they-closed 74725 X-Gnu-PR-Package: emacs Reply-To: 74725@debbugs.gnu.org Date: Sat, 28 Dec 2024 12:39:02 +0000 Content-Type: multipart/mixed; boundary="----------=_1735389542-10631-1" This is a multi-part message in MIME format... ------------=_1735389542-10631-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Your bug report #74725: 31.0.50; image-scaling-factor is ignored by create-image which was filed against the emacs package, has been closed. The explanation is attached below, along with your original report. If you require more details, please reply to 74725@debbugs.gnu.org. --=20 74725: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D74725 GNU Bug Tracking System Contact help-debbugs@gnu.org with problems ------------=_1735389542-10631-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at 74725-done) by debbugs.gnu.org; 28 Dec 2024 12:38:04 +0000 Received: from localhost ([127.0.0.1]:49690 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tRW4y-0002k0-AK for submit@debbugs.gnu.org; Sat, 28 Dec 2024 07:38:04 -0500 Received: from dane.soverin.net ([185.233.34.149]:56187) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tRW4v-0002jP-CV for 74725-done@debbugs.gnu.org; Sat, 28 Dec 2024 07:38:02 -0500 Received: from smtp.soverin.net (c04smtp-lb01.int.sover.in [10.10.4.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by dane.soverin.net (Postfix) with ESMTPS id 4YL22V4jjZzyh4; Sat, 28 Dec 2024 12:37:54 +0000 (UTC) Received: from smtp.soverin.net (smtp.soverin.net [10.10.4.100]) by soverin.net (Postfix) with ESMTPSA id 4YL22T65KhzFh; Sat, 28 Dec 2024 12:37:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=idiocy.org; s=soverin; t=1735389474; bh=1Ge8zJ47yxfIaLHAmqVnWBiwBQYG5pGknA9xTNP02cQ=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=nnY9LpvdWUM722CkSEXy1nuKKi7++B2NvU++makL/FUgK/0nKiTzk2aWGtCmksrvA HvEUhFCzHn9owFgYlbjpKcEhsW/u/NcbOFylQ6X3LJIU6aT+POdK5Dml5iFJ4MW+6u mKRZtEfRiPEvDyIhqNiuJWLrw7Yl5oACZGFlq2agQAN3sY/k+sSIKb+Xw7gzW8Bdqq fK27Z8E4uaw/DZarSk1juxpZYbq0rIgAm4q4NhLd/MGKZrIEkEQsUIc/SHz/hxVbOx Wcoc7hpFG1qDbklsVIxIqU8VEpeW9Y+rYeQ1Yv/kl/JPdbbVEBlrDpwJY2zoCQbDi+ Fi+AwOTzGq5YA== X-CM-Envelope: MS4xfDkhwHhZkxIZPnvflTfpGkOzEditFJSYX7fIgEiaqCngiEFgHJfdAMAXZqrM42XM0V/TS/F1aF0tUEygvpdAaQVkbOeabw6Vnypj5N15Wlcod5VCQNCN di/98rlPs8wi6uM6LgJP/vQ4f9NVkFv4yr4FVciqD9xXb3kWRj7bn9vD2P96Z1xHcASFNkwLpo2elPdG/Td0E4oYZ+o6VRuoezMJQ+HetIlKLdpcnfgo8d2c oxvbVaOL4Q/RiwwaMFZGZJfqcP3AlVg4KohD/4iKiOGbVbJCrjf6ncuKkyUlO+M9 X-CM-Analysis: v=2.4 cv=e8f8Sbp/ c=1 sm=1 tr=0 ts=676ff122 a=UbsBXRcqaZ6D9kgPt/Dvnw==:617 a=xqWC_Br6kY4A:10 a=kj9zAlcOel0A:10 a=RZcAm9yDv7YA:10 a=hIj89exaAAAA:8 a=CjxXgO3LAAAA:8 a=mDV3o1hIAAAA:8 a=Y9vsEcAVA5bSJFaaRsAA:9 a=CjuIK1q_8ugA:10 a=lS9wXHQM5UdnNJ4u63Ry:22 a=9MSFP0l5Dcwi9NrB_JPx:22 Received: from localhost (faroe.holly.idiocy.org [local]) by faroe.holly.idiocy.org (OpenSMTPD) with ESMTPA id 2f67a744; Sat, 28 Dec 2024 12:37:52 +0000 (UTC) Date: Sat, 28 Dec 2024 12:37:52 +0000 From: Alan Third To: Eli Zaretskii Subject: Re: bug#74725: 31.0.50; image-scaling-factor is ignored by create-image Message-ID: Mail-Followup-To: Alan Third , Eli Zaretskii , luangruo@yahoo.com, 74725-done@debbugs.gnu.org, da_vid@orange.fr References: <86y10rh26m.fsf@gnu.org> <87plm3ghzw.fsf@yahoo.com> <86frmyhfss.fsf@gnu.org> <87h67eha9b.fsf@yahoo.com> <86plm2fk1l.fsf@gnu.org> <86frmh8kj9.fsf@gnu.org> <87o714pnpq.fsf@yahoo.com> <86a5co6wnv.fsf@gnu.org> <86pllcro1k.fsf@gnu.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <86pllcro1k.fsf@gnu.org> X-Spampanel-Class: ham X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 74725-done Cc: luangruo@yahoo.com, 74725-done@debbugs.gnu.org, da_vid@orange.fr X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) On Sat, Dec 28, 2024 at 02:26:47PM +0200, Eli Zaretskii wrote: > > Date: Fri, 27 Dec 2024 12:11:33 +0000 > > From: Alan Third > > Cc: Po Lu , 74725@debbugs.gnu.org, da_vid@orange.fr > > > > > Alan, could you please prepare a patch (for the master branch) that > > > records the scaling factor in the image cache and rejects a cache hit > > > with a different scaling factor? > > > > Hi Eli, patch attached. > > Thanks, LGTM. > > > I named a new function image_compute_scale because most of the other > > functions in that file start image_, however I wasn't sure if I should > > name it compute_image_scale to mirror compute_image_size. Let me know > > if you think I should change it. > > Static functions can have any names we see fit, so feel free to rename > if you think compute_image_scale would be better. > > Feel free to install on master, when you are satisfied with the code. Done. Thanks. -- Alan Third ------------=_1735389542-10631-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at submit) by debbugs.gnu.org; 7 Dec 2024 12:14:13 +0000 Received: from localhost ([127.0.0.1]:45659 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tJthM-0001AB-T6 for submit@debbugs.gnu.org; Sat, 07 Dec 2024 07:14:13 -0500 Received: from lists.gnu.org ([209.51.188.17]:49248) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tJthI-0001A2-Tc for submit@debbugs.gnu.org; Sat, 07 Dec 2024 07:14:10 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tJthI-0001YE-MK for bug-gnu-emacs@gnu.org; Sat, 07 Dec 2024 07:14:08 -0500 Received: from smtp-25.smtpout.orange.fr ([80.12.242.25] helo=smtp.smtpout.orange.fr) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tJthF-0008BF-KH for bug-gnu-emacs@gnu.org; Sat, 07 Dec 2024 07:14:08 -0500 Received: from [192.168.1.21] ([90.112.40.65]) by smtp.orange.fr with ESMTPA id Jth9tn99801M2Jth9tHXWp; Sat, 07 Dec 2024 13:14:00 +0100 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=orange.fr; s=t20230301; t=1733573640; bh=mMGZYJ4e0Jo+KExxqmgyXNnw2l408XFRVIabrWGhPso=; h=Message-ID:Date:MIME-Version:To:From:Subject; b=GwdzY3b+a2YQNnUtn8MflWH7yz5gMzW/6k3Duvp5RFsFU1QL6FP1RdpqyMZNJIGaC uPTGqOjffGZv1MsXq+7++LZmRVIOE2VcGdFu9Wpv9qIeo73Bn0QRZAmThHVmP+aKDk 7Hv3Sxil+ojj5YYcQXCqYo0ysqm9Jktv3FmEpXGrHj+czbyQY4Gk/YqHDXgE94MdC3 ZBBHwBVd2hm868hnpGkQjR0+kE3gMv2lq8ikHuPYxaJC5cqWq+ruyEeQgsp0ietmjd FfsPoq5lglzThNb99+/PrG4kzed/F3am0t9JpBis/QT1nVLHH8MNS7LvKSDrghCCBJ vrDUe7AVdxi3A== X-ME-Helo: [192.168.1.21] X-ME-Auth: ZGFfdmlkQHdhbmFkb28uZnI= X-ME-Date: Sat, 07 Dec 2024 13:14:00 +0100 X-ME-IP: 90.112.40.65 Message-ID: <2304cad6-884f-4528-a85e-ab9c06b80016@orange.fr> Date: Sat, 7 Dec 2024 13:13:58 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Content-Language: fr, en-US To: bug-gnu-emacs@gnu.org From: David Ponce Subject: 31.0.50; image-scaling-factor is ignored by create-image Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Received-SPF: pass client-ip=80.12.242.25; envelope-from=da_vid@orange.fr; helo=smtp.smtpout.orange.fr X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: -1.3 (-) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.3 (--) Hello, While working with images, I found what seems an issue to me with `create-image' which unconditionally set the :scale image property to 'default' when not specified, ignoring the value of the option `image-scaling-factor'. Here is an illustration: (let ((image-scaling-factor 1.0)) (image-size (find-image '((:file "icons/hicolor/scalable/apps/emacs.svg"))) t)) => (63 . 63) (let ((image-scaling-factor 2.0)) (image-size (find-image '((:file "icons/hicolor/scalable/apps/emacs.svg"))) t)) => (63 . 63) (image-size (find-image '((:file "icons/hicolor/scalable/apps/emacs.svg" :scale 1))) t) => (48 . 48) (image-size (find-image '((:file "icons/hicolor/scalable/apps/emacs.svg" :scale 2))) t) => (96 . 96) You can replace `image-size' with `insert-image' and observe the same. Here is a simple patch which fix the issue for me: diff --git a/lisp/image.el b/lisp/image.el index ce97eeb3ca1..2c1e865c336 100644 --- a/lisp/image.el +++ b/lisp/image.el @@ -536,7 +536,9 @@ create-image file-or-data) (and (not (plist-get props :scale)) ;; Add default scaling. - (list :scale 'default)) + (list :scale (if (numberp image-scaling-factor) + image-scaling-factor + 'default))) props))) ;; Add default smoothing. (unless (plist-member props :transform-smoothing) Thanks! In GNU Emacs 31.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.43, cairo version 1.18.0) of 2024-12-02 Repository revision: 8cd4ab7abde87ac04e05442196b4646ab46df9a7 Repository branch: master Windowing system distributor 'The X.Org Foundation', version 11.0.12014000 System Description: Fedora Linux 40 (KDE Plasma) Configured using: 'configure --with-native-compilation=no PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:/usr/lib/pkgconfig' Configured features: ACL CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS GPM GSETTINGS HARFBUZZ JPEG LCMS2 LIBOTF LIBSELINUX LIBSYSTEMD LIBXML2 M17N_FLT MODULES NOTIFY INOTIFY PDUMPER PNG RSVG SECCOMP SOUND SQLITE3 THREADS TIFF TOOLKIT_SCROLL_BARS TREE_SITTER WEBP X11 XDBE XIM XINPUT2 XPM GTK3 ZLIB Important settings: value of $LC_TIME: fr_FR.utf8 value of $LANG: fr_FR.UTF-8 locale-coding-system: utf-8-unix ------------=_1735389542-10631-1--