[OpenJDK 2D-Dev] Review request for 8069348 SunGraphics2D.copyArea() does not properly work for scaled graphics in D3D

Jim Graham james.graham at oracle.com
Fri Nov 27 22:43:28 UTC 2015

Hi Alexandr,

On 11/27/15 2:06 AM, Alexander Scherbatiy wrote:
>> OSXOffscreenSD.java (and all *SD.java), line 481 - should we just make
>> this part of the SD.copyArea contract, that the coordinates are in
>> device space and the SD method should not concern itself with the SG2D
>> transform?
>      I updated the SurfaceData.copyArea() x,y,width, and height
> description.

And yet most of the implementations still check the transformState. Why 
do they do that if they are no longer concerned with transforming the 

>> CopyAreaTest.java, line 61 - rounding is not the same operation that
>> SG2D uses, but it works anyway?

The rounding still isn't the same as SG2D.  Floor() != ceil(v - 0.5).

On second thought, it's probably best not to worry about the exact 
rounding in the test case, but just test 1 pixel inset from the 
coordinates that are needed.  In other words, check:

scale(X + (N+1) * DX) + 1
scale(Y + (N+1) * DY) + 1,
scale(W) - 2
scale(H) - 2

and go back to just rounding...

>> CopyAreaTest.java, lines 143,144 - why subtract 2DX and 2DY here? Ah,
>> this may mask the error in line 94 above...?

I notice that it used to check the rectangle at X+(N+1)*DX, Y+(N+1)*DY, 
but now it only checks X+N*DX,Y+N*DY. Why not continue to check the N+1 
copy? That should be the location of the destination of the last copy, 


More information about the 2d-dev mailing list