mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Remove moved to the custom jdk code.
This commit is contained in:
@@ -291,7 +291,6 @@ public class UISettings extends SimpleModificationTracker implements PersistentS
|
||||
g2d.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_OFF);
|
||||
}
|
||||
}
|
||||
UIUtil.setHintingForLCDText(g2d);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -3088,8 +3088,6 @@ public final class EditorImpl extends UserDataHolderBase implements EditorEx, Hi
|
||||
if (!Comparing.equal(color[i], currentColor)) {
|
||||
currentColor = color[i] != null ? color[i] : JBColor.black;
|
||||
|
||||
UIUtil.updateLCDContrastBasingOnForegroundColor(g, currentColor);
|
||||
|
||||
g.setColor(currentColor);
|
||||
}
|
||||
|
||||
|
||||
@@ -71,8 +71,6 @@ public class GraphicsUtil {
|
||||
g.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING,
|
||||
enableAA ? RenderingHints.VALUE_TEXT_ANTIALIAS_LCD_HBGR : RenderingHints.VALUE_TEXT_ANTIALIAS_OFF);
|
||||
}
|
||||
|
||||
UIUtil.setHintingForLCDText(g);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1771,56 +1771,6 @@ public class UIUtil {
|
||||
Map map = (Map)tk.getDesktopProperty("awt.font.desktophints");
|
||||
if (map != null) {
|
||||
g2d.addRenderingHints(map);
|
||||
setHintingForLCDText(g2d);
|
||||
}
|
||||
}
|
||||
|
||||
private static int THEME_BASED_TEXT_LCD_CONTRAST = 0;
|
||||
private static int BEST_DARK_LCD_CONTRAST = 250;
|
||||
private static int BEST_LIGHT_LCD_CONTRAST = 100;
|
||||
|
||||
public static int getContrastForColor (Color color) {
|
||||
// YIQ
|
||||
int yiqValue = ((color.getRed() * 299) + (color.getGreen() * 587) + (color.getBlue() * 114)) / 1000;
|
||||
return yiqValue * 150/255 + 100;
|
||||
}
|
||||
|
||||
|
||||
public static void updateLCDContrastBasingOnForegroundColor(Graphics g, Color color) {
|
||||
Graphics2D g2d = (Graphics2D)g;
|
||||
|
||||
if (SystemInfo.isJetbrainsJvm && Registry.is("force.subpixel.hinting")) {
|
||||
g2d.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_LCD_HRGB);
|
||||
g2d.setRenderingHint(RenderingHints.KEY_TEXT_LCD_CONTRAST, getContrastForColor(color));
|
||||
}
|
||||
}
|
||||
|
||||
public static void setHintingForLCDText(Graphics2D g2d) {
|
||||
if (SystemInfo.isJetbrainsJvm && Registry.is("force.subpixel.hinting")) {
|
||||
g2d.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_LCD_HRGB);
|
||||
|
||||
// According to JavaDoc we can set values form 100 to 250
|
||||
// So we can use 0 as a special flag
|
||||
int registryLcdContrastValue = Registry.intValue("lcd.contrast.value");
|
||||
if (registryLcdContrastValue == THEME_BASED_TEXT_LCD_CONTRAST) {
|
||||
if (isUnderDarcula()) {
|
||||
registryLcdContrastValue = BEST_DARK_LCD_CONTRAST;
|
||||
} else {
|
||||
registryLcdContrastValue = BEST_LIGHT_LCD_CONTRAST;
|
||||
}
|
||||
}
|
||||
|
||||
// Wrong values prevent IDE from start
|
||||
// So we have to be careful
|
||||
if (registryLcdContrastValue < 100) {
|
||||
LOG.warn("Wrong value of text LCD contrast " + registryLcdContrastValue);
|
||||
registryLcdContrastValue = 100;
|
||||
} else if (registryLcdContrastValue > 250) {
|
||||
LOG.warn("Wrong value of text LCD contrast " + registryLcdContrastValue);
|
||||
registryLcdContrastValue = 250;
|
||||
}
|
||||
|
||||
g2d.setRenderingHint(RenderingHints.KEY_TEXT_LCD_CONTRAST, registryLcdContrastValue);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user