apple.awt.OSXImage in jdk6 and the image drawing pipeline
Johnny Chen
jia-hong.chen at oracle.com
Fri Jun 28 11:18:57 PDT 2013
Hi,
We recently received a bug concerning a regression of jdk7 compared to Apple's jdk6.
The problem was that the Bi-cubic and Bi-linear rendering are slow. Digging a little bit, it appears that Apple's jdk6
is using a special image instance, e.g., image=apple.awt.OSXImage at 6f9ec4ed, while jdk7/8 is using, e.g.,
image=sun.awt.image.ToolkitImage at 2d6df705, when it comes time to draw the image using Graphics2D.draw(image, ….).
The sample program is putting a java.awt.Canvas subclass called ScaledImage inside a JPanel and doing the image drawing
inside the subclass' paint(Graphics g) method. There is massive slowness in jdk7 compared to jdk6 with the above approach.
Now if I change the ScaledImage class to extend JComponent, instead of ScaledImage extends Canvas,
the response feels much better, although still slower. Without access to the jdk6 source code, I can only guess that apple.awt.OSXImage
is a special kind of Image with much better acceleration on the Mac OS X platform for Canvas drawing and the associated
pipeline for image drawing does a better job than jdk7 for image rendering even on a lightweight component.
Can anyone enlighten me on the rationale for taking out the apple.awt.OSXImage class for macosx port
and whether there's anything similar to Apple jdk6's way of rendering image that we can do to speed things up?
Thanks,
Johnny Chen
More information about the macosx-port-dev
mailing list