RFR: 8357299: Graphics copyArea doesn't copy any pixels when there is overflow
Prasanta Sadhukhan
psadhukhan at openjdk.org
Wed May 21 07:25:52 UTC 2025
On Wed, 21 May 2025 07:05:26 GMT, Sergey Bylokhov <serb at openjdk.org> wrote:
>> Graphics copyArea overflow check bails out of copying pixels if there is overflow.
>> The spec says ""If a portion of the source rectangle lies outside the bounds of the component, or is obscured by another window or component, {@code copyArea} *will be unable to copy* the associated pixels"
>>
>> which suggests that we should always copy the parts inside the bounds and never the parts outside the bounds
>> but it seems currently, in the case of overflow it no longer copies any pixels, including the parts that are inside.
>> So, the fix clips the copyarea region to clip bounds so it will only affect pixels within the valid bounds, and any pixels outside will be ignored.
>
> src/java.desktop/share/native/libawt/java2d/loops/Blit.c line 77:
>
>> 75: srcInfo.bounds.x1 = srcx;
>> 76: srcInfo.bounds.y1 = srcy;
>> 77: if (UNSAFE_TO_ADD(srcx, width) ||
>
> isn't the MaskBlit_MaskBlit use the same pattern?
But that doesn't cause any issue to the testcase given and existing testcase..Do you have any testcase which doesnt work because of MaskBlit pattern?
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/25340#discussion_r2099557371
More information about the client-libs-dev
mailing list