Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSravan Kumar Lakkimsetti2020-05-07 09:38:23 +0000
committerSravan Kumar Lakkimsetti2020-05-07 09:41:34 +0000
commita7d0efb586239158f344d81a41927c1a2a4bda8b (patch)
treeeea0291f5b3db297c22a0ad4fce3b8a478e534dc
parentd9e7d54ccd6f1d6187c2c4012183cb02b2438849 (diff)
downloadeclipse.platform.swt-a7d0efb586239158f344d81a41927c1a2a4bda8b.tar.gz
eclipse.platform.swt-a7d0efb586239158f344d81a41927c1a2a4bda8b.tar.xz
eclipse.platform.swt-a7d0efb586239158f344d81a41927c1a2a4bda8b.zip
Bug 548430 - [Cocoa] NullPointerException in Image.internal_new_GC
(4.12.0RC2) Change-Id: Iae632214868bfe87c02a0744c4acaf0480f872bd Signed-off-by: Sravan Kumar Lakkimsetti <sravankumarl@in.ibm.com>
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/graphics/Image.java31
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/internal/graphics/ImageUtil.java4
2 files changed, 7 insertions, 28 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/graphics/Image.java b/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/graphics/Image.java
index bd436003dd..9352bb4eb5 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/graphics/Image.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/graphics/Image.java
@@ -1349,35 +1349,14 @@ public ImageData getImageData(int zoom) {
NSAutoreleasePool pool = null;
if (!NSThread.isMainThread()) pool = (NSAutoreleasePool) new NSAutoreleasePool().alloc().init();
try {
- boolean hasImageProvider = imageFileNameProvider != null || imageDataProvider != null;
if (zoom == 100) {
NSBitmapImageRep imageRep;
- if (hasImageProvider) {
- imageRep = getRepresentation_100();
- return _getImageData(imageRep, alphaInfo_100);
- } else {
- imageRep = getRepresentation();
- if (imageRep.pixelsHigh() == this.height) {
- return _getImageData(imageRep, alphaInfo_100);
- } else {
- if (alphaInfo_200 == null) {
- initAlpha_200(imageRep);
- }
-
- NSArray reps = handle.representations();
- long count = reps.count();
- for (int i = 0; i < count; i++) {
- handle.removeRepresentation(new NSImageRep(handle.representations().objectAtIndex(0)));
- }
- handle.addRepresentation(imageRep);
-
- NSSize targetSize = handle.size();
- imageRep = createImageRep(targetSize);
- /* Recreate alpha info */
- initAlpha_100(imageRep);
- return _getImageData(imageRep, alphaInfo_100);
- }
+ NSSize size = handle.size();
+ imageRep = getRepresentation_100();
+ if (!((imageRep.pixelsHigh() == size.height) && (imageRep.pixelsWide() == size.width))) {
+ imageRep = createImageRep(size);
}
+ return _getImageData(imageRep, alphaInfo_100);
}
if (zoom == 200) {
NSBitmapImageRep imageRep200 = getRepresentation_200();
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/internal/graphics/ImageUtil.java b/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/internal/graphics/ImageUtil.java
index 34d8570a41..5ea70a5958 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/internal/graphics/ImageUtil.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/internal/graphics/ImageUtil.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2019 IBM Corporation and others.
+ * Copyright (c) 2020 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -51,7 +51,7 @@ public class ImageUtil {
NSRect sourceRect = new NSRect();
sourceRect.width = 0;
sourceRect.height = 0;
- imgHandle.drawInRect(target, sourceRect, OS.NSCompositeCopy, 1);
+ imgHandle.drawInRect(target, sourceRect, OS.NSCompositeCopy, 0);
NSGraphicsContext.static_restoreGraphicsState();
rep.autorelease();
return rep;

Back to the top