diff options
author | Niraj Modi | 2016-01-22 11:47:08 +0000 |
---|---|---|
committer | Niraj Modi | 2016-01-22 11:47:08 +0000 |
commit | 6f45f070654872959136998cb2143f6e2cde8deb (patch) | |
tree | e506c5d67f13fcdf978cf9e05b4233fd024ebb11 | |
parent | bfc1e3c65b70473217ef81110d736a14f49170d3 (diff) | |
download | eclipse.platform.swt-6f45f070654872959136998cb2143f6e2cde8deb.tar.gz eclipse.platform.swt-6f45f070654872959136998cb2143f6e2cde8deb.tar.xz eclipse.platform.swt-6f45f070654872959136998cb2143f6e2cde8deb.zip |
Bug 481315 (Part 4)- [Graphics] Implement new HighDPI APIs
Image#getImageData(zoom) and Image#getBounds(zoom)
- Win32/GTK: updated getImageData() to delegate to getImageData(100)
Change-Id: I10d2db239a68ef519249df8dc5ffce64099a6bab
Signed-off-by: Niraj Modi <niraj.modi@in.ibm.com>
-rw-r--r-- | bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/Image.java | 17 | ||||
-rw-r--r-- | bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/Image.java | 17 |
2 files changed, 20 insertions, 14 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/Image.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/Image.java index 985f8b56d7..c45b238611 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/Image.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/Image.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2015 IBM Corporation and others. + * Copyright (c) 2000, 2016 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -1347,7 +1347,10 @@ public Rectangle getBounds() { } return bounds; } - + +/** + * @return a rectangle specifying the image's bounds at current zoom. + */ Rectangle _getBounds() { if (width != -1 && height != -1) { return new Rectangle(0, 0, width, height); @@ -1404,13 +1407,13 @@ public Rectangle getBounds(int zoom) { */ public ImageData getImageData() { if (isDisposed()) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED); - ImageData imageData = _getImageData(); - if (imageData != null && getEnableAutoScaling()) { - data = DPIUtil.autoScaleImageData(data, 100, currentDeviceZoom); - } - return imageData; + return getImageData(100); } +/** + * @return an <code>ImageData</code> containing the image's data and + * attributes at current zoom level. + */ ImageData _getImageData() { if (OS.USE_CAIRO) { long /*int*/ surface = ImageList.convertSurface(this); diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/Image.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/Image.java index dcc6458134..963c290962 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/Image.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/Image.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2015 IBM Corporation and others. + * Copyright (c) 2000, 2016 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -1396,7 +1396,10 @@ public Rectangle getBounds() { } return bounds; } - + +/** + * @return a rectangle specifying the image's bounds at current zoom. + */ Rectangle _getBounds() { if (width != -1 && height != -1) { return new Rectangle(0, 0, width, height); @@ -1469,13 +1472,13 @@ public Rectangle getBounds(int zoom) { */ public ImageData getImageData() { if (isDisposed()) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED); - ImageData imageData = _getImageData(); - if (imageData != null && getEnableAutoScaling()) { - data = DPIUtil.autoScaleImageData(data, 100, currentDeviceZoom); - } - return imageData; + return getImageData(100); } +/** + * @return an <code>ImageData</code> containing the image's data and + * attributes at current zoom level. + */ ImageData _getImageData() { BITMAP bm; int depth, width, height; |