From bf1fcd71c5490c7492059e43f44a1752e480bd6b Mon Sep 17 00:00:00 2001 From: Jimin Lee Date: Tue, 2 Jul 2024 13:24:32 +0900 Subject: [PATCH] HiDPI fix Issue: When using XLog in a HiDPI environment with the -Dswt.autoScale=quarter option added to the scouter.ini file, the graphs appear blurry. This is because when drawing a point using the drawPoint method in a HiDPI environment, the pixel is enlarged to become opaque. Solution: The issue has been resolved by modifying the code to draw graphs using rectangles instead of points using the fillRectangle method. Additional Details: The -Dswt.autoScale=quarter option is automatically selects the appropriate HiDPI ratio. The drawPoint method draws individual pixels, which can appear blurry when scaled up. The fillRectangle function draws filled rectangles, which provide a smoother and more consistent appearance in HiDPI environments. --- .../src/scouter/client/xlog/ImageCache.java | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/scouter.client/src/scouter/client/xlog/ImageCache.java b/scouter.client/src/scouter/client/xlog/ImageCache.java index 34e677ec5..e53763ec2 100644 --- a/scouter.client/src/scouter/client/xlog/ImageCache.java +++ b/scouter.client/src/scouter/client/xlog/ImageCache.java @@ -61,7 +61,7 @@ public synchronized Image getXPImage(int objHash, byte xtype) { } private Image createXPImage(RGB rgb) { - return createXPImage5(rgb); + return createXPImage6(rgb); } private Image createXPImage4(RGB rgb) { @@ -98,6 +98,21 @@ private Image createXPImage5(RGB rgb) { return xp; } + private Image createXPImage6(RGB rgb) { + Image xp; + xp = new Image(null, 5, 5); + GC gcc = new GC(xp); + gcc.setBackground(new Color(null, rgb)); + gcc.fillRectangle(0, 0, 5, 5); + gcc.setBackground(ColorUtil.getInstance().getColor("white")); + gcc.fillRectangle(1, 0, 1, 1); + gcc.fillRectangle(4, 1, 1, 1); + gcc.fillRectangle(0, 3, 1, 1); + gcc.fillRectangle(3, 4, 1, 1); + gcc.dispose(); + return xp; + } + public synchronized Image getXPErrorImage(byte xtype) { if (errorXpDot == null) { errorXpDot = createXPImage(ColorUtil.getInstance().getColor("red").getRGB());