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 304798 - Painting brush outline is slow
Painting brush outline is slow
Status: RESOLVED FIXED
Product: GIMP
Classification: Other
Component: User Interface
2.4.x
Other All
: Normal minor
: 2.8
Assigned To: GIMP Bugs
GIMP Bugs
: 592016 631766 (view as bug list)
Depends on:
Blocks: 141797
 
 
Reported: 2005-05-19 20:15 UTC by Rene Jensen
Modified: 2012-05-07 04:39 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
patch that adds a call to boundary_simplify() (1.37 KB, patch)
2008-01-16 20:07 UTC, Sven Neumann
rejected Details | Review

Description Rene Jensen 2005-05-19 20:15:10 UTC
A brush with a complicated outline (for instance a 300x300 brush made from
acrylic paint strokes) seems to be slow to move about on the screen. The problem
is solved by unmarking the checkbox 'Show brush outline' in Preferences / Image
Windows /  under 'Mouse Cursors'.

If the brush has a simple outline then the problem doesn't seem to occur even
though is is big.



Other information:
I use:

o) Ubuntu Hoary (debian based)
o) Nvidia MX440 graphics card
o) Xorg, native drivers, not Nvidia's own proprietory drivers (e.g. there is no
OpenGL available)
Comment 1 weskaggs 2005-05-20 15:12:33 UTC
GIMP does not make use of OpenGL or any other fancy graphics-card functionality;
it is a pure 2D application.  Basically you are just asking GIMP to work really
really hard, and it can't keep up -- there's probably no simple change that will
help much.  (If you would like to build a profiling-enabled version of GIMP and
do some detailed testing, though, feel free.)  So this is really not a bug, just
a limitation, and I am going to resolve it as NOTABUG.

You didn't mention the speed of your processor, by the way -- this is probably
the single most important factor.

Also, as a rule, you should try to upgrade to the latest stable version before
reporting a bug.  In this case it almost certainly won't make a difference, but
it is still a good rule.
Comment 2 Sven Neumann 2005-05-20 22:22:28 UTC
I had explicitely asked the bug reporter to open this report. Closing it without
a good reason is not very nice. Reopening so that we remember to profile this
part. I am confident that the GIMP code involved here can be optimized.
Comment 3 Sven Neumann 2005-05-20 23:12:54 UTC
This might be the same problem that is causing bug #149616. The same code is
being used here, to find the boundary and to draw it.
Comment 4 Sven Neumann 2005-07-05 17:09:29 UTC
This change might have had a noticable impact on this problem:

2005-06-26  Tor Lillqvist  <tml@novell.com>

        * app/tools/gimppainttool.c (gimp_paint_tool_draw): Store the
        GimpBrushCore::brush_bound_segs as sorted (the result of
        sort_boundary), as the only place where it is used
        (gimp_draw_tool_draw_boundary()) would sort it each time it is
        called anyway.

        * app/tools/gimpdrawtool.c (gimp_draw_tool_draw_boundary):
        Correspondingly we now don't have to sort the boundary here.
Comment 5 Michael Schumacher 2006-02-23 21:11:05 UTC
What do we do about this now? Has anything changed, can we close this bug?
Comment 6 André Klapper 2006-08-28 20:12:47 UTC
*poke*
Comment 7 weskaggs 2006-10-02 01:06:42 UTC
resolving as INCOMPLETE due to lack of response to NEEDINFO from the bug reporter for well over a year.
Comment 8 Rene Jensen 2008-01-16 09:18:21 UTC
.. Failed to respond to life in general in that time period..

Yesterday an empty mail ticked into my box about this bug, so I'd just as well start on this again:

Example of brush with an outline that is updated slowly (could not figure out how to attach it):
http://vaults.atomicmonstergirls.net/public/cornucopia/program-gimp/brushes/Pastel-010.gih

