<AWT Dev> [OpenJDK 2D-Dev] [8] Review request for 8011059 [macosx] Make JDK demos look perfect on retina displays

Jim Graham james.graham at oracle.com
Thu Nov 7 13:19:28 PST 2013



On 10/31/13 9:19 AM, Alexander Scherbatiy wrote:
>
>   Could you review the updated fix:
>     http://cr.openjdk.java.net/~alexsch/8011059/webrev.04/

I'd like to point out a potential issue here with respect to ImageObserver.

Typically, when the ImageObserver is notified that the image loading is 
complete then it becomes irrelevant.  I'm not sure if we've documented 
this anywhere, and I've not done a code survey to see if anyone has ever 
created code based on that assumption, but it is true.  complete means 
the bits are all there and all calls to drawImage() forever-more will 
succeed without any problems.

The way that the scaled images are introduced here, there will be 
separate image loading for both the regular and @2x versions of the 
image.  A developer could render the image on one resolution display 
which would trigger the loading of that version of the image until it 
says it is complete, but the first time they load the image on a new 
display of a different resolution, then suddenly a new version of the 
image is needed and will not have been loaded - but that has never been 
possible before and so the developer could be caught off guard by this.

There would ideally be some way to make the status of the image only 
complete when all resolution variants of an image are loaded.

This gets more complicated with the MediaTracker object which is 
supposed to be used to load an image completely.  We don't explicitly 
say that if a MediaTracker says an image is complete that they can then 
ignore their observers, and there is already an issue with animated GIFs 
where we document that the tracker will claim they are done after their 
first frame is loaded, but I don't doubt that many programmers have 
written code to funnel all images through MT and then assume they don't 
need observers after that.  In fact, I believe that Swing has done 
things like that internally.  The question then is, what happens with MT 
and @2x images?

			...jim


More information about the awt-dev mailing list