Skip to content

Commit

Permalink
Fix scaling issues with very wide preview icons
Browse files Browse the repository at this point in the history
  • Loading branch information
Argent77 committed Jul 13, 2023
1 parent 2933128 commit 408ac6a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/org/infinity/util/IconCache.java
Original file line number Diff line number Diff line change
Expand Up @@ -170,10 +170,10 @@ private static synchronized Image getScaledImage(Image image, int size, boolean
Image retVal = image;

if (image != null) {
if (image.getHeight(null) != size) {
if (image.getWidth(null) != size || image.getHeight(null) != size) {
final int dstWidth;
final int dstHeight;
if (image.getHeight(null) > size) {
if (image.getWidth(null) > size || image.getHeight(null) > size) {
// preserve image aspect ratio
dstWidth = (image.getWidth(null) >= image.getHeight(null)) ? size : image.getWidth(null) * size / image.getHeight(null);
dstHeight = (image.getHeight(null) >= image.getWidth(null)) ? size : image.getHeight(null) * size / image.getWidth(null);
Expand Down

0 comments on commit 408ac6a

Please sign in to comment.