Bug 552148 - [hidpi][Cocoa] GC.copyArea(Image) broken since Bug 489451
Change-Id: I717378baddabb4b0cf1f631786b1c077f061eb64
Signed-off-by: Sravan Kumar Lakkimsetti <sravankumarl@in.ibm.com>
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/graphics/GC.java b/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/graphics/GC.java
index cd4a279..7765365 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/graphics/GC.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/cocoa/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
@@ -510,6 +510,7 @@
try {
if (data.image != null) {
int srcX = x, srcY = y, destX = 0, destY = 0;
+ int scaleFactor = DPIUtil.getDeviceZoom () / 100;
NSSize srcSize = data.image.handle.size();
int imgHeight = (int)srcSize.height;
int destWidth = (int)srcSize.width - x, destHeight = (int)srcSize.height - y;
@@ -529,8 +530,8 @@
NSRect destRect = new NSRect();
destRect.x = destX;
destRect.y = destY;
- destRect.width = destWidth;
- destRect.height = destHeight;
+ destRect.width = destWidth * scaleFactor;
+ destRect.height = destHeight * scaleFactor;
data.image.handle.drawInRect(destRect, srcRect, OS.NSCompositeCopy, 1);
NSGraphicsContext.static_restoreGraphicsState();
return;