Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove and replace DPIUtil.autoScaleUpUsingNativeDpi #1357

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -393,15 +393,6 @@ public static int scaleUp(int size, int zoom) {
return Math.round (size * scaleFactor);
}

/**
* Auto-scale up int dimensions using Native DPI
*/
public static int autoScaleUpUsingNativeDPI (int size) {
if (nativeDeviceZoom == 100 || size == SWT.DEFAULT) return size;
float nativeScaleFactor = nativeDeviceZoom / 100f;
return Math.round (size * nativeScaleFactor);
}

/**
* Auto-scale up int dimensions if enabled for Drawable class.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1314,7 +1314,7 @@ private int getCheckboxTextOffset(long hdc) {
OS.GetThemePartSize(display.hButtonTheme(), hdc, OS.BP_CHECKBOX, OS.CBS_UNCHECKEDNORMAL, null, OS.TS_TRUE, size);
result += size.cx;
} else {
result += DPIUtil.autoScaleUpUsingNativeDPI(13);
result += DPIUtil.scaleUp(13, nativeZoom);
}

// Windows uses half width of '0' as checkbox-to-text distance.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1161,7 +1161,7 @@ LRESULT wmMeasureChild (long wParam, long lParam) {
* NOTE: autoScaleUpUsingNativeDPI() is used to avoid problems
* with applications that disable automatic scaling.
*/
struct.itemWidth = DPIUtil.autoScaleUpUsingNativeDPI(5);
struct.itemWidth = DPIUtil.scaleUp(5, nativeZoom);
OS.MoveMemory (lParam, struct, MEASUREITEMSTRUCT.sizeof);
return null;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6915,7 +6915,7 @@ LRESULT wmNotifyHeader (NMHDR hdr, long wParam, long lParam) {
* Sort indicator size needs to scale as per the Native Windows OS DPI level
* when header is custom drawn. For more details refer bug 537097.
*/
int leg = DPIUtil.autoScaleUpUsingNativeDPI(3);
int leg = DPIUtil.scaleUp(3, nativeZoom);
if (sortDirection == SWT.UP) {
OS.Polyline(nmcd.hdc, new int[] {center-leg, 1+leg, center+1, 0}, 2);
OS.Polyline(nmcd.hdc, new int[] {center+leg, 1+leg, center-1, 0}, 2);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7884,7 +7884,7 @@ LRESULT wmNotifyHeader (NMHDR hdr, long wParam, long lParam) {
* Sort indicator size needs to scale as per the Native Windows OS DPI level
* when header is custom drawn. For more details refer bug 537097.
*/
int leg = DPIUtil.autoScaleUpUsingNativeDPI(3);
int leg = DPIUtil.scaleUp(3, nativeZoom);
if (sortDirection == SWT.UP) {
OS.Polyline(nmcd.hdc, new int[] {center-leg, 1+leg, center+1, 0}, 2);
OS.Polyline(nmcd.hdc, new int[] {center+leg, 1+leg, center-1, 0}, 2);
Expand Down
Loading