* bug#22442: 25.0.50; --with-cairo does not display PNG on GNU/Linux
@ 2016-01-23 8:27 Paul Eggert
2016-01-23 9:24 ` Eli Zaretskii
` (2 more replies)
0 siblings, 3 replies; 8+ messages in thread
From: Paul Eggert @ 2016-01-23 8:27 UTC (permalink / raw)
To: 22442
To reproduce the problem, configure Emacs --with-cairo, and then run these shell
commands:
wget https://upload.wikimedia.org/wikipedia/commons/f/f5/All_palaeotemps.png
emacs -Q All_palaeotemps.png
Emacs shows a blank (or sometimes garbled) screen instead of the image.
I think the problem is that lookup_rgb_color is returning garbage.
Here are more details about the configuration, built on Fedora 23 x86-64:
In GNU Emacs 25.0.50.55 (x86_64-unknown-linux-gnu, GTK+ Version 3.18.6, cairo
version 1.14.2)
of 2016-01-22 built on penguin.cs.ucla.edu
Repository revision: 27a0919cde7a6dce93aeba63b5ce7d0834f48531
Configured using:
'configure --enable-gcc-warnings --with-cairo'
Configured features:
XPM JPEG TIFF GIF PNG RSVG CAIRO IMAGEMAGICK SOUND GPM DBUS GCONF
GSETTINGS NOTIFY ACL LIBSELINUX GNUTLS LIBXML2 FREETYPE M17N_FLT LIBOTF
XFT ZLIB TOOLKIT_SCROLL_BARS GTK3 X11
Important settings:
value of $LC_ALL: en_US.utf8
value of $LC_COLLATE: en_US.UTF-8
value of $LC_CTYPE: en_US.UTF-8
value of $LC_MESSAGES: en_US.UTF-8
value of $LANG: C
locale-coding-system: utf-8-unix
^ permalink raw reply [flat|nested] 8+ messages in thread
* bug#22442: 25.0.50; --with-cairo does not display PNG on GNU/Linux
2016-01-23 8:27 bug#22442: 25.0.50; --with-cairo does not display PNG on GNU/Linux Paul Eggert
@ 2016-01-23 9:24 ` Eli Zaretskii
2016-01-23 9:44 ` Paul Eggert
2016-01-24 0:31 ` Paul Eggert
2018-12-11 2:29 ` Dmitry Gutov
2 siblings, 1 reply; 8+ messages in thread
From: Eli Zaretskii @ 2016-01-23 9:24 UTC (permalink / raw)
To: Paul Eggert; +Cc: 22442
> From: Paul Eggert <eggert@cs.ucla.edu>
> Date: Sat, 23 Jan 2016 00:27:08 -0800
>
> To reproduce the problem, configure Emacs --with-cairo, and then run these shell
> commands:
>
> wget https://upload.wikimedia.org/wikipedia/commons/f/f5/All_palaeotemps.png
> emacs -Q All_palaeotemps.png
>
> Emacs shows a blank (or sometimes garbled) screen instead of the image.
Due to this and other issues with Cairo, and the lack of an active
developer who could work on fixing them, should we perhaps say in NEWS
that --with-cairo is still experimental?
Thanks.
^ permalink raw reply [flat|nested] 8+ messages in thread
* bug#22442: 25.0.50; --with-cairo does not display PNG on GNU/Linux
2016-01-23 8:27 bug#22442: 25.0.50; --with-cairo does not display PNG on GNU/Linux Paul Eggert
2016-01-23 9:24 ` Eli Zaretskii
@ 2016-01-24 0:31 ` Paul Eggert
2016-01-24 6:38 ` Mark Oteiza
2018-12-11 2:29 ` Dmitry Gutov
2 siblings, 1 reply; 8+ messages in thread
From: Paul Eggert @ 2016-01-24 0:31 UTC (permalink / raw)
To: 22442
The bug appears to have been "fixed" by this commit:
http://git.savannah.gnu.org/cgit/emacs.git/commit/?h=emacs-25&id=190d365f90d741b09e817d9878afd256505e1944
I don't know how to explain this. Possibly Emacs tries to convert a pixel to
RGB, this signals an error, and then Emacs falls back on something else that
works. Hard to believe that this is the desired behavior, so I'll leave
Bug#22442 open.
^ permalink raw reply [flat|nested] 8+ messages in thread
* bug#22442: 25.0.50; --with-cairo does not display PNG on GNU/Linux
2016-01-23 8:27 bug#22442: 25.0.50; --with-cairo does not display PNG on GNU/Linux Paul Eggert
2016-01-23 9:24 ` Eli Zaretskii
2016-01-24 0:31 ` Paul Eggert
@ 2018-12-11 2:29 ` Dmitry Gutov
2 siblings, 0 replies; 8+ messages in thread
From: Dmitry Gutov @ 2018-12-11 2:29 UTC (permalink / raw)
To: Paul Eggert, 22442
On 23.01.2016 10:27, Paul Eggert wrote:
> wget
> https://upload.wikimedia.org/wikipedia/commons/f/f5/All_palaeotemps.png
> emacs -Q All_palaeotemps.png
Seems to work fine now. Latest emacs-26 and master, with Cairo and
ImageMagick.
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH] Fix compilation erorr when --enable-gcc-warnings passed
@ 2016-01-22 10:54 Alexander Kuleshov
2016-01-23 0:06 ` Paul Eggert
0 siblings, 1 reply; 8+ messages in thread
From: Alexander Kuleshov @ 2016-01-22 10:54 UTC (permalink / raw)
To: emacs-devel; +Cc: Alexander Kuleshov
This patch does not provide functional changes, but contains fixes
for compilation errors if GNU Emacs was configured with the
--enable-gcc-warnings option. Mostly "defined but not used" fixed.
* src/gtkutil.c: set Qreverse_landscape if orientation symbol not
given. Prevents compilation error: orientation_symbol can be not
initialzed.
* src/image.c: add check that COLOR_TABLE_SUPPORT defined. Prevents
compilation error: macro COLOR_TABLE_SUPPORT defined but not used.
* src/xterm.c: move 'Window' declaration in the x_draw_fringe_bitmap()
to prevent errors "defined but not used".
---
src/gtkutil.c | 2 +-
src/image.c | 46 +++++++++++++++++++++++++++++-----------------
src/xterm.c | 6 +++---
3 files changed, 33 insertions(+), 21 deletions(-)
diff --git a/src/gtkutil.c b/src/gtkutil.c
index 768df34..bf7a067 100644
--- a/src/gtkutil.c
+++ b/src/gtkutil.c
@@ -4096,7 +4096,7 @@ xg_get_page_setup (void)
orientation_symbol = Qlandscape;
else if (orientation == GTK_PAGE_ORIENTATION_REVERSE_PORTRAIT)
orientation_symbol = Qreverse_portrait;
- else if (orientation == GTK_PAGE_ORIENTATION_REVERSE_LANDSCAPE)
+ else
orientation_symbol = Qreverse_landscape;
return listn (CONSTYPE_HEAP, 7,
diff --git a/src/image.c b/src/image.c
index 8bb5ff7..03b4489 100644
--- a/src/image.c
+++ b/src/image.c
@@ -75,7 +75,9 @@ typedef struct x_bitmap_record Bitmap_Record;
#endif
/* W32_TODO : Color tables on W32. */
+#ifdef COLOR_TABLE_SUPPORT
#undef COLOR_TABLE_SUPPORT
+#endif
typedef struct w32_bitmap_record Bitmap_Record;
#define GET_PIXEL(ximg, x, y) GetPixel (ximg, x, y)
@@ -90,11 +92,16 @@ typedef struct w32_bitmap_record Bitmap_Record;
#endif /* HAVE_NTGUI */
#ifdef USE_CAIRO
+#ifdef COLOR_TABLE_SUPPORT
#undef COLOR_TABLE_SUPPORT
#endif
+#endif
#ifdef HAVE_NS
+
+#ifdef COLOR_TABLE_SUPPORT
#undef COLOR_TABLE_SUPPORT
+#endif
typedef struct ns_bitmap_record Bitmap_Record;
@@ -4615,16 +4622,15 @@ colors_in_color_table (int *n)
static unsigned long
lookup_rgb_color (struct frame *f, int r, int g, int b)
{
- unsigned long pixel;
-
#ifdef HAVE_NTGUI
- pixel = PALETTERGB (r >> 8, g >> 8, b >> 8);
+ return PALETTERGB (r >> 8, g >> 8, b >> 8);
#endif /* HAVE_NTGUI */
#ifdef HAVE_NS
- pixel = RGB_TO_ULONG (r >> 8, g >> 8, b >> 8);
+ return RGB_TO_ULONG (r >> 8, g >> 8, b >> 8);
#endif /* HAVE_NS */
- return pixel;
+
+ return 0;
}
static void
@@ -7328,10 +7334,10 @@ tiff_load (struct frame *f, struct image *img)
for (x = 0; x < width; ++x)
{
uint32 abgr = row[x];
- int r = TIFFGetR (abgr);
- int g = TIFFGetG (abgr);
- int b = TIFFGetB (abgr);
- int a = TIFFGetA (abgr);
+ r = TIFFGetR (abgr);
+ g = TIFFGetG (abgr);
+ b = TIFFGetB (abgr);
+ a = TIFFGetA (abgr);
*dataptr++ = (a << 24) | (r << 16) | (g << 8) | b;
}
}
@@ -7634,13 +7640,11 @@ gif_load (struct frame *f, struct image *img)
{
int rc, width, height, x, y, i, j;
ColorMapObject *gif_color_map;
- unsigned long pixel_colors[256];
GifFileType *gif;
gif_memory_source memsrc;
Lisp_Object specified_bg = image_spec_value (img->spec, QCbackground, NULL);
Lisp_Object specified_file = image_spec_value (img->spec, QCfile, NULL);
Lisp_Object specified_data = image_spec_value (img->spec, QCdata, NULL);
- unsigned long bgcolor = 0;
EMACS_INT idx;
int gif_err;
@@ -7648,6 +7652,8 @@ gif_load (struct frame *f, struct image *img)
unsigned char *data = 0;
#else
XImagePtr ximg;
+ unsigned long pixel_colors[256];
+ unsigned long bgcolor = 0;
#endif
if (NILP (specified_data))
@@ -7834,8 +7840,12 @@ gif_load (struct frame *f, struct image *img)
init_color_table ();
if (STRINGP (specified_bg))
+#ifndef USE_CAIRO
bgcolor = x_alloc_image_color (f, img, specified_bg,
- FRAME_BACKGROUND_PIXEL (f));
+ FRAME_BACKGROUND_PIXEL (f));
+#else
+ x_alloc_image_color (f, img, specified_bg, FRAME_BACKGROUND_PIXEL (f));
+#endif
for (j = 0; j <= idx; ++j)
{
/* We use a local variable `raster' here because RasterBits is a
@@ -9182,11 +9192,13 @@ svg_load_image (struct frame *f, /* Pointer to emacs frame structure. *
int height;
const guint8 *pixels;
int rowstride;
- XImagePtr ximg;
- Lisp_Object specified_bg;
- XColor background;
+#ifndef USE_CAIRO
int x;
int y;
+ XColor background;
+ XImagePtr ximg;
+ Lisp_Object specified_bg;
+#endif
#if ! GLIB_CHECK_VERSION (2, 36, 0)
/* g_type_init is a glib function that must be called prior to
@@ -9597,8 +9609,6 @@ x_kill_gs_process (Pixmap pixmap, struct frame *f)
0, 0, img->width, img->height, ~0, ZPixmap);
if (ximg)
{
- int x, y;
-
/* Initialize the color table. */
init_color_table ();
@@ -9606,6 +9616,8 @@ x_kill_gs_process (Pixmap pixmap, struct frame *f)
color table. After having done so, the color table will
contain an entry for each color used by the image. */
#ifdef COLOR_TABLE_SUPPORT
+ int x, y;
+
for (y = 0; y < img->height; ++y)
for (x = 0; x < img->width; ++x)
{
diff --git a/src/xterm.c b/src/xterm.c
index 5a6d643..530c918 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -1312,7 +1312,6 @@ x_draw_fringe_bitmap (struct window *w, struct glyph_row *row, struct draw_fring
{
struct frame *f = XFRAME (WINDOW_FRAME (w));
Display *display = FRAME_X_DISPLAY (f);
- Window window = FRAME_X_WINDOW (f);
GC gc = f->output_data.x->normal_gc;
struct face *face = p->face;
@@ -1359,6 +1358,7 @@ x_draw_fringe_bitmap (struct window *w, struct glyph_row *row, struct draw_fring
Pixmap pixmap, clipmask = (Pixmap) 0;
int depth = DefaultDepthOfScreen (FRAME_X_SCREEN (f));
XGCValues gcv;
+ Window window = FRAME_X_WINDOW (f);
if (p->wd > 8)
bits = (char *) (p->bits + p->dh);
@@ -3749,7 +3749,7 @@ x_delete_glyphs (struct frame *f, register int n)
emacs_abort ();
}
-
+#if !defined USE_CAIRO || !defined USE_TOOLKIT_SCROLL_BARS
/* Like XClearArea, but check that WIDTH and HEIGHT are reasonable.
If they are <= 0, this is probably an error. */
@@ -3760,7 +3760,7 @@ x_clear_area1 (Display *dpy, Window window,
eassert (width > 0 && height > 0);
XClearArea (dpy, window, x, y, width, height, exposures);
}
-
+#endif
void
x_clear_area (struct frame *f, int x, int y, int width, int height)
--
2.7.0.25.gfc10eb5
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH] Fix compilation erorr when --enable-gcc-warnings passed
2016-01-22 10:54 [PATCH] Fix compilation erorr when --enable-gcc-warnings passed Alexander Kuleshov
@ 2016-01-23 0:06 ` Paul Eggert
2016-01-23 6:28 ` Alexander Kuleshov
0 siblings, 1 reply; 8+ messages in thread
From: Paul Eggert @ 2016-01-23 0:06 UTC (permalink / raw)
To: Alexander Kuleshov, emacs-devel
On 01/22/2016 02:54 AM, Alexander Kuleshov wrote:
> @@ -4615,16 +4622,15 @@ colors_in_color_table (int *n)
> static unsigned long
> lookup_rgb_color (struct frame *f, int r, int g, int b)
> {
> - unsigned long pixel;
> -
> #ifdef HAVE_NTGUI
> - pixel = PALETTERGB (r >> 8, g >> 8, b >> 8);
> + return PALETTERGB (r >> 8, g >> 8, b >> 8);
> #endif /* HAVE_NTGUI */
>
> #ifdef HAVE_NS
> - pixel = RGB_TO_ULONG (r >> 8, g >> 8, b >> 8);
> + return RGB_TO_ULONG (r >> 8, g >> 8, b >> 8);
> #endif /* HAVE_NS */
> - return pixel;
> +
> + return 0;
> }
Does this change cause lookup_rgb_color to always return 0 on platforms
other than MS-Windows and NextStep? Is this the right thing to do? This
part of the change isn't mentioned in the draft ChangeLog entry, so I'm
a bit lost as to the motivation.
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] Fix compilation erorr when --enable-gcc-warnings passed
2016-01-23 0:06 ` Paul Eggert
@ 2016-01-23 6:28 ` Alexander Kuleshov
2016-01-23 9:12 ` bug#22442: 25.0.50; --with-cairo does not display PNG on GNU/Linux Paul Eggert
0 siblings, 1 reply; 8+ messages in thread
From: Alexander Kuleshov @ 2016-01-23 6:28 UTC (permalink / raw)
To: Paul Eggert; +Cc: emacs-devel, Alexander Kuleshov
Hello Paul,
On 01-22-16, Paul Eggert wrote:
> On 01/22/2016 02:54 AM, Alexander Kuleshov wrote:
> >@@ -4615,16 +4622,15 @@ colors_in_color_table (int *n)
> > static unsigned long
> > lookup_rgb_color (struct frame *f, int r, int g, int b)
> > {
> >- unsigned long pixel;
> >-
> > #ifdef HAVE_NTGUI
> >- pixel = PALETTERGB (r >> 8, g >> 8, b >> 8);
> >+ return PALETTERGB (r >> 8, g >> 8, b >> 8);
> > #endif /* HAVE_NTGUI */
> > #ifdef HAVE_NS
> >- pixel = RGB_TO_ULONG (r >> 8, g >> 8, b >> 8);
> >+ return RGB_TO_ULONG (r >> 8, g >> 8, b >> 8);
> > #endif /* HAVE_NS */
> >- return pixel;
> >+
> >+ return 0;
> > }
>
> Does this change cause lookup_rgb_color to always return 0 on platforms
> other than MS-Windows and NextStep? Is this the right thing to do? This part
> of the change isn't mentioned in the draft ChangeLog entry, so I'm a bit
> lost as to the motivation.
Some motivation: Previous version was:
static unsigned long
lookup_rgb_color (struct frame *f, int r, int g, int b)
{
unsigned long pixel;
#ifdef HAVE_NTGUI
pixel = PALETTERGB (r >> 8, g >> 8, b >> 8);
#endif /* HAVE_NTGUI */
#ifdef HAVE_NS
pixel = RGB_TO_ULONG (r >> 8, g >> 8, b >> 8);
#endif /* HAVE_NS */
return pixel;
}
So, during compilation with enabled warnings, we will get following
error:
image.c: In function ‘lookup_rgb_color’:
image.c:4634:10: error: ‘pixel’ is used uninitialized in this function [-Werror=uninitialized]
return pixel;
And seems that this version of the lookup_rgb_color() is only for these platforms, because I see that the src/image.c contains yet another implementation of the lookup_rgb_color() for platforms where COLOR_TABLE_SUPPORT is enabled.
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2018-12-11 2:29 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-01-23 8:27 bug#22442: 25.0.50; --with-cairo does not display PNG on GNU/Linux Paul Eggert
2016-01-23 9:24 ` Eli Zaretskii
2016-01-23 9:44 ` Paul Eggert
2016-01-24 0:31 ` Paul Eggert
2016-01-24 6:38 ` Mark Oteiza
2018-12-11 2:29 ` Dmitry Gutov
-- strict thread matches above, loose matches on Subject: below --
2016-01-22 10:54 [PATCH] Fix compilation erorr when --enable-gcc-warnings passed Alexander Kuleshov
2016-01-23 0:06 ` Paul Eggert
2016-01-23 6:28 ` Alexander Kuleshov
2016-01-23 9:12 ` bug#22442: 25.0.50; --with-cairo does not display PNG on GNU/Linux Paul Eggert
2016-01-23 9:25 ` Eli Zaretskii
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.