Antialiasing fixes
Build and Test j3270 / Build JAR & Run Tests (push) Successful in 40s

This commit is contained in:
2026-08-25 23:31:14 +00:00
parent 2584f4289f
commit bcfd4ba2e0
6 changed files with 132 additions and 72 deletions
@@ -218,22 +218,22 @@ public class GocaDecoderTest {
@Test
public void test3179GCoordinateMapping() {
GraphicsPlane plane = new GraphicsPlane(720, 516);
GraphicsPlane plane = new GraphicsPlane(1000, 750);
plane.setScreenDimensions(80, 43);
// Screen center (0, 0) should map to canvas center (360, 257)
assertEquals(360, plane.mapX(0));
assertEquals(257, plane.mapY(0));
// Screen center (0, 0) should map to canvas center
assertEquals(500, plane.mapX(0));
assertEquals(374, plane.mapY(0));
// Left edge (-360) should map to 0
assertEquals(0, plane.mapX(-360));
// Right edge (+359) should map to 719
assertEquals(719, plane.mapX(359));
// Left edge (-xMax) should map to 0
assertEquals(0, plane.mapX(-plane.getXMax()));
// Right edge (+xMax) should map to 1000
assertEquals(1000, plane.mapX(plane.getXMax()));
// Top edge (+257) should map to 0
assertEquals(0, plane.mapY(257));
// Bottom edge (-258) should map to 515
assertEquals(515, plane.mapY(-258));
// Top edge (+yMax) should map to 0
assertEquals(0, plane.mapY(plane.getYMax()));
// Bottom edge (yMax - totalHeight) should map to 750
assertEquals(750, plane.mapY(plane.getYMax() - plane.getTotalHeight()));
// Bidirectional roundtrip mapping must be exact
assertEquals(0, plane.unmapX(plane.mapX(0)));
@@ -512,7 +512,7 @@ public class GocaDecoderTest {
@Test
public void testMultiPolygonAreaFilling() {
GraphicsPlane plane = new GraphicsPlane(200, 200);
GraphicsPlane plane = new GraphicsPlane(1000, 750);
GocaDecoder decoder = new GocaDecoder(plane);
// Sequence: GBAR (0x68) short form 0x80 (bounded, always filled in GOCA)
@@ -786,11 +786,18 @@ public class GocaDecoderTest {
}
assertTrue(foundBlue, "Slide body must contain stippled blue pixels");
// Verify that the boundary (e.g. at (10, 50)) is drawn in White!
// Verify that the boundary (e.g. at X=10) is drawn in White!
int whiteArgb = GocaConstants.GOCA_COLORS[7];
int borderX = plane.mapX(10);
int borderY = plane.mapY(50);
int borderPixel = plane.getRgbBuffer()[borderY * plane.getCanvasWidth() + borderX];
assertEquals(whiteArgb, borderPixel, "Slide border outline must be drawn in White");
boolean foundWhite = false;
int y1 = Math.min(plane.mapY(10), plane.mapY(90));
int y2 = Math.max(plane.mapY(10), plane.mapY(90));
for (int y = y1; y <= y2; y++) {
if (plane.getRgbBuffer()[y * plane.getCanvasWidth() + borderX] == whiteArgb) {
foundWhite = true;
break;
}
}
assertTrue(foundWhite, "Slide border outline must be drawn in White");
}
}