[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
master 6a2c132 1/4: Merge from origin/emacs-27
From: |
Glenn Morris |
Subject: |
master 6a2c132 1/4: Merge from origin/emacs-27 |
Date: |
Tue, 15 Dec 2020 12:24:36 -0500 (EST) |
branch: master
commit 6a2c13280c4fb2e154e34af6e3b91dd77592d7ba
Merge: f3e2148 62a6934
Author: Glenn Morris <rgm@gnu.org>
Commit: Glenn Morris <rgm@gnu.org>
Merge from origin/emacs-27
62a6934af9 Fix crash when using XRender and restoring image from X (b...
de032d41c6 Bind k to image-kill-buffer in doc-view-mode-map.
---
lisp/doc-view.el | 1 +
src/dispextern.h | 4 ++++
src/image.c | 9 +++++++++
3 files changed, 14 insertions(+)
diff --git a/lisp/doc-view.el b/lisp/doc-view.el
index f7a7be9..dbd9356 100644
--- a/lisp/doc-view.el
+++ b/lisp/doc-view.el
@@ -432,6 +432,7 @@ Typically \"page-%s.png\".")
(define-key map "P" 'doc-view-fit-page-to-window)
(define-key map "F" 'doc-view-fit-window-to-page) ;F = frame
;; Killing the buffer (and the process)
+ (define-key map (kbd "k") 'image-kill-buffer)
(define-key map (kbd "K") 'doc-view-kill-proc)
;; Slicing the image
(define-key map (kbd "c s") 'doc-view-set-slice)
diff --git a/src/dispextern.h b/src/dispextern.h
index da51772..c76822f 100644
--- a/src/dispextern.h
+++ b/src/dispextern.h
@@ -3040,6 +3040,10 @@ struct image
# if !defined USE_CAIRO && defined HAVE_XRENDER
/* Picture versions of pixmap and mask for compositing. */
Picture picture, mask_picture;
+
+ /* We need to store the original image dimensions in case we have to
+ call XGetImage. */
+ int original_width, original_height;
# endif
#endif /* HAVE_X_WINDOWS */
#ifdef HAVE_NTGUI
diff --git a/src/image.c b/src/image.c
index a3301ad..dc06e9c 100644
--- a/src/image.c
+++ b/src/image.c
@@ -2170,6 +2170,10 @@ image_set_transform (struct frame *f, struct image *img)
# if !defined USE_CAIRO && defined HAVE_XRENDER
if (!img->picture)
return;
+
+ /* Store the original dimensions as we'll overwrite them later. */
+ img->original_width = img->width;
+ img->original_height = img->height;
# endif
/* Determine size. */
@@ -3029,6 +3033,11 @@ image_get_x_image (struct frame *f, struct image *img,
bool mask_p)
if (ximg_in_img)
return ximg_in_img;
+#ifdef HAVE_XRENDER
+ else if (img->picture)
+ return XGetImage (FRAME_X_DISPLAY (f), !mask_p ? img->pixmap : img->mask,
+ 0, 0, img->original_width, img->original_height, ~0,
ZPixmap);
+#endif
else
return XGetImage (FRAME_X_DISPLAY (f), !mask_p ? img->pixmap : img->mask,
0, 0, img->width, img->height, ~0, ZPixmap);