Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSravan Kumar Lakkimsetti2016-02-03 08:07:16 +0000
committerSravan Kumar Lakkimsetti2016-02-03 08:07:16 +0000
commitbfe68e9289f45d76c1801186771cc587858dfb6e (patch)
treeb9f9d6691309b207381dff2693dac8d078cf473f
parent1888432b8a02ce4c7c1fd54af1e9a0ae5c149d39 (diff)
downloadeclipse.platform.swt-bfe68e9289f45d76c1801186771cc587858dfb6e.tar.gz
eclipse.platform.swt-bfe68e9289f45d76c1801186771cc587858dfb6e.tar.xz
eclipse.platform.swt-bfe68e9289f45d76c1801186771cc587858dfb6e.zip
Bug 399786 - Removed the compilation errors
Change-Id: Ibb37ba7932545adb5a6d5cd79e8f96b7b06f8bae Signed-off-by: Sravan Kumar Lakkimsetti <sravankumarl@in.ibm.com>
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/graphics/DPIUtil.java11
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/GC.java7
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/Image.java5
3 files changed, 16 insertions, 7 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/graphics/DPIUtil.java b/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/graphics/DPIUtil.java
index d8ae97cc8b..a1fcb11871 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/graphics/DPIUtil.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/graphics/DPIUtil.java
@@ -76,7 +76,7 @@ public static Rectangle autoScaleDown (Rectangle rect, Device device) {
/**
* Auto-scale image with ImageData
*/
-private static ImageData autoScaleImageData (ImageData imageData, int targetZoom, int currentZoom) {
+static ImageData autoScaleImageData (ImageData imageData, int targetZoom, int currentZoom) {
if (!getAutoScale () || imageData == null || targetZoom == currentZoom) return imageData;
float scaleFactor = ((float) targetZoom)/((float) currentZoom);
return imageData.scaledTo (Math.round ((float)imageData.width * scaleFactor), Math.round ((float)imageData.height * scaleFactor));
@@ -239,4 +239,13 @@ static String validateAndGetImagePathAtZoom (ImageFileNameProvider provider, int
return filename;
}
+/**
+ * Auto-scale image with ImageFileName
+ */
+static ImageData autoScaleImageFileName (String filename, int targetZoom, int currentZoom) {
+ if (filename == null) return null;
+ ImageData imageData = new ImageData (filename);
+ return autoScaleImageData (imageData, targetZoom, currentZoom);
+}
+
}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/GC.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/GC.java
index 14117672b6..100b5d63ee 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/GC.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/GC.java
@@ -4051,10 +4051,9 @@ public void setLineStyle(int lineStyle) {
*/
public void setLineWidth(int lineWidth) {
if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
- if (this.getEnableAutoScaling ()) {
- float scaleFactor = ((float)this.getDeviceZoom()) / 100;
- lineWidth = (int)(lineWidth * scaleFactor);
- }
+
+ float scaleFactor = DPIUtil.getScalingFactor(device);
+ lineWidth = (int)(lineWidth * scaleFactor);
if (data.lineWidth == lineWidth) return;
data.lineWidth = lineWidth;
data.state &= ~(LINE_WIDTH | DRAW_OFFSET);
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 82125fcd7d..d9daae8480 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
@@ -866,8 +866,9 @@ public Image(Device device, ImageDataProvider imageDataProvider) {
*/
boolean refreshImageForZoom () {
boolean refreshed = false;
+ int deviceZoom = Math.round (DPIUtil.getscalingFactor(this) * 100);
if (imageFileNameProvider != null) {
- int deviceZoomLevel = getDeviceZoom();
+ int deviceZoomLevel = deviceZoom;
if (deviceZoomLevel != currentDeviceZoom) {
boolean[] found = new boolean[1];
String filename = DPIUtil.validateAndGetImagePathAtZoom (imageFileNameProvider, deviceZoomLevel, found);
@@ -894,7 +895,7 @@ boolean refreshImageForZoom () {
currentDeviceZoom = deviceZoomLevel;
}
} else if (imageDataProvider != null) {
- int deviceZoomLevel = getDeviceZoom();
+ int deviceZoomLevel = deviceZoom;
if (deviceZoomLevel != currentDeviceZoom) {
boolean[] found = new boolean[1];
ImageData data = DPIUtil.validateAndGetImageDataAtZoom (imageDataProvider, deviceZoomLevel, found);

Back to the top