Directly use an image with an exact match if available.

This commit is contained in:
Stian Grenborgen 2024-01-07 15:02:44 +01:00
parent 63b053b868
commit cb44400862
1 changed files with 3 additions and 0 deletions

View File

@ -203,6 +203,9 @@ public class ImageResource extends Resource implements Cleanable {
if (img == null) {
return null;
}
if (size.width == img.getWidth() && size.height == img.getHeight()) {
return img;
}
if (loadedImages == null || loadedImages.isEmpty()) {
return createResizedImage(img, size.width, size.height, true);
}