-
Notifications
You must be signed in to change notification settings - Fork 147
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Multiple zoom level support to path for win 32
This commit contributes to the obtaining the path as per the zoom level of the monitor. A method win32_getPAth is used in place wherever path.handle was used earlier by the clients. The preferred zoom level has to be passed by the clients as a parameter to the mthod in order to get the handle for the scaled path. contributes to #62 and #127
- Loading branch information
1 parent
7ac43c0
commit d0092c0
Showing
3 changed files
with
95 additions
and
38 deletions.
There are no files selected for viewing
40 changes: 40 additions & 0 deletions
40
bundles/org.eclipse.swt/Eclipse SWT Tests/win32/org/eclipse/swt/graphics/PathWin32Tests.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
/******************************************************************************* | ||
* Copyright (c) 2024 Yatta Solutions | ||
* | ||
* This program and the accompanying materials | ||
* are made available under the terms of the Eclipse Public License 2.0 | ||
* which accompanies this distribution, and is available at | ||
* https://www.eclipse.org/legal/epl-2.0/ | ||
* | ||
* SPDX-License-Identifier: EPL-2.0 | ||
* | ||
* Contributors: | ||
* Yatta Solutions - initial API and implementation | ||
*******************************************************************************/ | ||
package org.eclipse.swt.graphics; | ||
|
||
import static org.junit.Assert.assertTrue; | ||
|
||
import java.util.*; | ||
|
||
import org.eclipse.swt.internal.*; | ||
import org.junit.*; | ||
|
||
public class PathWin32Tests extends Win32AutoscaleTestBase { | ||
|
||
@Test | ||
public void pathMustBeScaledOnZoomLevelChange() { | ||
int zoom = DPIUtil.getDeviceZoom(); | ||
Path path = new Path(display); | ||
path.addArc(0, 0, 10, 10, 0, 90); | ||
long scaledHandle = path.getHandle(zoom * 2); | ||
PathData pathData = path.getPathData(); | ||
path.handle = scaledHandle; | ||
PathData scaledPathData = path.getPathData(); | ||
assertTrue("PathData types don't change on zoom level change", Arrays.equals(pathData.types, scaledPathData.types)); | ||
for (int i = 0; i < pathData.points.length; i++) { | ||
pathData.points[i] = pathData.points[i] * 2; | ||
} | ||
assertTrue("PathData types don't change on zoom level change", Arrays.equals(pathData.points, scaledPathData.points)); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters