Bug 494035 - [HiDpi] Rendering issues on Neon due to the new SWT
Auto-scaling feature on Windows and GTK platforms
- taken care of review comments
Change-Id: I4ae4f75eb89d44d6f6ae2b8b09031d98c51b4605
Signed-off-by: Sravan Kumar Lakkimsetti <sravankumarl@in.ibm.com>
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/cairo/org/eclipse/swt/graphics/Path.java b/bundles/org.eclipse.swt/Eclipse SWT/cairo/org/eclipse/swt/graphics/Path.java
index 0855bbf..3ae25f4 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/cairo/org/eclipse/swt/graphics/Path.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/cairo/org/eclipse/swt/graphics/Path.java
@@ -557,6 +557,12 @@
*/
public PathData getPathData() {
if (isDisposed()) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
+ PathData result = getPathDataInPixels();
+ result.points = DPIUtil.autoScaleDown(result.points);
+ return result;
+}
+
+PathData getPathDataInPixels() {
long /*int*/ copy = Cairo.cairo_copy_path(handle);
if (copy == 0) SWT.error(SWT.ERROR_NO_HANDLES);
cairo_path_t path = new cairo_path_t();
@@ -726,16 +732,16 @@
for (int i = 0, j = 0; i < types.length; i++) {
switch (types[i]) {
case SWT.PATH_MOVE_TO:
- moveToInPixels(points[j++], points[j++]);
+ moveTo(points[j++], points[j++]);
break;
case SWT.PATH_LINE_TO:
- lineToInPixels(points[j++], points[j++]);
+ lineTo(points[j++], points[j++]);
break;
case SWT.PATH_CUBIC_TO:
- cubicToInPixels(points[j++], points[j++], points[j++], points[j++], points[j++], points[j++]);
+ cubicTo(points[j++], points[j++], points[j++], points[j++], points[j++], points[j++]);
break;
case SWT.PATH_QUAD_TO:
- quadToInPixels(points[j++], points[j++], points[j++], points[j++]);
+ quadTo(points[j++], points[j++], points[j++], points[j++]);
break;
case SWT.PATH_CLOSE:
close();
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/Path.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/Path.java
index 7b845f2..82095e4 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/Path.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/Path.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2014 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
@@ -506,6 +506,12 @@
*/
public PathData getPathData() {
if (isDisposed()) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
+ PathData result = getPathDataInPixels();
+ result.points = DPIUtil.autoScaleDown(result.points);
+ return result;
+}
+
+PathData getPathDataInPixels() {
int count = Gdip.GraphicsPath_GetPointCount(handle);
byte[] gdipTypes = new byte[count];
float[] points = new float[count * 2];
@@ -577,16 +583,16 @@
for (int i = 0, j = 0; i < types.length; i++) {
switch (types[i]) {
case SWT.PATH_MOVE_TO:
- moveToInPixels(points[j++], points[j++]);
+ moveTo(points[j++], points[j++]);
break;
case SWT.PATH_LINE_TO:
- lineToInPixels(points[j++], points[j++]);
+ lineTo(points[j++], points[j++]);
break;
case SWT.PATH_CUBIC_TO:
- cubicToInPixels(points[j++], points[j++], points[j++], points[j++], points[j++], points[j++]);
+ cubicTo(points[j++], points[j++], points[j++], points[j++], points[j++], points[j++]);
break;
case SWT.PATH_QUAD_TO:
- quadToInPixels(points[j++], points[j++], points[j++], points[j++]);
+ quadTo(points[j++], points[j++], points[j++], points[j++]);
break;
case SWT.PATH_CLOSE:
close();