Skip to content

Commit bf1fcd7

Browse files
authored
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.
1 parent 474c456 commit bf1fcd7

1 file changed

Lines changed: 16 additions & 1 deletion

File tree

scouter.client/src/scouter/client/xlog/ImageCache.java

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ public synchronized Image getXPImage(int objHash, byte xtype) {
6161
}
6262

6363
private Image createXPImage(RGB rgb) {
64-
return createXPImage5(rgb);
64+
return createXPImage6(rgb);
6565
}
6666

6767
private Image createXPImage4(RGB rgb) {
@@ -98,6 +98,21 @@ private Image createXPImage5(RGB rgb) {
9898
return xp;
9999
}
100100

101+
private Image createXPImage6(RGB rgb) {
102+
Image xp;
103+
xp = new Image(null, 5, 5);
104+
GC gcc = new GC(xp);
105+
gcc.setBackground(new Color(null, rgb));
106+
gcc.fillRectangle(0, 0, 5, 5);
107+
gcc.setBackground(ColorUtil.getInstance().getColor("white"));
108+
gcc.fillRectangle(1, 0, 1, 1);
109+
gcc.fillRectangle(4, 1, 1, 1);
110+
gcc.fillRectangle(0, 3, 1, 1);
111+
gcc.fillRectangle(3, 4, 1, 1);
112+
gcc.dispose();
113+
return xp;
114+
}
115+
101116
public synchronized Image getXPErrorImage(byte xtype) {
102117
if (errorXpDot == null) {
103118
errorXpDot = createXPImage(ColorUtil.getInstance().getColor("red").getRGB());

0 commit comments

Comments
 (0)