aboutsummaryrefslogtreecommitdiffstats
path: root/src/image.c
diff options
context:
space:
mode:
authorAlexander Gramiak2019-04-13 20:41:31 -0600
committerAlexander Gramiak2019-04-26 16:55:39 -0600
commit5d8b0fadeec373cd2861328aeb1cb4293cbc9ded (patch)
treec1db5270ae236a1437660b486e6c74fbee4733ff /src/image.c
parent41e20ee4bc01576d23fb8fd4f875385ce57eb36a (diff)
downloademacs-5d8b0fadeec373cd2861328aeb1cb4293cbc9ded.tar.gz
emacs-5d8b0fadeec373cd2861328aeb1cb4293cbc9ded.zip
Add terminal hook query_frame_background_color
* src/termhooks.c (query_frame_background_color): New terminal hook. * src/image.c (image_query_frame_background_color): Remove. Use the terminal hook instead. * src/nsterm.m: * src/w32term.c: * src/xterm.c: Implement and set the new terminal hook.
Diffstat (limited to 'src/image.c')
-rw-r--r--src/image.c23
1 files changed, 4 insertions, 19 deletions
diff --git a/src/image.c b/src/image.c
index 0023b9369c1..bf594987eb8 100644
--- a/src/image.c
+++ b/src/image.c
@@ -1306,22 +1306,6 @@ image_background_transparent (struct image *img, struct frame *f, XImagePtr_or_D
1306 return img->background_transparent; 1306 return img->background_transparent;
1307} 1307}
1308 1308
1309#if defined (HAVE_PNG) || defined (HAVE_IMAGEMAGICK) || defined (HAVE_RSVG)
1310
1311/* Store F's background color into *BGCOLOR. */
1312static void
1313image_query_frame_background_color (struct frame *f, XColor *bgcolor)
1314{
1315#ifndef HAVE_NS
1316 bgcolor->pixel = FRAME_BACKGROUND_PIXEL (f);
1317 x_query_color (f, bgcolor);
1318#else
1319 ns_query_color (FRAME_BACKGROUND_COLOR (f), bgcolor, 1);
1320#endif
1321}
1322
1323#endif /* HAVE_PNG || HAVE_IMAGEMAGICK || HAVE_RSVG */
1324
1325/*********************************************************************** 1309/***********************************************************************
1326 Helper functions for X image types 1310 Helper functions for X image types
1327 ***********************************************************************/ 1311 ***********************************************************************/
@@ -6363,7 +6347,8 @@ png_load_body (struct frame *f, struct image *img, struct png_load_context *c)
6363 &color, 6347 &color,
6364 false, 6348 false,
6365 false) 6349 false)
6366 : (image_query_frame_background_color (f, &color), true)) 6350 : (FRAME_TERMINAL (f)->query_frame_background_color (f, &color),
6351 true))
6367 /* The user specified `:background', use that. */ 6352 /* The user specified `:background', use that. */
6368 { 6353 {
6369 int shift = bit_depth == 16 ? 0 : 8; 6354 int shift = bit_depth == 16 ? 0 : 8;
@@ -8816,7 +8801,7 @@ imagemagick_load_image (struct frame *f, struct image *img,
8816 &bgcolor, 8801 &bgcolor,
8817 false, 8802 false,
8818 false)) 8803 false))
8819 image_query_frame_background_color (f, &bgcolor); 8804 FRAME_TERMINAL (f)->query_frame_background_color (f, &bgcolor);
8820 8805
8821 bg_wand = NewPixelWand (); 8806 bg_wand = NewPixelWand ();
8822 PixelSetRed (bg_wand, (double) bgcolor.red / 65535); 8807 PixelSetRed (bg_wand, (double) bgcolor.red / 65535);
@@ -9555,7 +9540,7 @@ svg_load_image (struct frame *f, struct image *img, char *contents,
9555 &background, 9540 &background,
9556 false, 9541 false,
9557 false)) 9542 false))
9558 image_query_frame_background_color (f, &background); 9543 FRAME_TERMINAL (f)->query_frame_background_color (f, &background);
9559 9544
9560 /* SVG pixmaps specify transparency in the last byte, so right 9545 /* SVG pixmaps specify transparency in the last byte, so right
9561 shift 8 bits to get rid of it, since emacs doesn't support 9546 shift 8 bits to get rid of it, since emacs doesn't support