scripts: dbgbmap[d3].py: Adopted slightly different row prioritization
This still forces the block_rows_ <= height invariant, but also prevents ceiling errors from introducing blank rows. I guess the simplest solution is the best one, eh?
This commit is contained in:
+12
-10
@@ -4715,19 +4715,21 @@ def main_(ring, disk, mroots=None, *,
|
|||||||
block_cols_ = block_cols
|
block_cols_ = block_cols
|
||||||
block_rows_ = mt.ceil(len(bmap) / block_cols)
|
block_rows_ = mt.ceil(len(bmap) / block_cols)
|
||||||
else:
|
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
|
# divide by 2 until we hit our target ratio, this works
|
||||||
# well for things that are often powers-of-two
|
# well for things that are often powers-of-two
|
||||||
while (abs(((canvas.width/(block_cols_*2))
|
#
|
||||||
/ max(canvas.height/mt.ceil(block_rows_/2), 1))
|
# also prioritize rows at low resolution
|
||||||
- block_ratio)
|
block_cols_ = 1
|
||||||
< abs(((canvas.width/block_cols_)
|
block_rows_ = len(bmap)
|
||||||
/ max(canvas.height/block_rows_, 1)))
|
while (block_rows_ > canvas.height
|
||||||
- block_ratio):
|
or abs(((canvas.width/(block_cols_*2))
|
||||||
block_rows_ = mt.ceil(block_rows_ / 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_cols_ *= 2
|
||||||
|
block_rows_ = mt.ceil(block_rows_ / 2)
|
||||||
|
|
||||||
block_width_ = canvas.width / block_cols_
|
block_width_ = canvas.width / block_cols_
|
||||||
block_height_ = canvas.height / block_rows_
|
block_height_ = canvas.height / block_rows_
|
||||||
|
|||||||
+12
-10
@@ -4438,19 +4438,21 @@ def main(disk, output, mroots=None, *,
|
|||||||
block_cols_ = block_cols
|
block_cols_ = block_cols
|
||||||
block_rows_ = mt.ceil(len(bmap) / block_cols)
|
block_rows_ = mt.ceil(len(bmap) / block_cols)
|
||||||
else:
|
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
|
# divide by 2 until we hit our target ratio, this works
|
||||||
# well for things that are often powers-of-two
|
# well for things that are often powers-of-two
|
||||||
while (abs(((width__/(block_cols_*2))
|
#
|
||||||
/ max(height__/mt.ceil(block_rows_/2), 1))
|
# also prioritize rows at low resolution
|
||||||
- block_ratio)
|
block_cols_ = 1
|
||||||
< abs(((width__/block_cols_)
|
block_rows_ = len(bmap)
|
||||||
/ max(height__/block_rows_, 1)))
|
while (block_rows_ > height__
|
||||||
- block_ratio):
|
or abs(((width__/(block_cols_*2))
|
||||||
block_rows_ = mt.ceil(block_rows_ / 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_cols_ *= 2
|
||||||
|
block_rows_ = mt.ceil(block_rows_ / 2)
|
||||||
|
|
||||||
block_width_ = width__ / block_cols_
|
block_width_ = width__ / block_cols_
|
||||||
block_height_ = height__ / block_rows_
|
block_height_ = height__ / block_rows_
|
||||||
|
|||||||
Reference in New Issue
Block a user