Browse Source

Merge pull request #3895 in DESIGN/design from final/10.0 to bugfix/10.0

* commit 'f141bf91c14468ce8e2f0ed9ded61b81a79fd27a':
  REPORT-50662 fix ;
  REPORT-50662 设计器运行一段时间后会卡死
bugfix/10.0
superman 4 years ago
parent
commit
09e3cd5450
  1. 15
      designer-base/src/main/java/com/fr/design/utils/gui/GUIPaintUtils.java

15
designer-base/src/main/java/com/fr/design/utils/gui/GUIPaintUtils.java

@ -4,12 +4,15 @@ import com.fr.base.vcs.DesignerMode;
import com.fr.design.constants.UIConstants; import com.fr.design.constants.UIConstants;
import com.fr.stable.Constants; import com.fr.stable.Constants;
import com.fr.stable.os.OperatingSystem;
import java.awt.*; import java.awt.*;
import java.awt.geom.GeneralPath; import java.awt.geom.GeneralPath;
import java.awt.geom.RoundRectangle2D; import java.awt.geom.RoundRectangle2D;
public class GUIPaintUtils { public class GUIPaintUtils {
private static boolean macos = OperatingSystem.isMacos();
public static final void drawBorder(Graphics2D g2d, int x, int y, int width, int height, boolean isRound, int rectDirection) { public static final void drawBorder(Graphics2D g2d, int x, int y, int width, int height, boolean isRound, int rectDirection) {
drawBorder(g2d, x, y, width, height, isRound, rectDirection, false); drawBorder(g2d, x, y, width, height, isRound, rectDirection, false);
} }
@ -39,10 +42,14 @@ public class GUIPaintUtils {
g2d.drawLine(x, y, x, height - 1); g2d.drawLine(x, y, x, height - 1);
g2d.drawLine(x, height - 1, x + 3, height - 1); g2d.drawLine(x, height - 1, x + 3, height - 1);
} else { } else {
double offsetX = Math.min(GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice().getDefaultConfiguration().getDefaultTransform().getScaleX() - 1, 0.5d); if (macos) {
double offsetY = Math.min(GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice().getDefaultConfiguration().getDefaultTransform().getScaleY() - 1, 0.5d); g2d.drawRoundRect(x, y, width - 1, height - 1, UIConstants.ARC, UIConstants.ARC);
Shape shape = new RoundRectangle2D.Double(x + offsetX, y + offsetY, width - 1d, height - 1d, UIConstants.ARC, UIConstants.ARC); } else {
g2d.draw(shape); double offsetX = Math.min(GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice().getDefaultConfiguration().getDefaultTransform().getScaleX() - 1, 0.5d);
double offsetY = Math.min(GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice().getDefaultConfiguration().getDefaultTransform().getScaleY() - 1, 0.5d);
Shape shape = new RoundRectangle2D.Double(x + offsetX, y + offsetY, width - 1d, height - 1d, UIConstants.ARC, UIConstants.ARC);
g2d.draw(shape);
}
} }
g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_OFF); g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_OFF);
} else { } else {

Loading…
Cancel
Save