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 604508 - gimp-layer-new-from-visible should work from updated projection
gimp-layer-new-from-visible should work from updated projection
Status: RESOLVED FIXED
Product: GIMP
Classification: Other
Component: General
2.6.7
Other All
: Normal normal
: 2.6
Assigned To: GIMP Bugs
GIMP Bugs
Depends on:
Blocks:
 
 
Reported: 2009-12-14 06:14 UTC by saulgoode
Modified: 2015-12-21 09:42 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Patch that attempts to rectify the problem (575 bytes, application/octet-stream)
2009-12-14 06:14 UTC, saulgoode
Details

Description saulgoode 2009-12-14 06:14:20 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
Comment 1 Michael Natterer 2009-12-14 12:59:42 UTC
The proper call is gimp_pickable_flush(), and it needs to be added
in two places, will fix right away.
Comment 2 Michael Natterer 2009-12-14 13:21:14 UTC
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(-)