Class VerticalLayoutPixelIndexMap

java.lang.Object
ghidra.app.decompiler.component.margin.VerticalLayoutPixelIndexMap
All Implemented Interfaces:
LayoutPixelIndexMap

public class VerticalLayoutPixelIndexMap extends Object implements LayoutPixelIndexMap
An implementation of LayoutPixelIndexMap for vertical coordinates

This class implements getIndex(int) in log time and getPixel(BigInteger) in constant time.

  • Constructor Details

    • VerticalLayoutPixelIndexMap

      public VerticalLayoutPixelIndexMap()
  • Method Details

    • getPixel

      public int getPixel(BigInteger index)
      Description copied from interface: LayoutPixelIndexMap
      Get the top of the layout with the given index

      Gets the minimum y coordinate of any pixel occupied by the layout having the given index. In essence, this maps from layout index to vertical position, relative to the main panel's viewport. This accounts for scrolling and non-uniform height among the layouts.

      Specified by:
      getPixel in interface LayoutPixelIndexMap
      Parameters:
      index - the index of the layout
      Returns:
      the top of the layout, relative to the main panel's viewport
    • computeOff

      protected int computeOff(int pixel)
    • getIndex

      public BigInteger getIndex(int pixel)
      Description copied from interface: LayoutPixelIndexMap
      Get the index of the layout at the given position

      Get the index of the layout occupying the line of pixels in the main panel having the given y coordinate. In essence, this maps from vertical position, relative to the main panel's viewport, to layout index. This accounts for scrolling and non-uniform height among the layouts.

      Specified by:
      getIndex in interface LayoutPixelIndexMap
      Parameters:
      pixel - the vertical position of the pixel, relative to the main panel's viewport
      Returns:
      the index of the layout
    • layoutsChanged

      public void layoutsChanged(List<AnchoredLayout> layouts)