Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSravan Kumar Lakkimsetti2016-05-11 06:34:27 -0400
committerSravan Kumar Lakkimsetti2016-05-18 08:41:59 -0400
commit7fa3827ceb8969d31a1db12eb2ec49ab39016263 (patch)
tree0d2a121b128d4eaf60a7b3442be9abd953ac2ee1 /features
parent4fd4716a7c8677fa01b3a7c4efd9e069d8213458 (diff)
downloadrt.equinox.framework-7fa3827ceb8969d31a1db12eb2ec49ab39016263.tar.gz
rt.equinox.framework-7fa3827ceb8969d31a1db12eb2ec49ab39016263.tar.xz
rt.equinox.framework-7fa3827ceb8969d31a1db12eb2ec49ab39016263.zip
Bug 493797 - [HiDPI][Win32][GTK] Adapts Launcher to 'integer' scaling
which is default for Eclipse/SWT Change-Id: Ie2fa7b5c8e65216d3852bb1daee60be06e0f8927 Signed-off-by: Sravan Kumar Lakkimsetti <sravankumarl@in.ibm.com>
Diffstat (limited to 'features')
-rw-r--r--features/org.eclipse.equinox.executable.feature/library/gtk/eclipseGtk.c4
-rw-r--r--features/org.eclipse.equinox.executable.feature/library/win32/eclipseWin.c11
2 files changed, 8 insertions, 7 deletions
diff --git a/features/org.eclipse.equinox.executable.feature/library/gtk/eclipseGtk.c b/features/org.eclipse.equinox.executable.feature/library/gtk/eclipseGtk.c
index 2b25cc61e..361c3d098 100644
--- a/features/org.eclipse.equinox.executable.feature/library/gtk/eclipseGtk.c
+++ b/features/org.eclipse.equinox.executable.feature/library/gtk/eclipseGtk.c
@@ -235,8 +235,8 @@ float scaleFactor ()
screen = gtk.gdk_screen_get_default();
resolution = gtk.gdk_screen_get_resolution (screen);
if (resolution <= 0) resolution = 96; // in unix and windows 100% corresponds to dpi of 96
- resolution = ((int)(resolution/24 + 0.5)) * 24; //rounding the resolution to 25% multiples, 25% of 96 is 24.
- scaleFactor = (float)(resolution/96);
+ resolution = ((int)((resolution + 24) / 96)) * 96; //rounding the resolution to 100% multiples,this implementation needs to be kept in sync with org.eclipse.swt.internal.DPIUtil#setDeviceZoom(int)
+ scaleFactor = (float)(resolution / 96);
return scaleFactor;
}
/* Create and Display the Splash Window */
diff --git a/features/org.eclipse.equinox.executable.feature/library/win32/eclipseWin.c b/features/org.eclipse.equinox.executable.feature/library/win32/eclipseWin.c
index 4af33336c..9fdcea04c 100644
--- a/features/org.eclipse.equinox.executable.feature/library/win32/eclipseWin.c
+++ b/features/org.eclipse.equinox.executable.feature/library/win32/eclipseWin.c
@@ -221,9 +221,10 @@ int showSplash( const _TCHAR* featureImage )
hDC = GetDC( NULL);
depth = GetDeviceCaps( hDC, BITSPIXEL ) * GetDeviceCaps( hDC, PLANES);
- /* fetch screen DPI and round it to closest 25% interval(25% of 96 is 24) */
+ /* fetch screen DPI and round it to 100% multiples,
+ this implementation needs to be kept in sync with org.eclipse.swt.internal.DPIUtil#setDeviceZoom(int) */
dpiX = GetDeviceCaps ( hDC, LOGPIXELSX );
- dpiX = ((int)(dpiX / 24.f + 0.5)) * 24;
+ dpiX = ((int)((dpiX + 24) / 96 )) * 96;
ReleaseDC(NULL, hDC);
if (featureImage != NULL)
@@ -236,10 +237,10 @@ int showSplash( const _TCHAR* featureImage )
GetObject(hBitmap, sizeof(BITMAP), &bmp);
/* reload scaled up image when zoom > 100% */
- if (dpiX > 96.f) {
+ if (dpiX > 96) {
/* calculate scaled-up bounds */
- scaledWidth = dpiX * bmp.bmWidth / 96.f;
- scaledHeight = dpiX * bmp.bmHeight / 96.f;
+ scaledWidth = dpiX * bmp.bmWidth / 96;
+ scaledHeight = dpiX * bmp.bmHeight / 96;
hBitmap = LoadImage(NULL, featureImage, IMAGE_BITMAP, scaledWidth, scaledHeight, LR_LOADFROMFILE);

Back to the top