From: Joseph Turner via "Bug reports for GNU Emacs, the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
To: Eli Zaretskii <eliz@gnu.org>
Cc: 69602-done@debbugs.gnu.org, stephen.berman@gmx.net, juri@linkov.net
Subject: bug#69602: 29.1; Image :map should adjust with :scale and :rotation
Date: Sat, 23 Mar 2024 13:32:05 -0700 [thread overview]
Message-ID: <87frwgofj5.fsf@breatheoutbreathe.in> (raw)
In-Reply-To: <86ttkwygml.fsf@gnu.org>
[-- Attachment #1: Type: text/plain, Size: 620 bytes --]
Eli Zaretskii <eliz@gnu.org> writes:
>> From: Joseph Turner <joseph@breatheoutbreathe.in>
>> Cc: 69602@debbugs.gnu.org, stephen.berman@gmx.net, juri@linkov.net
>> Date: Sat, 23 Mar 2024 10:41:59 -0700
>>
>> Eli Zaretskii <eliz@gnu.org> writes:
>>
>> > In image-tests--map-equal:
>> > lisp/image-tests.el:192:17: Warning: Unused lexical variable `i'
>> >
>> > Can you fix this, please?
>>
>> Oops! I just re-read the dotimes docstring to discover that the RESULT
>> arg is deprecated. Fixed. Thank you!
>
> Thanks, installed on master, and closing the bug.
Another minor improvement. Please see patch.
Joseph
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-copy-tree-just-image-map-not-entire-image.patch --]
[-- Type: text/x-diff, Size: 2443 bytes --]
From 359f9f889c2cad5e2f49aa4efd16bb18fe98e0a1 Mon Sep 17 00:00:00 2001
From: Joseph Turner <joseph@breatheoutbreathe.in>
Date: Sat, 23 Mar 2024 13:29:17 -0700
Subject: [PATCH] copy-tree just image map, not entire image.
* lisp/image.el (image--compute-original-map):
---
lisp/image.el | 27 +++++++++++++--------------
1 file changed, 13 insertions(+), 14 deletions(-)
diff --git a/lisp/image.el b/lisp/image.el
index 55340ea03dc..d7496485aca 100644
--- a/lisp/image.el
+++ b/lisp/image.el
@@ -1455,24 +1455,23 @@ image--compute-original-map
If IMAGE lacks :map property, return nil.
When :rotation is not a multiple of 90, return copy of :map."
(when (image-property image :map)
- (let* ((image-copy (copy-tree image t))
- (map (image-property image-copy :map))
- (scale (or (image-property image-copy :scale) 1))
- (rotation (or (image-property image-copy :rotation) 0))
- (flip (image-property image-copy :flip))
- (size (image-size image-copy t)))
+ (let* ((original-map (copy-tree (image-property image :map) t))
+ (scale (or (image-property image :scale) 1))
+ (rotation (or (image-property image :rotation) 0))
+ (flip (image-property image :flip))
+ (size (image-size image t)))
(when (and ; Handle only 90-degree rotations
(zerop (mod rotation 1))
(zerop (% (truncate rotation) 90)))
;; In rendered images, rotation is always applied before flip.
- ;; To undo the transformation, flip before rotating.
- ;; SIZE fits MAP before it is transformed back to ORIGINAL-MAP.
- ;; Therefore, scale MAP after flip and rotate operations, since
- ;; both need MAP to fit SIZE.
- (image--flip-map map flip size)
- (image--rotate-map map (- rotation) size)
- (image--scale-map map (/ 1.0 scale)))
- map)))
+ ;; To undo the transformation, flip before rotating. SIZE fits
+ ;; ORIGINAL-MAP before transformations are applied. Therefore,
+ ;; scale ORIGINAL-MAP after flip and rotate operations, since
+ ;; both need ORIGINAL-MAP to fit SIZE.
+ (image--flip-map original-map flip size)
+ (image--rotate-map original-map (- rotation) size)
+ (image--scale-map original-map (/ 1.0 scale)))
+ original-map)))
(defun image--scale-map (map scale)
"Scale MAP according to SCALE.
--
2.41.0
next prev parent reply other threads:[~2024-03-23 20:32 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-03-07 5:37 bug#69602: 29.1; Image :map should adjust with :scale and :rotation Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-03-07 7:04 ` Eli Zaretskii
2024-03-07 7:14 ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-03-07 7:55 ` Eli Zaretskii
2024-03-07 8:08 ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-03-07 9:27 ` Eli Zaretskii
2024-03-07 13:53 ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-03-08 7:02 ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-03-08 8:31 ` Eli Zaretskii
2024-03-08 8:39 ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-03-08 11:50 ` Eli Zaretskii
2024-03-21 6:45 ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-03-21 11:59 ` Eli Zaretskii
2024-03-23 0:11 ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-03-23 7:58 ` Eli Zaretskii
2024-03-23 17:41 ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-03-23 17:58 ` Eli Zaretskii
2024-03-23 18:18 ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-03-23 20:32 ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors [this message]
2024-03-28 10:13 ` Eli Zaretskii
2024-03-08 7:24 ` Eli Zaretskii
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87frwgofj5.fsf@breatheoutbreathe.in \
--to=bug-gnu-emacs@gnu.org \
--cc=69602-done@debbugs.gnu.org \
--cc=eliz@gnu.org \
--cc=joseph@breatheoutbreathe.in \
--cc=juri@linkov.net \
--cc=stephen.berman@gmx.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.