Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNiraj Modi2019-02-04 14:44:31 +0000
committerNiraj Modi2019-02-04 17:01:00 +0000
commit796a41a7ac80115a4a90c80b42d2989134aed2ef (patch)
tree7a046ed4e4deaf9b17c61d7e8813825d59f6daa4 /bundles
parent4e982f236b057723c4407d1d433bce7d38b87e28 (diff)
downloadeclipse.platform.swt-796a41a7ac80115a4a90c80b42d2989134aed2ef.tar.gz
eclipse.platform.swt-796a41a7ac80115a4a90c80b42d2989134aed2ef.tar.xz
eclipse.platform.swt-796a41a7ac80115a4a90c80b42d2989134aed2ef.zip
Bug 139791 - [Win32] GC.fillPolygon paints at wrong coordinates when
GDI+ is used Change-Id: I9a0e965dd43d6325e759ddeefa2ea4274a43caba Signed-off-by: Niraj Modi <niraj.modi@in.ibm.com>
Diffstat (limited to 'bundles')
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/GC.java11
1 files changed, 10 insertions, 1 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/GC.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/GC.java
index 089f7b36de..0f4a9f460e 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/GC.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/GC.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2018 IBM Corporation and others.
+ * Copyright (c) 2000, 2019 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -2919,7 +2919,15 @@ void fillPolygonInPixels (int[] pointArray) {
checkGC(FILL);
if (data.gdipGraphics != 0) {
int mode = OS.GetPolyFillMode(handle) == OS.WINDING ? Gdip.FillModeWinding : Gdip.FillModeAlternate;
+ /*
+ * GC.fillPolygon method paints at wrong coordinates when GDI+ is used, the
+ * difference is marginal, hence applying the transformation with additional
+ * 0.5f pixel correction to avoid the issue seen in bug 139791
+ */
+ float offsetCorrection = 0.5f;
+ Gdip.Graphics_TranslateTransform(data.gdipGraphics, data.gdipXOffset + offsetCorrection, data.gdipYOffset + offsetCorrection, Gdip.MatrixOrderPrepend);
Gdip.Graphics_FillPolygon(data.gdipGraphics, data.gdipBrush, pointArray, pointArray.length / 2, mode);
+ Gdip.Graphics_TranslateTransform(data.gdipGraphics, -(data.gdipXOffset + offsetCorrection), -(data.gdipYOffset + offsetCorrection), Gdip.MatrixOrderPrepend);
return;
}
if ((data.style & SWT.MIRRORED) != 0) {
@@ -2933,6 +2941,7 @@ void fillPolygonInPixels (int[] pointArray) {
pointArray[i]++;
}
}
+
}
/**

Back to the top