GNOME Bugzilla – Bug 604508
gimp-layer-new-from-visible should work from updated projection
Last modified: 2015-12-21 09:42:43 UTC
Created attachment 149674 [details] Patch that attempts to rectify the problem The "Layer New From Visible" menu command and the 'gimp-layer-new-from-visible' PDB function can result in a layer which represents an incompletely rendered projection. This makes using the menu command problematic (as a user may not notice changes were not incorporated in the new layer); and makes the PDB function extremely unreliable (a script or plug-in shouldn't need to depend upon the speed of the system or a lack of complexity in the image). The problem can be demonstrated with an image which demands significant processing to render. For example, start with a 2000x1000 photo and duplicate the layer. Add a layermask to the duplicate and change the layermode to Hue. Duplicate that layer and change the layermode of the duplicate to Grain Merge. Now bucket fill the background layer and *quickly* perform a "Layer New From Visible" (a keyboard shortcut assignment is recommended). The resulting layer will likely represent the projection only partially rendered. The problem with the PDB function can be demonstrated with a similar setup and executing the following commands in the Script-fu console: (gimp-edit-fill bg-layer 1) (gimp-displays-flush) (gimp-image-add-layer image (car (gimp-layer-new-from-visible image image "Proj")) 0) Additional Notes: This bug is quite similar in nature to Bug #332933, which was resolved in GIMP 2.4 Though I have very little confidence in it being a proper solution, I was able to make things function by adding a call to 'gimp_projection_flush_now' to the 'layer_new_from_visible_invoker' function found in app/pdb/layer-cmds.c
The proper call is gimp_pickable_flush(), and it needs to be added in two places, will fix right away.
Fixed in both branches: commit 86f299bacd80cceb91023a124cd78c255853443f Author: Michael Natterer <mitch@gimp.org> Date: Mon Dec 14 14:19:10 2009 +0100 Bug 604508 - gimp-layer-new-from-visible should work from updated projection Call gimp_pickable_flush(projection) before creating a new layer from it. (cherry picked and modified from commit 335597ce7d92c22e9ecb90c21176b6b43dae5459) app/actions/layers-commands.c | 3 +++ app/pdb/layer-cmds.c | 3 +++ tools/pdbgen/pdb/layer.pdb | 3 +++ 3 files changed, 9 insertions(+), 0 deletions(-)