jiayouxjh / grafx2

Automatically exported from code.google.com/p/grafx2
0 stars 0 forks source link

Image corruption when running a Lua script after loading 24bit image #320

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
"I notice that my remap-scripts (and perhaps others) frequently
fails/corrupts the image on the first run of a new image (loaded as 24bit).
(1359).
And look at the grab, this is what happened when I ran the isometric-script
on the image that you see...like it's operating on an undo-buffer. I did
run my carpet-script a while back.
(when I undo this and run again...it performs normally)"
[Screenshot shows the result of Iso script for a Sierpinski image, though
the background shows a very different image, probably a JPG photograph]

Reported by DawnBringer, using 2.2wip1359

Problem certainly related to issue 310. Maybe a missing call of
End_of_modification() in some case after loading a 24bit image.

Original issue reported on code.google.com by yrizoud on 23 Feb 2010 at 2:20

GoogleCodeExporter commented 9 years ago

Original comment by yrizoud on 23 Feb 2010 at 2:20

GoogleCodeExporter commented 9 years ago
Got it. How to reproduce:

After loading or reloading a 24bit image, if the first action you do is:
- scroll image with RMB
---> You scroll an uninitialized image, apparently (color 0). This is only 
missing
visual feedback: if you swap pages and back, you can see that your action 
worked.

- Contour fill
---> The outline is color 255

- or Run a Lua script that relies on GetBackupPixel,
---> The pixels it reads are from before the load/load. This can be nasty if the
image was different size.

----

Culprit is not a missing End_of_modification() call, but it's due to a 
difference
between normal loading and 24bit loading:
- Normal loading puts each pixel in the layer + depth buffer + visible image. 
So on
end of load, all is up-to-date.
- 24bit loading fills only the layer buffer. Depth buffer and visible image 
still
contain values from previous image.

After loading, End_of_modification() is called before Redraw_layered_image(), 
it is
wrong because End_of_modification() copies old values; Redraw_layered_image() 
then
updates the front image but too late.

Original comment by yrizoud on 24 Feb 2010 at 2:07

GoogleCodeExporter commented 9 years ago
Also happened when loading jpeg from command-line.
Fixed in r1366

Original comment by yrizoud on 24 Feb 2010 at 2:31