Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNiraj Modi2016-03-12 07:14:49 +0000
committerNiraj Modi2016-03-12 07:14:49 +0000
commite02d49aefe42ac4c77b81048299ab069ddb5c2ba (patch)
treeee78920992cfda51890cca0bf5fb394c876add83 /bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Canvas.java
parentf50994fe9b815dddd13700087e2289575a82e8b7 (diff)
downloadeclipse.platform.swt-e02d49aefe42ac4c77b81048299ab069ddb5c2ba.tar.gz
eclipse.platform.swt-e02d49aefe42ac4c77b81048299ab069ddb5c2ba.tar.xz
eclipse.platform.swt-e02d49aefe42ac4c77b81048299ab069ddb5c2ba.zip
Bug 479614 - [Graphics] HiDPI support for eclipse platform
- Windows changes Change-Id: I9cd0004d57a2a3a2a956a71de91b10af560c08a7 Signed-off-by: Niraj Modi <niraj.modi@in.ibm.com>
Diffstat (limited to 'bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Canvas.java')
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Canvas.java23
1 files changed, 19 insertions, 4 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Canvas.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Canvas.java
index 1c17b19910..c283f29f40 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Canvas.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Canvas.java
@@ -11,9 +11,10 @@
package org.eclipse.swt.widgets;
-import org.eclipse.swt.internal.win32.*;
import org.eclipse.swt.*;
import org.eclipse.swt.graphics.*;
+import org.eclipse.swt.internal.*;
+import org.eclipse.swt.internal.win32.*;
/**
* Instances of this class provide a surface for drawing
@@ -110,7 +111,11 @@ void clearArea (int x, int y, int width, int height) {
* @since 3.2
*/
public void drawBackground (GC gc, int x, int y, int width, int height) {
- drawBackground(gc, x, y, width, height, 0, 0);
+ x = DPIUtil.autoScaleUp(x);
+ y = DPIUtil.autoScaleUp(y);
+ width = DPIUtil.autoScaleUp(width);
+ height = DPIUtil.autoScaleUp(height);
+ drawBackgroundInPixels(gc, x, y, width, height, 0, 0);
}
/**
@@ -197,6 +202,16 @@ void reskinChildren (int flags) {
*/
public void scroll (int destX, int destY, int x, int y, int width, int height, boolean all) {
checkWidget ();
+ destX = DPIUtil.autoScaleUp(destX);
+ destY = DPIUtil.autoScaleUp(destY);
+ x = DPIUtil.autoScaleUp(x);
+ y = DPIUtil.autoScaleUp(y);
+ width = DPIUtil.autoScaleUp(width);
+ height = DPIUtil.autoScaleUp(height);
+ scrollInPixels(destX, destY, x, y, width, height, all);
+}
+
+void scrollInPixels (int destX, int destY, int x, int y, int width, int height, boolean all) {
forceResize ();
boolean isFocus = caret != null && caret.isFocusCaret ();
if (isFocus) caret.killFocus ();
@@ -252,10 +267,10 @@ public void scroll (int destX, int destY, int x, int y, int width, int height, b
Control [] children = _getChildren ();
for (int i=0; i<children.length; i++) {
Control child = children [i];
- Rectangle rect = child.getBounds ();
+ Rectangle rect = child.getBoundsInPixels ();
if (Math.min (x + width, rect.x + rect.width) >= Math.max (x, rect.x) &&
Math.min (y + height, rect.y + rect.height) >= Math.max (y, rect.y)) {
- child.setLocation (rect.x + deltaX, rect.y + deltaY);
+ child.setLocationInPixels (rect.x + deltaX, rect.y + deltaY);
}
}
}

Back to the top