[cairo] potential bug in cairo relative to intel drivers

Mike Gualtieri mike.gualtieri at gmail.com
Wed Jul 29 11:35:49 PDT 2009


Hi all,

I wanted to report a potential bug I have found in cairo that occurs in Xorg
when using Intel drivers >=2.2.1.  In my testing this only occurs on some of
my machines, and I haven't been able to track down why it is occurring in
cairo.  I haven't seen this issue with other Xorg drivers / video cards or
earlier intel drivers.

I have also noticed that this issue disappears when I add the following in
the drivers section of my xorg.conf:

Option     "NoAccel"     "true"

This leads me to believe it has something to do with dri or some other 3D
acceleration extension.


On to the problem:

In my application, I have a variety of custom gtk/cairo objects to draw
components on the screen.  Most of these objects also have a background
image, placed into a cairo surface, that I scale to fit the widget size.  If
I leave the background image on a 1:1 scale everything looks appropriate.
If I scale the image either smaller or larger, the edges of the image look
like they are alpha blended with the widget background color.

I first noticed this issue when I was receiving a 1px line next to any of
the scaled surfaces.  When I stretch the surface to be several times larger
it can be seen that the background color of the widget blends with the
surface and is stretched with the image.

I hope that makes sense!  It's difficult to describe.

Essentially my code looks like this (this is stripped out of a few function
calls):

cairo_surface_t *bg_image_surface;
bg_image_surface = cairo_image_surface_create_from_png (bg_img);

cairo_t *cr;
cr = gdk_cairo_create (widget->window);

cairo_scale (cr, bg_scale_width,  bg_scale_height);
cairo_set_source_surface (cr, widget->bg_image_surface, 0, 0);
cairo_paint (cr);


Right now as a workaround, I'm planning to do the image scaling in a
GDKPixbuf and then place the pre-scaled image into the cairo surface.
Although this works, it is less than ideal and adds needless complexity to a
piece of code that was previously working fine.

If anyone has a suggestion in what I might be doing wrong I'm happy to
hear.  Also, if this should be reported upstream to the Intel folks I can do
that as well.  I use Gentoo Linux on my machines, so this could possibly be
related to an ABI issue, although after several entire system recompilations
the problem still exists.


Thanks in advance!

- Mike Gualtieri
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.cairographics.org/archives/cairo/attachments/20090729/10cdf47f/attachment.html 


More information about the cairo mailing list