Remove get_zoom and use builtin fit feature

using renpy.render, wtf

(cherry picked from commit 3278b1f4af)
This commit is contained in:
Gouvernathor 2023-11-16 17:22:23 +01:00 committed by LoafyLemon
parent dbfb22b566
commit a5b47a41e7
2 changed files with 2 additions and 12 deletions

View File

@ -16,6 +16,6 @@ screen gift(gift):
zorder 30
if isinstance(gift, Item):
add gift.get_image() align (0.5, 0.4) zoom get_zoom(gift.get_image(), (320, 320))
add gift.get_image() align (0.5, 0.4) xysize (320, 320) fit "contain"
else:
add gift align (0.5, 0.4) zoom get_zoom(gift, (320, 320))
add gift align (0.5, 0.4) xysize (320, 320) fit "contain"

View File

@ -37,13 +37,3 @@ init python:
sprite = Image(path)
return Transform(sprite, crop=(x, y, w, h), xsize=xsize, ysize=ysize, fit="contain", matrixcolor=matrix, subpixel=True)
def get_zoom(image, size):
if isinstance(image, str):
image = Image(image)
r = renpy.render(image, 800, 800, 0, 0)
x, y = r.get_size()
xsize, ysize = size
return min(ysize / y, xsize / x)