Skip to content

Commit f49bb0c

Browse files
committed
[win32] Refactor path to support multiple handles
This commit refactors Path in the win32 implementation to better support multiple handles for different zoom settings of a Path when monitor-specific scaling is enables. The previous implementation only applied adaptions on the path to the initial handle and relied on the path not to be changed after usage. This doesn't cover all scenarios and can lead to incompletely rendered path when reusing Path object over different zoom settings.
1 parent 9f60279 commit f49bb0c

File tree

5 files changed

+703
-248
lines changed

5 files changed

+703
-248
lines changed

bundles/org.eclipse.swt/Eclipse SWT Tests/win32/org/eclipse/swt/graphics/PathWin32Tests.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
*******************************************************************************/
1414
package org.eclipse.swt.graphics;
1515

16+
import static org.junit.Assert.assertFalse;
1617
import static org.junit.Assert.assertTrue;
1718

1819
import java.util.*;
@@ -49,9 +50,11 @@ public void testHandlesExistForEachZoomLevelInHashMap() {
4950
DPIUtil.setDeviceZoom(zoom);
5051
Path path = new Path(display);
5152
path.addArc(0, 0, 10, 10, 0, 90);
53+
path.getHandle(zoom);
54+
assertTrue("zoomLevelToHandle should contain initial zoom's handle", path.toString().contains(zoom + "="));
55+
assertFalse("zoomLevelToHandle should not contains scaled handle", path.toString().contains(scaledZoom + "="));
5256
path.getHandle(scaledZoom);
53-
assertTrue("zoomLevelToHandle contains scaled handle", path.toString().contains(scaledZoom + "="));
54-
assertTrue("zoomLevelToHandle contains initial zoom's handle", path.toString().contains(zoom + "="));
57+
assertTrue("zoomLevelToHandle should contain scaled handle", path.toString().contains(scaledZoom + "="));
5558
}
5659

5760
@Test

0 commit comments

Comments
 (0)