-
Notifications
You must be signed in to change notification settings - Fork 143
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Multi Zoom Support for region for win32
This commit adds the feature of scaling region based on the zoom level of the monitor it is drawn on. The mentioned functionality is attained by using a map to maintain the handle of the region scale as per zoom level. The handle can then be obtained by the method win32_getHandle by passing the zoom information from the client. contributes to #62 and #127
- Loading branch information
1 parent
7ac43c0
commit b4dcb80
Showing
4 changed files
with
88 additions
and
31 deletions.
There are no files selected for viewing
23 changes: 23 additions & 0 deletions
23
...es/org.eclipse.swt/Eclipse SWT Tests/win32/org/eclipse/swt/graphics/RegionWin32Tests.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,23 @@ | ||
package org.eclipse.swt.graphics; | ||
|
||
import static org.junit.Assert.assertEquals; | ||
|
||
import org.eclipse.swt.internal.*; | ||
import org.junit.*; | ||
|
||
public class RegionWin32Tests extends Win32AutoscaleTestBase { | ||
|
||
@Test | ||
public void testRegionMustBeScaledOnHandleOfScaledZoomLevel() { | ||
int zoom = DPIUtil.getDeviceZoom(); | ||
Region region = new Region(display); | ||
region.add(0, 0, 5, 10); | ||
long scaledRegionHandle = Region.win32_getHandle(region, zoom * 2); | ||
Region scaledRegion = Region.win32_new(display, (int) scaledRegionHandle); | ||
Rectangle scaledBounds = scaledRegion.getBounds(); | ||
Rectangle bounds = region.getBounds(); | ||
assertEquals("scaled region's height should be double of unscaled region", bounds.height * 2, scaledBounds.height); | ||
assertEquals("scaled region's width should be double of unscaled region", bounds.width * 2, scaledBounds.width); | ||
} | ||
|
||
} |
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
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