< prev index next >
src/java.desktop/windows/native/libawt/java2d/d3d/D3DVertexCacher.cpp
Print this page
@@ -209,10 +209,20 @@
res = lpD3DDevice->SetStreamSource(0, lpD3DVertexBuffer, 0,
sizeof(J2DLVERTEX));
RETURN_STATUS_IF_FAILED(res);
lpD3DDevice->SetFVF(D3DFVF_J2DLVERTEX);
+
+ fudge2 = HV_FF2;
+ if (fudge2 > 0) {
+ D3DADAPTER_IDENTIFIER9 aid;
+ if (SUCCEEDED(pCtx->Get3DObject()->GetAdapterIdentifier(pCtx->
+ getAdapterOrdinal(), 0, &aid)) && aid.VendorId == 0x8086) {
+ // Intel
+ fudge2 -= 0.09f;
+ }
+ }
return res;
}
void
D3DVertexCacher::ReleaseDefPoolResources()
@@ -231,14 +241,14 @@
fy1 = (float)y1+HV_FF1;
fy2 = fy1;
if (x1 > x2) {
fx1 = (float)x2+HV_FF3;
- fx2 = (float)x1+HV_FF2;
+ fx2 = (float)x1+fudge2;
} else if (x1 < x2) {
fx1 = (float)x1+HV_FF3;
- fx2 = (float)x2+HV_FF2;
+ fx2 = (float)x2+fudge2;
} else {
// single point, offset a little so that a single
// pixel is rendered
fx1 = (float)x1-SP_FF4;
fy1 = (float)y1-SP_FF4;
@@ -249,14 +259,14 @@
// vertical
fx1 = (float)x1+HV_FF1;
fx2 = fx1;
if (y1 > y2) {
fy1 = (float)y2+HV_FF3;
- fy2 = (float)y1+HV_FF2;
+ fy2 = (float)y1+fudge2;
} else {
fy1 = (float)y1+HV_FF3;
- fy2 = (float)y2+HV_FF2;
+ fy2 = (float)y2+fudge2;
}
} else {
// diagonal
if (x1 > x2 && y1 > y2) {
// ^
@@ -385,11 +395,11 @@
UINT vertsInBatch = min(2*(MAX_BATCH_SIZE/2), reqVerts);
if (SUCCEEDED(res = EnsureCapacity(D3DPT_LINELIST, vertsInBatch))) {
reqVerts -= vertsInBatch;
do {
x1 = ((float)*(scanlines++)) +HV_FF3;
- x2 = ((float)*(scanlines++)) +HV_FF2;
+ x2 = ((float)*(scanlines++)) +fudge2;
y = ((float)*(scanlines++)) +HV_FF1;
ADD_LINE_XYC(x1, y, x2, y, color);
vertsInBatch -= 2;
} while (vertsInBatch > 0);
}
@@ -441,17 +451,17 @@
float fy1 = (float)y1;
float fx2 = (float)x2;
float fy2 = (float)y2;
// horiz: top left - top right
- ADD_LINE_XYC(fx1+HV_FF3, fy1+HV_FF1, fx2-1.0f+HV_FF2, fy1+HV_FF1,color);
+ ADD_LINE_XYC(fx1+HV_FF3, fy1+HV_FF1, fx2-1.0f+fudge2, fy1+HV_FF1,color);
// horiz: bottom left - bottom right
- ADD_LINE_XYC(fx1+1.0f+HV_FF3, fy2+HV_FF1, fx2+HV_FF2, fy2+HV_FF1,color);
+ ADD_LINE_XYC(fx1+1.0f+HV_FF3, fy2+HV_FF1, fx2+fudge2, fy2+HV_FF1,color);
// vert : top right - bottom right
- ADD_LINE_XYC(fx2+HV_FF1, fy1+HV_FF3, fx2+HV_FF1, fy2-1.0f+HV_FF2,color);
+ ADD_LINE_XYC(fx2+HV_FF1, fy1+HV_FF3, fx2+HV_FF1, fy2-1.0f+fudge2,color);
// vert : top left - bottom left
- ADD_LINE_XYC(fx1+HV_FF1, fy1+1.0f+HV_FF3, fx1+HV_FF1, fy2+HV_FF2,color);
+ ADD_LINE_XYC(fx1+HV_FF1, fy1+1.0f+HV_FF3, fx1+HV_FF1, fy2+fudge2,color);
}
return res;
}
HRESULT D3DVertexCacher::FillRect(int x1, int y1, int x2, int y2)
< prev index next >