Package: libcairo1
Version: 0.4.0-1
Severity: important

When cairo_show_surface id called with a surface created with
CAIRO_FORMAT_RGB24 pixel format, the app crash with xlib BadMatch error.

The error was 'BadMatch (invalid parameter attributes)'.
(Details: serial 211 error_code 8 request_code 72 minor_code 0)
(Note to programmers: normally, X errors are reported
asynchronously;
that is, you will receive the error a while after causing it.
To debug your program, run it with the --sync command line
option to change this behavior. You can then get a meaningful
backtrace from your debugger if you break on the gdk_x_error()
function.)

Test program :
#include <cairo/cairo.h>
#include <cairo/cairo-xlib.h>
#include <gtk/gtk.h>
#include <gdk/gdk.h>

void cairo_gdk (cairo_t* ct, GdkDrawable* window);
gint expose (GtkWidget* widget, GdkEventExpose* event);
GtkWidget *label;
cairo_surface_t *s;

int main(int argc, char **argv)
{
        GtkWidget *win;

        gtk_init (&argc, &argv);

        win = gtk_window_new (GTK_WINDOW_TOPLEVEL);
        gtk_widget_set_size_request (win, 100, 100);

        label = gtk_label_new ("sds");
        gtk_container_add (win, label);
        g_signal_connect (G_OBJECT (label), "expose-event", G_CALLBACK
(expose), NULL);

        {
                cairo_t *cr;
                s = cairo_image_surface_create (CAIRO_FORMAT_RGB24, 50,
50);
                cr = cairo_create ();

                cairo_set_target_surface (cr, s);
                cairo_set_rgb_color (cr, 255,0,0);
                cairo_set_alpha (cr, 0.5);
                cairo_rectangle (cr, 10, 10, 50, 50);
                cairo_stroke (cr);
                cairo_destroy (cr);
        }
        gtk_widget_show_all (win);

        gtk_main ();
        
        return 0;
}

gint 
expose (GtkWidget* widget, GdkEventExpose* event)
{
        cairo_t *cr;
        cr = cairo_create ();

        cairo_gdk (cr, GDK_WINDOW (label->window));

        cairo_translate (cr, 50, 50);
        cairo_show_surface (cr, s, 50, 50);
        cairo_destroy (cr);

        return FALSE;
}

void
cairo_gdk (cairo_t* ct, GdkDrawable* window)
{
        Display* dpy;
        Drawable drawable;
        GdkDrawable* real_drawable;
        gint x_off, y_off;

        if (GDK_IS_WINDOW (window)) {
                gdk_window_get_internal_paint_info (window,
&real_drawable, &x_off, &y_off);
                dpy = gdk_x11_drawable_get_xdisplay (real_drawable);
                drawable = gdk_x11_drawable_get_xid (real_drawable);
        } else {
                dpy = gdk_x11_drawable_get_xdisplay (window);
                drawable = gdk_x11_drawable_get_xid (window);
        }
        cairo_set_target_drawable (ct, dpy, drawable);
    
        if (GDK_IS_WINDOW (window)) cairo_translate (ct,
-(double)x_off,-(double)y_off);
}

Programs like Oregano[1] fails with this error.

bye

[1] : http://packages.qa.debian.org/o/oregano.html

-- System Information:
Debian Release: 3.1
  APT prefers unstable
  APT policy: (500, 'unstable'), (500, 'testing')
Architecture: i386 (i686)
Shell:  /bin/sh linked to /bin/bash
Kernel: Linux 2.6.7-1-k7
Locale: LANG=es_AR, LC_CTYPE=es_AR (charmap=ISO-8859-1)

Versions of packages libcairo1 depends on:
ii  libc6                    2.3.2.ds1-22    GNU C Library: Shared
libraries an
ii  libfontconfig1           2.3.2-1         generic font configuration
library
ii  libfreetype6             2.1.7-2.4       FreeType 2 font engine,
shared lib
ii  libpixman1               0.1.4-1         Cairo pixel manipulation
library
ii  libpng12-0               1.2.8rel-1      PNG library - runtime
ii  libx11-6                 4.3.0.dfsg.1-13 X Window System protocol
client li
ii  libxrender1              1:0.8.3-1       X Rendering Extension
client libra
ii  xlibs                    4.3.0.dfsg.1-13 X Keyboard Extension (XKB)
configu
ii  zlib1g                   1:1.2.2-4       compression library -
runtime

-- no debconf information




-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to