From a5b47a41e7e8e15fd041714c8257cb34a9f91cb0 Mon Sep 17 00:00:00 2001 From: Gouvernathor <44340603+Gouvernathor@users.noreply.github.com> Date: Thu, 16 Nov 2023 17:22:23 +0100 Subject: [PATCH] Remove get_zoom and use builtin fit feature using renpy.render, wtf (cherry picked from commit 3278b1f4afdb9ce887cdac0e87c28a61b974a737) --- game/scripts/interface/gifts.rpy | 4 ++-- game/scripts/utility/image_crop.rpy | 10 ---------- 2 files changed, 2 insertions(+), 12 deletions(-) diff --git a/game/scripts/interface/gifts.rpy b/game/scripts/interface/gifts.rpy index 7dd08adf..99cd351d 100644 --- a/game/scripts/interface/gifts.rpy +++ b/game/scripts/interface/gifts.rpy @@ -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" diff --git a/game/scripts/utility/image_crop.rpy b/game/scripts/utility/image_crop.rpy index 2b27c5b3..76ff7f6a 100644 --- a/game/scripts/utility/image_crop.rpy +++ b/game/scripts/utility/image_crop.rpy @@ -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)