Systems: PC + Windows, Ubuntu, Archlinux, Debian (all I've tried)
CPU: AMD XP 2500. Intel Centrino 1700mhz.
Graphics: nvidia 6600gt, 6200go
Gimp: 2.2, 2.4 (my ArchLinux currently has 2.4.3)

Try the brush, you'll know what I mean.
I haven't looked in the code, but I will assume you do not render an outline edge-list more than once.. Hopefully you simply have a pixel buffer with the rendered brush outline that you mask onto the existing graphics buffer on every mouse event? It cannot possibly be as slow as observed.

Kind regards - Rene Jensen

P.S. If I just disable outline rendering in the preferences, I do not really have a problem. In fact, I think it is hard to see what is going on during a paint operation with a visible outline anyway.
Comment 9 Sven Neumann 2008-01-16 19:21:07 UTC
Your assumption is wrong. Since the rendering of the brush outline needs to be done using XOR, it is left to  GDK to do that. Your brush has a very complex outline, so this can become rather slow. What should be done is to simplify the outline.
Comment 10 Sven Neumann 2008-01-16 20:07:46 UTC
Created attachment 103021 [details] [review]
patch that adds a call to boundary_simplify()

This patch introduces a call to boundary_simplify(). But it turns out that this function doesn't work good enough.
Comment 11 Sven Neumann 2008-01-22 20:08:13 UTC
I've committed this to both branches:

2008-01-22  Sven Neumann  <sven@gimp.org>

	* app/paint/gimpbrushcore.c (gimp_brush_core_create_bound_segs):
	dilate the brush mask in order to obtain a simpler boundary.
	Addresses bug #304798.

Let's keep this open until we get some feedback.
Comment 12 Sven Neumann 2008-01-22 20:21:29 UTC
2008-01-22  Sven Neumann  <sven@gimp.org>

        * app/paint/gimpbrushcore.c (gimp_brush_core_create_bound_segs):
        smooth the mask instead of dilating.
Comment 13 Kurt Pruenner 2008-02-03 13:33:43 UTC
Could it be that the above change horked the outline of (at least) the 1x1 pixel brush in 2.4.4 on Windows?

If you use the 1x1 brush (or a custom brush made with the brush editor with a radius of even 0.2) you'll get a 3x3 square outline instead of the 1x1 square it previously was (and, really, ought to be) - that makes using the pencil tool to edit single pixels at 800% zoom rather tedious.

Maybe it should only smooth the brush if it is bigger than a certain size (8x8? 16x16?), as I wouldn't think this does improve performance much for such small brushes...
Comment 14 Sven Neumann 2008-02-04 07:26:42 UTC
Yes, this change could probably need some further fine-tuning...
Comment 15 Sven Neumann 2008-02-04 09:41:17 UTC
This change improves the hack, but it still has issues:

2008-02-04  Sven Neumann  <sven@gimp.org>

        * app/paint/gimpbrushcore.c (gimp_brush_core_create_bound_segs):
        only smooth the inner area of the mask so that we don't enlarge
        the boundary for hard brushes (bug #304798).
Comment 16 Sven Neumann 2008-02-04 15:39:48 UTC
I found that it makes most sense to only apply the workaround for large brushes:

2008-02-04  Sven Neumann  <sven@gimp.org>

	Merged from trunk:

	* app/paint/gimpbrushcore.c (gimp_brush_core_create_bound_segs):
	changed workaround to look at the brush size instead (bug #514309).
Comment 17 D 2009-05-30 11:26:42 UTC
This still occurs in Windows Gimp 2.6.5
pentium d 2.8GHz only by disabling brush outline does the behavior disappear, but you do not know what your brush looks like as you work nor do you know where the boundaries are. 
Comment 18 david gowers 2009-05-30 12:57:39 UTC
Perhaps we can do as mypaint (http://mypaint.intilinux.com) does, just only for complex brushes (based on the number of vertices in the outline)... just show a circle of approximately the right size (with a marker in the center, perhaps like an asterisk shape, to show that this is an approximation.)
\|/
-+-
/|\

when a stroke is actually ongoing (and only show the detailed outline when the user is simply moving about without drawing)
IMO an detailed stroke outline isn't very usable during drawing a stroke anyway, and my personal experience is that this part of the slowdown is the worst in terms of usability -- Moving about too slowly is annoying, but stroking too slowly has far more potential to damage workflow.
Comment 19 Michael Schumacher 2009-08-17 08:17:50 UTC
*** Bug 592016 has been marked as a duplicate of this bug. ***
Comment 20 Sven Neumann 2010-09-26 21:48:29 UTC
Someone should check if this is still a problem in the master branch where we don't use XOR drawing any longer.
Comment 21 Rene Jensen 2011-01-28 14:15:24 UTC
I'm sorry, but I simply can't get GIMP to paint an outline with the version in git. I assume it is still only a matter of checking "Show brush outline" in Preferences->Image Windows->Mouse Pointers.

I made a 'git clone' of babl, gegl, gimp today (2010-jan-28 - pardon me, but I don't know git well enough to get the revision number out of it) on a clean Ubuntu 10.04 (on a virtual machine).

Painted with the paint brush and air brush. None of them rendered an outline of neither my own brushes nor any other, large nor small.
Comment 22 Michael Natterer 2011-03-18 10:52:47 UTC
*** Bug 631766 has been marked as a duplicate of this bug. ***
Comment 23 Michael Natterer 2011-03-18 10:54:33 UTC
It's in fact even worse with cairo, so I'm hijacking this bug to track
the "new" slowness. Setting milestone to 2.8 because we really should
do something about it.
Comment 24 Alexia Death 2011-07-15 16:03:26 UTC
Cairo painting got considerable performance boost little while ago and now performs better than XOR drawing ever did. There are ways to improve it further, but it is no longer blocking 2.8 release.
Comment 25 languitar 2012-05-05 22:23:36 UTC
I just got the update to 2.8 in  archlinux and still using brushes when the outline is enabled feels horribly slow and jerky. Are there any known issues left?