getBottomRightOnBit method

List<int>? getBottomRightOnBit()

Implementation

List<int>? getBottomRightOnBit() {
  int bitsOffset = _bits.length - 1;
  while (bitsOffset >= 0 && _bits[bitsOffset] == 0) {
    bitsOffset--;
  }
  if (bitsOffset < 0) {
    return null;
  }

  final int y = bitsOffset ~/ _rowSize;
  int x = (bitsOffset % _rowSize) * 32;

  final theBits = _bits[bitsOffset];
  int bit = 31;
  while ((theBits >>> bit) == 0) {
    bit--;
  }
  x += bit;

  return [x, y];
}