[OpenJDK 2D-Dev] Review Request for JDK-8139183 : drawImage misses background's alpha channel

Jim Graham james.graham at oracle.com
Tue Mar 8 21:53:04 UTC 2016

Hi Jay,

On 3/8/16 12:56 AM, Jayathirth D V wrote:
> Hi Jim,
> Thanks for the review. I have made changes in test case based on input provided.
> 1) Added contentsLost() after we drawImage() and getSnapshot() to verify the content and if it is lost loop again.

Unfortunately, if contents are lost you need to loop back to where you 
create the image, which means you don't have enough code inside the 
while loop.  All of the items I mentioned below in my comment need to be 
included in that "loop back around".  To be painfully clear here, the 
loop should look like this:

     backgroundColor = ...;  /* no need to create this inside the loop */
     do {
         img = ...;
         Graphics2D imgGraphics = img.createGraphics();
         // fill img with transparency
         imgGraphics.drawImage(..., bgColor);
     } while (img.contentsLost());

The rest looked fine...


More information about the 2d-dev mailing list