diff --git a/bundles/org.eclipse.swt/Eclipse SWT AWT/gtk/org/eclipse/swt/awt/SWT_AWT.java b/bundles/org.eclipse.swt/Eclipse SWT AWT/gtk/org/eclipse/swt/awt/SWT_AWT.java index ad34ca74296..c6b32e3e51a 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT AWT/gtk/org/eclipse/swt/awt/SWT_AWT.java +++ b/bundles/org.eclipse.swt/Eclipse SWT AWT/gtk/org/eclipse/swt/awt/SWT_AWT.java @@ -231,7 +231,7 @@ public static Frame new_Frame (final Composite parent) { }); break; case SWT.Resize: - final Rectangle clientArea = DPIUtil.autoScaleUp(parent.getClientArea()); + final Rectangle clientArea = parent.getClientArea(); EventQueue.invokeLater(() -> frame[0].setSize (clientArea.width, clientArea.height)); break; } @@ -241,7 +241,7 @@ public static Frame new_Frame (final Composite parent) { parent.getDisplay().asyncExec(() -> { if (parent.isDisposed()) return; - final Rectangle clientArea = DPIUtil.autoScaleUp(parent.getClientArea()); + final Rectangle clientArea = parent.getClientArea(); EventQueue.invokeLater(() -> { frame[0].setSize (clientArea.width, clientArea.height); frame[0].validate (); @@ -285,7 +285,7 @@ public void componentResized (ComponentEvent e) { display.syncExec (() -> { if (shell.isDisposed()) return; Dimension dim = parent.getSize (); - shell.setSize (DPIUtil.autoScaleDown(new Point(dim.width, dim.height))); + shell.setSize (new Point(dim.width, dim.height)); }); } }; diff --git a/bundles/org.eclipse.swt/Eclipse SWT Accessibility/gtk/org/eclipse/swt/accessibility/AccessibleObject.java b/bundles/org.eclipse.swt/Eclipse SWT Accessibility/gtk/org/eclipse/swt/accessibility/AccessibleObject.java index 6eeb54a0d2a..73e3c8c6364 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT Accessibility/gtk/org/eclipse/swt/accessibility/AccessibleObject.java +++ b/bundles/org.eclipse.swt/Eclipse SWT Accessibility/gtk/org/eclipse/swt/accessibility/AccessibleObject.java @@ -4534,10 +4534,8 @@ static long toDisplay (long gdkResource, long x, long y) { } else { GDK.gdk_window_get_origin (gdkResource, origin_x, origin_y); } - int scaledX = DPIUtil.autoScaleDown (origin_x [0]); - int scaledY = DPIUtil.autoScaleDown (origin_y [0]); - C.memmove (x, new int[] {scaledX}, 4); - C.memmove (y, new int[] {scaledY}, 4); + C.memmove (x, origin_x, 4); + C.memmove (y, origin_y, 4); return 0; } diff --git a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk/org/eclipse/swt/dnd/DropTarget.java b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk/org/eclipse/swt/dnd/DropTarget.java index 8830850b1cb..78675f78b53 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk/org/eclipse/swt/dnd/DropTarget.java +++ b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk/org/eclipse/swt/dnd/DropTarget.java @@ -792,7 +792,7 @@ boolean setEventData(long context, int x, int y, int time, DNDEvent event) { long window = GTK3.gtk_widget_get_window (control.handle); GDK.gdk_window_get_origin(window, origin_x, origin_y); } - Point coordinates = DPIUtil.autoScaleDown(new Point(origin_x[0] + x, origin_y[0] + y)); + Point coordinates = new Point(origin_x[0] + x, origin_y[0] + y); event.widget = this; event.x = coordinates.x; diff --git a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk/org/eclipse/swt/dnd/TableDropTargetEffect.java b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk/org/eclipse/swt/dnd/TableDropTargetEffect.java index 8b14b6f23b3..9fa476f9fb1 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk/org/eclipse/swt/dnd/TableDropTargetEffect.java +++ b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk/org/eclipse/swt/dnd/TableDropTargetEffect.java @@ -136,7 +136,7 @@ public void dragOver(DropTargetEvent event) { long handle = table.handle; int effect = checkEffect(event.feedback); Point coordinates = new Point(event.x, event.y); - coordinates = DPIUtil.autoScaleUp(table.toControl(coordinates)); + coordinates = table.toControl(coordinates); long [] path = new long [1]; GTK.gtk_tree_view_get_path_at_pos (handle, coordinates.x, coordinates.y, path, null, null, null); int index = -1; @@ -154,7 +154,7 @@ public void dragOver(DropTargetEvent event) { } else { if (index != -1 && scrollIndex == index && scrollBeginTime != 0) { if (System.currentTimeMillis() >= scrollBeginTime) { - if (coordinates.y < DPIUtil.autoScaleUp(table.getItemHeight())) { + if (coordinates.y < table.getItemHeight()) { GTK.gtk_tree_path_prev(path[0]); } else { GTK.gtk_tree_path_next(path[0]); diff --git a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk/org/eclipse/swt/dnd/TreeDropTargetEffect.java b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk/org/eclipse/swt/dnd/TreeDropTargetEffect.java index 0f77fc07745..3269b1b1dc8 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk/org/eclipse/swt/dnd/TreeDropTargetEffect.java +++ b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk/org/eclipse/swt/dnd/TreeDropTargetEffect.java @@ -150,7 +150,7 @@ public void dragOver(DropTargetEvent event) { long handle = tree.handle; Point coordinates = new Point(event.x, event.y); - coordinates = DPIUtil.autoScaleUp(tree.toControl(coordinates)); + coordinates = tree.toControl(coordinates); long [] path = new long [1]; GTK.gtk_tree_view_get_path_at_pos (handle, coordinates.x, coordinates.y, path, null, null, null); int index = -1; diff --git a/bundles/org.eclipse.swt/Eclipse SWT OpenGL/gtk/org/eclipse/swt/opengl/GLCanvas.java b/bundles/org.eclipse.swt/Eclipse SWT OpenGL/gtk/org/eclipse/swt/opengl/GLCanvas.java index d7dd4873eba..c4ded786ef9 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT OpenGL/gtk/org/eclipse/swt/opengl/GLCanvas.java +++ b/bundles/org.eclipse.swt/Eclipse SWT OpenGL/gtk/org/eclipse/swt/opengl/GLCanvas.java @@ -15,7 +15,6 @@ import org.eclipse.swt.*; import org.eclipse.swt.graphics.*; -import org.eclipse.swt.internal.*; import org.eclipse.swt.internal.gtk.*; import org.eclipse.swt.internal.gtk3.*; import org.eclipse.swt.internal.opengl.glx.*; @@ -164,7 +163,7 @@ public GLCanvas (Composite parent, int style, GLData data) { GLX.glViewport (viewport [0],viewport [1],viewport [2],viewport [3]); break; case SWT.Resize: - Rectangle clientArea = DPIUtil.autoScaleUp(getClientArea()); + Rectangle clientArea = getClientArea(); GDK.gdk_window_move (glWindow, clientArea.x, clientArea.y); GDK.gdk_window_resize (glWindow, clientArea.width, clientArea.height); break; diff --git a/bundles/org.eclipse.swt/Eclipse SWT WebKit/gtk/org/eclipse/swt/browser/WebKit.java b/bundles/org.eclipse.swt/Eclipse SWT WebKit/gtk/org/eclipse/swt/browser/WebKit.java index 68b8f4cdc61..74fda155d7b 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT WebKit/gtk/org/eclipse/swt/browser/WebKit.java +++ b/bundles/org.eclipse.swt/Eclipse SWT WebKit/gtk/org/eclipse/swt/browser/WebKit.java @@ -1817,7 +1817,7 @@ void onDispose (Event e) { } void onResize (Event e) { - Rectangle rect = DPIUtil.autoScaleUp(browser.getClientArea ()); + Rectangle rect = browser.getClientArea (); if (webView == 0) return; GTK.gtk_widget_set_size_request (webView, rect.width, rect.height); 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 d7ca68d5136..2273df459c5 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 @@ -219,14 +219,6 @@ public Path (Device device, PathData data) { public void addArc(float x, float y, float width, float height, float startAngle, float arcAngle) { if (isDisposed()) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED); if (width == 0 || height == 0 || arcAngle == 0) return; - x = DPIUtil.autoScaleUp(x); - y = DPIUtil.autoScaleUp(y); - width = DPIUtil.autoScaleUp(width); - height = DPIUtil.autoScaleUp(height); - addArcInPixels(x, y, width, height, startAngle, arcAngle); -} - -void addArcInPixels(float x, float y, float width, float height, float startAngle, float arcAngle) { moved = true; if (width == height) { float angle = -startAngle * (float)Math.PI / 180; @@ -292,14 +284,6 @@ public void addPath(Path path) { */ public void addRectangle(float x, float y, float width, float height) { if (isDisposed()) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED); - x = DPIUtil.autoScaleUp(x); - y = DPIUtil.autoScaleUp(y); - width = DPIUtil.autoScaleUp(width); - height = DPIUtil.autoScaleUp(height); - addRectangleInPixels(x, y, width, height); -} - -void addRectangleInPixels(float x, float y, float width, float height) { moved = false; Cairo.cairo_rectangle(handle, x, y, width, height); closed = true; @@ -326,19 +310,14 @@ public void addString(String string, float x, float y, Font font) { if (isDisposed()) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED); if (font == null) SWT.error(SWT.ERROR_NULL_ARGUMENT); if (font.isDisposed()) SWT.error(SWT.ERROR_INVALID_ARGUMENT); - x = DPIUtil.autoScaleUp(x); - y = DPIUtil.autoScaleUp(y); // Scale up the font FontData fd = font.getFontData()[0]; - fd.setHeight(DPIUtil.autoScaleUp(fd.getHeight())); + fd.setHeight(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; GC.addCairoString(handle, string, x, y, font); closed = true; + scaledFont.dispose(); // Dispose the scaled up font } /** @@ -384,11 +363,6 @@ public boolean contains(float x, float y, GC gc, boolean outline) { if (isDisposed()) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED); if (gc == null) SWT.error(SWT.ERROR_NULL_ARGUMENT); if (gc.isDisposed()) SWT.error(SWT.ERROR_INVALID_ARGUMENT); - x = DPIUtil.autoScaleUp(x); - y = DPIUtil.autoScaleUp(y); - return containsInPixels(x, y, gc, outline); -} -boolean containsInPixels(float x, float y, GC gc, boolean outline) { //TODO - see Windows gc.initCairo(); gc.checkGC(GC.LINE_CAP | GC.LINE_JOIN | GC.LINE_STYLE | GC.LINE_WIDTH); @@ -423,15 +397,6 @@ boolean containsInPixels(float x, float y, GC gc, boolean outline) { */ public void cubicTo(float cx1, float cy1, float cx2, float cy2, float x, float y) { if (isDisposed()) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED); - cx1 = DPIUtil.autoScaleUp(cx1); - 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) { if (!moved) { double[] currentX = new double[1], currentY = new double[1]; Cairo.cairo_get_current_point(handle, currentX, currentY); @@ -647,11 +612,6 @@ PathData getPathDataInPixels() { */ public void lineTo(float x, float y) { if (isDisposed()) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED); - x = DPIUtil.autoScaleUp(x); - y = DPIUtil.autoScaleUp(y); - lineToInPixels(x, y); -} -void lineToInPixels(float x, float y) { if (!moved) { double[] currentX = new double[1], currentY = new double[1]; Cairo.cairo_get_current_point(handle, currentX, currentY); @@ -676,11 +636,6 @@ void lineToInPixels(float x, float y) { */ public void moveTo(float x, float y) { if (isDisposed()) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED); - x = DPIUtil.autoScaleUp(x); - y = DPIUtil.autoScaleUp(y); - moveToInPixels(x, y); -} -void moveToInPixels(float x, float y) { /* * Bug in Cairo. If cairo_move_to() is not called at the * begining of a subpath, the first cairo_line_to() or @@ -707,13 +662,6 @@ void moveToInPixels(float x, float y) { */ public void quadTo(float cx, float cy, float x, float y) { if (isDisposed()) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED); - x = DPIUtil.autoScaleUp(x); - y = DPIUtil.autoScaleUp(y); - cx = DPIUtil.autoScaleUp(cx); - cy = DPIUtil.autoScaleUp(cy); - quadToInPixels(cx, cy, x, y); -} -void quadToInPixels(float cx, float cy, float x, float y) { double[] currentX = new double[1], currentY = new double[1]; Cairo.cairo_get_current_point(handle, currentX, currentY); if (!moved) { diff --git a/bundles/org.eclipse.swt/Eclipse SWT/cairo/org/eclipse/swt/graphics/Pattern.java b/bundles/org.eclipse.swt/Eclipse SWT/cairo/org/eclipse/swt/graphics/Pattern.java index 91a15888442..51a3424ae59 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/cairo/org/eclipse/swt/graphics/Pattern.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/cairo/org/eclipse/swt/graphics/Pattern.java @@ -14,7 +14,6 @@ package org.eclipse.swt.graphics; import org.eclipse.swt.*; -import org.eclipse.swt.internal.*; import org.eclipse.swt.internal.cairo.*; /** @@ -173,10 +172,6 @@ public Pattern(Device device, float x1, float y1, float x2, float y2, Color colo */ public Pattern(Device device, float x1, float y1, float x2, float y2, Color color1, int alpha1, Color color2, int alpha2) { super(device); - x1 = DPIUtil.autoScaleUp(x1); - y1 = DPIUtil.autoScaleUp(y1); - x2 = DPIUtil.autoScaleUp(x2); - y2 = DPIUtil.autoScaleUp(y2); if (color1 == null) SWT.error(SWT.ERROR_NULL_ARGUMENT); if (color1.isDisposed()) SWT.error(SWT.ERROR_INVALID_ARGUMENT); if (color2 == null) SWT.error(SWT.ERROR_NULL_ARGUMENT); diff --git a/bundles/org.eclipse.swt/Eclipse SWT/cairo/org/eclipse/swt/graphics/Transform.java b/bundles/org.eclipse.swt/Eclipse SWT/cairo/org/eclipse/swt/graphics/Transform.java index f9484fdba88..4ed39f4b218 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/cairo/org/eclipse/swt/graphics/Transform.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/cairo/org/eclipse/swt/graphics/Transform.java @@ -147,7 +147,7 @@ public Transform (Device device, float m11, float m12, float m21, float m22, flo super(device); handle = new double[6]; if (handle == null) SWT.error(SWT.ERROR_NO_HANDLES); - Cairo.cairo_matrix_init(handle, m11, m12, m21, m22, DPIUtil.autoScaleUp(dx), DPIUtil.autoScaleUp(dy)); + Cairo.cairo_matrix_init(handle, m11, m12, m21, m22, dx, dy); init(); } @@ -320,7 +320,7 @@ public void scale(float scaleX, float scaleY) { */ public void setElements(float m11, float m12, float m21, float m22, float dx, float dy) { if (isDisposed()) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED); - Cairo.cairo_matrix_init(handle, m11, m12, m21, m22, DPIUtil.autoScaleUp(dx), DPIUtil.autoScaleUp(dy)); + Cairo.cairo_matrix_init(handle, m11, m12, m21, m22, dx, dy); } /** @@ -362,8 +362,8 @@ public void transform(float[] pointArray) { double[] dx = new double[1], dy = new double[1]; int length = pointArray.length / 2; for (int i = 0, j = 0; i < length; i++, j += 2) { - dx[0] = DPIUtil.autoScaleUp(pointArray[j]); - dy[0] = DPIUtil.autoScaleUp(pointArray[j + 1]); + dx[0] = pointArray[j]; + dy[0] = pointArray[j + 1]; Cairo.cairo_matrix_transform_point(handle, dx, dy); pointArray[j] = DPIUtil.autoScaleDown((float)dx[0]); pointArray[j + 1] = DPIUtil.autoScaleDown((float)dy[0]); @@ -383,7 +383,7 @@ public void transform(float[] pointArray) { */ public void translate(float offsetX, float offsetY) { if (isDisposed()) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED); - Cairo.cairo_matrix_translate(handle, DPIUtil.autoScaleUp(offsetX), DPIUtil.autoScaleUp(offsetY)); + Cairo.cairo_matrix_translate(handle, offsetX, offsetY); } /** diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/Device.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/Device.java index 3363ea5ae86..77cf257f985 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/Device.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/Device.java @@ -346,10 +346,6 @@ protected void destroy () { */ public Rectangle getBounds () { checkDevice (); - return DPIUtil.autoScaleDown (getBoundsInPixels ()); -} - -private Rectangle getBoundsInPixels () { return new Rectangle(0, 0, 0, 0); } 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 70632dbc2ca..8c6842bb2c4 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 @@ -343,7 +343,7 @@ void checkGC (int mask) { Cairo.cairo_set_line_join(cairo, join_style); } if ((state & LINE_WIDTH) != 0) { - Cairo.cairo_set_line_width(cairo, data.lineWidth == 0 ? DPIUtil.autoScaleUp(drawable, 1) : data.lineWidth); + Cairo.cairo_set_line_width(cairo, data.lineWidth == 0 ? 1 : data.lineWidth); switch (data.lineStyle) { case SWT.LINE_DOT: case SWT.LINE_DASH: @@ -467,10 +467,6 @@ public void copyArea(Image image, int x, int y) { if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED); if (image == null) SWT.error(SWT.ERROR_NULL_ARGUMENT); if (image.type != SWT.BITMAP || image.isDisposed()) SWT.error(SWT.ERROR_INVALID_ARGUMENT); - Point loc = DPIUtil.autoScaleUp(drawable, new Point(x, y)); - copyAreaInPixels(image, loc.x, loc.y); -} -void copyAreaInPixels(Image image, int x, int y) { long cairo = Cairo.cairo_create(image.surface); if (cairo == 0) SWT.error(SWT.ERROR_NO_HANDLES); Cairo.cairo_translate(cairo, -x, -y); @@ -507,13 +503,7 @@ void copyAreaInPixels(Image image, int x, int y) { */ public void copyArea(int srcX, int srcY, int width, int height, int destX, int destY) { if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED); - Rectangle src = DPIUtil.autoScaleUp(drawable, new Rectangle(srcX, srcY, width, height)); - Point dest = DPIUtil.autoScaleUp(drawable, new Point(destX, destY)); - copyAreaInPixels(src.x, src.y, src.width, src.height, dest.x, dest.y); -} - -void copyAreaInPixels(int srcX, int srcY, int width, int height, int destX, int destY) { - copyAreaInPixels(srcX, srcY, width, height, destX, destY, true); + copyArea(srcX, srcY, width, height, destX, destY, true); } /** * Copies a rectangular area of the receiver at the source @@ -535,11 +525,6 @@ void copyAreaInPixels(int srcX, int srcY, int width, int height, int destX, int */ public void copyArea(int srcX, int srcY, int width, int height, int destX, int destY, boolean paint) { if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED); - Rectangle srcLoc = DPIUtil.autoScaleUp(drawable, new Rectangle(srcX, srcY, width, height)); - Point destLoc = DPIUtil.autoScaleUp(drawable, new Point(destX, destY)); - copyAreaInPixels(srcLoc.x, srcLoc.y, srcLoc.width, srcLoc.height, destLoc.x, destLoc.y, paint); -} -void copyAreaInPixels(int srcX, int srcY, int width, int height, int destX, int destY, boolean paint) { if (width <= 0 || height <= 0) return; int deltaX = destX - srcX, deltaY = destY - srcY; if (deltaX == 0 && deltaY == 0) return; @@ -720,10 +705,6 @@ void destroy() { */ public void drawArc(int x, int y, int width, int height, int startAngle, int arcAngle) { if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED); - Rectangle loc = DPIUtil.autoScaleUp(drawable, new Rectangle(x, y, width, height)); - drawArcInPixels(loc.x, loc.y, loc.width, loc.height, startAngle, arcAngle); -} -void drawArcInPixels(int x, int y, int width, int height, int startAngle, int arcAngle) { checkGC(DRAW); if (width < 0) { x = x + width; @@ -775,10 +756,6 @@ void drawArcInPixels(int x, int y, int width, int height, int startAngle, int ar */ public void drawFocus(int x, int y, int width, int height) { if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED); - Rectangle loc = DPIUtil.autoScaleUp(drawable, new Rectangle(x, y, width, height)); - drawFocusInPixels(loc.x, loc.y, loc.width, loc.height); -} -void drawFocusInPixels(int x, int y, int width, int height) { long cairo = data.cairo; checkGC(FOREGROUND); long context = GTK.gtk_widget_get_style_context(data.device.shellHandle); @@ -808,10 +785,6 @@ public void drawImage(Image image, int x, int y) { if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED); if (image == null) SWT.error(SWT.ERROR_NULL_ARGUMENT); if (image.isDisposed()) SWT.error(SWT.ERROR_INVALID_ARGUMENT); - Point loc = DPIUtil.autoScaleUp(drawable, new Point(x, y)); - drawImageInPixels(image, loc.x, loc.y); -} -void drawImageInPixels(Image image, int x, int y) { drawImage(image, 0, 0, -1, -1, x, y, -1, -1, true); } @@ -855,8 +828,7 @@ public void drawImage(Image image, int srcX, int srcY, int srcWidth, int srcHeig } if (image == null) SWT.error(SWT.ERROR_NULL_ARGUMENT); if (image.isDisposed()) SWT.error(SWT.ERROR_INVALID_ARGUMENT); - Rectangle destRect = DPIUtil.autoScaleUp(drawable, new Rectangle(destX, destY, destWidth, destHeight)); - drawImage(image, srcX, srcY, srcWidth, srcHeight, destRect.x, destRect.y, destRect.width, destRect.height, false); + drawImage(image, srcX, srcY, srcWidth, srcHeight, destX, destY, destWidth, destHeight, false); } void drawImage(Image srcImage, int srcX, int srcY, int srcWidth, int srcHeight, int destX, int destY, int destWidth, int destHeight, boolean simple) { /* Refresh Image as per zoom level, if required. */ @@ -933,11 +905,6 @@ void drawImage(Image srcImage, int srcX, int srcY, int srcWidth, int srcHeight, */ public void drawLine(int x1, int y1, int x2, int y2) { if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED); - Point loc1 = DPIUtil.autoScaleUp(drawable, new Point(x1, y1)); - Point loc2 = DPIUtil.autoScaleUp(drawable, new Point(x2, y2)); - drawLineInPixels(loc1.x, loc1.y, loc2.x, loc2.y); -} -void drawLineInPixels(int x1, int y1, int x2, int y2) { checkGC(DRAW); long cairo = data.cairo; double xOffset = data.cairoXoffset, yOffset = data.cairoYoffset; @@ -972,10 +939,6 @@ void drawLineInPixels(int x1, int y1, int x2, int y2) { */ public void drawOval(int x, int y, int width, int height) { if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED); - Rectangle rect = DPIUtil.autoScaleUp(drawable, new Rectangle(x, y, width, height)); - drawOvalInPixels(rect.x, rect.y, rect.width, rect.height); -} -void drawOvalInPixels(int x, int y, int width, int height) { checkGC(DRAW); if (width < 0) { x = x + width; @@ -1059,10 +1022,6 @@ public void drawPath(Path path) { */ public void drawPoint (int x, int y) { if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED); - Point loc = DPIUtil.autoScaleUp(drawable, new Point(x, y)); - drawPointInPixels(loc.x, loc.y); -} -void drawPointInPixels (int x, int y) { checkGC(DRAW); long cairo = data.cairo; Cairo.cairo_rectangle(cairo, x, y, 1, 1); @@ -1089,10 +1048,6 @@ void drawPointInPixels (int x, int y) { public void drawPolygon(int[] pointArray) { if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED); if (pointArray == null) SWT.error(SWT.ERROR_NULL_ARGUMENT); - int [] scaledPointArray = DPIUtil.autoScaleUp(drawable, pointArray); - drawPolygonInPixels(scaledPointArray); -} -void drawPolygonInPixels(int[] pointArray) { checkGC(DRAW); long cairo = data.cairo; drawPolyline(cairo, pointArray, true); @@ -1119,10 +1074,6 @@ void drawPolygonInPixels(int[] pointArray) { public void drawPolyline(int[] pointArray) { if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED); if (pointArray == null) SWT.error(SWT.ERROR_NULL_ARGUMENT); - int [] scaledPointArray = DPIUtil.autoScaleUp(drawable, pointArray); - drawPolylineInPixels(scaledPointArray); -} -void drawPolylineInPixels(int[] pointArray) { checkGC(DRAW); long cairo = data.cairo; drawPolyline(cairo, pointArray, false); @@ -1157,9 +1108,6 @@ void drawPolyline(long cairo, int[] pointArray, boolean close) { */ public void drawRectangle(int x, int y, int width, int height) { if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED); - drawRectangle(new Rectangle(x, y, width, height)); -} -void drawRectangleInPixels(int x, int y, int width, int height) { checkGC(DRAW); if (width < 0) { x = x + width; @@ -1193,10 +1141,7 @@ void drawRectangleInPixels(int x, int y, int width, int height) { */ public void drawRectangle(Rectangle rect) { if (rect == null) SWT.error(SWT.ERROR_NULL_ARGUMENT); - drawRectangleInPixels(DPIUtil.autoScaleUp(drawable, rect)); -} -void drawRectangleInPixels(Rectangle rect) { - drawRectangleInPixels (rect.x, rect.y, rect.width, rect.height); + drawRectangle (rect.x, rect.y, rect.width, rect.height); } /** * Draws the outline of the round-cornered rectangle specified by @@ -1221,11 +1166,6 @@ void drawRectangleInPixels(Rectangle rect) { */ public void drawRoundRectangle(int x, int y, int width, int height, int arcWidth, int arcHeight) { if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED); - Rectangle rect = DPIUtil.autoScaleUp(drawable, new Rectangle(x, y, width, height)); - Point arcSize = DPIUtil.autoScaleUp(drawable, new Point(arcWidth, arcHeight)); - drawRoundRectangleInPixels(rect.x, rect.y, rect.width, rect.height, arcSize.x, arcSize.y); -} -void drawRoundRectangleInPixels(int x, int y, int width, int height, int arcWidth, int arcHeight) { checkGC(DRAW); int nx = x; int ny = y; @@ -1294,9 +1234,6 @@ public void drawString (String string, int x, int y) { drawString (string, x, y, false); } -void drawStringInPixels (String string, int x, int y) { - drawStringInPixels(string, x, y, false); -} /** * Draws the given string, using the receiver's current font and * foreground color. No tab expansion or carriage return processing @@ -1327,12 +1264,7 @@ void drawStringInPixels (String string, int x, int y) { public void drawString(String string, int x, int y, boolean isTransparent) { if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED); if (string == null) SWT.error(SWT.ERROR_NULL_ARGUMENT); - Point loc = DPIUtil.autoScaleUp(drawable, new Point(x, y)); - drawStringInPixels(string, loc.x, loc.y, isTransparent); -} - -void drawStringInPixels(String string, int x, int y, boolean isTransparent) { - drawTextInPixels(string, x, y, isTransparent ? SWT.DRAW_TRANSPARENT : 0); + drawText(string, x, y, isTransparent ? SWT.DRAW_TRANSPARENT : 0); } /** @@ -1360,9 +1292,6 @@ void drawStringInPixels(String string, int x, int y, boolean isTransparent) { public void drawText(String string, int x, int y) { drawText(string, x, y, SWT.DRAW_DELIMITER | SWT.DRAW_TAB); } -void drawTextInPixels(String string, int x, int y) { - drawTextInPixels(string, x, y, SWT.DRAW_DELIMITER | SWT.DRAW_TAB); -} /** * Draws the given string, using the receiver's current font and @@ -1389,13 +1318,9 @@ void drawTextInPixels(String string, int x, int y) { * */ public void drawText(String string, int x, int y, boolean isTransparent) { - Point loc = DPIUtil.autoScaleUp(drawable, new Point (x, y)); - drawTextInPixels(string, loc.x, loc.y, isTransparent); -} -void drawTextInPixels(String string, int x, int y, boolean isTransparent) { int flags = SWT.DRAW_DELIMITER | SWT.DRAW_TAB; if (isTransparent) flags |= SWT.DRAW_TRANSPARENT; - drawTextInPixels(string, x, y, flags); + drawText(string, x, y, flags); } /** @@ -1438,10 +1363,6 @@ void drawTextInPixels(String string, int x, int y, boolean isTransparent) { * */ public void drawText (String string, int x, int y, int flags) { - Point loc = DPIUtil.autoScaleUp(drawable, new Point (x, y)); - drawTextInPixels(string, loc.x, loc.y, flags); -} -void drawTextInPixels (String string, int x, int y, int flags) { if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED); if (string == null) SWT.error(SWT.ERROR_NULL_ARGUMENT); if (string.length() == 0) return; @@ -1524,10 +1445,6 @@ public boolean equals(Object object) { */ public void fillArc(int x, int y, int width, int height, int startAngle, int arcAngle) { if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED); - Rectangle rect = DPIUtil.autoScaleUp(drawable, new Rectangle(x, y, width, height)); - fillArcInPixels(rect.x, rect.y, rect.width, rect.height, startAngle, arcAngle); -} -void fillArcInPixels(int x, int y, int width, int height, int startAngle, int arcAngle) { checkGC(FILL); if (width < 0) { x = x + width; @@ -1583,11 +1500,6 @@ void fillArcInPixels(int x, int y, int width, int height, int startAngle, int ar */ public void fillGradientRectangle(int x, int y, int width, int height, boolean vertical) { if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED); - Rectangle rect = DPIUtil.autoScaleUp(drawable, new Rectangle(x, y, width, height)); - fillGradientRectangleInPixels(rect.x, rect.y, rect.width, rect.height, vertical); -} - -void fillGradientRectangleInPixels(int x, int y, int width, int height, boolean vertical) { if ((width == 0) || (height == 0)) return; /* Rewrite this to use GdkPixbuf */ @@ -1615,22 +1527,14 @@ void fillGradientRectangleInPixels(int x, int y, int width, int height, boolean long cairo = data.cairo; long pattern; - if (DPIUtil.useCairoAutoScale() ) { - /* - * Here the co-ordinates passed are in points for GTK3. - * That means the user is expecting surface to be at - * device scale equal to current scale factor. So need - * to set the device scale to current scale factor - */ - long surface = Cairo.cairo_get_target(cairo); - if (surface != 0) { - float scaleFactor = DPIUtil.getDeviceZoom() / 100f; - Cairo.cairo_surface_set_device_scale(surface, scaleFactor, scaleFactor); - } + long surface = Cairo.cairo_get_target(cairo); + if (surface != 0) { + float scaleFactor = DPIUtil.getDeviceZoom() / 100f; + Cairo.cairo_surface_set_device_scale(surface, scaleFactor, scaleFactor); } if (fromRGB.equals(toRGB)) { - fillRectangleInPixels(x, y, width, height); + fillRectangle(x, y, width, height); return; } @@ -1669,10 +1573,6 @@ void fillGradientRectangleInPixels(int x, int y, int width, int height, boolean */ public void fillOval(int x, int y, int width, int height) { if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED); - Rectangle rect = DPIUtil.autoScaleUp(drawable, new Rectangle(x, y, width, height)); - fillOvalInPixels(rect.x, rect.y, rect.width, rect.height); -} -void fillOvalInPixels(int x, int y, int width, int height) { checkGC(FILL); if (width < 0) { x = x + width; @@ -1754,10 +1654,6 @@ public void fillPath (Path path) { public void fillPolygon(int[] pointArray) { if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED); if (pointArray == null) SWT.error(SWT.ERROR_NULL_ARGUMENT); - int [] scaledPointArray = DPIUtil.autoScaleUp(drawable, pointArray); - fillPolygonInPixels(scaledPointArray); -} -void fillPolygonInPixels(int[] pointArray) { checkGC(FILL); long cairo = data.cairo; drawPolyline(cairo, pointArray, true); @@ -1781,9 +1677,6 @@ void fillPolygonInPixels(int[] pointArray) { */ public void fillRectangle(int x, int y, int width, int height) { if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED); - fillRectangle(new Rectangle(x, y, width, height)); -} -void fillRectangleInPixels(int x, int y, int width, int height) { checkGC(FILL); if (width < 0) { x = x + width; @@ -1820,10 +1713,7 @@ void fillRectangleInPixels(int x, int y, int width, int height) { public void fillRectangle(Rectangle rect) { if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED); if (rect == null) SWT.error(SWT.ERROR_NULL_ARGUMENT); - fillRectangleInPixels(DPIUtil.autoScaleUp(drawable, rect)); -} -void fillRectangleInPixels(Rectangle rect) { - fillRectangleInPixels(rect.x, rect.y, rect.width, rect.height); + fillRectangle(rect.x, rect.y, rect.width, rect.height); } /** @@ -1845,11 +1735,6 @@ void fillRectangleInPixels(Rectangle rect) { */ public void fillRoundRectangle(int x, int y, int width, int height, int arcWidth, int arcHeight) { if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED); - Rectangle rect = DPIUtil.autoScaleUp(drawable, new Rectangle(x, y, width, height)); - Point arcSize = DPIUtil.autoScaleUp(drawable, new Point(arcWidth, arcHeight)); - fillRoundRectangleInPixels(rect.x, rect.y, rect.width, rect.height, arcSize.x, arcSize.y); -} -void fillRoundRectangleInPixels(int x, int y, int width, int height, int arcWidth, int arcHeight) { checkGC(FILL); int nx = x; int ny = y; @@ -1922,7 +1807,7 @@ int fixMnemonic (char [] buffer) { public int getAdvanceWidth(char ch) { if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED); //BOGUS - return stringExtentInPixels(new String(new char[]{ch})).x; + return stringExtent(new String(new char[]{ch})).x; } /** @@ -2053,7 +1938,7 @@ public Pattern getBackgroundPattern() { public int getCharWidth(char ch) { if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED); //BOGUS - return stringExtentInPixels(new String(new char[]{ch})).x; + return stringExtent(new String(new char[]{ch})).x; } /** @@ -2070,9 +1955,6 @@ public int getCharWidth(char ch) { */ public Rectangle getClipping() { if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED); - return DPIUtil.autoScaleDown(drawable, getClippingInPixels()); -} -Rectangle getClippingInPixels() { /* Calculate visible bounds in device space */ int x = 0, y = 0, width = 0, height = 0; int[] w = new int[1], h = new int[1]; @@ -2247,11 +2129,11 @@ public FontMetrics getFontMetrics() { FontMetrics fm = new FontMetrics(); int ascent = OS.pango_font_metrics_get_ascent(metrics); int descent = OS.pango_font_metrics_get_descent(metrics); - int ascentInPoints = DPIUtil.autoScaleDown(drawable, OS.PANGO_PIXELS(ascent)); + int ascentInPoints = OS.PANGO_PIXELS(ascent); fm.ascentInPoints = ascentInPoints; - int heightInPoints = DPIUtil.autoScaleDown(drawable, OS.PANGO_PIXELS(ascent + descent)); + int heightInPoints = OS.PANGO_PIXELS(ascent + descent); fm.descentInPoints = heightInPoints - ascentInPoints; - fm.averageCharWidthInPoints = DPIUtil.autoScaleDown(drawable, OS.PANGO_PIXELS(OS.pango_font_metrics_get_approximate_char_width(metrics))); + fm.averageCharWidthInPoints = OS.PANGO_PIXELS(OS.pango_font_metrics_get_approximate_char_width(metrics)); OS.pango_font_metrics_unref(metrics); return fm; } @@ -2347,11 +2229,6 @@ public int getInterpolation() { */ public LineAttributes getLineAttributes() { if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED); - LineAttributes attributes = getLineAttributesInPixels(); - attributes.width = DPIUtil.autoScaleDown(drawable, attributes.width); - return attributes; -} -LineAttributes getLineAttributesInPixels() { float[] dashes = null; if (data.lineDashes != null) { dashes = new float[data.lineDashes.length]; @@ -2449,9 +2326,6 @@ public int getLineStyle() { */ public int getLineWidth() { if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED); - return (int)DPIUtil.autoScaleDown(drawable, data.lineWidth); -} -int getLineWidthInPixels() { return (int)data.lineWidth; } @@ -3108,9 +2982,6 @@ void setClipping(long clipRgn) { */ public void setClipping(int x, int y, int width, int height) { if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED); - setClippingInPixels(DPIUtil.autoScaleUp(drawable, x), DPIUtil.autoScaleUp(drawable, y), DPIUtil.autoScaleUp(drawable, width), DPIUtil.autoScaleUp(drawable, height)); -} -void setClippingInPixels(int x, int y, int width, int height) { if (width < 0) { x = x + width; width = -width; @@ -3186,13 +3057,10 @@ public void setClipping(Path path) { */ public void setClipping(Rectangle rect) { if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED); - setClippingInPixels(DPIUtil.autoScaleUp(drawable, rect)); -} -void setClippingInPixels(Rectangle rect) { if (rect == null) { resetClipping(); } else { - setClippingInPixels(rect.x, rect.y, rect.width, rect.height); + setClipping(rect.x, rect.y, rect.width, rect.height); } } @@ -3411,10 +3279,7 @@ public void setInterpolation(int interpolation) { public void setLineAttributes(LineAttributes attributes) { if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED); if (attributes == null) SWT.error(SWT.ERROR_NULL_ARGUMENT); - attributes.width = DPIUtil.autoScaleUp(drawable, attributes.width); - setLineAttributesInPixels(attributes); -} -void setLineAttributesInPixels(LineAttributes attributes) { + attributes.width = attributes.width; int mask = 0; float lineWidth = attributes.width; if (lineWidth != data.lineWidth) { @@ -3665,9 +3530,6 @@ public void setLineStyle(int lineStyle) { */ public void setLineWidth(int lineWidth) { if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED); - setLineWidthInPixels(DPIUtil.autoScaleUp(drawable, lineWidth)); -} -void setLineWidthInPixels(int lineWidth) { if (data.lineWidth == lineWidth) return; data.lineWidth = lineWidth; data.state &= ~(LINE_WIDTH | DRAW_OFFSET); @@ -3849,10 +3711,7 @@ public void setXORMode(boolean xor) { * */ public Point stringExtent(String string) { - return DPIUtil.autoScaleDown(drawable, stringExtentInPixels(string)); -} -Point stringExtentInPixels(String string) { - return textExtentInPixels(string, 0); + return textExtent(string, 0); } /** @@ -3875,11 +3734,7 @@ Point stringExtentInPixels(String string) { * */ public Point textExtent(String string) { - return DPIUtil.autoScaleDown(drawable, textExtentInPixels(string)); -} - -Point textExtentInPixels(String string) { - return textExtentInPixels(string, SWT.DRAW_DELIMITER | SWT.DRAW_TAB); + return textExtent(string, SWT.DRAW_DELIMITER | SWT.DRAW_TAB); } /** @@ -3916,9 +3771,6 @@ Point textExtentInPixels(String string) { public Point textExtent(String string, int flags) { if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED); if (string == null) SWT.error(SWT.ERROR_NULL_ARGUMENT); - return DPIUtil.autoScaleDown(drawable, textExtentInPixels(string, flags)); -} -Point textExtentInPixels(String string, int flags) { setString(string, flags); checkGC(FONT); if (data.stringWidth == -1) { 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 6a44fc0c61a..14276c683cc 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 @@ -205,9 +205,8 @@ public final class Image extends Resource implements Drawable { */ public Image(Device device, int width, int height) { super(device); - Point size = DPIUtil.autoScaleUp(new Point(width, height)); currentDeviceZoom = DPIUtil.getDeviceZoom(); - init(size.x, size.y); + init(width, height); init(); } @@ -275,7 +274,7 @@ public Image(Device device, Image srcImage, int flag) { boolean hasAlpha = format == Cairo.CAIRO_FORMAT_ARGB32; surface = Cairo.cairo_image_surface_create(format, width, height); if (surface == 0) SWT.error(SWT.ERROR_NO_HANDLES); - if (DPIUtil.getDeviceZoom() != currentDeviceZoom && DPIUtil.useCairoAutoScale()) { + if (DPIUtil.getDeviceZoom() != currentDeviceZoom) { double scaleFactor = DPIUtil.getDeviceZoom() / 100f; Cairo.cairo_surface_set_device_scale(surface, scaleFactor, scaleFactor); } @@ -383,8 +382,7 @@ public Image(Device device, Rectangle bounds) { super(device); if (bounds == null) SWT.error(SWT.ERROR_NULL_ARGUMENT); currentDeviceZoom = DPIUtil.getDeviceZoom(); - Rectangle bounds1 = DPIUtil.autoScaleUp (bounds); - init(bounds1.width, bounds1.height); + init(bounds.width, bounds.height); init(); } @@ -415,7 +413,6 @@ public Image(Device device, ImageData data) { super(device); if (data == null) SWT.error(SWT.ERROR_NULL_ARGUMENT); currentDeviceZoom = DPIUtil.getDeviceZoom(); - data = DPIUtil.autoScaleUp (device, data); init(data); init(); } @@ -458,8 +455,6 @@ public Image(Device device, ImageData source, ImageData mask) { SWT.error(SWT.ERROR_INVALID_ARGUMENT); } currentDeviceZoom = DPIUtil.getDeviceZoom(); - source = DPIUtil.autoScaleUp (device, source); - mask = DPIUtil.autoScaleUp (device, mask); mask = ImageData.convertMask (mask); ImageData image = new ImageData(source.width, source.height, source.depth, source.palette, source.scanlinePad, source.data); image.maskPad = mask.scanlinePad; @@ -525,7 +520,6 @@ public Image(Device device, InputStream stream) { super(device); ImageData data = new ImageData(stream); currentDeviceZoom = DPIUtil.getDeviceZoom(); - data = DPIUtil.autoScaleUp (device, data); init(data); init(); } @@ -568,7 +562,6 @@ public Image(Device device, String filename) { ImageData data = new ImageData(filename); currentDeviceZoom = DPIUtil.getDeviceZoom(); - data = DPIUtil.autoScaleUp (device, data); init(data); init(); } @@ -722,19 +715,6 @@ boolean refreshImageForZoom () { refreshed = true; currentDeviceZoom = deviceZoomLevel; } - } else { - if (!DPIUtil.useCairoAutoScale()) { - int deviceZoomLevel = deviceZoom; - if (deviceZoomLevel != currentDeviceZoom) { - ImageData data = getImageDataAtCurrentZoom(); - destroy (); - ImageData resizedData = DPIUtil.autoScaleImageData(device, data, deviceZoomLevel, currentDeviceZoom); - init(resizedData); - init(); - refreshed = true; - currentDeviceZoom = deviceZoomLevel; - } - } } return refreshed; } @@ -772,7 +752,7 @@ void createFromPixbuf(int type, long pixbuf) { // Initialize surface with dimensions received from the pixbuf and set device_scale appropriately surface = Cairo.cairo_image_surface_create(format, pixbufWidth, pixbufHeight); if (surface == 0) SWT.error(SWT.ERROR_NO_HANDLES); - if (DPIUtil.useCairoAutoScale()) Cairo.cairo_surface_set_device_scale(surface, scaleFactor, scaleFactor); + Cairo.cairo_surface_set_device_scale(surface, scaleFactor, scaleFactor); long data = Cairo.cairo_image_surface_get_data(surface); int cairoStride = Cairo.cairo_image_surface_get_stride(surface); @@ -946,27 +926,6 @@ public Color getBackground() { * */ public Rectangle getBounds() { - if (isDisposed()) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED); - return DPIUtil.autoScaleDown(getBoundsInPixels()); -} - -/** - * Returns the bounds of the receiver. The rectangle will always - * have x and y values of 0, and the width and height of the - * image in pixels. - * - * @return a rectangle specifying the image's bounds in pixels. - * - * @exception SWTException
1
1