Skip to content

Commit fb74f42

Browse files
authored
Merge pull request #129 from coder/fix-icon-rendering-on-retina-displays
Fix icon rendering on retina displays
2 parents 8aa3417 + c97865a commit fb74f42

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

CHANGELOG.md

+3
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@
1010
### Changed
1111
- renamed the plugin from `Coder Gateway` to `Gateway`
1212

13+
### Fixed
14+
- icon rendering on macOS
15+
1316
## 2.1.3 - 2022-12-09
1417

1518
### Added

src/main/kotlin/com/coder/gateway/sdk/TemplateIconDownloader.kt

+3-6
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@ package com.coder.gateway.sdk
33
import com.coder.gateway.icons.CoderIcons
44
import com.intellij.openapi.components.Service
55
import com.intellij.openapi.components.service
6-
import com.intellij.ui.scale.ScaleContext
6+
import com.intellij.util.IconUtil
77
import com.intellij.util.ImageLoader
88
import com.intellij.util.ui.ImageUtil
9+
import org.imgscalr.Scalr
910
import java.net.URL
1011
import javax.swing.Icon
11-
import javax.swing.ImageIcon
1212

1313
@Service(Service.Level.APP)
1414
class TemplateIconDownloader {
@@ -25,10 +25,7 @@ class TemplateIconDownloader {
2525
if (url != null) {
2626
var img = ImageLoader.loadFromUrl(url)
2727
if (img != null) {
28-
if (ImageUtil.getRealHeight(img) > 32 && ImageUtil.getRealWidth(img) > 32) {
29-
img = ImageUtil.resize(img, 32, ScaleContext.create())
30-
}
31-
return ImageIcon(img)
28+
return IconUtil.toRetinaAwareIcon(Scalr.resize(ImageUtil.toBufferedImage(img), Scalr.Method.ULTRA_QUALITY, 32))
3229
}
3330
}
3431

Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
minCompatibleCoderVersion=0.12.9
2-
maxCompatibleCoderVersion=0.13.1
2+
maxCompatibleCoderVersion=0.13.5

0 commit comments

Comments
 (0)