Follow-up Comment #5, patch #2715 (project freeciv): Found out interesting facts about GtkPixcomm implementation. Actual drawing when widget is exposed uses those data pointers that have been earlier passed to gtk_pixcomm_fill() and gtk_pixcomm_copyto(). This means that GtkPixcomm users must ensure that color structures or sprites are not freed as long as GtkPixcomm is in use. This explains at least one bug in my earlier cairo patches where local GdkColor structure was passed to gtk_pixcomm_fill() but GtkPixcomm was drawn only after exiting that function.
Corrupted backgrounds in sprites (including animated cursors) seem to be problem in drawing to gtk widgets. Everything in handling sprites and canvases seem to work. Only when final draw from some partly transparent cairo surface to gtk widget surface is made, extra stuff is left to those transparent places. It looks like widget surfaces had some stuff on them initially and that's visible in places we don't overdraw. I actually did test version that had extra level of drawing. Our partly transparent canvases were drawn on top of another filled canvas so that the result had no transparent parts at all. That canvas is then drawn to gtk widget. No corruption was visible with that version, and for a while I actually considered using it as fallback solution for first canvas using commit - but then I noticed that even cursors would need that and those really need transparency. Improvements in attached version since previous: - Helpdialog always keeps color-structure for unit GtkPixcomm - Moved surface initialization outside of the operations iteration when GtkPixcomm exposed - Common parts of sprite_get_pixbuf() and canvas_put_pixbuf() moved to separate function surface_get_pixbuf() - Completely removed some code that was already commented out in earlier versions Buglist: - Unit sprites not shown at help dialog - Wrong terrain pieces drawn to main map (mask handling problem?) - gtk widgets and cursors displays mess where we don't overdraw with solid color (file #13849) _______________________________________________________ Additional Item Attachment: File name: CairoTmp5.diff.bz2 Size:13 KB _______________________________________________________ Reply to this item at: <http://gna.org/patch/?2715> _______________________________________________ Message sent via/by Gna! http://gna.org/ _______________________________________________ Freeciv-dev mailing list Freecivfirstname.lastname@example.org https://mail.gna.org/listinfo/freeciv-dev