JDK-6662388 : D3D: D3DContext::SetRectClip doesn't clip the input coordinates correctly in some cases
Type:Bug
Component:client-libs
Sub-Component:2d
Affected Version:6u10
Priority:P4
Status:Resolved
Resolution:Fixed
OS:windows_xp
CPU:x86
Submitted:2008-02-13
Updated:2010-10-14
Resolved:2008-03-04
The Version table provides details related to the release that this issue/RFE will be addressed.
Unresolved : Release in which this issue/RFE will be addressed. Resolved: Release in which this issue/RFE has been resolved. Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.
EVALUATION
We have to clip incoming coordinates because otherwise SetScissorRect fails
with the debug d3d runtime. Unfortunately the clipping code doesn't do it
correctly in some cases.
The clipping code looks like this:
if (x1 < 0) x1 = 0;
if (y1 < 0) y1 = 0;
if ((UINT)x2 > desc.Width) x2 = desc.Width;
if ((UINT)y2 > desc.Height) y2 = desc.Height;
if (x1 > x2) x2 = x1;
if (y1 > y2) y2 = y1;
RECT newRect = { x1, y1, x2, y2 };
It is not correct for cases when say, both x1 and x2 are greater than
render target's width. In this case we'll end up with
x1 == x2 > desc.Width. Same with y1/2 and Height.
The fix is to set both x1,x2 or y1,y2 to 0 if the clip rect is empty
so that scissor rect is empty.