Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNiraj Modi2016-03-09 14:06:49 +0000
committerNiraj Modi2016-03-09 14:06:49 +0000
commite1aa4b1bb6bdfc94af89df37b8b2b08b6edc35e8 (patch)
tree3176bfe2f4e53b3c1621cdac043eed4abfbabd54
parent588516d048ce33ef47cdefcae656fe15460f8105 (diff)
downloadeclipse.platform.swt-e1aa4b1bb6bdfc94af89df37b8b2b08b6edc35e8.tar.gz
eclipse.platform.swt-e1aa4b1bb6bdfc94af89df37b8b2b08b6edc35e8.tar.xz
eclipse.platform.swt-e1aa4b1bb6bdfc94af89df37b8b2b08b6edc35e8.zip
Win32(Part21): Changing API's coordinate system from Pixels to Points.
- Cleanup of *InPixels methods on Windows. Change-Id: I3182a31e58c86c3f7035b8c99a80c6b43a28739d Signed-off-by: Niraj Modi <niraj.modi@in.ibm.com>
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT Theme/win32/org/eclipse/swt/internal/theme/DrawData.java6
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT Theme/win32/org/eclipse/swt/internal/theme/ScaleDrawData.java5
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT Theme/win32/org/eclipse/swt/internal/theme/Theme.java2
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/GC.java208
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Button.java8
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Canvas.java13
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Composite.java2
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Display.java22
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/ExpandItem.java4
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Label.java4
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Link.java4
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Menu.java6
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/MenuItem.java3
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Table.java11
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Tree.java36
15 files changed, 121 insertions, 213 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Theme/win32/org/eclipse/swt/internal/theme/DrawData.java b/bundles/org.eclipse.swt/Eclipse SWT Theme/win32/org/eclipse/swt/internal/theme/DrawData.java
index effb397228..2abf6a11e7 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT Theme/win32/org/eclipse/swt/internal/theme/DrawData.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT Theme/win32/org/eclipse/swt/internal/theme/DrawData.java
@@ -12,6 +12,7 @@ package org.eclipse.swt.internal.theme;
import org.eclipse.swt.*;
import org.eclipse.swt.graphics.*;
+import org.eclipse.swt.internal.*;
import org.eclipse.swt.internal.win32.*;
public class DrawData {
@@ -102,8 +103,9 @@ void drawImage(Theme theme, Image image, GC gc, Rectangle bounds) {
// OS.DrawThemeIcon(hTheme, gc.handle, part[0], part[1], rect, imageList.getHandle(), imageIndex);
// imageList.dispose();
// OS.CloseThemeData(hTheme);
- Rectangle rect = image.getBoundsInPixels();
- gc.drawImageInPixels(image, 0, 0, rect.width, rect.height, bounds.x, bounds.y, bounds.width, bounds.height);
+ Rectangle rect = image.getBounds ();
+ bounds = DPIUtil.autoScaleDown (bounds);
+ gc.drawImage (image, 0, 0, rect.width, rect.height, bounds.x, bounds.y, bounds.width, bounds.height);
}
}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Theme/win32/org/eclipse/swt/internal/theme/ScaleDrawData.java b/bundles/org.eclipse.swt/Eclipse SWT Theme/win32/org/eclipse/swt/internal/theme/ScaleDrawData.java
index 3606d99cb6..b748a7d330 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT Theme/win32/org/eclipse/swt/internal/theme/ScaleDrawData.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT Theme/win32/org/eclipse/swt/internal/theme/ScaleDrawData.java
@@ -12,6 +12,7 @@ package org.eclipse.swt.internal.theme;
import org.eclipse.swt.*;
import org.eclipse.swt.graphics.*;
+import org.eclipse.swt.internal.*;
import org.eclipse.swt.internal.win32.*;
public class ScaleDrawData extends RangeDrawData {
@@ -72,13 +73,13 @@ void draw(Theme theme, GC gc, Rectangle bounds) {
rect.bottom = rect.top + 1;
//TODO - why tics are ot drawn
OS.DrawThemeBackground(hTheme, gc.handle, OS.TKP_TICSVERT, 1, rect, null);
- gc.drawLineInPixels(rect.left, rect.top, rect.right, rect.top);
+ gc.drawLine(DPIUtil.autoScaleDown(rect.left), DPIUtil.autoScaleDown(rect.top), DPIUtil.autoScaleDown(rect.right), DPIUtil.autoScaleDown(rect.top));
rect.left = bounds.x + TICS_MARGIN + thumbWidth + 1;
rect.right = rect.left + ticWidth;
if (sel != minimum && sel != maximum) rect.right--;
//TODO - why tics are ot drawn
OS.DrawThemeBackground(hTheme, gc.handle, OS.TKP_TICSVERT, 1, rect, null);
- gc.drawLineInPixels(rect.left, rect.top, rect.right, rect.top);
+ gc.drawLine (DPIUtil.autoScaleDown(rect.left), DPIUtil.autoScaleDown(rect.top), DPIUtil.autoScaleDown(rect.right), DPIUtil.autoScaleDown(rect.top));
}
} else {
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Theme/win32/org/eclipse/swt/internal/theme/Theme.java b/bundles/org.eclipse.swt/Eclipse SWT Theme/win32/org/eclipse/swt/internal/theme/Theme.java
index 44537af9d6..10a0a9ccc6 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT Theme/win32/org/eclipse/swt/internal/theme/Theme.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT Theme/win32/org/eclipse/swt/internal/theme/Theme.java
@@ -52,7 +52,7 @@ public void drawFocus(GC gc, Rectangle bounds, DrawData data) {
if (bounds == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
if (data == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
if (gc.isDisposed()) SWT.error(SWT.ERROR_INVALID_ARGUMENT);
- gc.drawFocusInPixels(bounds.x, bounds.y, bounds.width, bounds.height);
+ gc.drawFocus(bounds.x, bounds.y, bounds.width, bounds.height);
}
public void drawImage(GC gc, Rectangle bounds, DrawData data, Image image, int flags) {
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 0b9f7d4ddb..c3ae163ac5 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
@@ -450,10 +450,8 @@ public void copyArea (Image image, int x, int y) {
y = DPIUtil.autoScaleUp(y);
copyAreaInPixels(image, x, y);
}
-/**
-* @noreference This method is not intended to be referenced by clients.
-*/
-public void copyAreaInPixels(Image image, int x, int y) {
+
+void copyAreaInPixels(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);
@@ -484,10 +482,8 @@ public void copyAreaInPixels(Image image, int x, int y) {
public void copyArea (int srcX, int srcY, int width, int height, int destX, int destY) {
copyAreaInPixels (srcX, srcY, width, height, destX, destY);
}
-/**
-* @noreference This method is not intended to be referenced by clients.
-*/
-public void copyAreaInPixels(int srcX, int srcY, int width, int height, int destX, int destY) {
+
+void copyAreaInPixels(int srcX, int srcY, int width, int height, int destX, int destY) {
copyAreaInPixels(srcX, srcY, width, height, destX, destY, true);
}
@@ -518,10 +514,8 @@ public void copyArea (int srcX, int srcY, int width, int height, int destX, int
destY = DPIUtil.autoScaleUp(destY);
copyAreaInPixels(srcX, srcY, width, height, destX, destY, paint);
}
-/**
-* @noreference This method is not intended to be referenced by clients.
-*/
-public void copyAreaInPixels(int srcX, int srcY, int width, int height, int destX, int destY, boolean paint) {
+
+void copyAreaInPixels(int srcX, int srcY, int width, int height, int destX, int destY, boolean paint) {
if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
/*
* Feature in WinCE. The function WindowFromDC is not part of the
@@ -759,10 +753,8 @@ public void drawArc (int x, int y, int width, int height, int startAngle, int ar
height = DPIUtil.autoScaleUp(height);
drawArcInPixels(x, y, width, height, startAngle, arcAngle);
}
-/**
-* @noreference This method is not intended to be referenced by clients.
-*/
-public void drawArcInPixels (int x, int y, int width, int height, int startAngle, int arcAngle) {
+
+void drawArcInPixels (int x, int y, int width, int height, int startAngle, int arcAngle) {
if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
checkGC(DRAW);
if (width < 0) {
@@ -867,10 +859,8 @@ public void drawFocus (int x, int y, int width, int height) {
height = DPIUtil.autoScaleUp (height);
drawFocusInPixels(x, y, width, height);
}
-/**
-* @noreference This method is not intended to be referenced by clients.
-*/
-public void drawFocusInPixels (int x, int y, int width, int height) {
+
+void drawFocusInPixels (int x, int y, int width, int height) {
if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
if ((data.uiState & OS.UISF_HIDEFOCUS) != 0) return;
data.focusDrawn = true;
@@ -945,10 +935,8 @@ public void drawImage (Image image, int x, int y) {
y = (y != SWT.DEFAULT ? DPIUtil.autoScaleUp(y) : y);
drawImageInPixels(image, x, y);
}
-/**
-* @noreference This method is not intended to be referenced by clients.
-*/
-public void drawImageInPixels(Image image, int x, int y) {
+
+void drawImageInPixels(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);
@@ -999,10 +987,7 @@ public void drawImage (Image image, int srcX, int srcY, int srcWidth, int srcHei
drawImageInPixels(image, srcX, srcY, srcWidth, srcHeight, destX, destY, destWidth, destHeight);
}
-/**
-* @noreference This method is not intended to be referenced by clients.
-*/
-public void drawImageInPixels(Image image, int srcX, int srcY, int srcWidth, int srcHeight, int destX, int destY, int destWidth, int destHeight) {
+void drawImageInPixels(Image image, int srcX, int srcY, int srcWidth, int srcHeight, int destX, int destY, int destWidth, int destHeight) {
if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
if (srcWidth == 0 || srcHeight == 0 || destWidth == 0 || destHeight == 0) return;
if (srcX < 0 || srcY < 0 || srcWidth < 0 || srcHeight < 0 || destWidth < 0 || destHeight < 0) {
@@ -1762,10 +1747,8 @@ public void drawLine (int x1, int y1, int x2, int y2) {
y2 = DPIUtil.autoScaleUp (y2);
drawLineInPixels(x1, y1, x2, y2);
}
-/**
-* @noreference This method is not intended to be referenced by clients.
-*/
-public void drawLineInPixels (int x1, int y1, int x2, int y2) {
+
+void drawLineInPixels (int x1, int y1, int x2, int y2) {
if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
checkGC(DRAW);
long /*int*/ gdipGraphics = data.gdipGraphics;
@@ -1821,10 +1804,8 @@ public void drawOval (int x, int y, int width, int height) {
height = DPIUtil.autoScaleUp (height);
drawOvalInPixels(x, y, width, height);
}
-/**
-* @noreference This method is not intended to be referenced by clients.
-*/
-public void drawOvalInPixels (int x, int y, int width, int height) {
+
+void drawOvalInPixels (int x, int y, int width, int height) {
if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
checkGC(DRAW);
long /*int*/ gdipGraphics = data.gdipGraphics;
@@ -1897,10 +1878,8 @@ public void drawPoint (int x, int y) {
y = DPIUtil.autoScaleUp (y);
drawPointInPixels(x, y);
}
-/**
-* @noreference This method is not intended to be referenced by clients.
-*/
-public void drawPointInPixels (int x, int y) {
+
+void drawPointInPixels (int x, int y) {
if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
if (data.gdipGraphics != 0) {
checkGC(DRAW);
@@ -1931,10 +1910,7 @@ public void drawPolygon (int[] pointArray) {
drawPolygonInPixels(DPIUtil.autoScaleUp(pointArray));
}
-/**
-* @noreference This method is not intended to be referenced by clients.
-*/
-public void drawPolygonInPixels(int[] pointArray) {
+void drawPolygonInPixels(int[] pointArray) {
if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
if (pointArray == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
checkGC(DRAW);
@@ -1982,10 +1958,8 @@ public void drawPolygonInPixels(int[] pointArray) {
public void drawPolyline (int[] pointArray) {
drawPolylineInPixels(DPIUtil.autoScaleUp(pointArray));
}
-/**
-* @noreference This method is not intended to be referenced by clients.
-*/
-public void drawPolylineInPixels(int[] pointArray) {
+
+void drawPolylineInPixels(int[] pointArray) {
if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
if (pointArray == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
checkGC(DRAW);
@@ -2041,10 +2015,8 @@ public void drawRectangle (int x, int y, int width, int height) {
height = DPIUtil.autoScaleUp (height);
drawRectangleInPixels(x, y, width, height);
}
-/**
-* @noreference This method is not intended to be referenced by clients.
-*/
-public void drawRectangleInPixels (int x, int y, int width, int height) {
+
+void drawRectangleInPixels (int x, int y, int width, int height) {
if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
checkGC(DRAW);
long /*int*/ gdipGraphics = data.gdipGraphics;
@@ -2095,15 +2067,9 @@ public void drawRectangleInPixels (int x, int y, int width, int height) {
* </ul>
*/
public void drawRectangle (Rectangle rect) {
- rect = DPIUtil.autoScaleUp(rect);
- drawRectangleInPixels(rect);
-}
-/**
-* @noreference This method is not intended to be referenced by clients.
-*/
-public void drawRectangleInPixels (Rectangle rect) {
if (rect == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
- drawRectangleInPixels (rect.x, rect.y, rect.width, rect.height);
+ rect = DPIUtil.autoScaleUp(rect);
+ drawRectangleInPixels(rect.x, rect.y, rect.width, rect.height);
}
/**
@@ -2136,10 +2102,8 @@ public void drawRoundRectangle (int x, int y, int width, int height, int arcWidt
arcHeight = DPIUtil.autoScaleUp (arcHeight);
drawRoundRectangleInPixels(x, y, width, height, arcWidth, arcHeight);
}
-/**
-* @noreference This method is not intended to be referenced by clients.
-*/
-public void drawRoundRectangleInPixels (int x, int y, int width, int height, int arcWidth, int arcHeight) {
+
+void drawRoundRectangleInPixels (int x, int y, int width, int height, int arcWidth, int arcHeight) {
if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
checkGC(DRAW);
if (data.gdipGraphics != 0) {
@@ -2267,10 +2231,8 @@ public void drawString (String string, int x, int y) {
y = DPIUtil.autoScaleUp(y);
drawStringInPixels(string, x, y);
}
-/**
-* @noreference This method is not intended to be referenced by clients.
-*/
-public void drawStringInPixels (String string, int x, int y) {
+
+void drawStringInPixels (String string, int x, int y) {
drawStringInPixels(string, x, y, false);
}
@@ -2300,10 +2262,7 @@ public void drawString (String string, int x, int y, boolean isTransparent) {
drawStringInPixels(string, x, y, isTransparent);
}
-/**
-* @noreference This method is not intended to be referenced by clients.
-*/
-public void drawStringInPixels (String string, int x, int y, boolean isTransparent) {
+void drawStringInPixels (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);
// TCHAR buffer = new TCHAR (getCodePage(), string, false);
@@ -2399,10 +2358,7 @@ public void drawText (String string, int x, int y) {
drawTextInPixels(string, x, y);
}
-/**
-* @noreference This method is not intended to be referenced by clients.
-*/
-public void drawTextInPixels (String string, int x, int y) {
+void drawTextInPixels (String string, int x, int y) {
drawTextInPixels(string, x, y, SWT.DRAW_DELIMITER | SWT.DRAW_TAB);
}
@@ -2431,10 +2387,8 @@ public void drawText (String string, int x, int y, boolean isTransparent) {
y = DPIUtil.autoScaleUp(y);
drawTextInPixels(string, x, y, isTransparent);
}
-/**
-* @noreference This method is not intended to be referenced by clients.
-*/
-public void drawTextInPixels (String string, int x, int y, boolean 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);
@@ -2480,10 +2434,7 @@ public void drawText (String string, int x, int y, int flags) {
drawTextInPixels(string, x, y, flags);
}
-/**
-* @noreference This method is not intended to be referenced by clients.
-*/
-public void drawTextInPixels (String string, int x, int y, int 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;
@@ -2885,10 +2836,8 @@ public void fillArc (int x, int y, int width, int height, int startAngle, int ar
height = DPIUtil.autoScaleUp (height);
fillArcInPixels(x, y, width, height, startAngle, arcAngle);
}
-/**
-* @noreference This method is not intended to be referenced by clients.
-*/
-public void fillArcInPixels (int x, int y, int width, int height, int startAngle, int arcAngle) {
+
+void fillArcInPixels (int x, int y, int width, int height, int startAngle, int arcAngle) {
if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
checkGC(FILL);
if (width < 0) {
@@ -2996,10 +2945,8 @@ public void fillGradientRectangle (int x, int y, int width, int height, boolean
height = DPIUtil.autoScaleUp (height);
fillGradientRectangleInPixels(x, y, width, height, vertical);
}
-/**
-* @noreference This method is not intended to be referenced by clients.
-*/
-public void fillGradientRectangleInPixels(int x, int y, int width, int height, boolean vertical) {
+
+void fillGradientRectangleInPixels(int x, int y, int width, int height, boolean vertical) {
if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
if (width == 0 || height == 0) return;
@@ -3132,10 +3079,8 @@ public void fillOval (int x, int y, int width, int height) {
height = DPIUtil.autoScaleUp (height);
fillOvalInPixels(x, y, width, height);
}
-/**
-* @noreference This method is not intended to be referenced by clients.
-*/
-public void fillOvalInPixels (int x, int y, int width, int height) {
+
+void fillOvalInPixels (int x, int y, int width, int height) {
if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
checkGC(FILL);
if (data.gdipGraphics != 0) {
@@ -3202,10 +3147,8 @@ public void fillPath (Path path) {
public void fillPolygon (int[] pointArray) {
fillPolygonInPixels(DPIUtil.autoScaleUp(pointArray));
}
-/**
-* @noreference This method is not intended to be referenced by clients.
-*/
-public void fillPolygonInPixels (int[] pointArray) {
+
+void fillPolygonInPixels (int[] pointArray) {
if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
if (pointArray == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
checkGC(FILL);
@@ -3249,10 +3192,8 @@ public void fillRectangle (int x, int y, int width, int height) {
height = DPIUtil.autoScaleUp (height);
fillRectangleInPixels(x, y, width, height);
}
-/**
-* @noreference This method is not intended to be referenced by clients.
-*/
-public void fillRectangleInPixels (int x, int y, int width, int height) {
+
+void fillRectangleInPixels (int x, int y, int width, int height) {
if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
checkGC(FILL);
if (data.gdipGraphics != 0) {
@@ -3297,10 +3238,8 @@ public void fillRectangle (Rectangle rect) {
rect = DPIUtil.autoScaleUp(rect);
fillRectangleInPixels(rect);
}
-/**
-* @noreference This method is not intended to be referenced by clients.
-*/
-public void fillRectangleInPixels (Rectangle rect) {
+
+void fillRectangleInPixels (Rectangle rect) {
if (rect == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
fillRectangleInPixels (rect.x, rect.y, rect.width, rect.height);
}
@@ -3331,10 +3270,8 @@ public void fillRoundRectangle (int x, int y, int width, int height, int arcWidt
arcHeight = DPIUtil.autoScaleUp (arcHeight);
fillRoundRectangleInPixels(x, y, width, height, arcWidth, arcHeight);
}
-/**
-* @noreference This method is not intended to be referenced by clients.
-*/
-public void fillRoundRectangleInPixels (int x, int y, int width, int height, int arcWidth, int arcHeight) {
+
+void fillRoundRectangleInPixels (int x, int y, int width, int height, int arcWidth, int arcHeight) {
if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
checkGC(FILL);
if (data.gdipGraphics != 0) {
@@ -3608,10 +3545,8 @@ public int getCharWidth(char ch) {
public Rectangle getClipping () {
return DPIUtil.autoScaleDown(getClippingInPixels());
}
-/**
-* @noreference This method is not intended to be referenced by clients.
-*/
-public Rectangle getClippingInPixels() {
+
+Rectangle getClippingInPixels() {
if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
long /*int*/ gdipGraphics = data.gdipGraphics;
if (gdipGraphics != 0) {
@@ -3987,10 +3922,8 @@ public int getLineStyle() {
public int getLineWidth () {
return DPIUtil.autoScaleDown(getLineWidthInPixels());
}
-/**
-* @noreference This method is not intended to be referenced by clients.
-*/
-public int getLineWidthInPixels() {
+
+int getLineWidthInPixels() {
if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
return (int)data.lineWidth;
}
@@ -4557,10 +4490,8 @@ public void setClipping (int x, int y, int width, int height) {
height = DPIUtil.autoScaleUp(height);
setClippingInPixels(x, y, width, height);
}
-/**
-* @noreference This method is not intended to be referenced by clients.
-*/
-public void setClippingInPixels (int x, int y, int width, int height) {
+
+void setClippingInPixels (int x, int y, int width, int height) {
if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
long /*int*/ hRgn = OS.CreateRectRgn(x, y, x + width, y + height);
setClipping(hRgn);
@@ -4622,10 +4553,8 @@ public void setClipping (Rectangle rect) {
rect = DPIUtil.autoScaleUp(rect);
setClippingInPixels(rect);
}
-/**
-* @noreference This method is not intended to be referenced by clients.
-*/
-public void setClippingInPixels (Rectangle rect) {
+
+void setClippingInPixels (Rectangle rect) {
if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
if (rect == null) {
setClipping(0);
@@ -5088,10 +5017,8 @@ public void setLineWidth(int lineWidth) {
lineWidth = DPIUtil.autoScaleUp (lineWidth);
setLineWidthInPixels(lineWidth);
}
-/**
-* @noreference This method is not intended to be referenced by clients.
-*/
-public void setLineWidthInPixels(int lineWidth) {
+
+void setLineWidthInPixels(int lineWidth) {
if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
if (data.lineWidth == lineWidth) return;
data.lineWidth = lineWidth;
@@ -5242,10 +5169,8 @@ public void setTransform(Transform transform) {
public Point stringExtent (String string) {
return DPIUtil.autoScaleDown(stringExtentInPixels(string));
}
-/**
-* @noreference This method is not intended to be referenced by clients.
-*/
-public Point stringExtentInPixels (String string) {
+
+Point stringExtentInPixels (String string) {
if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
if (string == null) SWT.error (SWT.ERROR_NULL_ARGUMENT);
checkGC(FONT);
@@ -5292,10 +5217,8 @@ public Point stringExtentInPixels (String string) {
public Point textExtent (String string) {
return DPIUtil.autoScaleDown(textExtentInPixels(string));
}
-/**
-* @noreference This method is not intended to be referenced by clients.
-*/
-public Point textExtentInPixels(String string) {
+
+Point textExtentInPixels(String string) {
return textExtentInPixels(string, SWT.DRAW_DELIMITER | SWT.DRAW_TAB);
}
@@ -5334,10 +5257,7 @@ public Point textExtent (String string, int flags) {
return DPIUtil.autoScaleDown(textExtentInPixels(string, flags));
}
-/**
-* @noreference This method is not intended to be referenced by clients.
-*/
-public Point textExtentInPixels(String string, int flags) {
+Point textExtentInPixels(String string, int flags) {
if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
if (string == null) SWT.error (SWT.ERROR_NULL_ARGUMENT);
checkGC(FONT);
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Button.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Button.java
index 285d41eeef..aba6517576 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Button.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Button.java
@@ -168,8 +168,8 @@ void _setImage (Image image) {
if (image != null) {
switch (image.type) {
case SWT.BITMAP: {
- Rectangle rect = image.getBoundsInPixels ();
- ImageData data = image.getImageDataAtCurrentZoom ();
+ Rectangle rect = image.getBounds ();
+ ImageData data = image.getImageData ();
switch (data.getTransparencyType ()) {
case SWT.TRANSPARENCY_PIXEL:
if (rect.width <= ICON_WIDTH && rect.height <= ICON_HEIGHT) {
@@ -184,8 +184,8 @@ void _setImage (Image image) {
image2 = new Image (display, rect.width, rect.height);
GC gc = new GC (image2);
gc.setBackground (getBackground ());
- gc.fillRectangleInPixels (rect);
- gc.drawImageInPixels (image, 0, 0);
+ gc.fillRectangle (rect);
+ gc.drawImage (image, 0, 0);
gc.dispose ();
hImage = image2.handle;
imageBits = OS.BS_BITMAP;
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Canvas.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Canvas.java
index 972d92f17b..ebb147a04b 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Canvas.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Canvas.java
@@ -115,13 +115,6 @@ public void drawBackground (GC gc, int x, int y, int width, int height) {
y = DPIUtil.autoScaleUp(y);
width = DPIUtil.autoScaleUp(width);
height = DPIUtil.autoScaleUp(height);
- drawBackgroundInPixels(gc, x, y, width, height);
-}
-
-/**
-* @noreference This method is not intended to be referenced by clients.
-*/
-public void drawBackgroundInPixels (GC gc, int x, int y, int width, int height) {
drawBackgroundInPixels(gc, x, y, width, height, 0, 0);
}
@@ -216,10 +209,8 @@ public void scroll (int destX, int destY, int x, int y, int width, int height, b
height = DPIUtil.autoScaleUp(height);
scrollInPixels(destX, destY, x, y, width, height, all);
}
-/**
-* @noreference This method is not intended to be referenced by clients.
-*/
-public void scrollInPixels (int destX, int destY, int x, int y, int width, int height, boolean all) {
+
+void scrollInPixels (int destX, int destY, int x, int y, int width, int height, boolean all) {
checkWidget ();
forceResize ();
boolean isFocus = caret != null && caret.isFocusCaret ();
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Composite.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Composite.java
index 9a2ed8d4cc..4ddebda353 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Composite.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Composite.java
@@ -1687,7 +1687,7 @@ LRESULT WM_PAINT (long /*int*/ wParam, long /*int*/ lParam) {
if (gcData.focusDrawn && !isDisposed ()) updateUIState ();
}
gc.dispose();
- if (!isDisposed ()) paintGC.drawImageInPixels (image, ps.left, ps.top);
+ if (!isDisposed ()) paintGC.drawImage (image, DPIUtil.autoScaleDown(ps.left), DPIUtil.autoScaleDown(ps.top));
image.dispose ();
gc = paintGC;
}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Display.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Display.java
index 8118628000..ad69757b07 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Display.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Display.java
@@ -1664,10 +1664,7 @@ public Point getCursorLocation () {
return DPIUtil.autoScaleDown(getCursorLocationInPixels());
}
-/**
-* @noreference This method is not intended to be referenced by clients.
-*/
-public Point getCursorLocationInPixels () {
+Point getCursorLocationInPixels () {
POINT pt = new POINT ();
OS.GetCursorPos (pt);
return new Point (pt.x, pt.y);
@@ -2283,13 +2280,13 @@ Image getSortImage (int direction) {
upArrow = new Image (this, imageData);
GC gc = new GC (upArrow);
gc.setBackground (c3);
- gc.fillRectangleInPixels (0, 0, 8, 8);
+ gc.fillRectangle (0, 0, 8, 8);
gc.setForeground (c1);
int [] line1 = new int [] {0,6, 1,6, 1,4, 2,4, 2,2, 3,2, 3,1};
- gc.drawPolylineInPixels (line1);
+ gc.drawPolyline (line1);
gc.setForeground (c2);
int [] line2 = new int [] {0,7, 7,7, 7,6, 6,6, 6,4, 5,4, 5,2, 4,2, 4,1};
- gc.drawPolylineInPixels (line2);
+ gc.drawPolyline (line2);
gc.dispose ();
return upArrow;
}
@@ -2304,13 +2301,13 @@ Image getSortImage (int direction) {
downArrow = new Image (this, imageData);
GC gc = new GC (downArrow);
gc.setBackground (c3);
- gc.fillRectangleInPixels (0, 0, 8, 8);
+ gc.fillRectangle (0, 0, 8, 8);
gc.setForeground (c1);
int [] line1 = new int [] {7,0, 0,0, 0,1, 1,1, 1,3, 2,3, 2,5, 3,5, 3,6};
- gc.drawPolylineInPixels (line1);
+ gc.drawPolyline (line1);
gc.setForeground (c2);
int [] line2 = new int [] {4,6, 4,5, 5,5, 5,3, 6,3, 6,1, 7,1};
- gc.drawPolylineInPixels (line2);
+ gc.drawPolyline (line2);
gc.dispose ();
return downArrow;
}
@@ -2965,10 +2962,7 @@ public Point map (Control from, Control to, Point point) {
return DPIUtil.autoScaleDown(mapInPixels(from, to, point));
}
-/**
-* @noreference This method is not intended to be referenced by clients.
-*/
-public Point mapInPixels (Control from, Control to, Point point) {
+Point mapInPixels (Control from, Control to, Point point) {
return mapInPixels (from, to, point.x, point.y);
}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/ExpandItem.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/ExpandItem.java
index 4b25b7a2a3..d4865e51d3 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/ExpandItem.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/ExpandItem.java
@@ -190,9 +190,9 @@ void drawItem (GC gc, long /*int*/ hTheme, RECT clipRect, boolean drawFocus) {
if (image != null) {
rect.left += ExpandItem.TEXT_INSET;
if (imageHeight > headerHeight) {
- gc.drawImageInPixels (image, rect.left, rect.top + headerHeight - imageHeight);
+ gc.drawImage (image, DPIUtil.autoScaleDown(rect.left), DPIUtil.autoScaleDown(rect.top + headerHeight - imageHeight));
} else {
- gc.drawImageInPixels (image, rect.left, rect.top + (headerHeight - imageHeight) / 2);
+ gc.drawImage (image, DPIUtil.autoScaleDown(rect.left), DPIUtil.autoScaleDown(rect.top + (headerHeight - imageHeight) / 2));
}
rect.left += imageWidth;
}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Label.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Label.java
index 49041cd909..fa1826b167 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Label.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Label.java
@@ -619,7 +619,7 @@ LRESULT WM_PAINT (long /*int*/ wParam, long /*int*/ lParam) {
x = Math.max (0, (clientRect.right - imageBounds.width));
}
}
- gc.drawImageInPixels (image, x, Math.max (0, (clientRect.bottom - imageBounds.height) / 2));
+ gc.drawImage (image, DPIUtil.autoScaleDown(x), DPIUtil.autoScaleDown(Math.max (0, (clientRect.bottom - imageBounds.height) / 2)));
result = LRESULT.ONE;
}
int width = ps.right - ps.left;
@@ -703,7 +703,7 @@ LRESULT wmDrawChild (long /*int*/ wParam, long /*int*/ lParam) {
data.device = display;
GC gc = GC.win32_new (struct.hDC, data);
Image image = getEnabled () ? this.image : new Image (display, this.image, SWT.IMAGE_DISABLE);
- gc.drawImageInPixels (image, x, Math.max (0, (height - imageHeight) / 2));
+ gc.drawImage (image, DPIUtil.autoScaleDown(x), DPIUtil.autoScaleDown(Math.max (0, (height - imageHeight) / 2)));
if (image != this.image) image.dispose ();
gc.dispose ();
x += imageWidth + margin;
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Link.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Link.java
index c3bfec86f3..5fe47f29e3 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Link.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Link.java
@@ -275,8 +275,8 @@ void drawWidget (GC gc, RECT rect) {
if (hasFocus () && focusIndex != -1) {
Rectangle [] rects = getRectangles (focusIndex);
for (int i = 0; i < rects.length; i++) {
- Rectangle rectangle = rects [i];
- gc.drawFocusInPixels (rectangle.x, rectangle.y, rectangle.width, rectangle.height);
+ Rectangle rectangle = DPIUtil.autoScaleDown(rects [i]);
+ gc.drawFocus (rectangle.x, rectangle.y, rectangle.width, rectangle.height);
}
}
if (hooks (SWT.Paint) || filters (SWT.Paint)) {
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Menu.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Menu.java
index e4935b6253..a08c092caf 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Menu.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Menu.java
@@ -1448,10 +1448,8 @@ public void setLocation (int x, int y) {
checkWidget ();
setLocationInPixels(DPIUtil.autoScaleUp(x), DPIUtil.autoScaleUp(y));
}
-/**
-* @noreference This method is not intended to be referenced by clients.
-*/
-public void setLocationInPixels (int x, int y) {
+
+void setLocationInPixels (int x, int y) {
if ((style & (SWT.BAR | SWT.DROP_DOWN)) != 0) return;
this.x = x;
this.y = y;
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/MenuItem.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/MenuItem.java
index 687e80bf6d..fc7eb8f7ab 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/MenuItem.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/MenuItem.java
@@ -14,6 +14,7 @@ package org.eclipse.swt.widgets;
import org.eclipse.swt.*;
import org.eclipse.swt.events.*;
import org.eclipse.swt.graphics.*;
+import org.eclipse.swt.internal.*;
import org.eclipse.swt.internal.win32.*;
/**
@@ -1278,7 +1279,7 @@ LRESULT wmDrawChild (long /*int*/ wParam, long /*int*/ lParam) {
*/
int x = (parent.style & SWT.BAR) != 0 ? MARGIN_WIDTH * 2 : struct.left;
Image image = getEnabled () ? this.image : new Image (display, this.image, SWT.IMAGE_DISABLE);
- gc.drawImageInPixels (image, x, struct.top + MARGIN_HEIGHT);
+ gc.drawImage (image, DPIUtil.autoScaleDown(x), DPIUtil.autoScaleDown(struct.top + MARGIN_HEIGHT));
if (this.image != image) image.dispose ();
gc.dispose ();
}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Table.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Table.java
index eac3f342e2..7fa3897981 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Table.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Table.java
@@ -3650,9 +3650,9 @@ void sendEraseItemEvent (TableItem item, NMLVCUSTOMDRAW nmcd, long /*int*/ lPara
if (drawHot) event.detail |= SWT.HOT;
if (drawSelected) event.detail |= SWT.SELECTED;
if (drawBackground) event.detail |= SWT.BACKGROUND;
- Rectangle boundsInPixels = new Rectangle(cellRect.left, cellRect.top, cellRect.right - cellRect.left, cellRect.bottom - cellRect.top);
- event.setBoundsInPixels(boundsInPixels);
- gc.setClippingInPixels (boundsInPixels);
+ Rectangle boundsInPixels = new Rectangle (cellRect.left, cellRect.top, cellRect.right - cellRect.left, cellRect.bottom - cellRect.top);
+ event.setBoundsInPixels (boundsInPixels);
+ gc.setClipping (DPIUtil.autoScaleDown(boundsInPixels));
sendEvent (SWT.EraseItem, event);
event.gc = null;
int clrSelectionText = data.foreground;
@@ -4101,7 +4101,7 @@ void sendPaintItemEvent (TableItem item, NMLVCUSTOMDRAW nmcd) {
RECT cellRect = item.getBounds ((int)/*64*/nmcd.dwItemSpec, nmcd.iSubItem, true, true, true, true, hDC);
int cellWidth = cellRect.right - cellRect.left;
int cellHeight = cellRect.bottom - cellRect.top;
- gc.setClippingInPixels (cellRect.left, cellRect.top, cellWidth, cellHeight);
+ gc.setClipping (DPIUtil.autoScaleDown(new Rectangle (cellRect.left, cellRect.top, cellWidth, cellHeight)));
sendEvent (SWT.PaintItem, event);
if (data.focusDrawn) focusRect = null;
event.gc = null;
@@ -7517,7 +7517,8 @@ LRESULT wmNotifyToolTip (NMTTCUSTOMDRAW nmcd, long /*int*/ lParam) {
if (!OS.IsWinCE && OS.WIN32_VERSION >= OS.VERSION (6, 0)) {
y = y + Math.max (0, (imageRect.bottom - imageRect.top - size.y) / 2);
}
- gc.drawImageInPixels (image, rect.x, rect.y, rect.width, rect.height, x, y, size.x, size.y);
+ rect = DPIUtil.autoScaleDown(rect);
+ gc.drawImage (image, rect.x, rect.y, rect.width, rect.height, DPIUtil.autoScaleDown(x), DPIUtil.autoScaleDown(y), DPIUtil.autoScaleDown(size.x), DPIUtil.autoScaleDown(size.y));
x += size.x + INSET + (pinfo.iSubItem == 0 ? -2 : 4);
} else {
x += INSET + 2;
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Tree.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Tree.java
index 3a15cc0c89..174c572fa4 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Tree.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Tree.java
@@ -525,15 +525,15 @@ LRESULT CDDS_ITEMPOSTPAINT (NMTVCUSTOMDRAW nmcd, long /*int*/ wParam, long /*int
if (images != null) image = images [index];
}
if (image != null) {
- Rectangle bounds = image.getBoundsInPixels ();
- if (size == null) size = getImageSize ();
+ Rectangle bounds = image.getBounds (); // Points
+ if (size == null) size = DPIUtil.autoScaleDown (getImageSize ()); // To Points
if (!ignoreDrawForeground) {
GCData data = new GCData();
data.device = display;
GC gc = GC.win32_new (hDC, data);
- RECT iconRect = item.getBounds (index, false, true, false, false, true, hDC);
- gc.setClippingInPixels (iconRect.left, iconRect.top, iconRect.right - iconRect.left, iconRect.bottom - iconRect.top);
- gc.drawImageInPixels (image, 0, 0, bounds.width, bounds.height, iconRect.left, iconRect.top, size.x, size.y);
+ RECT iconRect = item.getBounds (index, false, true, false, false, true, hDC); // Pixels
+ gc.setClipping (DPIUtil.autoScaleDown(new Rectangle(iconRect.left, iconRect.top, iconRect.right - iconRect.left, iconRect.bottom - iconRect.top)));
+ gc.drawImage (image, 0, 0, bounds.width, bounds.height, DPIUtil.autoScaleDown(iconRect.left), DPIUtil.autoScaleDown(iconRect.top), size.x, size.y);
OS.SelectClipRgn (hDC, 0);
gc.dispose ();
}
@@ -648,9 +648,9 @@ LRESULT CDDS_ITEMPOSTPAINT (NMTVCUSTOMDRAW nmcd, long /*int*/ wParam, long /*int
}
}
}
- Rectangle boundsInPixels = new Rectangle(cellRect.left, cellRect.top, cellRect.right - cellRect.left, cellRect.bottom - cellRect.top);
- event.setBoundsInPixels(boundsInPixels);
- gc.setClippingInPixels (boundsInPixels);
+ Rectangle boundsInPixels = new Rectangle (cellRect.left, cellRect.top, cellRect.right - cellRect.left, cellRect.bottom - cellRect.top);
+ event.setBoundsInPixels (boundsInPixels);
+ gc.setClipping (DPIUtil.autoScaleDown (boundsInPixels));
sendEvent (SWT.EraseItem, event);
event.gc = null;
int newTextClr = data.foreground;
@@ -763,8 +763,8 @@ LRESULT CDDS_ITEMPOSTPAINT (NMTVCUSTOMDRAW nmcd, long /*int*/ wParam, long /*int
int inset = i != 0 ? INSET : 0;
int offset = i != 0 ? INSET : INSET + 2;
if (image != null) {
- Rectangle bounds = image.getBoundsInPixels ();
- if (size == null) size = getImageSize ();
+ Rectangle bounds = image.getBounds (); // Points
+ if (size == null) size = DPIUtil.autoScaleDown (getImageSize ()); // To Points
if (!ignoreDrawForeground) {
//int y1 = rect.top + (index == 0 ? (getItemHeight () - size.y) / 2 : 0);
int y1 = rect.top;
@@ -772,8 +772,8 @@ LRESULT CDDS_ITEMPOSTPAINT (NMTVCUSTOMDRAW nmcd, long /*int*/ wParam, long /*int
GCData data = new GCData();
data.device = display;
GC gc = GC.win32_new (hDC, data);
- gc.setClippingInPixels (x1, rect.top, rect.right - x1, rect.bottom - rect.top);
- gc.drawImageInPixels (image, 0, 0, bounds.width, bounds.height, x1, y1, size.x, size.y);
+ gc.setClipping (DPIUtil.autoScaleDown(new Rectangle(x1, rect.top, rect.right - x1, rect.bottom - rect.top)));
+ gc.drawImage (image, 0, 0, bounds.width, bounds.height, DPIUtil.autoScaleDown(x1), DPIUtil.autoScaleDown(y1), size.x, size.y);
OS.SelectClipRgn (hDC, 0);
gc.dispose ();
}
@@ -867,7 +867,7 @@ LRESULT CDDS_ITEMPOSTPAINT (NMTVCUSTOMDRAW nmcd, long /*int*/ wParam, long /*int
RECT cellRect = item.getBounds (index, true, true, true, true, true, hDC);
int cellWidth = cellRect.right - cellRect.left;
int cellHeight = cellRect.bottom - cellRect.top;
- gc.setClippingInPixels (cellRect.left, cellRect.top, cellWidth, cellHeight);
+ gc.setClipping (DPIUtil.autoScaleDown(new Rectangle(cellRect.left, cellRect.top, cellWidth, cellHeight)));
sendEvent (SWT.PaintItem, event);
if (data.focusDrawn) focusRect = null;
event.gc = null;
@@ -1052,9 +1052,9 @@ LRESULT CDDS_ITEMPREPAINT (NMTVCUSTOMDRAW nmcd, long /*int*/ wParam, long /*int*
}
}
}
- Rectangle boundsInPixels2 = new Rectangle(cellRect.left, cellRect.top, cellRect.right - cellRect.left, cellRect.bottom - cellRect.top);
- event.setBoundsInPixels(boundsInPixels2);
- gc.setClippingInPixels (boundsInPixels2);
+ Rectangle boundsInPixels2 = new Rectangle (cellRect.left, cellRect.top, cellRect.right - cellRect.left, cellRect.bottom - cellRect.top);
+ event.setBoundsInPixels (boundsInPixels2);
+ gc.setClipping (DPIUtil.autoScaleDown (boundsInPixels2));
sendEvent (SWT.EraseItem, event);
event.gc = null;
int newTextClr = data.foreground;
@@ -8110,8 +8110,8 @@ LRESULT wmNotifyToolTip (NMTTCUSTOMDRAW nmcd, long /*int*/ lParam) {
RECT imageRect = item [0].getBounds (index [0], false, true, false, false, false, hDC);
if (imageList == null) size.x = imageRect.right - imageRect.left;
if (image != null) {
- Rectangle rect = image.getBoundsInPixels ();
- gc.drawImageInPixels (image, rect.x, rect.y, rect.width, rect.height, x, imageRect.top, size.x, size.y);
+ Rectangle rect = image.getBounds (); // Points
+ gc.drawImage (image, rect.x, rect.y, rect.width, rect.height, DPIUtil.autoScaleDown(x), DPIUtil.autoScaleDown(imageRect.top), DPIUtil.autoScaleDown(size.x), DPIUtil.autoScaleDown(size.y));
x += INSET + (index [0] == 0 ? 1 : 0);
}
x += size.x;

Back to the top