After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 642728 - Use cairo to draw Gfig
Use cairo to draw Gfig
Status: RESOLVED FIXED
Product: GIMP
Classification: Other
Component: Plugins
git master
Other All
: Normal normal
: 2.8
Assigned To: GIMP Bugs
GIMP Bugs
Depends on:
Blocks:
 
 
Reported: 2011-02-19 04:43 UTC by matthaeus123
Modified: 2012-02-16 21:05 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Proposed patch (71.39 KB, patch)
2012-02-15 18:40 UTC, Massimo
none Details | Review
Two small bugs discovered while testing the previous patch (1.87 KB, patch)
2012-02-15 18:42 UTC, Massimo
none Details | Review
fix grid and combo boxes (2.76 KB, patch)
2012-02-15 19:29 UTC, Mikael Magnusson
none Details | Review
fix grid and all three combo boxes (3.31 KB, patch)
2012-02-15 19:32 UTC, Mikael Magnusson
none Details | Review
New patch (70.99 KB, patch)
2012-02-16 11:35 UTC, Massimo
reviewed Details | Review

Description matthaeus123 2011-02-19 04:43:45 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
Comment 2 matthaeus123 2011-02-19 04:47:43 UTC
might be related to #641787
Comment 3 Michael Natterer 2011-02-28 23:05:07 UTC
These plugins need to be undeprecated, which will happen for 2.8.
Comment 4 Mikael Magnusson 2011-03-14 08:48:01 UTC
imagemap (imap) is ported to cairo, so only gfig needs the undeprecation.
Comment 5 Michael Natterer 2011-03-14 10:33:35 UTC
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.
Comment 6 Omari Stephens 2011-03-15 17:53:42 UTC
Has anyone contacted Sven directly about this yet?
Comment 7 Michael Natterer 2011-03-18 11:08:19 UTC
I was misinformed, there is no patch, so we need to start from scratch.
Comment 8 Martin Nordholts 2011-04-10 15:31:26 UTC
Why do we need to port this to cairo at all? We're going to abandon it in GIMP 3.0 anyway
Comment 9 Michael Natterer 2011-04-10 16:33:00 UTC
Not unless we have vector layers until then.
Comment 10 Alexandre Prokoudine 2012-01-19 23:58:40 UTC
Shouldn't we retarget it from 2.8 to at least 2.10?
Comment 11 Massimo 2012-02-15 18:40:22 UTC
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.
Comment 12 Massimo 2012-02-15 18:42:01 UTC
Created attachment 207690 [details] [review]
Two small bugs discovered while testing the previous patch
Comment 13 Mikael Magnusson 2012-02-15 19:29:44 UTC
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. :)
Comment 14 Mikael Magnusson 2012-02-15 19:32:52 UTC
Created attachment 207692 [details] [review]
fix grid and all three combo boxes

(attached wrong version of patch before)
Comment 15 Michael Natterer 2012-02-15 19:39:30 UTC
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?
Comment 16 Mikael Magnusson 2012-02-15 19:41:09 UTC
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);
}
Comment 17 Massimo 2012-02-16 11:35:10 UTC
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.
Comment 18 Mikael Magnusson 2012-02-16 11:59:50 UTC
Review of attachment 207754 [details] [review]:

looks good to me.
Comment 19 Michael Natterer 2012-02-16 14:03:05 UTC
Please go ahead guys, push the patches and kill the bug.
Comment 20 Mikael Magnusson 2012-02-16 21:05:24 UTC
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")