GNOME Bugzilla – Bug 642728
Use cairo to draw Gfig
Last modified: 2012-02-16 21:05:24 UTC
"Function `gdk_gc_new' implicitly converted to pointer" causes build failure on x64 processors. Tried to build GIMP with dpkg, and the build failed to package, but only on x64 processors. dpkg gives this error message: Function `gdk_gc_new' implicitly converted to pointer at gfig-dialog.c:2177 Function `gdk_gc_new' implicitly converted to pointer at imap_grid.c:362 Function `gdk_gc_new' implicitly converted to pointer at imap_main.c:233 Our automated build log filter detected the problem(s) above that will likely cause your package to segfault on architectures where the size of a pointer is greater than the size of an integer, such as ia64 and amd64. This is often due to a missing function prototype definition. Since use of implicitly converted pointers is always fatal to the application on ia64, they are errors. Please correct them for your next upload. It occurs every time I try to compile it on a x64. And I have been receiving this for at least the last 2 weeks, from the current Git repo. Last time the code was pulled was 2/18/2011
This is the build-log. http://launchpadlibrarian.net/64693135/buildlog_ubuntu-maverick-amd64.gimp_2.7.3-2011021801~mm_FAILEDTOBUILD.txt.gz
might be related to #641787
These plugins need to be undeprecated, which will happen for 2.8.
imagemap (imap) is ported to cairo, so only gfig needs the undeprecation.
I think Sven started to port gfig. So if he doesn't have the time to finish it, we should get our hands on his WIP.
Has anyone contacted Sven directly about this yet?
I was misinformed, there is no patch, so we need to start from scratch.
Why do we need to port this to cairo at all? We're going to abandon it in GIMP 3.0 anyway
Not unless we have vector layers until then.
Shouldn't we retarget it from 2.8 to at least 2.10?
Created attachment 207689 [details] [review] Proposed patch I never used gfig before, so probably I did not exercised every use case, but what I tested seems to work. Please review and test, be sure to have a brush and a gradient active before invoking the plug-in. And to operate on a grayscale image you need the patch attached to the next comment.
Created attachment 207690 [details] [review] Two small bugs discovered while testing the previous patch
Created attachment 207691 [details] [review] fix grid and combo boxes Your patch looks good to me, and it even seems to work :). I had a half-started attempt which had two things better, the rectangular grid is drawn on whole pixels, and the combo boxes have the correct values when you open the dialogs (though this is unrelated to cairo porting.. :). I've attached these two changes here. You can either roll them into your patch or I can commit it later. A minor thing is that usually we draw cairo stuff with a 3-width black line and then a 1-width white line, while your patch uses a 1-width purple line. I don't think anyone will care though. :)
Created attachment 207692 [details] [review] fix grid and all three combo boxes (attached wrong version of patch before)
I do care :) No way will we have purple lines :P Thanks for the great patch tho, can you add a simple stroke function that does the drawing and use the default style Mikel desctibed?
This is the function i used in my patch: void draw_item (cairo_t *cr, gboolean fill) { cairo_save (cr); cairo_set_source_rgba (cr, 0.0, 0.0, 0.0, 1.0); if (fill) cairo_fill (cr); else { cairo_set_line_width (cr, 3.0); cairo_stroke_preserve (cr); cairo_set_source_rgba (cr, 1.0, 1.0, 1.0, 1.0); cairo_set_line_width (cr, 1.0); cairo_stroke (cr); } cairo_restore (cr); }
Created attachment 207754 [details] [review] New patch Dropped purple and magenta colors, made use of the draw_item function above changed to outline a filled shape with a 1 pixel wide white line (to avoid that a black square/circle drawn over a black background disappears). Changed poly and spiral to draw the currently moved control point as a filled circle, as it is for all other shapes and as it was without cairo. To avoid conflicts Mikael's patch must be applied last.
Review of attachment 207754 [details] [review]: looks good to me.
Please go ahead guys, push the patches and kill the bug.
fixed in git: commit f68acc3946dd941fb7c03c4b5d5bc9f62d816500 Author: Mikael Magnusson <mikachu@src.gnome.org> Date: Wed Feb 15 20:23:35 2012 +0100 gfig: draw rectangular grid on whole pixels, set correct defaults in combo boxes. commit 8b995fc76dd44d1b64e66bdb4c6f666219a2b7ac Author: Massimo Valentini <mvalentini@src.gnome.org> Date: Thu Feb 16 17:57:05 2012 +0100 gfig: mute compiler warnings commit 261da8a4ab5f2db6256def0c96ee47426a383051 Author: Massimo Valentini <mvalentini@src.gnome.org> Date: Thu Feb 16 17:56:52 2012 +0100 Bug 642728: Use cairo to draw Gfig commit a1d7a4dba4bc6ba44f0f07416e3a8236bbd96620 Author: Massimo Valentini <mvalentini@src.gnome.org> Date: Thu Feb 16 17:56:40 2012 +0100 gfig: select the correct layer GimpImageType and avoid a warning in a useless (but not unreachable) code path and do not dereference a NULL pointer when a style name includes a white space (ex. "default style")