rewrite image caching logic

This commit is contained in:
GenevensiS
2025-12-14 05:33:31 +01:00
parent aa0791686e
commit 66016f381c
4 changed files with 41 additions and 31 deletions
+2 -2
View File
@@ -34,7 +34,7 @@ Image conform_image(const Image& img, const GeneratedImage::Options& options) {
int iw = image.GetWidth(), ih = image.GetHeight();
if ((iw == options.width && ih == options.height) || (options.width == 0 && options.height == 0)) {
// zoom?
if (options.zoom != 1.0) {
if (!almost_equal(options.zoom, 1.0)) {
image = resample(image, int(iw * options.zoom), int(ih * options.zoom));
} else {
// already the right size
@@ -73,7 +73,7 @@ Image conform_image(const Image& img, const GeneratedImage::Options& options) {
options.width = image.GetWidth();
options.height = image.GetHeight();
// rotate?
if (options.angle != 0) {
if (!almost_equal(options.angle, 0)) {
image = rotate_image(image, options.angle);
}
return image;