On 9/12/13, Jon Nordby <jononor gmail com> wrote:
On 12 September 2013 16:08, Elle Stone <l elle stone gmail com> wrote:
The problem at this point is that the image won't display properly until something like doing a very small levels correction forces a screen redraw. After forcing a screen redraw, the image is displayed without any posterization, but with magenta lines (outlining the tiles?). The screen redraw lasts until the level dialog is closed. I think the problem is that I'm not properly merging and updating "buffer" after the hard-coded transform. The corresponding code from the lcms.c file uses layer buffers, which seems not applicable to a projection: gimp_drawable_merge_shadow (layer_id, TRUE); gimp_drawable_update (layer_id, 0, 0, layer_width, layer_height);I do not know the GimpDisplayShell code well, but try to just read out data from the projection GeglBuffer instead of modifying it.
I created a copy of "buffer" and converted it to the monitor profile, with the same results. I'm pretty sure the problem is what happens to the buffer after it's been used. It doesn't quietly disappear. In a small test image the code that does the transform gets executed 11 times per anything that changes the screen. It takes up "pipes" and a larger image eventually crashes Gimp ("unable to open pipe: Too many open files").
And instead of the the "gegl_buffer_get (buffer, ... "cairo-ARGB32", ... data ...)" that you have marked, do the lcms transform such that the 8bit ready-for-display ends up in the "data" buffer.
That code is the pre-existing code that sends the buffer to cairo, so I haven't tried to modify it. There's probably a way to get "buffer" to be converted from the image color space at 32f to the monitor profile at 8i in one fell swoop - I'm pretty sure lcms can do the conversion in one fell swoop but I don't have the gegl buffers set up correctly. But "gegl_buffer_get (buffer, ... "cairo-ARGB32", ..." does convert "buffer" to 8-bits.
Also, can you please post your changes as a (git formatted) diff? It is much easier to read and apply for another contributor trying to help you out.
I posted the git patch, the two ICC profiles in the hard-coded transform, and a test image to http://ninedegreesbelow.com/temp/convert-buffer-before-cairo.html. I hope I did the git patch correctly! The git patch (but not the profiles or test image) is also attached to this email.
Jon Nordby - www.jonnor.com
Thanks! Jon, for taking an interest in this project. Elle -- http://ninedegreesbelow.com
Attachment:
convert-before-cairo-patch.txt
Description: Text document