mirror of
https://github.com/JetBrains/JetBrainsRuntime.git
synced 2025-12-06 09:29:38 +01:00
JBR-9043: Return null from getPlatformImageBytesForFormat for images with unknown extents on macOS
This commit is contained in:
@@ -186,13 +186,18 @@ public class CImage extends CFRetainedResource {
|
||||
return getPlatformImageBytes(image);
|
||||
}
|
||||
|
||||
int width = image.getWidth(null);
|
||||
int height = image.getHeight(null);
|
||||
BufferedImage bufferedImage;
|
||||
|
||||
if (image instanceof BufferedImage) {
|
||||
bufferedImage = (BufferedImage) image;
|
||||
} else {
|
||||
int width = image.getWidth(null);
|
||||
int height = image.getHeight(null);
|
||||
|
||||
if (width <= 0 || height <= 0) {
|
||||
return null;
|
||||
}
|
||||
|
||||
bufferedImage = new BufferedImage(width, height, BufferedImage.TYPE_INT_ARGB);
|
||||
Graphics2D g2d = bufferedImage.createGraphics();
|
||||
g2d.drawImage(image, 0, 0, null);
|
||||
|
||||
Reference in New Issue
Block a user