diff --git a/scripts/dbgbmap.py b/scripts/dbgbmap.py index 61e1e1eb..db415cce 100755 --- a/scripts/dbgbmap.py +++ b/scripts/dbgbmap.py @@ -4717,18 +4717,19 @@ def main_(ring, disk, mroots=None, *, block_cols_ = block_cols block_rows_ = mt.ceil(len(bmap) / block_cols) else: + # prioritize rows at low resolution + block_rows_ = min(len(bmap), max(canvas.height, 1)) # was len(bmap) + block_cols_ = mt.ceil(len(bmap) / block_rows_) # was 1 # divide by 2 until we hit our target ratio, this works # well for things that are often powers-of-two - block_cols_ = 1 - block_rows_ = len(bmap) while (abs(((canvas.width/(block_cols_*2)) / max(canvas.height/mt.ceil(block_rows_/2), 1)) - block_ratio) < abs(((canvas.width/block_cols_) / max(canvas.height/block_rows_, 1))) - block_ratio): - block_cols_ *= 2 block_rows_ = mt.ceil(block_rows_ / 2) + block_cols_ *= 2 block_width_ = canvas.width / block_cols_ block_height_ = canvas.height / block_rows_ diff --git a/scripts/dbgbmapd3.py b/scripts/dbgbmapd3.py index f3e4e06d..54e2bcd3 100755 --- a/scripts/dbgbmapd3.py +++ b/scripts/dbgbmapd3.py @@ -4440,18 +4440,19 @@ def main(disk, output, mroots=None, *, block_cols_ = block_cols block_rows_ = mt.ceil(len(bmap) / block_cols) else: + # prioritize rows at low resolution + block_rows_ = min(len(bmap), max(height__, 1)) # was len(bmap) + block_cols_ = mt.ceil(len(bmap) / block_rows_) # was 1 # divide by 2 until we hit our target ratio, this works # well for things that are often powers-of-two - block_cols_ = 1 - block_rows_ = len(bmap) while (abs(((width__/(block_cols_*2)) / max(height__/mt.ceil(block_rows_/2), 1)) - block_ratio) < abs(((width__/block_cols_) / max(height__/block_rows_, 1))) - block_ratio): - block_cols_ *= 2 block_rows_ = mt.ceil(block_rows_ / 2) + block_cols_ *= 2 block_width_ = width__ / block_cols_ block_height_ = height__ / block_rows_