Skip to content

Commit 0fe94e9

Browse files
Replacing the usage of getBoundsInPixels with getBounds
initial native image must be the one that will be used by a widget, thats why using getBounds with initialNativeZoom
1 parent 85c26ca commit 0fe94e9

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/GC.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -466,7 +466,7 @@ void copyAreaInPixels(Image image, int x, int y) {
466466
if (image == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
467467
if (image.type != SWT.BITMAP || image.isDisposed()) SWT.error(SWT.ERROR_INVALID_ARGUMENT);
468468
/* Copy the bitmap area */
469-
Rectangle rect = image.getBoundsInPixels();
469+
Rectangle rect = image.getBounds(data.nativeZoom);
470470
long memHdc = OS.CreateCompatibleDC(handle);
471471
long hOldBitmap = OS.SelectObject(memHdc, Image.win32_getHandle(image, getZoom()));
472472
OS.BitBlt(memHdc, 0, 0, rect.width, rect.height, handle, x, y, OS.SRCCOPY);

bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/Image.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -252,13 +252,13 @@ public Image(Device device, Image srcImage, int flag) {
252252
device = this.device;
253253
if (srcImage == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
254254
if (srcImage.isDisposed()) SWT.error(SWT.ERROR_INVALID_ARGUMENT);
255-
Rectangle rect = srcImage.getBoundsInPixels();
256255
this.type = srcImage.type;
257256
this.imageDataProvider = srcImage.imageDataProvider;
258257
this.imageFileNameProvider = srcImage.imageFileNameProvider;
259258
this.styleFlag = srcImage.styleFlag | flag;
260259
initialNativeZoom = srcImage.initialNativeZoom;
261260
this.dataAtBaseZoom = srcImage.dataAtBaseZoom;
261+
Rectangle rect = srcImage.getBounds(initialNativeZoom);
262262
switch (flag) {
263263
case SWT.IMAGE_COPY: {
264264
switch (type) {

bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Table.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7293,7 +7293,7 @@ LRESULT wmNotifyToolTip (NMTTCUSTOMDRAW nmcd, long lParam) {
72937293
if (pinfo.iSubItem != 0) x -= gridWidth;
72947294
Image image = item.getImage (pinfo.iSubItem);
72957295
if (image != null) {
7296-
Rectangle rect = image.getBoundsInPixels ();
7296+
Rectangle rect = image.getBoundsInPixels();
72977297
RECT imageRect = item.getBounds (pinfo.iItem, pinfo.iSubItem, false, true, false, false, hDC);
72987298
Point size = imageList == null ? new Point (rect.width, rect.height) : imageList.getImageSize ();
72997299
int y = imageRect.top + Math.max (0, (imageRect.bottom - imageRect.top - size.y) / 2);

0 commit comments

Comments
 (0)