[cairo-bugs] [Bug 16216] New: Fill don't work properly

bugzilla-daemon at freedesktop.org bugzilla-daemon at freedesktop.org
Tue Jun 3 00:32:03 PDT 2008


http://bugs.freedesktop.org/show_bug.cgi?id=16216

           Summary: Fill don't work properly
           Product: cairo
           Version: 1.4.14
          Platform: x86 (IA32)
        OS/Version: Linux (All)
            Status: NEW
          Severity: minor
          Priority: medium
         Component: xlib backend
        AssignedTo: cworth at cworth.org
        ReportedBy: marcofal at tiscali.it
         QAContact: cairo-bugs at cairographics.org


Hi,
compile and run the program below. Why the left ellipses aren't properly filled
?
I tested with cairo 1.4.12, 1.4.14 on gentoo and cairo 1.4.2 on redhat 5, same
output.
It is very strange...

marco

/*****************************************************************************/

#include <gtk/gtk.h>
#include <cairo.h>
#include <math.h>

#define RX  50
#define RY  40

static void 
make_ellipse (cairo_t *cr, double cx, double cy, double rx, double ry)
{
  cairo_new_path (cr);
  cairo_save (cr);
  cairo_translate (cr, cx, cy);
  cairo_scale (cr, rx, ry);
  cairo_arc (cr, 0.0, 0.0, 1.0, 0.0, 2.0 * M_PI);
  cairo_restore (cr);
}

static gboolean
expose (GtkWidget *widget, GdkEventExpose *event, gpointer data)
{
  cairo_t *cr;

  cr = gdk_cairo_create (widget->window);

  cairo_rectangle (cr, 0, 0 , event->area.width, event->area.height / 2);
  cairo_set_source_rgb (cr, 0, 0, 0);
  cairo_fill (cr);

  cairo_rectangle (cr, 0, event->area.height / 2 , event->area.width,
event->area.height / 2);
  cairo_set_source_rgb (cr, 1, 1, 1);
  cairo_fill (cr);

  cairo_set_line_width (cr, 4.0);

  make_ellipse (cr, 100, 100, RX, RY);
  cairo_set_source_rgb (cr, 1, 0, 0);
  cairo_fill_preserve (cr);
  cairo_set_source_rgb (cr, 0, 0, 1);
  cairo_stroke (cr);                         

  make_ellipse (cr, 300, 100, RX, RY);
  cairo_set_source_rgb (cr, 1, 0, 0);
  cairo_fill_preserve (cr);
  cairo_set_source_rgb (cr, 1, 1, 0);
  cairo_stroke (cr);                         

  make_ellipse (cr, 100, 300, RX, RY);
  cairo_set_source_rgb (cr, 1, 0, 0);
  cairo_fill_preserve (cr);
  cairo_set_source_rgb (cr, 0, 0, 1);
  cairo_stroke (cr);                         

  make_ellipse (cr, 300, 300, RX, RY);
  cairo_set_source_rgb (cr, 1, 0, 0);
  cairo_fill_preserve (cr);
  cairo_set_source_rgb (cr, 1, 1, 0);
  cairo_stroke (cr);                         

  cairo_destroy (cr);

  return FALSE;
}

int main (int argc, char *argv[])
{
  GtkWidget *widget,*window;

  gtk_init (&argc, &argv);

  window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
  g_signal_connect (G_OBJECT (window), "delete_event",
                    G_CALLBACK (gtk_main_quit), NULL);

  widget = gtk_drawing_area_new();
  gtk_widget_set_size_request (widget, 400, 400);
  g_signal_connect (widget, "expose_event",
                                      G_CALLBACK (expose), NULL);  
  gtk_container_add (GTK_CONTAINER (window), widget);

  gtk_widget_show_all (GTK_WIDGET(window));

  gtk_main ();

  return 0;
}


-- 
Configure bugmail: http://bugs.freedesktop.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.


More information about the cairo-bugs mailing list