This commit is contained in:
Konstantin Bulenkov
2016-05-17 14:18:34 +02:00
parent dd81d54d01
commit aa2cd57b2b
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2015 JetBrains s.r.o.
* Copyright 2000-2016 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -294,8 +294,13 @@ public class ImageLoader implements Serializable {
@NotNull
private static Image scaleImage(Image image, float scale) {
int width = (int)(scale * image.getWidth(null));
int height = (int)(scale * image.getHeight(null));
int w = image.getWidth(null);
int h = image.getHeight(null);
if (w <= 0 || h <= 0) {
return image;
}
int width = (int)(scale * w);
int height = (int)(scale * h);
// Using "QUALITY" instead of "ULTRA_QUALITY" results in images that are less blurry
// because ultra quality performs a few more passes when scaling, which introduces blurriness
// when the scaling factor is relatively small (i.e. <= 3.0f) -- which is the case here.