aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPo Lu2024-06-03 20:37:41 +0800
committerPo Lu2024-06-03 20:39:41 +0800
commit68cc4cb6b1ce7ccc66084cb5e431bc9f6713bf04 (patch)
tree7a59786f0dd6f2fe58897aa7ed0145345e1e10f2
parent3a54dfab2463913601a16756102ac1d30653a805 (diff)
downloademacs-68cc4cb6b1ce7ccc66084cb5e431bc9f6713bf04.tar.gz
emacs-68cc4cb6b1ce7ccc66084cb5e431bc9f6713bf04.zip
Small followup change
* lisp/image.el (create-image): Remove supererogatory instances of pcase. Recognize new `lambda' values and refrain from specifying a default transform-smoothing when it is returned. (image--default-smoothing): Return lambda if scaling is default. * lisp/tool-bar.el (tool-bar--image-expression): Revert this portion of last change.
-rw-r--r--lisp/image.el24
-rw-r--r--lisp/tool-bar.el3
2 files changed, 16 insertions, 11 deletions
diff --git a/lisp/image.el b/lisp/image.el
index 654a15ef2b4..c155cda125e 100644
--- a/lisp/image.el
+++ b/lisp/image.el
@@ -520,7 +520,7 @@ Images should not be larger than specified by `max-image-size'."
520 (let ((data-format 520 (let ((data-format
521 ;; Pass the image format, if any, if this is data. 521 ;; Pass the image format, if any, if this is data.
522 (and data-p (or (plist-get props :format) t)))) 522 (and data-p (or (plist-get props :format) t))))
523 ;; It is x_find_image_file in image.c that sets the search path. 523 ;; It is `x_find_image_fd' in image.c that sets the search path.
524 (setq type (ignore-error unknown-image-type 524 (setq type (ignore-error unknown-image-type
525 (image-type file-or-data type data-format))) 525 (image-type file-or-data type data-format)))
526 ;; If we have external image conversion switched on (for exotic, 526 ;; If we have external image conversion switched on (for exotic,
@@ -540,12 +540,13 @@ Images should not be larger than specified by `max-image-size'."
540 props))) 540 props)))
541 ;; Add default smoothing. 541 ;; Add default smoothing.
542 (unless (plist-member props :transform-smoothing) 542 (unless (plist-member props :transform-smoothing)
543 (setq image (nconc image 543 (let* ((func image-transform-smoothing)
544 (list :transform-smoothing 544 (value (or (eq func t)
545 (pcase image-transform-smoothing 545 (and func (funcall func image)))))
546 ('t t) 546 (unless (eq value 'lambda)
547 ('nil nil) 547 (setq image (nconc image
548 (func (funcall func image))))))) 548 (list :transform-smoothing
549 value))))))
549 ;; Add original map from map. 550 ;; Add original map from map.
550 (when (and (plist-get props :map) 551 (when (and (plist-get props :map)
551 (not (plist-get props :original-map))) 552 (not (plist-get props :original-map)))
@@ -559,13 +560,18 @@ Images should not be larger than specified by `max-image-size'."
559 image))) 560 image)))
560 561
561(defun image--default-smoothing (image) 562(defun image--default-smoothing (image)
562 "Say whether IMAGE should be smoothed when transformed." 563 "Say whether IMAGE should be smoothed when transformed.
564Return `lambda' if the decision should be deferred to the time IMAGE is
565loaded."
563 (let* ((props (nthcdr 5 image)) 566 (let* ((props (nthcdr 5 image))
564 (scaling (plist-get props :scale)) 567 (scaling (plist-get props :scale))
565 (rotation (plist-get props :rotation))) 568 (rotation (plist-get props :rotation)))
566 (cond 569 (cond
570 ;; The scale of the image won't be available until
571 ;; `image_set_transform', and as such, defer to its judgement.
572 ((eq scaling 'default) 'lambda)
567 ;; We always smooth when scaling down and small upwards scaling. 573 ;; We always smooth when scaling down and small upwards scaling.
568 ((and scaling (numberp scaling) (< scaling 2)) 574 ((and scaling (< scaling 2))
569 t) 575 t)
570 ;; Smooth when doing non-90-degree rotation 576 ;; Smooth when doing non-90-degree rotation
571 ((and rotation 577 ((and rotation
diff --git a/lisp/tool-bar.el b/lisp/tool-bar.el
index 1beb6dd819f..01c65c42324 100644
--- a/lisp/tool-bar.el
+++ b/lisp/tool-bar.el
@@ -220,8 +220,7 @@ To define items in any other map, use `tool-bar-local-item'."
220 (let* ((fg (face-attribute 'tool-bar :foreground)) 220 (let* ((fg (face-attribute 'tool-bar :foreground))
221 (bg (face-attribute 'tool-bar :background)) 221 (bg (face-attribute 'tool-bar :background))
222 (colors (nconc (if (eq fg 'unspecified) nil (list :foreground fg)) 222 (colors (nconc (if (eq fg 'unspecified) nil (list :foreground fg))
223 (if (eq bg 'unspecified) nil (list :background bg)) 223 (if (eq bg 'unspecified) nil (list :background bg))))
224 '(:transform-smoothing nil)))
225 (xpm-spec (list :type 'xpm :file (concat icon ".xpm"))) 224 (xpm-spec (list :type 'xpm :file (concat icon ".xpm")))
226 (xpm-lo-spec (list :type 'xpm :file 225 (xpm-lo-spec (list :type 'xpm :file
227 (concat "low-color/" icon ".xpm"))) 226 (concat "low-color/" icon ".xpm")))