From nalimilan at club.fr  Mon Jan  7 10:54:12 2013
From: nalimilan at club.fr (Milan Bouchet-Valat)
Date: Mon, 07 Jan 2013 10:54:12 +0100
Subject: [Rd] Plots not drawn with buffered Cairo 1.12
Message-ID: <1357552452.23196.86.camel@milan>

Hi!

On Fedora 18 [1] and Arch Linux [2], using R 2.15.2, X11 plots are not
drawn (i.e. the window stays blank) when using X11.options(type="cairo")
and X11.options(type="dbcairo"). They are correctly drawn when using
X11.options(type="nbcairo") and X11.options(type="xlib"), or after
resizing the X11 window.

The bug happens with Cairo 1.12.4 and above, but not with 1.10.2 (I have
not tested versions between these two). I've filed a bug against Cairo
[3], and developers replied that R was probably not calling
cairo_surface_flush() when it should, as Cairo relies on this and this
assumption is relied on in more places in recent releases.

I gave a try to that idea but so far I've not been able to fix the bug
by adding cairo_surface_flush() calls in the src/modules/X11/devX11.c
code.

I've also discovered that the code in X11_Mode() is never really run
when drawing a simple plot like 'plot(1:10)'. What happens is that
xd->holdlevel is always 1 when X11_Mode() is called, so the function
returns. And when xd->holdlevel is set back to 0, no call to X11_Mode is
done. On the contrary, if I resize the window, the blocks for mode==0
and mode==1 are run several times. Is this behavior expected?

This also happens with Cairo 1.10.2, when the plot is correctly drawn,
so this is not the cause of the problem. But I find this puzzling, since
a comment says:

/********************************************************/
/* device_Mode is called whenever the graphics engine	*/
/* starts drawing (mode=1) or stops drawing mode=0)	*/
/* the device is not required to do anything		*/
/********************************************************/

According to what I'm seeing, the "starts drawing" part never happens.
So the comments sounds a bit misleading to me, if not completely wrong.

Any ideas?


Regards


1: https://bugzilla.redhat.com/show_bug.cgi?id=891983
2: https://bugs.archlinux.org/task/32597
3: https://bugs.freedesktop.org/show_bug.cgi?id=59085



[Rd] Plots not drawn with buffered Cairo 1.12
Milan Bouchet-Valat