[cairo] Flickering on some scaling-values

Andreas Wittmann andreas.wittmann at wittnet.org
Thu Aug 21 02:44:11 PDT 2014


Hi Mailinglist!

I'm new to cairo so this is maybe a simple question but i haven't found 
any answers using the internet. I'm using Linux/Debian and the newest 
cairo-release 1.12.16 (But my/this problem will also occur on previous 
releases!)

wxWidgets is also used, i'm using a simple render-function which looks 
like this and which is called from the wxWidgets-framework:

void BasicDrawPane::render(wxDC&  dc2)
{
     cairo_t* cairo_image = gdk_cairo_create((GdkWindow*)dc.GetHandle());
     cairo_t *cr = cairo_image;

     cairo_scale(cr, global_scale_x, global_scale_y);
     cairo_translate(cr, 0.5, 0.5);

     cairo_rectangle(cr, 0.0, 0.0, rect.width / global_scale_x, 
rect.height / global_scale_y);
     cairo_set_source_rgb(cr, 255, 255, 255);
     cairo_fill(cr);

      // drawing some shapes ...

     cairo_destroy(cairo_image);
}

The shapes will be drawn (eg. from a mouse-event) without any flickering 
if the global-scales (global_scale_x, global_scale_y) are NOT 2.0, 4.0, 
6.0, 8.0, 10.0, ... and so on. A value of eg. 2.1 would work without any 
flickering.

Could anybody please give me some direction on how to solve this problem 
or why it happens?

The translation is used for drawing thin lines.

Thanks!
regards
Andreas


More information about the cairo mailing list