Skip to content

Fix icon rendering on retina displays #129

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Dec 20, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@
### Changed
- renamed the plugin from `Coder Gateway` to `Gateway`

### Fixed
- icon rendering on macOS

## 2.1.3 - 2022-12-09

### Added
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ package com.coder.gateway.sdk
import com.coder.gateway.icons.CoderIcons
import com.intellij.openapi.components.Service
import com.intellij.openapi.components.service
import com.intellij.ui.scale.ScaleContext
import com.intellij.util.IconUtil
import com.intellij.util.ImageLoader
import com.intellij.util.ui.ImageUtil
import org.imgscalr.Scalr
import java.net.URL
import javax.swing.Icon
import javax.swing.ImageIcon

@Service(Service.Level.APP)
class TemplateIconDownloader {
Expand All @@ -25,10 +25,7 @@ class TemplateIconDownloader {
if (url != null) {
var img = ImageLoader.loadFromUrl(url)
if (img != null) {
if (ImageUtil.getRealHeight(img) > 32 && ImageUtil.getRealWidth(img) > 32) {
img = ImageUtil.resize(img, 32, ScaleContext.create())
}
return ImageIcon(img)
return IconUtil.toRetinaAwareIcon(Scalr.resize(ImageUtil.toBufferedImage(img), Scalr.Method.ULTRA_QUALITY, 32))
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
minCompatibleCoderVersion=0.12.9
maxCompatibleCoderVersion=0.13.1
maxCompatibleCoderVersion=0.13.5