GNOME Bugzilla – Bug 332933
gimp-edit-copy-visible should work from updated projection
Last modified: 2008-01-15 13:05:45 UTC
The plug-in "gimp-edit-copy-visible" should assure that the projection is not "dirty" (i.e., perform a "gimp-displays-flush") before the copy is performed. Currently, layers can have their visibility attribute cleared and yet "gimp-edit-copy-visible" might still include their contents. Other information: At a minimum, the PDB documentation should probably suggest performing a "gimp-displays-flush" before calling "gimp-edit-copy-visible". On a side note, "gimp-edit-copy-visible" does not seem to put itself into the UNDO history (although I haven't yet researched this in depth). My apologies if I am out of line on this, my first use of Bugzilla.
Created attachment 60367 [details] SIOD file to demo visibility behavior Script is for demonstration purposes only and is simplified to work on an image with two layers. It is not intended to be a useful plug-in.
Created attachment 60368 [details] XCF image file with two layers (8.7 kilobytes) Image is 320x240 with a Background layer and a Text layer. It is intended to be used with the "test-visibility.scm" plug-in to demonstrate that the function "gimp-edit-copy-visible" assumes that the projection has been updated.
This should be fixed in the core. All places that read from the projection must make sure it is up-to-date before doing so. I'm about to fix this.
Oh, and copy visible is not in the undo history because it doesn't change the image.
Fixed in HEAD. I'm not sure what to do with 2.2, this patch is IMHO too much of a change for stable. Opinions? 2006-03-02 Michael Natterer <mitch@gimp.org> * app/core/gimppickable.[ch]: added new methods ::get_bytes() and ::flush() * app/core/gimpchannel.c * app/core/gimpdrawable.c * app/core/gimpimagemap.c * app/core/gimpprojection.c: implement ::get_bytes() * app/core/gimpprojection.c: implement ::flush() (immediately process both the idle renderer's queue and the unflushed update areas, to make sure that any reading from the projection will re-construct it). * app/core/gimp-edit.c * app/core/gimpchannel.c * app/core/gimpimage-contiguous-region.c * app/core/gimpimage-crop.c * app/core/gimppalette-import.c * app/paint/gimpclone.c * app/tools/gimpbycolorselecttool.c * app/tools/gimpiscissorstool.c * tools/pdbgen/pdb/image.pdb: use the pickable interface more consistently when reading from any drawable or the projection, and call gimp_pickable_flush() before doing so. Fixes bug #332933. * app/core/gimpimage-pick-color.c: added comment why the we don't call gimp_pickable_flush() here. * app/pdb/image_cmds.c * libgimp/gimpimage_pdb.c: regenerated.
The only reason this situation was grievous to me was that it only occurred in the script itself; i.e., when I replicated the steps using the menus and even when I typed in the commands from the Script-fu console individually, things worked as expected (perhaps the console performs a display flush after each readline?). For my situation, the work-around of manually calling displays-flush before copy-visible would seem satisfactory.
It should be possibly to find a simpler fix that we can apply in the 2.2 branch.
I did that fix already. Will commit today.
Fixed in the 2-2 branch: 2006-03-08 Michael Natterer <mitch@gimp.org> * app/core/gimp-edit.c * app/core/gimpchannel.c * app/core/gimpimage-contiguous-region.c * app/core/gimpimage-crop.c * app/core/gimppalette-import.c * app/tools/gimpbycolorselecttool.c * app/tools/gimpiscissorstool.c * tools/pdbgen/pdb/image.pdb: flush the projection before reading from it. Fixes bug #332933. * app/pdb/image_cmds.c: regenerated.