Ghidra is a software reverse engineering (SRE) framework
GP-2723: Blend overlapping markers
Dan5eb1c90c3d54
diff --git a/Ghidra/Debug/Debugger/src/test/java/ghidra/app/plugin/core/debug/gui/listing/DebuggerListingProviderTest.java b/Ghidra/Debug/Debugger/src/test/java/ghidra/app/plugin/core/debug/gui/listing/DebuggerListingProviderTest.javaindex 66b42e87e6..b48d7ecb3c 100644--- a/Ghidra/Debug/Debugger/src/test/java/ghidra/app/plugin/core/debug/gui/listing/DebuggerListingProviderTest.java+++ b/Ghidra/Debug/Debugger/src/test/java/ghidra/app/plugin/core/debug/gui/listing/DebuggerListingProviderTest.java@@ -34,7 +34,6 @@ import docking.menu.MultiStateDockingAction;import docking.widgets.EventTrigger;import docking.widgets.fieldpanel.FieldPanel;import generic.test.category.NightlyCategory;-import generic.test.rule.Repeated;import generic.theme.GThemeDefaults.Colors;import ghidra.app.plugin.assembler.*;import ghidra.app.plugin.core.codebrowser.CodeBrowserPlugin;diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/marker/MarkerManager.java b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/marker/MarkerManager.javaindex c29acf8e2c..5746e7305e 100644--- a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/marker/MarkerManager.java+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/marker/MarkerManager.java@@ -39,6 +39,7 @@ import ghidra.program.model.address.Address;import ghidra.program.model.address.AddressSet;import ghidra.program.model.listing.Program;import ghidra.program.util.ProgramLocation;+import ghidra.util.ColorUtils.ColorBlender;import ghidra.util.datastruct.*;import ghidra.util.exception.AssertException;import ghidra.util.task.SwingUpdateManager;@@ -491,6 +492,7 @@ public class MarkerManager implements MarkerService {private static class MarkerSetCacheEntry {private final List<MarkerSetImpl> markerSets = new ArrayList<>();private final AddressColorCache colorCache = new AddressColorCache();+ private final ColorBlender blender = new ColorBlender();private final MarkerSetCache cache;private final Program program;@@ -582,15 +584,16 @@ public class MarkerManager implements MarkerService {if (colorCache.containsKey(address)) {return colorCache.get(address);}- for (MarkerSetImpl markers : IterableUtils.reversedIterable(markerSets)) {+ blender.clear();+ for (MarkerSetImpl markers : markerSets) {if (markers.isActive() && markers.isColoringBackground() &&markers.contains(address)) {- Color color = markers.getMarkerColor();- colorCache.put(address, color);- return color;+ blender.add(markers.getMarkerColor());}}- return null;+ Color color = blender.getColor(null);+ colorCache.put(address, color);+ return color;}List<String> getTooltipLines(int y, int x, Address minAddr, Address maxAddr) {diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/services/MarkerService.java b/Ghidra/Features/Base/src/main/java/ghidra/app/services/MarkerService.javaindex d2a4488684..2b249f667c 100644--- a/Ghidra/Features/Base/src/main/java/ghidra/app/services/MarkerService.java+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/services/MarkerService.java@@ -48,7 +48,9 @@ import ghidra.program.model.listing.Program;* a program has become deactivated. In this example usage markers are added and removed as the user* tabs through open programs.*/-@ServiceInfo(defaultProvider = MarkerManagerPlugin.class, description = "Service to manage navigation markers displayed around a scrollable window.")+@ServiceInfo(+ defaultProvider = MarkerManagerPlugin.class,+ description = "Service to manage navigation markers displayed around a scrollable window.")public interface MarkerService {/**@@ -241,8 +243,8 @@ public interface MarkerService {/*** Returns the background color associated with the given program and address. Each markerSet- * that supports background coloring is checked in priority order to see if it wants to specify- * a background color for the given address.+ * that supports background coloring is blended to determine a background color for the given+ * address.** @param program the program to check for a background color.* @param address the address to check for a background color.diff --git a/Ghidra/Features/Base/src/test.slow/java/ghidra/app/plugin/core/marker/MarkerTest.java b/Ghidra/Features/Base/src/test.slow/java/ghidra/app/plugin/core/marker/MarkerTest.javaindex 3f897f2b04..da33528ed4 100644--- a/Ghidra/Features/Base/src/test.slow/java/ghidra/app/plugin/core/marker/MarkerTest.java+++ b/Ghidra/Features/Base/src/test.slow/java/ghidra/app/plugin/core/marker/MarkerTest.java@@ -423,7 +423,7 @@ public class MarkerTest extends AbstractGhidraHeadedIntegrationTest {return markerService.getBackgroundColor(p, address);});- assertEquals("Marker color not correct", c, actual);+ assertEquals("Marker color not correct", c.getRGB(), actual.getRGB());}private void switchToProgram(Program p) {