better fomulation (#466)

This commit is contained in:
lllyasviel 2023-09-21 03:48:09 -07:00 committed by GitHub
parent 93ee4eabe3
commit da40b0b461
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 17 additions and 9 deletions

View File

@ -1 +1 @@
version = '2.0.77' version = '2.0.78'

View File

@ -97,16 +97,24 @@ def solve_abcd(x, a, b, c, d, k, outpaint):
break break
if area_abcd(a, b, c, d) >= max_area: if area_abcd(a, b, c, d) >= max_area:
break break
if (b - a) < (d - c):
a -= 2 add_h = (b - a) < (d - c)
b += 2 add_w = not add_h
c -= 1
d += 1 if b - a == H:
else: add_w = True
if d - c == W:
add_h = True
if add_h:
a -= 1 a -= 1
b += 1 b += 1
c -= 2
d += 2 if add_w:
c -= 1
d += 1
a, b, c, d = regulate_abcd(x, a, b, c, d) a, b, c, d = regulate_abcd(x, a, b, c, d)
return a, b, c, d return a, b, c, d