Summary: | AWTTextureIO does not properly interpret a BufferedImage created with BufferedImage.getSubImage() | ||
---|---|---|---|
Product: | [JogAmp] Jogl | Reporter: | Bill Kuker <bkuker> |
Component: | awt | Assignee: | Sven Gothel <sgothel> |
Status: | UNCONFIRMED --- | ||
Severity: | normal | ||
Priority: | --- | ||
Version: | 2 | ||
Hardware: | All | ||
OS: | all | ||
Type: | --- | SCM Refs: | |
Workaround: | --- | ||
Attachments: | Test Program for bug |
Description
Bill Kuker
2013-09-02 03:56:58 CEST
Created attachment 501 [details]
Test Program for bug
This is a simple test program that should reproduce the problem.
A 256x256 texture is loaded, a 128x128 subimage is extracted at offset 128, 128 and used as a texture, once directly and once using the workaround in the ticket.
You should see TWO green squares, but see one red and one green, the green being a product of the workaround, the red being the texture in error.
Just as a note, I was going crazy trying to reproduce this and discovered that the problem occurs when the image is a JPEG, but not when it is a PNG. In AWTTextureIO there is a function, createFromCustom(...), which re-writes the image to a new BufferedImage exactly as the workaround above does. I think that it hits this code for PNG with alpha, but perhaps not for JPEG, explaining the difference between the two image types. (In reply to comment #2) > Just as a note, I was going crazy trying to reproduce this and discovered > that the problem occurs when the image is a JPEG, but not when it is a PNG. (In reply to comment #3) > In AWTTextureIO there is a function, createFromCustom(...), which re-writes > the image to a new BufferedImage exactly as the workaround above does. I > think that it hits this code for PNG with alpha, but perhaps not for JPEG, > explaining the difference between the two image types. > > (In reply to comment #2) > > Just as a note, I was going crazy trying to reproduce this and discovered > > that the problem occurs when the image is a JPEG, but not when it is a PNG. Bill, can you provide a patch ? Please also note, we consider using our own PNG and JPEG decoder code as the default - hence it is used by our TextureIO class. Both are more efficient and expose better performance. The JPEG decoder is even more compliant. |