N
Nelson Ashton
I've got incomplete information about this, but it seems to be a color
conversion problem.
Symptom: program displays several images, in response to various
inputs. One input, triggering a particular image, results in a lengthy
hang. After a full minute the UI is responsive again, but if the
JLabel displaying the image gets covered and then uncovered again
there's another hang.
Image is a jpeg. So are the ones without troublesome behavior. Some of
those others are larger.
Image is loaded via ImageIO into a BufferedImage. The image data
should therefore stay in RAM and it shouldn't be making a trip to the
disk to read the file every time it needs to repaint the label.
Changing "image" to "image.getScaledInstance(image.getWidth(null),
image.getHeight(null), Image.SCALE_SMOOTH)" gets rid of the hangs on
repaint, but not the initial hang.
CPU profiling during the hang shows a color conversion routine in
sun.* eating up CPU.
Suspicion: The jpeg has an unusual internal color model, and AWT is
stupidly converting it over and over again and not just the once,
except that getScaledInstance results in a lasting conversion.
Bug?
Workaround: use getScaledInstance, and at least it only hangs the once.
conversion problem.
Symptom: program displays several images, in response to various
inputs. One input, triggering a particular image, results in a lengthy
hang. After a full minute the UI is responsive again, but if the
JLabel displaying the image gets covered and then uncovered again
there's another hang.
Image is a jpeg. So are the ones without troublesome behavior. Some of
those others are larger.
Image is loaded via ImageIO into a BufferedImage. The image data
should therefore stay in RAM and it shouldn't be making a trip to the
disk to read the file every time it needs to repaint the label.
Changing "image" to "image.getScaledInstance(image.getWidth(null),
image.getHeight(null), Image.SCALE_SMOOTH)" gets rid of the hangs on
repaint, but not the initial hang.
CPU profiling during the hang shows a color conversion routine in
sun.* eating up CPU.
Suspicion: The jpeg has an unusual internal color model, and AWT is
stupidly converting it over and over again and not just the once,
except that getScaledInstance results in a lasting conversion.
Bug?
Workaround: use getScaledInstance, and at least it only hangs the once.