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 591911 - diacairo-interactive.c has problems clipping when rendering with alpha
diacairo-interactive.c has problems clipping when rendering with alpha
Status: RESOLVED FIXED
Product: dia
Classification: Other
Component: general
devel
Other Linux
: Normal normal
: 0.98
Assigned To: Dia maintainers
Dia maintainers
Depends on:
Blocks:
 
 
Reported: 2009-08-15 22:14 UTC by Jason Childs
Modified: 2009-12-05 19:07 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
first patch in series cleaning up cairo renderer (6.34 KB, patch)
2009-08-18 15:37 UTC, Jason Childs
none Details | Review
second patch, fixes seg fault and add DIAG_NOTE's for troubleshooting (4.27 KB, patch)
2009-08-18 15:38 UTC, Jason Childs
none Details | Review
last patch, fixes redraw on window restore from minimize (5.04 KB, patch)
2009-08-18 15:39 UTC, Jason Childs
none Details | Review
Correct clipping for cairo-interactive-renderer (1.30 KB, patch)
2009-08-21 13:38 UTC, Hans Breuer
none Details | Review

Description Jason Childs 2009-08-15 22:14:42 UTC
Additions of transparency as added by bug #591525 shows up problems with the interactive renderer for cairo.  There are bits of objects left behind on other objects due to improper clipping of the gdk surface.  The patches to fix this are included in this bug report.
Comment 1 Jason Childs 2009-08-15 22:19:20 UTC
Upgraded gnome bugzilla won't allow me to attach patches.  Updates can be pulled from http://github.com/oblivian/dia commits 52f232b69123388a57b091c7dd56b7ae36f8afb3 and 5617b4fe1b94ffdbb995f837440632edab6fff69
Comment 2 Jason Childs 2009-08-18 15:37:44 UTC
Created attachment 141088 [details] [review]
first patch in series cleaning up cairo renderer
Comment 3 Jason Childs 2009-08-18 15:38:27 UTC
Created attachment 141089 [details] [review]
second patch, fixes seg fault and add DIAG_NOTE's for troubleshooting
Comment 4 Jason Childs 2009-08-18 15:39:01 UTC
Created attachment 141090 [details] [review]
last patch, fixes redraw on window restore from minimize
Comment 5 Hans Breuer 2009-08-21 13:38:06 UTC
Created attachment 141328 [details] [review]
Correct clipping for cairo-interactive-renderer

You patch series seems to unnecessarily introduce another copy of the image data (cairo_image_surface_create), also I don't follow your definition of "cleanup" ;)

But it also did include the critical bits (gdk_cairo_region/cairo_clip), thanks.


BTW: for patches to be easily applied with "git am" it would be nice if you could follow the pattern given in http://mail.gnome.org/archives/dia-list/2009-April/msg00079.html for your commit messages.

BTW2: am I right tha the crash mentioned with the seconf patch was introduced with the first one?
Comment 6 Jason Childs 2009-08-21 14:55:45 UTC
My definition of cleanup is to remove the GDK paint components along with associated #if/#else sections.  Maybe not the right wording...

The point of having the image surface, is I was thinking about separating the grid drawing from the objects so that I could do independent object rotations (another whole set of changes I'm working on) so it kind of was a remnant/side effect of that thought process...

BTW Response: Not a problem, I'll make sure I follow that in the future.
BTW2 Response: Yep, I submitted the first patch and then found the crash.  I could have just resubmitted a whole new patch, but I didn't think about it when generating and submitting the second patch.  In the future, I'll just submit a replacement patch.
Comment 7 Hans Breuer 2009-08-21 16:47:05 UTC
It is not the wording which did hold me from commiting the patches, it was the unnecessary copy during rendering, the removal of the comments without explaination and the impression I got from reading the series, that the third patch changes a lot of what the first patch introduced.

Playing a bit more with parts I noticed, that the combination of fill_pixel_rect() with cairo and actually using a background color with transparency produces the effect shown in bug #402113. Filling must be solid to avoid it. 
The method fill_pixel_rect() is used to 'clear' the background to a defined state, reminds me on GIMP where the backround layer must not have alpha as well.
Comment 8 Jason Childs 2009-08-21 20:03:00 UTC
Would it make sense to do what I suggested? Allow for independent grid/page rendering. That way clearing and page rendering is not dependant on object rendering.
Comment 9 Hans Breuer 2009-08-21 21:51:10 UTC
Apparently I still dont understand what you suggested. Even now clearing and page rendering is not dependentant on object rendering. If at all, it is the other way around;) If you look at ddisplay_render_pixmap() you'll see the whole sequence of drawing.
The implementation split between pixel rendering (gdk usage in the interactive cairo renderer) and object rendering is indeed arbitrary. The pixel and clip functions just happened to be in pixel coordinates rather than in object coordinates. And it was easier to keep it this way instead of trying one-pixel lines with cairo.
But from what I understand from your approach you should see the same artifacts as described in bug #402113.
Comment 10 Jason Childs 2009-08-22 12:42:47 UTC
A quick "fix" is to draw a &color_white fill_pixel_rect before the background and grid.  What I am suggesting is that we could draw a page (e.g. 8x11 with gray borders) or normal like visio and that would be a separate function like drawing the grid.  That function would have the effect of always clearing the screen before the background color is applied.  I looked at the code and realized it is the other way around from what I thought it was :)
Comment 11 Hans Breuer 2009-08-22 13:11:26 UTC
Your "fix" sounds like a workaround for something which IMO should not be broken in the first place. Neither the current alpha patch nor some object rotation support should require to do the extra drawing pass. 
Let me try to rephrase my comment: please tell me what you want to achieve from the user point of view rather than how ;)
Comment 12 Jason Childs 2009-08-22 13:25:38 UTC
From the users point of view, they should have a blank canvas to draw on.  If they want to apply a transparent color all over the canvas with or without alpha that is the background color.  The canvas should be able to take different shapes (like a piece of paper the size of the current page setting, or the current unending style).
Comment 13 Hans Breuer 2009-08-22 15:10:00 UTC
Now I see. But this would be a completely unrelated feature deserving a bug report on it's own. So for the moment my patch should be enough to resolve this report.
Comment 14 Hans Breuer 2009-12-05 19:07:43 UTC
My patch from above got commited to master some weeks ago, see:
http://git.gnome.org/cgit/dia/commit/?id=cf021c3b0c722210f2096ac14433192959ff2aa7