aboutsummaryrefslogtreecommitdiffstats
path: root/src/xterm.c
diff options
context:
space:
mode:
authorYAMAMOTO Mitsuharu2019-05-29 17:58:04 +0900
committerYAMAMOTO Mitsuharu2019-05-29 17:58:43 +0900
commitc89900ebd79d8c4bf5fd5550de053f379abd60ef (patch)
tree73e5d59325043b25306bad2670c0a55b8ef172c0 /src/xterm.c
parent09dce0fd391571ab1b580d2818689d596a8b99de (diff)
downloademacs-c89900ebd79d8c4bf5fd5550de053f379abd60ef.tar.gz
emacs-c89900ebd79d8c4bf5fd5550de053f379abd60ef.zip
Rework cairo image support to improve consistency (Bug#35871)
* src/dispextern.h (Emacs_Pix_Container) [USE_CAIRO]: New struct. Also used as aliases of Emacs_Pixmap and Emacs_Pix_Context. (x_kill_gs_process) [USE_CAIRO]: #ifdef out extern. (RGB_PIXEL_COLOR) [USE_CAIRO]: Define as unsigned long. * src/image.c: Include stdint.h. On cairo, remove existing image support code, use non-X11-specific code for XBM/XPM, and remove POSTSCRIPT support. (PUT_PIXEL): New macro. Use it instead of XPutPixel when not specific to X11. (GET_PIXEL, NO_PIXMAP, PIX_MASK_RETAIN, PIX_MASK_DRAW) (RGB_TO_ULONG, ARGB_TO_ULONG, RED_FROM_ULONG) (GREEN_FROM_ULONG, BLUE_FROM_ULONG, RED16_FROM_ULONG) (GREEN16_FROM_ULONG, BLUE16_FROM_ULONG) [USE_CAIRO]: New macros. (image_create_pix_container, image_pix_container_put_pixel) (image_pix_context_get_pixel, image_pix_container_create_from_bitmap_data) (cr_create_cr_surface_from_image) [USE_CAIRO]: New functions. (image_create_x_image_and_pixmap_1, image_destroy_x_image) (image_check_image_size): Extract X11-specific code from here ... (x_create_x_image_and_pixmap, x_destroy_x_image) (x_check_image_size) [HAVE_X_WINDOWS]: ... to here. (x_create_bitmap_mask) [HAVE_X_WINDOWS]: Use them. Inline specialized version of four_corners_best. (prepare_image_for_display, image_clear_image_1, image_destroy_x_image) (gui_put_x_image, image_put_x_image, image_get_x_image, image_unget_x_image) (Create_Pixmap_From_Bitmap_Data, lookup_rgb_color) (image_to_emacs_colors) [USE_CAIRO]: Add cairo support. (image_background, png_load_body) [USE_CAIRO]: Use image_alloc_image_color for img->background. (image_sync_to_pixmaps) [USE_CAIRO]: #ifdef out function. (Create_Pixmap_From_Bitmap_Data) [HAVE_X_WINDOWS]: Move image_check_image_size call from here ... (xbm_load_image): ... to here. (xpm_load_image): (image_build_heuristic_mask, pbm_load, gif_load) [USE_CAIRO]: Use lookup_rgb_color for argument of PUT_PIXEL. (image_pixmap_draw_cross) [HAVE_X_WINDOWS || USE_CAIRO]: New function. (image_disable_image) [HAVE_X_WINDOWS || USE_CAIRO]: Use it. (CrossForeground) [!HAVE_NTGUI && !HAVE_NS]: New macro. (image_disable_image) [!HAVE_NTGUI && !HAVE_NS]: Use it. * src/xterm.c (handle_one_xevent) <ClientMessage> [USE_CAIRO]: #ifdef out x_kill_gs_process call. (x_free_pixmap) [USE_CAIRO]: Free Emacs_Pix_Container and data it contains.
Diffstat (limited to 'src/xterm.c')
-rw-r--r--src/xterm.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/xterm.c b/src/xterm.c
index 559d1b48924..03458cb03f6 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -7794,12 +7794,14 @@ handle_one_xevent (struct x_display_info *dpyinfo,
7794 reply with "Next" if we received "Page", but we 7794 reply with "Next" if we received "Page", but we
7795 currently never do because we are interested in 7795 currently never do because we are interested in
7796 images, only, which should have 1 page. */ 7796 images, only, which should have 1 page. */
7797 Pixmap pixmap = (Pixmap) event->xclient.data.l[1];
7798 f = x_window_to_frame (dpyinfo, event->xclient.window); 7797 f = x_window_to_frame (dpyinfo, event->xclient.window);
7799 if (!f) 7798 if (!f)
7800 goto OTHER; 7799 goto OTHER;
7800#ifndef USE_CAIRO
7801 Pixmap pixmap = (Pixmap) event->xclient.data.l[1];
7801 x_kill_gs_process (pixmap, f); 7802 x_kill_gs_process (pixmap, f);
7802 expose_frame (f, 0, 0, 0, 0); 7803 expose_frame (f, 0, 0, 0, 0);
7804#endif /* !USE_CAIRO */
7803 goto done; 7805 goto done;
7804 } 7806 }
7805 7807
@@ -12154,7 +12156,15 @@ x_check_font (struct frame *f, struct font *font)
12154static void 12156static void
12155x_free_pixmap (struct frame *f, Emacs_Pixmap pixmap) 12157x_free_pixmap (struct frame *f, Emacs_Pixmap pixmap)
12156{ 12158{
12159#ifdef USE_CAIRO
12160 if (pixmap)
12161 {
12162 xfree (pixmap->data);
12163 xfree (pixmap);
12164 }
12165#else
12157 XFreePixmap (FRAME_X_DISPLAY (f), pixmap); 12166 XFreePixmap (FRAME_X_DISPLAY (f), pixmap);
12167#endif
12158} 12168}
12159 12169
12160 12170