Paint from a surface to other doesn't work?

Carlos López González <[email protected]>
Newsgroups gmane.comp.lib.cairo
Message-ID <CAF52pzKVED=H6O0p6r35gvTJhkMXHhLcmhV6LWmZdwYVAouMvA@mail.gmail.com>
Hi!
I'm absolutely getting crazy and I need someone that give me a clue on this:

In this section of code:

void studio::Widget_NavView::on_finish_render()

{

if(studio::App::navigator_uses_cairo)

{

if(!cairo_surface)

{

synfig::warning("dock_navigator: Bad cairo surface");

return;

}

 if(cairo_surface_status(cairo_surface))

return;

 Target_Cairo::gamma_filter(cairo_surface);


 int w = 0, h = 0;

int dw = cairo_image_surface_get_width(cairo_surface);

int dh = cairo_image_surface_get_height(cairo_surface);


 if(cairo_prev)

{

w = cairo_image_surface_get_width(cairo_prev);

h = cairo_image_surface_get_height(cairo_prev);

}


 if( w!=dw || h!=dh || !cairo_prev)

{

cairo_prev=cairo_image_surface_create(CAIRO_FORMAT_ARGB32, dw, dh);

}

synfig::info("cairo_surface is mapped %d",
cairo_surface_is_mapped(cairo_surface)); // is not mapped

static int pass2=0;

// Image written to file is correct

cairo_surface_write_to_png(cairo_surface, strprintf(
"dock_navigator_on_finish_render_cairo_surface-pass%d.png", pass2).c_str());


 cairo_t* cr=cairo_create(cairo_prev);

cairo_save(cr);

cairo_set_source_surface(cr, cairo_surface, 0, 0);

cairo_set_operator(cr, CAIRO_OPERATOR_SOURCE);

cairo_paint(cr);

cairo_restore(cr);

cairo_destroy(cr);


 cairo_surface_write_to_png(cairo_prev, strprintf(
"dock_navigator_on_finish_render_cairo_prev-pass%d.png", pass2).c_str());

pass2++;

}

}



the written to file images cairo_prev and cairo_surface doesn't coincide,
how's that possible???
In particular cairo_surface is correct (what I expect to be) and cairo_prev
is simply transparent.
If I can write a surface to png correctly, why I can't paint it to other
surface??
Thanks in advance!

-- 
Carlos
http://synfig.org

-- 
cairo mailing list
[email protected]
http://lists.cairographics.org/mailman/listinfo/cairo
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.