diff options
Diffstat (limited to 'src/share/classes/sun/java2d/SunGraphicsEnvironment.java')
-rw-r--r-- | src/share/classes/sun/java2d/SunGraphicsEnvironment.java | 48 |
1 files changed, 41 insertions, 7 deletions
diff --git a/src/share/classes/sun/java2d/SunGraphicsEnvironment.java b/src/share/classes/sun/java2d/SunGraphicsEnvironment.java index 63b942bf4..e0e03d36a 100644 --- a/src/share/classes/sun/java2d/SunGraphicsEnvironment.java +++ b/src/share/classes/sun/java2d/SunGraphicsEnvironment.java @@ -1,5 +1,5 @@ /* - * Copyright 1997-2007 Sun Microsystems, Inc. All Rights Reserved. + * Copyright 1997-2008 Sun Microsystems, Inc. All Rights Reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -36,6 +36,7 @@ import java.awt.Rectangle; import java.awt.Toolkit; import java.awt.font.TextAttribute; import java.awt.image.BufferedImage; +import java.awt.peer.ComponentPeer; import java.io.BufferedReader; import java.io.File; import java.io.FileInputStream; @@ -78,6 +79,7 @@ public abstract class SunGraphicsEnvironment extends GraphicsEnvironment public static boolean isLinux; public static boolean isSolaris; + public static boolean isOpenSolaris; public static boolean isWindows; public static boolean noType1Font; private static Font defaultFont; @@ -167,6 +169,23 @@ public abstract class SunGraphicsEnvironment extends GraphicsEnvironment isLinux = true; } else if ("SunOS".equals(osName)) { isSolaris = true; + String version = System.getProperty("os.version", "0.0"); + try { + float ver = Float.parseFloat(version); + if (ver > 5.10f) { + File f = new File("/etc/release"); + FileInputStream fis = new FileInputStream(f); + InputStreamReader isr + = new InputStreamReader(fis, "ISO-8859-1"); + BufferedReader br = new BufferedReader(isr); + String line = br.readLine(); + if (line.indexOf("OpenSolaris") >= 0) { + isOpenSolaris = true; + } + fis.close(); + } + } catch (Exception e) { + } } else if ("Windows".equals(osName)) { isWindows = true; } @@ -174,11 +193,7 @@ public abstract class SunGraphicsEnvironment extends GraphicsEnvironment noType1Font = "true". equals(System.getProperty("sun.java2d.noType1Font")); - if (isOpenJDK()) { - String[] fontInfo = FontManager.getDefaultPlatformFont(); - defaultFontName = fontInfo[0]; - defaultFontFileName = fontInfo[1]; - } else { + if (!isOpenJDK()) { defaultFontName = lucidaFontName; if (useAbsoluteFontFileNames()) { defaultFontFileName = @@ -244,6 +259,11 @@ public abstract class SunGraphicsEnvironment extends GraphicsEnvironment * that might be specified. */ fontConfig = createFontConfiguration(); + if (isOpenJDK()) { + String[] fontInfo = FontManager.getDefaultPlatformFont(); + defaultFontName = fontInfo[0]; + defaultFontFileName = fontInfo[1]; + } getPlatformFontPathFromFontConfig(); String extraFontPath = fontConfig.getExtraFontPath(); @@ -1069,7 +1089,7 @@ public abstract class SunGraphicsEnvironment extends GraphicsEnvironment String fontFileName = getFileNameFromPlatformName(platformFontName); String[] nativeNames = null; - if (fontFileName == null) { + if (fontFileName == null || fontFileName.equals(platformFontName)){ /* No file located, so register using the platform name, * i.e. as a native font. */ @@ -1294,4 +1314,18 @@ public abstract class SunGraphicsEnvironment extends GraphicsEnvironment /* * ----END DISPLAY CHANGE SUPPORT---- */ + + /** + * Returns true if FlipBufferStrategy with COPIED buffer contents + * is preferred for this peer's GraphicsConfiguration over + * BlitBufferStrategy, false otherwise. + * + * The reason FlipBS could be preferred is that in some configurations + * an accelerated copy to the screen is supported (like Direct3D 9) + * + * @return true if flip strategy should be used, false otherwise + */ + public boolean isFlipStrategyPreferred(ComponentPeer peer) { + return false; + } } |