Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSravan Kumar Lakkimsetti2016-05-30 08:53:47 +0000
committerSravan Kumar Lakkimsetti2016-05-30 12:32:26 +0000
commited5e45664229e6b5ca67a044b19e5e7f6c9faa0d (patch)
tree14e5081443b52e359cc498b5054dbfea7394cd0d
parenta07d0f8d4ab74f0a603f72c7815f96a6bba28995 (diff)
downloadeclipse.platform.swt-ed5e45664229e6b5ca67a044b19e5e7f6c9faa0d.tar.gz
eclipse.platform.swt-ed5e45664229e6b5ca67a044b19e5e7f6c9faa0d.tar.xz
eclipse.platform.swt-ed5e45664229e6b5ca67a044b19e5e7f6c9faa0d.zip
Bug 494717 - [HiDPI][GTK] Path cubic curves are not auto-scaled
correctly with HiDPI settings Change-Id: I02121a7f450e005a7394deae2d9479094f081390
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/cairo/org/eclipse/swt/graphics/Path.java9
1 files changed, 8 insertions, 1 deletions
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 3ae25f4246..81fe58f402 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
@@ -325,7 +325,12 @@ public void addString(String string, float x, float y, Font font) {
if (font.isDisposed()) SWT.error(SWT.ERROR_INVALID_ARGUMENT);
x = DPIUtil.autoScaleUp(x);
y = DPIUtil.autoScaleUp(y);
- addStringInPixels(string, x, y, font);
+ // Scale up the font
+ FontData fd = font.getFontData()[0];
+ fd.setHeight(DPIUtil.autoScaleUp(fd.getHeight()));
+ Font scaledFont = new Font(font.getDevice(), fd);
+ addStringInPixels(string, x, y, scaledFont);
+ scaledFont.dispose(); // Dispose the scaled up font
}
void addStringInPixels(String string, float x, float y, Font font) {
moved = false;
@@ -419,6 +424,8 @@ public void cubicTo(float cx1, float cy1, float cx2, float cy2, float x, float y
cy1 = DPIUtil.autoScaleUp(cy1);
cx2 = DPIUtil.autoScaleUp(cx2);
cy2 = DPIUtil.autoScaleUp(cy2);
+ x = DPIUtil.autoScaleUp(x);
+ y = DPIUtil.autoScaleUp(y);
cubicToInPixels(cx1, cy1, cx2, cy2, x, y);
}
void cubicToInPixels(float cx1, float cy1, float cx2, float cy2, float x, float y) {

Back to the top