Bug 548430: [Cocoa] NullPointerException in Image.internal_new_GC - There is an underlying assumption while creating breadcrumb arrows. The image creation logic assumes the new image created is always created with transparent color. Currently only the opaque areas are set with alpha 255, which is opaque. But the areas where transparency should be set is not handled at all. This patch sets transparent area with alpha 0, which is transparent. This change is based on https://git.eclipse.org/r/#/c/163181/ Change-Id: I371373a7d7e1825fb17032465ddbe4e31fb8c0db
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/breadcrumb/BreadcrumbItemDropDown.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/breadcrumb/BreadcrumbItemDropDown.java index 08739bb..3f75d91 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/breadcrumb/BreadcrumbItemDropDown.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/breadcrumb/BreadcrumbItemDropDown.java
@@ -103,14 +103,24 @@ image.dispose(); int zoomedArrowSize = ARROW_SIZE * zoom / 100; for (int y1 = 0; y1 < zoomedArrowSize; y1++) { + // set opaque pixels for top half of the breadcrumb arrow for (int x1 = 0; x1 <= y1; x1++) { imageData.setAlpha(fLTR ? x1 : zoomedArrowSize - x1 - 1, y1, 255); } + // set transparent pixels for top half of the breadcrumbe arrow + for (int x1 = y1 + 1; x1 < zoomedArrowSize; x1++) { + imageData.setAlpha(fLTR ? x1 : zoomedArrowSize - x1 - 1, y1, 0); + } } for (int y2 = 0; y2 < zoomedArrowSize; y2++) { + // set opaque pixels for bottom half of the breadcrumb arrow for (int x2 = 0; x2 <= y2; x2++) { imageData.setAlpha(fLTR ? x2 : zoomedArrowSize - x2 - 1, zoomedArrowSize * 2 - y2 - 1, 255); } + // set transparent pixels for bottom half of the breadcrumbe arrow + for (int x2 = y2 + 1; x2 < zoomedArrowSize; x2++) { + imageData.setAlpha(fLTR ? x2 : zoomedArrowSize - x2 - 1, zoomedArrowSize * 2 - y2 - 1, 0); + } } return imageData; };