aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorlana <none@none>2009-01-06 16:24:03 -0800
committerlana <none@none>2009-01-06 16:24:03 -0800
commit939ce78b1984dc77cc7b00767663f9c881649605 (patch)
tree0dee679f0e906480015eb8451d9f0fc8b8ada221 /src
parent6178bb55a676bc25b35cc790375f109941d3017d (diff)
parent79f6cda307a94d2c6b34f582f93b54990eb0e7d0 (diff)
Diffstat (limited to 'src')
-rw-r--r--src/share/classes/com/sun/imageio/plugins/png/PNGImageReader.java70
-rw-r--r--src/share/classes/com/sun/imageio/plugins/png/PNGImageWriter.java90
-rw-r--r--src/share/classes/com/sun/imageio/plugins/png/PNGMetadata.java61
-rw-r--r--src/share/classes/java/awt/print/PrinterJob.java7
-rw-r--r--src/share/classes/javax/print/Doc.java2
-rw-r--r--src/share/classes/javax/print/DocFlavor.java1
-rw-r--r--src/share/classes/javax/print/DocPrintJob.java1
-rw-r--r--src/share/classes/javax/print/MultiDocPrintService.java5
-rw-r--r--src/share/classes/javax/print/PrintServiceLookup.java1
-rw-r--r--src/share/classes/javax/print/attribute/URISyntax.java1
-rw-r--r--src/share/classes/javax/print/event/PrintServiceAttributeEvent.java1
-rw-r--r--src/share/classes/sun/font/Decoration.java17
-rw-r--r--src/share/classes/sun/font/FontManager.java2
-rw-r--r--src/share/classes/sun/font/TrueTypeFont.java2
-rw-r--r--src/share/classes/sun/font/Underline.java4
-rw-r--r--src/share/classes/sun/java2d/SunGraphicsEnvironment.java41
-rw-r--r--src/share/classes/sun/java2d/SurfaceData.java3
-rw-r--r--src/share/classes/sun/java2d/opengl/OGLBlitLoops.java12
-rw-r--r--src/share/classes/sun/java2d/opengl/OGLSurfaceData.java5
-rw-r--r--src/share/classes/sun/java2d/pipe/BufferedContext.java13
-rw-r--r--src/share/classes/sun/print/PSPathGraphics.java1
-rw-r--r--src/share/classes/sun/print/PrintJobAttributeException.java1
-rw-r--r--src/share/classes/sun/print/SunMinMaxPage.java1
-rw-r--r--src/share/classes/sun/print/SunPageSelection.java1
-rw-r--r--src/share/classes/sun/swing/SwingUtilities2.java25
-rw-r--r--src/share/demo/java2d/J2DBench/src/j2dbench/tests/ImageTests.java257
-rw-r--r--src/share/native/sun/font/freetypeScaler.c2
-rw-r--r--src/share/native/sun/java2d/opengl/OGLBlitLoops.c74
-rw-r--r--src/share/native/sun/java2d/opengl/OGLSurfaceData.c3
-rw-r--r--src/solaris/classes/sun/awt/X11GraphicsEnvironment.java5
-rw-r--r--src/solaris/classes/sun/java2d/opengl/GLXGraphicsConfig.java14
-rw-r--r--src/solaris/classes/sun/java2d/x11/X11SurfaceData.java19
-rw-r--r--src/solaris/classes/sun/print/CUPSPrinter.java10
-rw-r--r--src/solaris/classes/sun/print/IPPPrintService.java126
-rw-r--r--src/solaris/classes/sun/print/UnixPrintService.java42
-rw-r--r--src/solaris/native/sun/awt/fontpath.c6
-rw-r--r--src/solaris/native/sun/java2d/x11/X11SurfaceData.c17
-rw-r--r--src/windows/classes/sun/awt/Win32GraphicsEnvironment.java5
-rw-r--r--src/windows/classes/sun/java2d/d3d/D3DBlitLoops.java8
-rw-r--r--src/windows/classes/sun/java2d/d3d/D3DSurfaceData.java5
-rw-r--r--src/windows/classes/sun/java2d/opengl/WGLGraphicsConfig.java14
-rw-r--r--src/windows/native/sun/font/fontpath.c54
-rw-r--r--src/windows/native/sun/java2d/d3d/D3DBadHardware.h39
-rw-r--r--src/windows/native/sun/java2d/d3d/D3DBlitLoops.cpp29
-rw-r--r--src/windows/native/sun/java2d/d3d/D3DContext.cpp9
-rw-r--r--src/windows/native/sun/java2d/d3d/D3DSurfaceData.h1
46 files changed, 720 insertions, 387 deletions
diff --git a/src/share/classes/com/sun/imageio/plugins/png/PNGImageReader.java b/src/share/classes/com/sun/imageio/plugins/png/PNGImageReader.java
index 0f5407075..84a593264 100644
--- a/src/share/classes/com/sun/imageio/plugins/png/PNGImageReader.java
+++ b/src/share/classes/com/sun/imageio/plugins/png/PNGImageReader.java
@@ -44,7 +44,6 @@ import java.util.ArrayList;
import java.util.Arrays;
import java.util.Enumeration;
import java.util.Iterator;
-import java.util.List;
import java.util.zip.Inflater;
import java.util.zip.InflaterInputStream;
import javax.imageio.IIOException;
@@ -57,6 +56,7 @@ import javax.imageio.stream.ImageInputStream;
import com.sun.imageio.plugins.common.InputStreamAdapter;
import com.sun.imageio.plugins.common.ReaderUtil;
import com.sun.imageio.plugins.common.SubImageInputStream;
+import java.io.ByteArrayOutputStream;
import sun.awt.image.ByteInterleavedRaster;
class PNGImageDataEnumeration implements Enumeration {
@@ -207,6 +207,15 @@ public class PNGImageReader extends ImageReader {
resetStreamSettings();
}
+ private String readNullTerminatedString(String charset) throws IOException {
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
+ int b;
+ while ((b = stream.read()) != 0) {
+ baos.write(b);
+ }
+ return new String(baos.toByteArray(), charset);
+ }
+
private String readNullTerminatedString() throws IOException {
StringBuilder b = new StringBuilder();
int c;
@@ -445,26 +454,27 @@ public class PNGImageReader extends ImageReader {
metadata.iTXt_keyword.add(keyword);
int compressionFlag = stream.readUnsignedByte();
- metadata.iTXt_compressionFlag.add(new Integer(compressionFlag));
+ metadata.iTXt_compressionFlag.add(Boolean.valueOf(compressionFlag == 1));
int compressionMethod = stream.readUnsignedByte();
- metadata.iTXt_compressionMethod.add(new Integer(compressionMethod));
+ metadata.iTXt_compressionMethod.add(Integer.valueOf(compressionMethod));
- String languageTag = readNullTerminatedString();
+ String languageTag = readNullTerminatedString("UTF8");
metadata.iTXt_languageTag.add(languageTag);
- String translatedKeyword = stream.readUTF();
+ String translatedKeyword =
+ readNullTerminatedString("UTF8");
metadata.iTXt_translatedKeyword.add(translatedKeyword);
- stream.skipBytes(1); // Null separator
String text;
+ long pos = stream.getStreamPosition();
+ byte[] b = new byte[(int)(chunkStart + chunkLength - pos)];
+ stream.readFully(b);
+
if (compressionFlag == 1) { // Decompress the text
- long pos = stream.getStreamPosition();
- byte[] b = new byte[(int)(chunkStart + chunkLength - pos)];
- stream.readFully(b);
- text = inflate(b);
+ text = new String(inflate(b), "UTF8");
} else {
- text = stream.readUTF();
+ text = new String(b, "UTF8");
}
metadata.iTXt_text.add(text);
}
@@ -613,15 +623,20 @@ public class PNGImageReader extends ImageReader {
metadata.tRNS_present = true;
}
- private static String inflate(byte[] b) throws IOException {
+ private static byte[] inflate(byte[] b) throws IOException {
InputStream bais = new ByteArrayInputStream(b);
InputStream iis = new InflaterInputStream(bais);
- StringBuilder sb = new StringBuilder(80);
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
+
int c;
- while ((c = iis.read()) != -1) {
- sb.append((char)c);
+ try {
+ while ((c = iis.read()) != -1) {
+ baos.write(c);
+ }
+ } finally {
+ iis.close();
}
- return sb.toString();
+ return baos.toByteArray();
}
private void parse_zTXt_chunk(int chunkLength) throws IOException {
@@ -633,7 +648,7 @@ public class PNGImageReader extends ImageReader {
byte[] b = new byte[chunkLength - keyword.length() - 2];
stream.readFully(b);
- metadata.zTXt_text.add(inflate(b));
+ metadata.zTXt_text.add(new String(inflate(b)));
}
private void readMetadata() throws IIOException {
@@ -1244,13 +1259,26 @@ public class PNGImageReader extends ImageReader {
destinationBands = param.getDestinationBands();
destinationOffset = param.getDestinationOffset();
}
-
+ Inflater inf = null;
try {
stream.seek(imageStartPosition);
Enumeration e = new PNGImageDataEnumeration(stream);
InputStream is = new SequenceInputStream(e);
- is = new InflaterInputStream(is, new Inflater());
+
+ /* InflaterInputStream uses an Inflater instance which consumes
+ * native (non-GC visible) resources. This is normally implicitly
+ * freed when the stream is closed. However since the
+ * InflaterInputStream wraps a client-supplied input stream,
+ * we cannot close it.
+ * But the app may depend on GC finalization to close the stream.
+ * Therefore to ensure timely freeing of native resources we
+ * explicitly create the Inflater instance and free its resources
+ * when we are done with the InflaterInputStream by calling
+ * inf.end();
+ */
+ inf = new Inflater();
+ is = new InflaterInputStream(is, inf);
is = new BufferedInputStream(is);
this.pixelStream = new DataInputStream(is);
@@ -1283,6 +1311,10 @@ public class PNGImageReader extends ImageReader {
}
} catch (IOException e) {
throw new IIOException("Error reading PNG image data", e);
+ } finally {
+ if (inf != null) {
+ inf.end();
+ }
}
}
diff --git a/src/share/classes/com/sun/imageio/plugins/png/PNGImageWriter.java b/src/share/classes/com/sun/imageio/plugins/png/PNGImageWriter.java
index 60db32fa1..ea4233a68 100644
--- a/src/share/classes/com/sun/imageio/plugins/png/PNGImageWriter.java
+++ b/src/share/classes/com/sun/imageio/plugins/png/PNGImageWriter.java
@@ -244,13 +244,17 @@ final class IDATOutputStream extends ImageOutputStreamImpl {
}
public void finish() throws IOException {
- if (!def.finished()) {
- def.finish();
- while (!def.finished()) {
- deflate();
+ try {
+ if (!def.finished()) {
+ def.finish();
+ while (!def.finished()) {
+ deflate();
+ }
}
+ finishChunk();
+ } finally {
+ def.end();
}
- finishChunk();
}
protected void finalize() throws Throwable {
@@ -667,13 +671,13 @@ public class PNGImageWriter extends ImageWriter {
}
}
- private byte[] deflate(String s) throws IOException {
+ private byte[] deflate(byte[] b) throws IOException {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
DeflaterOutputStream dos = new DeflaterOutputStream(baos);
- int len = s.length();
+ int len = b.length;
for (int i = 0; i < len; i++) {
- dos.write((int)s.charAt(i));
+ dos.write((int)(0xff & b[i]));
}
dos.close();
@@ -681,38 +685,37 @@ public class PNGImageWriter extends ImageWriter {
}
private void write_iTXt() throws IOException {
- Iterator keywordIter = metadata.iTXt_keyword.iterator();
- Iterator flagIter = metadata.iTXt_compressionFlag.iterator();
- Iterator methodIter = metadata.iTXt_compressionMethod.iterator();
- Iterator languageIter = metadata.iTXt_languageTag.iterator();
- Iterator translatedKeywordIter =
+ Iterator<String> keywordIter = metadata.iTXt_keyword.iterator();
+ Iterator<Boolean> flagIter = metadata.iTXt_compressionFlag.iterator();
+ Iterator<Integer> methodIter = metadata.iTXt_compressionMethod.iterator();
+ Iterator<String> languageIter = metadata.iTXt_languageTag.iterator();
+ Iterator<String> translatedKeywordIter =
metadata.iTXt_translatedKeyword.iterator();
- Iterator textIter = metadata.iTXt_text.iterator();
+ Iterator<String> textIter = metadata.iTXt_text.iterator();
while (keywordIter.hasNext()) {
ChunkStream cs = new ChunkStream(PNGImageReader.iTXt_TYPE, stream);
- String keyword = (String)keywordIter.next();
- cs.writeBytes(keyword);
+
+ cs.writeBytes(keywordIter.next());
cs.writeByte(0);
- int flag = ((Integer)flagIter.next()).intValue();
- cs.writeByte(flag);
- int method = ((Integer)methodIter.next()).intValue();
- cs.writeByte(method);
+ Boolean compressed = flagIter.next();
+ cs.writeByte(compressed ? 1 : 0);
+
+ cs.writeByte(methodIter.next().intValue());
- String languageTag = (String)languageIter.next();
- cs.writeBytes(languageTag);
+ cs.writeBytes(languageIter.next());
cs.writeByte(0);
- String translatedKeyword = (String)translatedKeywordIter.next();
- cs.writeBytes(translatedKeyword);
+
+ cs.write(translatedKeywordIter.next().getBytes("UTF8"));
cs.writeByte(0);
- String text = (String)textIter.next();
- if (flag == 1) {
- cs.write(deflate(text));
+ String text = textIter.next();
+ if (compressed) {
+ cs.write(deflate(text.getBytes("UTF8")));
} else {
- cs.writeUTF(text);
+ cs.write(text.getBytes("UTF8"));
}
cs.finish();
}
@@ -733,7 +736,7 @@ public class PNGImageWriter extends ImageWriter {
cs.writeByte(compressionMethod);
String text = (String)textIter.next();
- cs.write(deflate(text));
+ cs.write(deflate(text.getBytes()));
cs.finish();
}
}
@@ -928,23 +931,24 @@ public class PNGImageWriter extends ImageWriter {
// Use sourceXOffset, etc.
private void write_IDAT(RenderedImage image) throws IOException {
IDATOutputStream ios = new IDATOutputStream(stream, 32768);
-
- if (metadata.IHDR_interlaceMethod == 1) {
- for (int i = 0; i < 7; i++) {
- encodePass(ios, image,
- PNGImageReader.adam7XOffset[i],
- PNGImageReader.adam7YOffset[i],
- PNGImageReader.adam7XSubsampling[i],
- PNGImageReader.adam7YSubsampling[i]);
- if (abortRequested()) {
- break;
+ try {
+ if (metadata.IHDR_interlaceMethod == 1) {
+ for (int i = 0; i < 7; i++) {
+ encodePass(ios, image,
+ PNGImageReader.adam7XOffset[i],
+ PNGImageReader.adam7YOffset[i],
+ PNGImageReader.adam7XSubsampling[i],
+ PNGImageReader.adam7YSubsampling[i]);
+ if (abortRequested()) {
+ break;
+ }
}
+ } else {
+ encodePass(ios, image, 0, 0, 1, 1);
}
- } else {
- encodePass(ios, image, 0, 0, 1, 1);
+ } finally {
+ ios.finish();
}
-
- ios.finish();
}
private void writeIEND() throws IOException {
diff --git a/src/share/classes/com/sun/imageio/plugins/png/PNGMetadata.java b/src/share/classes/com/sun/imageio/plugins/png/PNGMetadata.java
index 19f4f6701..5475fc796 100644
--- a/src/share/classes/com/sun/imageio/plugins/png/PNGMetadata.java
+++ b/src/share/classes/com/sun/imageio/plugins/png/PNGMetadata.java
@@ -174,12 +174,12 @@ public class PNGMetadata extends IIOMetadata implements Cloneable {
public byte[] iCCP_compressedProfile;
// iTXt chunk
- public ArrayList iTXt_keyword = new ArrayList(); // Strings
- public ArrayList iTXt_compressionFlag = new ArrayList(); // Integers
- public ArrayList iTXt_compressionMethod = new ArrayList(); // Integers
- public ArrayList iTXt_languageTag = new ArrayList(); // Strings
- public ArrayList iTXt_translatedKeyword = new ArrayList(); // Strings
- public ArrayList iTXt_text = new ArrayList(); // Strings
+ public ArrayList<String> iTXt_keyword = new ArrayList<String>();
+ public ArrayList<Boolean> iTXt_compressionFlag = new ArrayList<Boolean>();
+ public ArrayList<Integer> iTXt_compressionMethod = new ArrayList<Integer>();
+ public ArrayList<String> iTXt_languageTag = new ArrayList<String>();
+ public ArrayList<String> iTXt_translatedKeyword = new ArrayList<String>();
+ public ArrayList<String> iTXt_text = new ArrayList<String>();
// pHYs chunk
public boolean pHYs_present;
@@ -597,19 +597,17 @@ public class PNGMetadata extends IIOMetadata implements Cloneable {
if (iTXt_keyword.size() > 0) {
IIOMetadataNode iTXt_parent = new IIOMetadataNode("iTXt");
for (int i = 0; i < iTXt_keyword.size(); i++) {
- Integer val;
-
IIOMetadataNode iTXt_node = new IIOMetadataNode("iTXtEntry");
- iTXt_node.setAttribute("keyword", (String)iTXt_keyword.get(i));
- val = (Integer)iTXt_compressionFlag.get(i);
- iTXt_node.setAttribute("compressionFlag", val.toString());
- val = (Integer)iTXt_compressionMethod.get(i);
- iTXt_node.setAttribute("compressionMethod", val.toString());
+ iTXt_node.setAttribute("keyword", iTXt_keyword.get(i));
+ iTXt_node.setAttribute("compressionFlag",
+ iTXt_compressionFlag.get(i) ? "1" : "0");
+ iTXt_node.setAttribute("compressionMethod",
+ iTXt_compressionMethod.get(i).toString());
iTXt_node.setAttribute("languageTag",
- (String)iTXt_languageTag.get(i));
+ iTXt_languageTag.get(i));
iTXt_node.setAttribute("translatedKeyword",
- (String)iTXt_translatedKeyword.get(i));
- iTXt_node.setAttribute("text", (String)iTXt_text.get(i));
+ iTXt_translatedKeyword.get(i));
+ iTXt_node.setAttribute("text", iTXt_text.get(i));
iTXt_parent.appendChild(iTXt_node);
}
@@ -1037,11 +1035,11 @@ public class PNGMetadata extends IIOMetadata implements Cloneable {
for (int i = 0; i < iTXt_keyword.size(); i++) {
node = new IIOMetadataNode("TextEntry");
- node.setAttribute("keyword", (String)iTXt_keyword.get(i));
- node.setAttribute("value", (String)iTXt_text.get(i));
+ node.setAttribute("keyword", iTXt_keyword.get(i));
+ node.setAttribute("value", iTXt_text.get(i));
node.setAttribute("language",
- (String)iTXt_languageTag.get(i));
- if (((Integer)iTXt_compressionFlag.get(i)).intValue() == 1) {
+ iTXt_languageTag.get(i));
+ if (iTXt_compressionFlag.get(i)) {
node.setAttribute("compression", "deflate");
} else {
node.setAttribute("compression", "none");
@@ -1427,11 +1425,11 @@ public class PNGMetadata extends IIOMetadata implements Cloneable {
boolean compressionFlag =
getBooleanAttribute(iTXt_node, "compressionFlag");
- iTXt_compressionFlag.add(new Boolean(compressionFlag));
+ iTXt_compressionFlag.add(Boolean.valueOf(compressionFlag));
String compressionMethod =
getAttribute(iTXt_node, "compressionMethod");
- iTXt_compressionMethod.add(compressionMethod);
+ iTXt_compressionMethod.add(Integer.valueOf(compressionMethod));
String languageTag =
getAttribute(iTXt_node, "languageTag");
@@ -1950,13 +1948,10 @@ public class PNGMetadata extends IIOMetadata implements Cloneable {
tEXt_text.add(value);
}
} else {
- int flag = compression.equals("zip") ?
- 1 : 0;
-
// Use an iTXt node
iTXt_keyword.add(keyword);
- iTXt_compressionFlag.add(new Integer(flag));
- iTXt_compressionMethod.add(new Integer(0));
+ iTXt_compressionFlag.add(Boolean.valueOf(compression.equals("zip")));
+ iTXt_compressionMethod.add(Integer.valueOf(0));
iTXt_languageTag.add(language);
iTXt_translatedKeyword.add(keyword); // fake it
iTXt_text.add(value);
@@ -1993,12 +1988,12 @@ public class PNGMetadata extends IIOMetadata implements Cloneable {
gAMA_present = false;
hIST_present = false;
iCCP_present = false;
- iTXt_keyword = new ArrayList();
- iTXt_compressionFlag = new ArrayList();
- iTXt_compressionMethod = new ArrayList();
- iTXt_languageTag = new ArrayList();
- iTXt_translatedKeyword = new ArrayList();
- iTXt_text = new ArrayList();
+ iTXt_keyword = new ArrayList<String>();
+ iTXt_compressionFlag = new ArrayList<Boolean>();
+ iTXt_compressionMethod = new ArrayList<Integer>();
+ iTXt_languageTag = new ArrayList<String>();
+ iTXt_translatedKeyword = new ArrayList<String>();
+ iTXt_text = new ArrayList<String>();
pHYs_present = false;
sBIT_present = false;
sPLT_present = false;
diff --git a/src/share/classes/java/awt/print/PrinterJob.java b/src/share/classes/java/awt/print/PrinterJob.java
index 28e500db7..f0ec3152b 100644
--- a/src/share/classes/java/awt/print/PrinterJob.java
+++ b/src/share/classes/java/awt/print/PrinterJob.java
@@ -117,15 +117,18 @@ public abstract class PrinterJob {
* FileOutputStream outstream;
* StreamPrintService psPrinter;
* String psMimeType = "application/postscript";
+ * PrinterJob pj = PrinterJob.getPrinterJob();
*
* StreamPrintServiceFactory[] factories =
* PrinterJob.lookupStreamPrintServices(psMimeType);
* if (factories.length > 0) {
* try {
* outstream = new File("out.ps");
- * psPrinter = factories[0].getPrintService(fos);
+ * psPrinter = factories[0].getPrintService(outstream);
* // psPrinter can now be set as the service on a PrinterJob
- * } catch (FileNotFoundException e) {
+ * pj.setPrintService(psPrinter)
+ * } catch (Exception e) {
+ * e.printStackTrace();
* }
* }
* </pre>
diff --git a/src/share/classes/javax/print/Doc.java b/src/share/classes/javax/print/Doc.java
index ef1bdb555..01fe4a064 100644
--- a/src/share/classes/javax/print/Doc.java
+++ b/src/share/classes/javax/print/Doc.java
@@ -28,9 +28,7 @@ package javax.print;
import java.io.InputStream;
import java.io.IOException;
import java.io.Reader;
-import java.io.UnsupportedEncodingException;
-import javax.print.attribute.AttributeSet;
import javax.print.attribute.DocAttributeSet;
diff --git a/src/share/classes/javax/print/DocFlavor.java b/src/share/classes/javax/print/DocFlavor.java
index bda24a70d..e72970c9f 100644
--- a/src/share/classes/javax/print/DocFlavor.java
+++ b/src/share/classes/javax/print/DocFlavor.java
@@ -30,7 +30,6 @@ import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.io.Serializable;
-import java.util.Map;
/**
* Class <code>DocFlavor</code> encapsulates an object that specifies the
diff --git a/src/share/classes/javax/print/DocPrintJob.java b/src/share/classes/javax/print/DocPrintJob.java
index 57040658d..671a51d6e 100644
--- a/src/share/classes/javax/print/DocPrintJob.java
+++ b/src/share/classes/javax/print/DocPrintJob.java
@@ -25,7 +25,6 @@
package javax.print;
-import javax.print.attribute.AttributeSet;
import javax.print.attribute.PrintJobAttributeSet;
import javax.print.attribute.PrintRequestAttributeSet;
import javax.print.event.PrintJobAttributeListener;
diff --git a/src/share/classes/javax/print/MultiDocPrintService.java b/src/share/classes/javax/print/MultiDocPrintService.java
index 4c6e31c08..e82620869 100644
--- a/src/share/classes/javax/print/MultiDocPrintService.java
+++ b/src/share/classes/javax/print/MultiDocPrintService.java
@@ -25,11 +25,6 @@
package javax.print;
-import java.util.Map;
-
-import javax.print.attribute.Attribute;
-import javax.print.event.PrintServiceAttributeListener;
-
/** Interface MultiPrintService is the factory for a MultiDocPrintJob.
* A MultiPrintService
diff --git a/src/share/classes/javax/print/PrintServiceLookup.java b/src/share/classes/javax/print/PrintServiceLookup.java
index 1a78eded1..33bc357be 100644
--- a/src/share/classes/javax/print/PrintServiceLookup.java
+++ b/src/share/classes/javax/print/PrintServiceLookup.java
@@ -28,7 +28,6 @@ package javax.print;
import java.util.ArrayList;
import java.util.Iterator;
-import java.util.List;
import javax.print.attribute.AttributeSet;
import sun.awt.AppContext;
diff --git a/src/share/classes/javax/print/attribute/URISyntax.java b/src/share/classes/javax/print/attribute/URISyntax.java
index e4bfa9de2..3ae7acc98 100644
--- a/src/share/classes/javax/print/attribute/URISyntax.java
+++ b/src/share/classes/javax/print/attribute/URISyntax.java
@@ -28,7 +28,6 @@ package javax.print.attribute;
import java.io.Serializable;
import java.net.URI;
-import java.net.URISyntaxException;
/**
* Class URISyntax is an abstract base class providing the common
diff --git a/src/share/classes/javax/print/event/PrintServiceAttributeEvent.java b/src/share/classes/javax/print/event/PrintServiceAttributeEvent.java
index 3ab488ffe..d65d1376e 100644
--- a/src/share/classes/javax/print/event/PrintServiceAttributeEvent.java
+++ b/src/share/classes/javax/print/event/PrintServiceAttributeEvent.java
@@ -25,7 +25,6 @@
package javax.print.event;
-import java.util.List;
import javax.print.PrintService;
import javax.print.attribute.AttributeSetUtilities;
import javax.print.attribute.PrintServiceAttributeSet;
diff --git a/src/share/classes/sun/font/Decoration.java b/src/share/classes/sun/font/Decoration.java
index ebdf7c49a..647baf45e 100644
--- a/src/share/classes/sun/font/Decoration.java
+++ b/src/share/classes/sun/font/Decoration.java
@@ -267,7 +267,9 @@ public class Decoration {
CoreMetrics cm = label.getCoreMetrics();
if (strikethrough) {
Stroke savedStroke = g2d.getStroke();
- g2d.setStroke(new BasicStroke(cm.strikethroughThickness));
+ g2d.setStroke(new BasicStroke(cm.strikethroughThickness,
+ BasicStroke.CAP_BUTT,
+ BasicStroke.JOIN_MITER));
float strikeY = y + cm.strikethroughOffset;
g2d.draw(new Line2D.Float(x1, strikeY, x2, strikeY));
g2d.setStroke(savedStroke);
@@ -341,7 +343,7 @@ public class Decoration {
Rectangle2D visBounds = label.handleGetVisualBounds();
- if (swapColors || bgPaint != null
+ if (swapColors || bgPaint != null || strikethrough
|| stdUnderline != null || imUnderline != null) {
float minX = 0;
@@ -377,6 +379,7 @@ public class Decoration {
// NOTE: The performace of the following code may
// be very poor.
float ulThickness = cm.underlineThickness;
+ float ulOffset = cm.underlineOffset;
Rectangle2D lb = label.getLogicalBounds();
float x1 = x;
@@ -385,12 +388,15 @@ public class Decoration {
Area area = null;
if (stdUnderline != null) {
- Shape ul = stdUnderline.getUnderlineShape(ulThickness, x1, x2, y);
+ Shape ul = stdUnderline.getUnderlineShape(ulThickness,
+ x1, x2, y+ulOffset);
area = new Area(ul);
}
if (strikethrough) {
- Stroke stStroke = new BasicStroke(cm.strikethroughThickness);
+ Stroke stStroke = new BasicStroke(cm.strikethroughThickness,
+ BasicStroke.CAP_BUTT,
+ BasicStroke.JOIN_MITER);
float shiftY = y + cm.strikethroughOffset;
Line2D line = new Line2D.Float(x1, shiftY, x2, shiftY);
Area slArea = new Area(stStroke.createStrokedShape(line));
@@ -402,7 +408,8 @@ public class Decoration {
}
if (imUnderline != null) {
- Shape ul = imUnderline.getUnderlineShape(ulThickness, x1, x2, y);
+ Shape ul = imUnderline.getUnderlineShape(ulThickness,
+ x1, x2, y+ulOffset);
Area ulArea = new Area(ul);
if (area == null) {
area = ulArea;
diff --git a/src/share/classes/sun/font/FontManager.java b/src/share/classes/sun/font/FontManager.java
index d217be16d..f709f381a 100644
--- a/src/share/classes/sun/font/FontManager.java
+++ b/src/share/classes/sun/font/FontManager.java
@@ -3344,7 +3344,7 @@ public final class FontManager {
int fontFormat = FONTFORMAT_NONE;
int fontRank = Font2D.UNKNOWN_RANK;
- if (ext.equals(".ttf") || isTTC) {
+ if (ext.equals(".ttf") || ext.equals(".otf") || isTTC) {
fontFormat = FONTFORMAT_TRUETYPE;
fontRank = Font2D.TTF_RANK;
} else if (ext.equals(".pfa") || ext.equals(".pfb")) {
diff --git a/src/share/classes/sun/font/TrueTypeFont.java b/src/share/classes/sun/font/TrueTypeFont.java
index f77003dd6..5d9477b6e 100644
--- a/src/share/classes/sun/font/TrueTypeFont.java
+++ b/src/share/classes/sun/font/TrueTypeFont.java
@@ -90,6 +90,7 @@ public class TrueTypeFont extends FileFont {
public static final int ttcfTag = 0x74746366; // 'ttcf' - TTC file
public static final int v1ttTag = 0x00010000; // 'v1tt' - Version 1 TT font
public static final int trueTag = 0x74727565; // 'true' - Version 2 TT font
+ public static final int ottoTag = 0x4f54544f; // 'otto' - OpenType font
/* -- ID's used in the 'name' table */
public static final int MS_PLATFORM_ID = 3;
@@ -490,6 +491,7 @@ public class TrueTypeFont extends FileFont {
case v1ttTag:
case trueTag:
+ case ottoTag:
break;
default:
diff --git a/src/share/classes/sun/font/Underline.java b/src/share/classes/sun/font/Underline.java
index efe78985d..ad1910b84 100644
--- a/src/share/classes/sun/font/Underline.java
+++ b/src/share/classes/sun/font/Underline.java
@@ -126,7 +126,9 @@ abstract class Underline {
private BasicStroke createStroke(float lineThickness) {
if (dashPattern == null) {
- return new BasicStroke(lineThickness);
+ return new BasicStroke(lineThickness,
+ BasicStroke.CAP_BUTT,
+ BasicStroke.JOIN_MITER);
}
else {
return new BasicStroke(lineThickness,
diff --git a/src/share/classes/sun/java2d/SunGraphicsEnvironment.java b/src/share/classes/sun/java2d/SunGraphicsEnvironment.java
index e0e03d36a..14029a0f8 100644
--- a/src/share/classes/sun/java2d/SunGraphicsEnvironment.java
+++ b/src/share/classes/sun/java2d/SunGraphicsEnvironment.java
@@ -812,7 +812,9 @@ public abstract class SunGraphicsEnvironment extends GraphicsEnvironment
return(name.startsWith(".ttf", offset) ||
name.startsWith(".TTF", offset) ||
name.startsWith(".ttc", offset) ||
- name.startsWith(".TTC", offset));
+ name.startsWith(".TTC", offset) ||
+ name.startsWith(".otf", offset) ||
+ name.startsWith(".OTF", offset));
}
}
}
@@ -835,31 +837,11 @@ public abstract class SunGraphicsEnvironment extends GraphicsEnvironment
}
}
- public static class TTorT1Filter implements FilenameFilter {
- public boolean accept(File dir, String name) {
-
- /* all conveniently have the same suffix length */
- int offset = name.length()-4;
- if (offset <= 0) { /* must be at least A.ttf or A.pfa */
- return false;
- } else {
- boolean isTT =
- name.startsWith(".ttf", offset) ||
- name.startsWith(".TTF", offset) ||
- name.startsWith(".ttc", offset) ||
- name.startsWith(".TTC", offset);
- if (isTT) {
- return true;
- } else if (noType1Font) {
- return false;
- } else {
- return(name.startsWith(".pfa", offset) ||
- name.startsWith(".pfb", offset) ||
- name.startsWith(".PFA", offset) ||
- name.startsWith(".PFB", offset));
- }
- }
- }
+ public static class TTorT1Filter implements FilenameFilter {
+ public boolean accept(File dir, String name) {
+ return SunGraphicsEnvironment.ttFilter.accept(dir, name) ||
+ SunGraphicsEnvironment.t1Filter.accept(dir, name);
+ }
}
/* No need to keep consing up new instances - reuse a singleton.
@@ -1290,6 +1272,13 @@ public abstract class SunGraphicsEnvironment extends GraphicsEnvironment
displayChanger.notifyPaletteChanged();
}
+ /**
+ * Returns true when the display is local, false for remote displays.
+ *
+ * @return true when the display is local, false for remote displays
+ */
+ public abstract boolean isDisplayLocal();
+
/*
* ----DISPLAY CHANGE SUPPORT----
*/
diff --git a/src/share/classes/sun/java2d/SurfaceData.java b/src/share/classes/sun/java2d/SurfaceData.java
index 84acfbd8f..65a04c232 100644
--- a/src/share/classes/sun/java2d/SurfaceData.java
+++ b/src/share/classes/sun/java2d/SurfaceData.java
@@ -449,7 +449,8 @@ public abstract class SurfaceData
// For now the answer can only be true in the following cases:
if (sg2d.compositeState <= SunGraphics2D.COMP_ISCOPY &&
sg2d.paintState <= SunGraphics2D.PAINT_ALPHACOLOR &&
- sg2d.clipState <= SunGraphics2D.CLIP_RECTANGULAR)
+ sg2d.clipState <= SunGraphics2D.CLIP_RECTANGULAR &&
+ sg2d.surfaceData.getTransparency() == Transparency.OPAQUE)
{
if (haveLCDLoop == LCDLOOP_UNKNOWN) {
DrawGlyphListLCD loop =
diff --git a/src/share/classes/sun/java2d/opengl/OGLBlitLoops.java b/src/share/classes/sun/java2d/opengl/OGLBlitLoops.java
index 5be4fec72..37dce4264 100644
--- a/src/share/classes/sun/java2d/opengl/OGLBlitLoops.java
+++ b/src/share/classes/sun/java2d/opengl/OGLBlitLoops.java
@@ -25,17 +25,13 @@
package sun.java2d.opengl;
-import java.awt.AlphaComposite;
-import java.awt.Color;
import java.awt.Composite;
import java.awt.Transparency;
import java.awt.geom.AffineTransform;
import java.awt.image.AffineTransformOp;
import java.awt.image.BufferedImage;
import java.awt.image.BufferedImageOp;
-import java.awt.image.ColorModel;
import java.lang.ref.WeakReference;
-import sun.awt.image.BufImgSurfaceData;
import sun.java2d.SurfaceData;
import sun.java2d.loops.Blit;
import sun.java2d.loops.CompositeType;
@@ -84,6 +80,8 @@ class OGLBlitLoops {
OGLSurfaceData.PF_INT_BGR),
new OGLSwToSurfaceBlit(SurfaceType.IntBgrx,
OGLSurfaceData.PF_INT_BGRX),
+ new OGLSwToSurfaceBlit(SurfaceType.ThreeByteBgr,
+ OGLSurfaceData.PF_3BYTE_BGR),
new OGLSwToSurfaceBlit(SurfaceType.Ushort565Rgb,
OGLSurfaceData.PF_USHORT_565_RGB),
new OGLSwToSurfaceBlit(SurfaceType.Ushort555Rgb,
@@ -106,6 +104,8 @@ class OGLBlitLoops {
OGLSurfaceData.PF_INT_BGR),
new OGLSwToSurfaceScale(SurfaceType.IntBgrx,
OGLSurfaceData.PF_INT_BGRX),
+ new OGLSwToSurfaceScale(SurfaceType.ThreeByteBgr,
+ OGLSurfaceData.PF_3BYTE_BGR),
new OGLSwToSurfaceScale(SurfaceType.Ushort565Rgb,
OGLSurfaceData.PF_USHORT_565_RGB),
new OGLSwToSurfaceScale(SurfaceType.Ushort555Rgb,
@@ -127,6 +127,8 @@ class OGLBlitLoops {
OGLSurfaceData.PF_INT_BGR),
new OGLSwToSurfaceTransform(SurfaceType.IntBgrx,
OGLSurfaceData.PF_INT_BGRX),
+ new OGLSwToSurfaceTransform(SurfaceType.ThreeByteBgr,
+ OGLSurfaceData.PF_3BYTE_BGR),
new OGLSwToSurfaceTransform(SurfaceType.Ushort565Rgb,
OGLSurfaceData.PF_USHORT_565_RGB),
new OGLSwToSurfaceTransform(SurfaceType.Ushort555Rgb,
@@ -155,6 +157,8 @@ class OGLBlitLoops {
OGLSurfaceData.PF_INT_BGR),
new OGLSwToTextureBlit(SurfaceType.IntBgrx,
OGLSurfaceData.PF_INT_BGRX),
+ new OGLSwToTextureBlit(SurfaceType.ThreeByteBgr,
+ OGLSurfaceData.PF_3BYTE_BGR),
new OGLSwToTextureBlit(SurfaceType.Ushort565Rgb,
OGLSurfaceData.PF_USHORT_565_RGB),
new OGLSwToTextureBlit(SurfaceType.Ushort555Rgb,
diff --git a/src/share/classes/sun/java2d/opengl/OGLSurfaceData.java b/src/share/classes/sun/java2d/opengl/OGLSurfaceData.java
index 78f16f7dc..dc509a71a 100644
--- a/src/share/classes/sun/java2d/opengl/OGLSurfaceData.java
+++ b/src/share/classes/sun/java2d/opengl/OGLSurfaceData.java
@@ -120,6 +120,7 @@ public abstract class OGLSurfaceData extends SurfaceData
public static final int PF_USHORT_555_RGBX = 8;
public static final int PF_BYTE_GRAY = 9;
public static final int PF_USHORT_GRAY = 10;
+ public static final int PF_3BYTE_BGR = 11;
/**
* SurfaceTypes
@@ -401,6 +402,7 @@ public abstract class OGLSurfaceData extends SurfaceData
* - the fragment shader extension is available, and
* - blending is disabled, and
* - the source color is opaque
+ * - and the destination is opaque
*
* Eventually, we could enhance the native OGL text rendering code
* and remove the above restrictions, but that would require significantly
@@ -410,7 +412,8 @@ public abstract class OGLSurfaceData extends SurfaceData
return
graphicsConfig.isCapPresent(CAPS_EXT_LCD_SHADER) &&
sg2d.compositeState <= SunGraphics2D.COMP_ISCOPY &&
- sg2d.paintState <= SunGraphics2D.PAINT_OPAQUECOLOR;
+ sg2d.paintState <= SunGraphics2D.PAINT_OPAQUECOLOR &&
+ sg2d.surfaceData.getTransparency() == Transparency.OPAQUE;
}
public void validatePipe(SunGraphics2D sg2d) {
diff --git a/src/share/classes/sun/java2d/pipe/BufferedContext.java b/src/share/classes/sun/java2d/pipe/BufferedContext.java
index 059895230..886ba1e11 100644
--- a/src/share/classes/sun/java2d/pipe/BufferedContext.java
+++ b/src/share/classes/sun/java2d/pipe/BufferedContext.java
@@ -90,7 +90,8 @@ public abstract class BufferedContext {
private Region validatedClip;
private Composite validatedComp;
private Paint validatedPaint;
- private boolean isValidatedPaintAColor;
+ // renamed from isValidatedPaintAColor as part of a work around for 6764257
+ private boolean isValidatedPaintJustAColor;
private int validatedRGB;
private int validatedFlags;
private boolean xformInUse;
@@ -182,7 +183,7 @@ public abstract class BufferedContext {
if (paint instanceof Color) {
// REMIND: not 30-bit friendly
int newRGB = ((Color)paint).getRGB();
- if (isValidatedPaintAColor) {
+ if (isValidatedPaintJustAColor) {
if (newRGB != validatedRGB) {
validatedRGB = newRGB;
updatePaint = true;
@@ -190,13 +191,13 @@ public abstract class BufferedContext {
} else {
validatedRGB = newRGB;
updatePaint = true;
- isValidatedPaintAColor = true;
+ isValidatedPaintJustAColor = true;
}
} else if (validatedPaint != paint) {
updatePaint = true;
// this should be set when we are switching from paint to color
// in which case this condition will be true
- isValidatedPaintAColor = false;
+ isValidatedPaintJustAColor = false;
}
if ((currentContext != this) ||
@@ -281,7 +282,7 @@ public abstract class BufferedContext {
txChanged = true;
}
// non-Color paints may require paint revalidation
- if (!isValidatedPaintAColor && txChanged) {
+ if (!isValidatedPaintJustAColor && txChanged) {
updatePaint = true;
}
@@ -427,10 +428,12 @@ public abstract class BufferedContext {
resetTransform();
resetComposite();
resetClip();
+ BufferedPaints.resetPaint(rq);
invalidateSurfaces();
validatedComp = null;
validatedClip = null;
validatedPaint = null;
+ isValidatedPaintJustAColor = false;
xformInUse = false;
}
diff --git a/src/share/classes/sun/print/PSPathGraphics.java b/src/share/classes/sun/print/PSPathGraphics.java
index 15bea939d..3e7b057b8 100644
--- a/src/share/classes/sun/print/PSPathGraphics.java
+++ b/src/share/classes/sun/print/PSPathGraphics.java
@@ -30,7 +30,6 @@ import java.awt.Font;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.Image;
-import java.awt.Paint;
import java.awt.Shape;
import java.awt.Transparency;
diff --git a/src/share/classes/sun/print/PrintJobAttributeException.java b/src/share/classes/sun/print/PrintJobAttributeException.java
index 7a29690c4..52a939f86 100644
--- a/src/share/classes/sun/print/PrintJobAttributeException.java
+++ b/src/share/classes/sun/print/PrintJobAttributeException.java
@@ -25,7 +25,6 @@
package sun.print;
-import javax.print.DocFlavor;
import javax.print.AttributeException;
import javax.print.PrintException;
import javax.print.attribute.Attribute;
diff --git a/src/share/classes/sun/print/SunMinMaxPage.java b/src/share/classes/sun/print/SunMinMaxPage.java
index 19962c56e..0bd9acb2a 100644
--- a/src/share/classes/sun/print/SunMinMaxPage.java
+++ b/src/share/classes/sun/print/SunMinMaxPage.java
@@ -25,7 +25,6 @@
package sun.print;
-import javax.print.attribute.EnumSyntax;
import javax.print.attribute.PrintRequestAttribute;
/*
diff --git a/src/share/classes/sun/print/SunPageSelection.java b/src/share/classes/sun/print/SunPageSelection.java
index 2c2d82b8d..f51f26e92 100644
--- a/src/share/classes/sun/print/SunPageSelection.java
+++ b/src/share/classes/sun/print/SunPageSelection.java
@@ -26,7 +26,6 @@
package sun.print;
import javax.print.attribute.PrintRequestAttribute;
-import javax.print.attribute.standard.Media;
/*
* A class used to determine the range of pages to be printed.
diff --git a/src/share/classes/sun/swing/SwingUtilities2.java b/src/share/classes/sun/swing/SwingUtilities2.java
index 3a12a4971..3a4bc2141 100644
--- a/src/share/classes/sun/swing/SwingUtilities2.java
+++ b/src/share/classes/sun/swing/SwingUtilities2.java
@@ -55,6 +55,7 @@ import java.io.*;
import java.util.*;
import sun.font.FontDesignMetrics;
import sun.font.FontManager;
+import sun.java2d.SunGraphicsEnvironment;
import java.util.concurrent.Callable;
import java.util.concurrent.Future;
@@ -1478,22 +1479,14 @@ public class SwingUtilities2 {
* appear capable of performing gamma correction needed for LCD text.
*/
public static boolean isLocalDisplay() {
- try {
- // On Windows just return true. Permission to read os.name
- // is granted to all code but wrapped in try to be safe.
- if (OSInfo.getOSType() == OSInfo.OSType.WINDOWS) {
- return true;
- }
- // Else probably Solaris or Linux in which case may be remote X11
- Class<?> x11Class = Class.forName("sun.awt.X11GraphicsEnvironment");
- Method isDisplayLocalMethod = x11Class.getMethod(
- "isDisplayLocal", new Class[0]);
- return (Boolean)isDisplayLocalMethod.invoke(null, (Object[])null);
- } catch (Throwable t) {
- }
- // If we get here we're most likely being run on some other O/S
- // or we didn't properly detect Windows.
- return true;
+ boolean isLocal;
+ GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
+ if (ge instanceof SunGraphicsEnvironment) {
+ isLocal = ((SunGraphicsEnvironment) ge).isDisplayLocal();
+ } else {
+ isLocal = true;
+ }
+ return isLocal;
}
/**
diff --git a/src/share/demo/java2d/J2DBench/src/j2dbench/tests/ImageTests.java b/src/share/demo/java2d/J2DBench/src/j2dbench/tests/ImageTests.java
index 51c4828e8..ab06b9f49 100644
--- a/src/share/demo/java2d/J2DBench/src/j2dbench/tests/ImageTests.java
+++ b/src/share/demo/java2d/J2DBench/src/j2dbench/tests/ImageTests.java
@@ -60,6 +60,9 @@ import java.awt.image.VolatileImage;
import java.awt.image.WritableRaster;
import java.awt.Transparency;
import java.awt.geom.AffineTransform;
+import java.awt.image.DataBufferByte;
+import java.awt.image.DataBufferInt;
+import java.awt.image.DataBufferShort;
import java.util.ArrayList;
import javax.swing.JComponent;
@@ -84,6 +87,7 @@ public abstract class ImageTests extends GraphicsTests {
static Group.EnableSet bufimgsrcroot;
static Group imgtestroot;
+ static Group imgoptionsroot;
static Group imageOpRoot;
static Group imageOpOptRoot;
@@ -92,6 +96,7 @@ public abstract class ImageTests extends GraphicsTests {
static Group bufImgOpTestRoot;
static Group rasterOpTestRoot;
static Option opList;
+ static Option doTouchSrc;
static String transNodeNames[] = {
null, "opaque", "bitmask", "translucent",
@@ -105,9 +110,19 @@ public abstract class ImageTests extends GraphicsTests {
imageroot = new Group(graphicsroot, "imaging",
"Imaging Benchmarks");
imageroot.setTabbed();
+
imgsrcroot = new Group.EnableSet(imageroot, "src",
"Image Rendering Sources");
imgsrcroot.setBordered(true);
+
+ imgoptionsroot = new Group(imgsrcroot, "options",
+ "Image Source Options");
+ imgoptionsroot.setBordered(true);
+ doTouchSrc =
+ new Option.Toggle(imgoptionsroot, "touchsrc",
+ "Touch src image before every operation",
+ Option.Toggle.Off);
+
imgtestroot = new Group(imageroot, "tests",
"Image Rendering Tests");
imgtestroot.setBordered(true);
@@ -131,7 +146,11 @@ public abstract class ImageTests extends GraphicsTests {
new BufImg(BufferedImage.TYPE_INT_RGB);
new BufImg(BufferedImage.TYPE_INT_ARGB);
new BufImg(BufferedImage.TYPE_BYTE_GRAY);
+ new BufImg(BufferedImage.TYPE_3BYTE_BGR);
new BmByteIndexBufImg();
+ new BufImg(BufferedImage.TYPE_INT_RGB, true);
+ new BufImg(BufferedImage.TYPE_INT_ARGB, true);
+ new BufImg(BufferedImage.TYPE_3BYTE_BGR, true);
imageOpRoot = new Group(imageroot, "imageops",
"Image Op Benchmarks");
@@ -193,6 +212,7 @@ public abstract class ImageTests extends GraphicsTests {
}
public static class Context extends GraphicsTests.Context {
+ boolean touchSrc;
Image src;
AffineTransform tx;
}
@@ -206,6 +226,7 @@ public abstract class ImageTests extends GraphicsTests {
{
super(parent, nodeName, description);
addDependency(imgsrcroot, srcFilter);
+ addDependency(doTouchSrc);
}
public GraphicsTests.Context createContext() {
@@ -217,6 +238,7 @@ public abstract class ImageTests extends GraphicsTests {
ImageTests.Context ictx = (ImageTests.Context) ctx;
ictx.src = env.getSrcImage();
+ ictx.touchSrc = env.isEnabled(doTouchSrc);
}
public abstract static class TriStateImageType extends Group {
@@ -272,13 +294,6 @@ public abstract class ImageTests extends GraphicsTests {
public static class CompatImg extends TriStateImageType {
int transparency;
- public static String Descriptions[] = {
- "Default Compatible Image",
- "Opaque Compatible Image",
- "Bitmask Compatible Image",
- "Translucent Compatible Image",
- };
-
public CompatImg(int transparency) {
super(imgsrcroot,
Destinations.CompatImg.ShortNames[transparency],
@@ -296,6 +311,7 @@ public abstract class ImageTests extends GraphicsTests {
public static class BufImg extends TriStateImageType {
int type;
+ boolean unmanaged;
static int Transparencies[] = {
Transparency.TRANSLUCENT, // "custom",
@@ -315,15 +331,37 @@ public abstract class ImageTests extends GraphicsTests {
};
public BufImg(int type) {
+ this(type, false);
+ }
+
+ public BufImg(int type, boolean unmanaged) {
super(bufimgsrcroot,
+ (unmanaged ? "unmanaged" : "") +
Destinations.BufImg.ShortNames[type],
+ (unmanaged ? "Unmanaged " : "") +
Destinations.BufImg.Descriptions[type],
Transparencies[type]);
this.type = type;
+ this.unmanaged = unmanaged;
}
public Image makeImage(TestEnvironment env, int w, int h) {
- return new BufferedImage(w, h, type);
+ BufferedImage img = new BufferedImage(w, h, type);
+ if (unmanaged) {
+ DataBuffer db = img.getRaster().getDataBuffer();
+ if (db instanceof DataBufferInt) {
+ ((DataBufferInt)db).getData();
+ } else if (db instanceof DataBufferShort) {
+ ((DataBufferShort)db).getData();
+ } else if (db instanceof DataBufferByte) {
+ ((DataBufferByte)db).getData();
+ } else {
+ try {
+ img.setAccelerationPriority(0.0f);
+ } catch (Throwable e) {}
+ }
+ }
+ return img;
}
}
@@ -471,15 +509,33 @@ public abstract class ImageTests extends GraphicsTests {
g.translate(ictx.orgX, ictx.orgY);
Image src = ictx.src;
if (ictx.animate) {
- do {
- g.drawImage(src, x, y, null);
- if ((x -= 3) < 0) x += ictx.maxX;
- if ((y -= 1) < 0) y += ictx.maxY;
- } while (--numReps > 0);
+ if (ictx.touchSrc) {
+ Graphics srcG = src.getGraphics();
+ do {
+ srcG.fillRect(0, 0, 1, 1);
+ g.drawImage(src, x, y, null);
+ if ((x -= 3) < 0) x += ictx.maxX;
+ if ((y -= 1) < 0) y += ictx.maxY;
+ } while (--numReps > 0);
+ } else {
+ do {
+ g.drawImage(src, x, y, null);
+ if ((x -= 3) < 0) x += ictx.maxX;
+ if ((y -= 1) < 0) y += ictx.maxY;
+ } while (--numReps > 0);
+ }
} else {
- do {
- g.drawImage(src, x, y, null);
- } while (--numReps > 0);
+ if (ictx.touchSrc) {
+ Graphics srcG = src.getGraphics();
+ do {
+ srcG.fillRect(0, 0, 1, 1);
+ g.drawImage(src, x, y, null);
+ } while (--numReps > 0);
+ } else {
+ do {
+ g.drawImage(src, x, y, null);
+ } while (--numReps > 0);
+ }
}
g.translate(-ictx.orgX, -ictx.orgY);
}
@@ -505,15 +561,33 @@ public abstract class ImageTests extends GraphicsTests {
Image src = ictx.src;
Color bg = Color.orange;
if (ictx.animate) {
- do {
- g.drawImage(src, x, y, bg, null);
- if ((x -= 3) < 0) x += ictx.maxX;
- if ((y -= 1) < 0) y += ictx.maxY;
- } while (--numReps > 0);
+ if (ictx.touchSrc) {
+ Graphics srcG = src.getGraphics();
+ do {
+ srcG.fillRect(0, 0, 1, 1);
+ g.drawImage(src, x, y, bg, null);
+ if ((x -= 3) < 0) x += ictx.maxX;
+ if ((y -= 1) < 0) y += ictx.maxY;
+ } while (--numReps > 0);
+ } else {
+ do {
+ g.drawImage(src, x, y, bg, null);
+ if ((x -= 3) < 0) x += ictx.maxX;
+ if ((y -= 1) < 0) y += ictx.maxY;
+ } while (--numReps > 0);
+ }
} else {
- do {
- g.drawImage(src, x, y, bg, null);
- } while (--numReps > 0);
+ if (ictx.touchSrc) {
+ Graphics srcG = src.getGraphics();
+ do {
+ srcG.fillRect(0, 0, 1, 1);
+ g.drawImage(src, x, y, bg, null);
+ } while (--numReps > 0);
+ } else {
+ do {
+ g.drawImage(src, x, y, bg, null);
+ } while (--numReps > 0);
+ }
}
g.translate(-ictx.orgX, -ictx.orgY);
}
@@ -524,7 +598,7 @@ public abstract class ImageTests extends GraphicsTests {
public DrawImageScale(String dir, float scale) {
super(imgtestroot, "drawimagescale"+dir,
- "drawImage(img, x, y, w*"+scale+", h*"+scale+", obs);");
+ "drawImage(img, x, y, w*"+scale+", h*"+scale+", obs);");
this.scale = scale;
}
@@ -546,15 +620,33 @@ public abstract class ImageTests extends GraphicsTests {
g.translate(ictx.orgX, ictx.orgY);
Image src = ictx.src;
if (ictx.animate) {
- do {
- g.drawImage(src, x, y, w, h, null);
- if ((x -= 3) < 0) x += ictx.maxX;
- if ((y -= 1) < 0) y += ictx.maxY;
- } while (--numReps > 0);
+ if (ictx.touchSrc) {
+ Graphics srcG = src.getGraphics();
+ do {
+ srcG.fillRect(0, 0, 1, 1);
+ g.drawImage(src, x, y, w, h, null);
+ if ((x -= 3) < 0) x += ictx.maxX;
+ if ((y -= 1) < 0) y += ictx.maxY;
+ } while (--numReps > 0);
+ } else {
+ do {
+ g.drawImage(src, x, y, w, h, null);
+ if ((x -= 3) < 0) x += ictx.maxX;
+ if ((y -= 1) < 0) y += ictx.maxY;
+ } while (--numReps > 0);
+ }
} else {
- do {
- g.drawImage(src, x, y, w, h, null);
- } while (--numReps > 0);
+ Graphics srcG = src.getGraphics();
+ if (ictx.touchSrc) {
+ do {
+ srcG.fillRect(0, 0, 1, 1);
+ g.drawImage(src, x, y, w, h, null);
+ } while (--numReps > 0);
+ } else {
+ do {
+ g.drawImage(src, x, y, w, h, null);
+ } while (--numReps > 0);
+ }
}
g.translate(-ictx.orgX, -ictx.orgY);
}
@@ -588,17 +680,36 @@ public abstract class ImageTests extends GraphicsTests {
Image src = ictx.src;
AffineTransform tx = ictx.tx;
if (ictx.animate) {
- do {
- tx.setTransform(1.0, 0.1, 0.1, 1.0, x, y);
- g.drawImage(src, tx, null);
- if ((x -= 3) < 0) x += ictx.maxX;
- if ((y -= 1) < 0) y += ictx.maxY;
- } while (--numReps > 0);
+ if (ictx.touchSrc) {
+ Graphics srcG = src.getGraphics();
+ do {
+ tx.setTransform(1.0, 0.1, 0.1, 1.0, x, y);
+ srcG.fillRect(0, 0, 1, 1);
+ g.drawImage(src, tx, null);
+ if ((x -= 3) < 0) x += ictx.maxX;
+ if ((y -= 1) < 0) y += ictx.maxY;
+ } while (--numReps > 0);
+ } else {
+ do {
+ tx.setTransform(1.0, 0.1, 0.1, 1.0, x, y);
+ g.drawImage(src, tx, null);
+ if ((x -= 3) < 0) x += ictx.maxX;
+ if ((y -= 1) < 0) y += ictx.maxY;
+ } while (--numReps > 0);
+ }
} else {
tx.setTransform(1.0, 0.1, 0.1, 1.0, x, y);
- do {
- g.drawImage(src, tx, null);
- } while (--numReps > 0);
+ if (ictx.touchSrc) {
+ Graphics srcG = src.getGraphics();
+ do {
+ srcG.fillRect(0, 0, 1, 1);
+ g.drawImage(src, tx, null);
+ } while (--numReps > 0);
+ } else {
+ do {
+ g.drawImage(src, tx, null);
+ } while (--numReps > 0);
+ }
}
g.translate(-ictx.orgX, -ictx.orgY);
}
@@ -736,15 +847,33 @@ public abstract class ImageTests extends GraphicsTests {
Graphics2D g2 = (Graphics2D)ictx.graphics;
g2.translate(ictx.orgX, ictx.orgY);
if (ictx.animate) {
- do {
- g2.drawImage(src, op, x, y);
- if ((x -= 3) < 0) x += ictx.maxX;
- if ((y -= 1) < 0) y += ictx.maxY;
- } while (--numReps > 0);
+ if (ictx.touchSrc) {
+ Graphics gSrc = src.getGraphics();
+ do {
+ gSrc.fillRect(0, 0, 1, 1);
+ g2.drawImage(src, op, x, y);
+ if ((x -= 3) < 0) x += ictx.maxX;
+ if ((y -= 1) < 0) y += ictx.maxY;
+ } while (--numReps > 0);
+ } else {
+ do {
+ g2.drawImage(src, op, x, y);
+ if ((x -= 3) < 0) x += ictx.maxX;
+ if ((y -= 1) < 0) y += ictx.maxY;
+ } while (--numReps > 0);
+ }
} else {
- do {
- g2.drawImage(src, op, x, y);
- } while (--numReps > 0);
+ if (ictx.touchSrc) {
+ Graphics gSrc = src.getGraphics();
+ do {
+ gSrc.fillRect(0, 0, 1, 1);
+ g2.drawImage(src, op, x, y);
+ } while (--numReps > 0);
+ } else {
+ do {
+ g2.drawImage(src, op, x, y);
+ } while (--numReps > 0);
+ }
}
g2.translate(-ictx.orgX, -ictx.orgY);
}
@@ -778,9 +907,17 @@ public abstract class ImageTests extends GraphicsTests {
BufferedImageOp op = ictx.bufImgOp;
BufferedImage src = ictx.bufSrc;
BufferedImage dst = ictx.bufDst;
- do {
- op.filter(src, dst);
- } while (--numReps > 0);
+ if (ictx.touchSrc) {
+ Graphics gSrc = src.getGraphics();
+ do {
+ gSrc.fillRect(0, 0, 1, 1);
+ op.filter(src, dst);
+ } while (--numReps > 0);
+ } else {
+ do {
+ op.filter(src, dst);
+ } while (--numReps > 0);
+ }
}
}
@@ -814,9 +951,17 @@ public abstract class ImageTests extends GraphicsTests {
RasterOp op = ictx.rasterOp;
Raster src = ictx.rasSrc;
WritableRaster dst = ictx.rasDst;
- do {
- op.filter(src, dst);
- } while (--numReps > 0);
+ if (ictx.touchSrc) {
+ Graphics gSrc = ictx.bufSrc.getGraphics();
+ do {
+ gSrc.fillRect(0, 0, 1, 1);
+ op.filter(src, dst);
+ } while (--numReps > 0);
+ } else {
+ do {
+ op.filter(src, dst);
+ } while (--numReps > 0);
+ }
}
}
}
diff --git a/src/share/native/sun/font/freetypeScaler.c b/src/share/native/sun/font/freetypeScaler.c
index 5f6385b28..59c1a180c 100644
--- a/src/share/native/sun/font/freetypeScaler.c
+++ b/src/share/native/sun/font/freetypeScaler.c
@@ -1281,7 +1281,7 @@ Java_sun_font_FreetypeFontScaler_getGlyphOutlineBoundsNative(
sunFontIDs.rect2DFloatClass,
sunFontIDs.rect2DFloatCtr4,
F26Dot6ToFloat(bbox.xMin),
- F26Dot6ToFloat(bbox.yMax),
+ F26Dot6ToFloat(-bbox.yMax),
F26Dot6ToFloat(bbox.xMax-bbox.xMin),
F26Dot6ToFloat(bbox.yMax-bbox.yMin));
}
diff --git a/src/share/native/sun/java2d/opengl/OGLBlitLoops.c b/src/share/native/sun/java2d/opengl/OGLBlitLoops.c
index 0a16a2b73..a9f98c80c 100644
--- a/src/share/native/sun/java2d/opengl/OGLBlitLoops.c
+++ b/src/share/native/sun/java2d/opengl/OGLBlitLoops.c
@@ -203,7 +203,24 @@ OGLBlitSwToSurface(OGLContext *oglc, SurfaceDataRasInfo *srcInfo,
j2d_glBitmap(0, 0, 0, 0, (GLfloat)dx1, (GLfloat)-dy1, NULL);
j2d_glPixelZoom(scalex, -scaley);
- j2d_glDrawPixels(sx2-sx1, sy2-sy1, pf->format, pf->type, srcInfo->rasBase);
+
+ // in case pixel stride is not a multiple of scanline stride the copy
+ // has to be done line by line (see 6207877)
+ if (srcInfo->scanStride % srcInfo->pixelStride != 0) {
+ jint width = sx2-sx1;
+ jint height = sy2-sy1;
+ GLvoid *pSrc = srcInfo->rasBase;
+
+ while (height > 0) {
+ j2d_glDrawPixels(width, 1, pf->format, pf->type, pSrc);
+ j2d_glBitmap(0, 0, 0, 0, (GLfloat)0, (GLfloat)-1, NULL);
+ pSrc = PtrAddBytes(pSrc, srcInfo->scanStride);
+ height--;
+ }
+ } else {
+ j2d_glDrawPixels(sx2-sx1, sy2-sy1, pf->format, pf->type, srcInfo->rasBase);
+ }
+
j2d_glPixelZoom(1.0, 1.0);
if (oglc->extraAlpha != 1.0f) {
@@ -250,6 +267,7 @@ OGLBlitToSurfaceViaTexture(OGLContext *oglc, SurfaceDataRasInfo *srcInfo,
jint sx, sy, sw, sh;
GLint glhint = (hint == OGLSD_XFORM_BILINEAR) ? GL_LINEAR : GL_NEAREST;
jboolean adjustAlpha = (pf != NULL && !pf->hasAlpha);
+ jboolean slowPath;
if (oglc->blitTextureID == 0) {
if (!OGLContext_InitBlitTileTexture(oglc)) {
@@ -279,6 +297,10 @@ OGLBlitToSurfaceViaTexture(OGLContext *oglc, SurfaceDataRasInfo *srcInfo,
j2d_glPixelTransferf(GL_ALPHA_BIAS, 1.0f);
}
+ // in case pixel stride is not a multiple of scanline stride the copy
+ // has to be done line by line (see 6207877)
+ slowPath = srcInfo->scanStride % srcInfo->pixelStride != 0;
+
for (sy = sy1, dy = dy1; sy < sy2; sy += th, dy += cdh) {
sh = ((sy + th) > sy2) ? (sy2 - sy) : th;
dh = ((dy + cdh) > dy2) ? (dy2 - dy) : cdh;
@@ -291,13 +313,29 @@ OGLBlitToSurfaceViaTexture(OGLContext *oglc, SurfaceDataRasInfo *srcInfo,
ty2 = ((GLdouble)sh) / th;
if (swsurface) {
- j2d_glPixelStorei(GL_UNPACK_SKIP_PIXELS, sx);
- j2d_glPixelStorei(GL_UNPACK_SKIP_ROWS, sy);
+ if (slowPath) {
+ jint tmph = sh;
+ GLvoid *pSrc = PtrCoord(srcInfo->rasBase,
+ sx, srcInfo->pixelStride,
+ sy, srcInfo->scanStride);
+
+ while (tmph > 0) {
+ j2d_glTexSubImage2D(GL_TEXTURE_2D, 0,
+ 0, sh - tmph, sw, 1,
+ pf->format, pf->type,
+ pSrc);
+ pSrc = PtrAddBytes(pSrc, srcInfo->scanStride);
+ tmph--;
+ }
+ } else {
+ j2d_glPixelStorei(GL_UNPACK_SKIP_PIXELS, sx);
+ j2d_glPixelStorei(GL_UNPACK_SKIP_ROWS, sy);
- j2d_glTexSubImage2D(GL_TEXTURE_2D, 0,
- 0, 0, sw, sh,
- pf->format, pf->type,
- srcInfo->rasBase);
+ j2d_glTexSubImage2D(GL_TEXTURE_2D, 0,
+ 0, 0, sw, sh,
+ pf->format, pf->type,
+ srcInfo->rasBase);
+ }
// the texture image is "right side up", so we align the
// upper-left texture corner with the upper-left quad corner
@@ -356,9 +394,25 @@ OGLBlitSwToTexture(SurfaceDataRasInfo *srcInfo, OGLPixelFormat *pf,
jint dx1, jint dy1, jint dx2, jint dy2)
{
j2d_glBindTexture(dstOps->textureTarget, dstOps->textureID);
- j2d_glTexSubImage2D(dstOps->textureTarget, 0,
- dx1, dy1, dx2-dx1, dy2-dy1,
- pf->format, pf->type, srcInfo->rasBase);
+ // in case pixel stride is not a multiple of scanline stride the copy
+ // has to be done line by line (see 6207877)
+ if (srcInfo->scanStride % srcInfo->pixelStride != 0) {
+ jint width = dx2 - dx1;
+ jint height = dy2 - dy1;
+ GLvoid *pSrc = srcInfo->rasBase;
+
+ while (height > 0) {
+ j2d_glTexSubImage2D(dstOps->textureTarget, 0,
+ dx1, dy2 - height, width, 1,
+ pf->format, pf->type, pSrc);
+ pSrc = PtrAddBytes(pSrc, srcInfo->scanStride);
+ height--;
+ }
+ } else {
+ j2d_glTexSubImage2D(dstOps->textureTarget, 0,
+ dx1, dy1, dx2-dx1, dy2-dy1,
+ pf->format, pf->type, srcInfo->rasBase);
+ }
}
/**
diff --git a/src/share/native/sun/java2d/opengl/OGLSurfaceData.c b/src/share/native/sun/java2d/opengl/OGLSurfaceData.c
index 2b45a610b..0cb11d105 100644
--- a/src/share/native/sun/java2d/opengl/OGLSurfaceData.c
+++ b/src/share/native/sun/java2d/opengl/OGLSurfaceData.c
@@ -73,7 +73,8 @@ OGLPixelFormat PixelFormats[] = {
1, 0, 1, }, /* 9 - ByteGray */
{ GL_LUMINANCE, GL_UNSIGNED_SHORT,
2, 0, 1, }, /*10 - UshortGray */
-};
+ { GL_BGR, GL_UNSIGNED_BYTE,
+ 1, 0, 1, }, /*11 - ThreeByteBgr */};
/**
* Given a starting value and a maximum limit, returns the first power-of-two
diff --git a/src/solaris/classes/sun/awt/X11GraphicsEnvironment.java b/src/solaris/classes/sun/awt/X11GraphicsEnvironment.java
index dadfe84d7..47ca64f1d 100644
--- a/src/solaris/classes/sun/awt/X11GraphicsEnvironment.java
+++ b/src/solaris/classes/sun/awt/X11GraphicsEnvironment.java
@@ -209,7 +209,7 @@ public class X11GraphicsEnvironment
private static native int checkShmExt();
private static native String getDisplayString();
- private static Boolean isDisplayLocal;
+ private Boolean isDisplayLocal;
/**
* This should only be called from the static initializer, so no need for
@@ -234,7 +234,8 @@ public class X11GraphicsEnvironment
return getScreenDevices()[getDefaultScreenNum()];
}
- public static boolean isDisplayLocal() {
+ @Override
+ public boolean isDisplayLocal() {
if (isDisplayLocal == null) {
SunToolkit.awtLock();
try {
diff --git a/src/solaris/classes/sun/java2d/opengl/GLXGraphicsConfig.java b/src/solaris/classes/sun/java2d/opengl/GLXGraphicsConfig.java
index 8e8e18448..d21e17754 100644
--- a/src/solaris/classes/sun/java2d/opengl/GLXGraphicsConfig.java
+++ b/src/solaris/classes/sun/java2d/opengl/GLXGraphicsConfig.java
@@ -120,12 +120,14 @@ public class GLXGraphicsConfig
new GLXGetConfigInfo(device.getScreen(), visualnum);
rq.flushAndInvokeNow(action);
cfginfo = action.getConfigInfo();
- OGLContext.setScratchSurface(cfginfo);
- rq.flushAndInvokeNow(new Runnable() {
- public void run() {
- ids[0] = OGLContext.getOGLIdString();
- }
- });
+ if (cfginfo != 0L) {
+ OGLContext.setScratchSurface(cfginfo);
+ rq.flushAndInvokeNow(new Runnable() {
+ public void run() {
+ ids[0] = OGLContext.getOGLIdString();
+ }
+ });
+ }
} finally {
rq.unlock();
}
diff --git a/src/solaris/classes/sun/java2d/x11/X11SurfaceData.java b/src/solaris/classes/sun/java2d/x11/X11SurfaceData.java
index 986f1b51e..54f797693 100644
--- a/src/solaris/classes/sun/java2d/x11/X11SurfaceData.java
+++ b/src/solaris/classes/sun/java2d/x11/X11SurfaceData.java
@@ -50,6 +50,7 @@ import sun.awt.image.PixelConverter;
import sun.font.X11TextRenderer;
import sun.java2d.InvalidPipeException;
import sun.java2d.SunGraphics2D;
+import sun.java2d.SunGraphicsEnvironment;
import sun.java2d.SurfaceData;
import sun.java2d.SurfaceDataProxy;
import sun.java2d.loops.SurfaceType;
@@ -240,6 +241,11 @@ public abstract class X11SurfaceData extends SurfaceData {
*/
public static native boolean isDgaAvailable();
+ /**
+ * Returns true if shared memory pixmaps are available
+ */
+ private static native boolean isShmPMAvailable();
+
public static boolean isAccelerationEnabled() {
if (accelerationEnabled == null) {
@@ -253,8 +259,17 @@ public abstract class X11SurfaceData extends SurfaceData {
// true iff prop==true, false otherwise
accelerationEnabled = Boolean.valueOf(prop);
} else {
- // use pixmaps if there is no dga, no matter local or remote
- accelerationEnabled = Boolean.valueOf(!isDgaAvailable());
+ boolean isDisplayLocal = false;
+ GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
+ if (ge instanceof SunGraphicsEnvironment) {
+ isDisplayLocal = ((SunGraphicsEnvironment) ge).isDisplayLocal();
+ }
+
+ // EXA based drivers tend to place pixmaps in VRAM, slowing down readbacks.
+ // Don't use pixmaps if dga is available,
+ // or we are local and shared memory Pixmaps are not available.
+ accelerationEnabled =
+ !(isDgaAvailable() || (isDisplayLocal && !isShmPMAvailable()));
}
}
}
diff --git a/src/solaris/classes/sun/print/CUPSPrinter.java b/src/solaris/classes/sun/print/CUPSPrinter.java
index cd7de38b2..a8c0dd0d3 100644
--- a/src/solaris/classes/sun/print/CUPSPrinter.java
+++ b/src/solaris/classes/sun/print/CUPSPrinter.java
@@ -46,9 +46,9 @@ import javax.print.attribute.standard.PrinterName;
public class CUPSPrinter {
-
+ private static final String debugPrefix = "CUPSPrinter>> ";
private static final double PRINTER_DPI = 72.0;
- private static boolean initialized;
+ private boolean initialized;
private static native String getCupsServer();
private static native int getCupsPort();
private static native boolean canConnect(String server, int port);
@@ -156,7 +156,7 @@ public class CUPSPrinter {
/**
* Initialize media by translating PPD info to PrintService attributes.
*/
- private void initMedia() {
+ private synchronized void initMedia() {
if (initialized) {
return;
} else {
@@ -392,9 +392,9 @@ public class CUPSPrinter {
* Detects if CUPS is running.
*/
public static boolean isCupsRunning() {
- IPPPrintService.debug_println("libFound "+libFound);
+ IPPPrintService.debug_println(debugPrefix+"libFound "+libFound);
if (libFound) {
- IPPPrintService.debug_println("CUPS server "+getServer()+
+ IPPPrintService.debug_println(debugPrefix+"CUPS server "+getServer()+
" port "+getPort());
return canConnect(getServer(), getPort());
} else {
diff --git a/src/solaris/classes/sun/print/IPPPrintService.java b/src/solaris/classes/sun/print/IPPPrintService.java
index ba438a930..07b68b18f 100644
--- a/src/solaris/classes/sun/print/IPPPrintService.java
+++ b/src/solaris/classes/sun/print/IPPPrintService.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2003-2008 Sun Microsystems, Inc. All Rights Reserved.
+ * Copyright 2003-2007 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
@@ -57,18 +57,28 @@ import java.io.InputStreamReader;
import java.nio.charset.Charset;
import java.util.Iterator;
+import java.util.HashSet;
public class IPPPrintService implements PrintService, SunPrinterJobService {
- public static boolean debugPrint = false;
- private static String debugPrefix = "IPPPrintService>> ";
+ public static final boolean debugPrint;
+ private static final String debugPrefix = "IPPPrintService>> ";
protected static void debug_println(String str) {
if (debugPrint) {
System.out.println(str);
}
}
+ private static final String FORCE_PIPE_PROP = "sun.print.ippdebug";
+
+ static {
+ String debugStr =
+ (String)java.security.AccessController.doPrivileged(
+ new sun.security.action.GetPropertyAction(FORCE_PIPE_PROP));
+
+ debugPrint = "true".equalsIgnoreCase(debugStr);
+ }
private String printer;
private URI myURI;
@@ -382,7 +392,7 @@ public class IPPPrintService implements PrintService, SunPrinterJobService {
if ((urlConnection = getIPPConnection(myURL)) == null) {
mediaSizeNames = new MediaSizeName[0];
mediaTrays = new MediaTray[0];
- debug_println("NULL urlConnection ");
+ debug_println(debugPrefix+"initAttributes, NULL urlConnection ");
init = true;
return;
}
@@ -407,7 +417,7 @@ public class IPPPrintService implements PrintService, SunPrinterJobService {
return;
} catch (Exception e) {
IPPPrintService.debug_println(debugPrefix+
- " error creating CUPSPrinter e="+e);
+ "initAttributes, error creating CUPSPrinter e="+e);
}
}
@@ -486,28 +496,26 @@ public class IPPPrintService implements PrintService, SunPrinterJobService {
/* Test if the flavor is compatible with the category */
if ((category == Copies.class) ||
(category == CopiesSupported.class)) {
- CopiesSupported cs = new CopiesSupported(1, MAXCOPIES);
- AttributeClass attribClass = (getAttMap != null) ?
- (AttributeClass)getAttMap.get(cs.getName()) : null;
- if (attribClass != null) {
- int[] range = attribClass.getIntRangeValue();
- cs = new CopiesSupported(range[0], range[1]);
+ if (flavor == null ||
+ !(flavor.equals(DocFlavor.INPUT_STREAM.POSTSCRIPT) ||
+ flavor.equals(DocFlavor.URL.POSTSCRIPT) ||
+ flavor.equals(DocFlavor.BYTE_ARRAY.POSTSCRIPT))) {
+ CopiesSupported cs = new CopiesSupported(1, MAXCOPIES);
+ AttributeClass attribClass = (getAttMap != null) ?
+ (AttributeClass)getAttMap.get(cs.getName()) : null;
+ if (attribClass != null) {
+ int[] range = attribClass.getIntRangeValue();
+ cs = new CopiesSupported(range[0], range[1]);
+ }
+ return cs;
+ } else {
+ return null;
}
- return cs;
} else if (category == Chromaticity.class) {
if (flavor == null ||
flavor.equals(DocFlavor.SERVICE_FORMATTED.PAGEABLE) ||
flavor.equals(DocFlavor.SERVICE_FORMATTED.PRINTABLE) ||
- flavor.equals(DocFlavor.BYTE_ARRAY.GIF) ||
- flavor.equals(DocFlavor.INPUT_STREAM.GIF) ||
- flavor.equals(DocFlavor.URL.GIF) ||
- flavor.equals(DocFlavor.BYTE_ARRAY.JPEG) ||
- flavor.equals(DocFlavor.INPUT_STREAM.JPEG) ||
- flavor.equals(DocFlavor.URL.JPEG) ||
- flavor.equals(DocFlavor.BYTE_ARRAY.PNG) ||
- flavor.equals(DocFlavor.INPUT_STREAM.PNG) ||
- flavor.equals(DocFlavor.URL.PNG)) {
-
+ !isIPPSupportedImages(flavor.getMimeType())) {
Chromaticity[]arr = new Chromaticity[1];
arr[0] = Chromaticity.COLOR;
return (arr);
@@ -822,7 +830,7 @@ public class IPPPrintService implements PrintService, SunPrinterJobService {
boolean psSupported = false;
String[] docFlavors = attribClass.getArrayOfStringValues();
DocFlavor[] flavors;
- ArrayList docList = new ArrayList();
+ HashSet docList = new HashSet();
int j;
String hostEnc = DocFlavor.hostEncoding.
toLowerCase(Locale.ENGLISH);
@@ -839,18 +847,6 @@ public class IPPPrintService implements PrintService, SunPrinterJobService {
docList.addAll(Arrays.asList(flavors));
- if (isCupsPrinter) {
- /*
- Always add Pageable and Printable for CUPS
- since it uses Filters to convert from Postscript
- to device printer language.
- */
- docList.add(
- DocFlavor.SERVICE_FORMATTED.PAGEABLE);
- docList.add(
- DocFlavor.SERVICE_FORMATTED.PRINTABLE);
- }
-
if (mimeType.equals("text/plain") &&
addHostEncoding) {
docList.add(Arrays.asList(textPlainHost));
@@ -880,16 +876,19 @@ public class IPPPrintService implements PrintService, SunPrinterJobService {
}
// check if we need to add image DocFlavors
+ // and Pageable/Printable flavors
if (psSupported || isCupsPrinter) {
- if (!jpgImagesAdded) {
- docList.addAll(Arrays.asList(imageJPG));
- }
- if (!pngImagesAdded) {
- docList.addAll(Arrays.asList(imagePNG));
- }
- if (!gifImagesAdded) {
- docList.addAll(Arrays.asList(imageGIF));
- }
+ /*
+ Always add Pageable and Printable for CUPS
+ since it uses Filters to convert from Postscript
+ to device printer language.
+ */
+ docList.add(DocFlavor.SERVICE_FORMATTED.PAGEABLE);
+ docList.add(DocFlavor.SERVICE_FORMATTED.PRINTABLE);
+
+ docList.addAll(Arrays.asList(imageJPG));
+ docList.addAll(Arrays.asList(imagePNG));
+ docList.addAll(Arrays.asList(imageGIF));
}
supportedDocFlavors = new DocFlavor[docList.size()];
docList.toArray(supportedDocFlavors);
@@ -922,6 +921,9 @@ public class IPPPrintService implements PrintService, SunPrinterJobService {
* Finds matching CustomMediaSizeName of given media.
*/
public CustomMediaSizeName findCustomMedia(MediaSizeName media) {
+ if (customMediaSizeNames == null) {
+ return null;
+ }
for (int i=0; i< customMediaSizeNames.length; i++) {
CustomMediaSizeName custom =
(CustomMediaSizeName)customMediaSizeNames[i];
@@ -1203,7 +1205,7 @@ public class IPPPrintService implements PrintService, SunPrinterJobService {
return true;
}
for (int i=0; i<mediaSizeNames.length; i++) {
- debug_println("mediaSizeNames[i] "+mediaSizeNames[i]);
+ debug_println(debugPrefix+"isSupportedMedia, mediaSizeNames[i] "+mediaSizeNames[i]);
if (msn.equals(mediaSizeNames[i])) {
return true;
}
@@ -1228,7 +1230,7 @@ public class IPPPrintService implements PrintService, SunPrinterJobService {
}
- public boolean isAttributeValueSupported(Attribute attr,
+ public boolean isAttributeValueSupported(Attribute attr,
DocFlavor flavor,
AttributeSet attributes) {
if (attr == null) {
@@ -1257,21 +1259,18 @@ public class IPPPrintService implements PrintService, SunPrinterJobService {
if ((flavor == null) ||
flavor.equals(DocFlavor.SERVICE_FORMATTED.PAGEABLE) ||
flavor.equals(DocFlavor.SERVICE_FORMATTED.PRINTABLE) ||
- flavor.equals(DocFlavor.BYTE_ARRAY.GIF) ||
- flavor.equals(DocFlavor.INPUT_STREAM.GIF) ||
- flavor.equals(DocFlavor.URL.GIF) ||
- flavor.equals(DocFlavor.BYTE_ARRAY.JPEG) ||
- flavor.equals(DocFlavor.INPUT_STREAM.JPEG) ||
- flavor.equals(DocFlavor.URL.JPEG) ||
- flavor.equals(DocFlavor.BYTE_ARRAY.PNG) ||
- flavor.equals(DocFlavor.INPUT_STREAM.PNG) ||
- flavor.equals(DocFlavor.URL.PNG)) {
+ !isIPPSupportedImages(flavor.getMimeType())) {
return attr == Chromaticity.COLOR;
} else {
return false;
}
} else if (attr.getCategory() == Copies.class) {
- return isSupportedCopies((Copies)attr);
+ return (flavor == null ||
+ !(flavor.equals(DocFlavor.INPUT_STREAM.POSTSCRIPT) ||
+ flavor.equals(DocFlavor.URL.POSTSCRIPT) ||
+ flavor.equals(DocFlavor.BYTE_ARRAY.POSTSCRIPT))) &&
+ isSupportedCopies((Copies)attr);
+
} else if (attr.getCategory() == Destination.class) {
if (flavor == null ||
flavor.equals(DocFlavor.SERVICE_FORMATTED.PAGEABLE) ||
@@ -1667,9 +1666,10 @@ public class IPPPrintService implements PrintService, SunPrinterJobService {
try {
osw = new OutputStreamWriter(os, "UTF-8");
} catch (java.io.UnsupportedEncodingException exc) {
- debug_println("UTF-8 not supported? Exception: "+exc);
+ debug_println(debugPrefix+"writeIPPRequest, UTF-8 not supported? Exception: "+exc);
return false;
}
+ debug_println(debugPrefix+"writeIPPRequest, op code= "+operCode);
char[] opCode = new char[2];
opCode[0] = (char)Byte.parseByte(operCode.substring(0,2), 16);
opCode[1] = (char)Byte.parseByte(operCode.substring(2,4), 16);
@@ -1710,7 +1710,7 @@ public class IPPPrintService implements PrintService, SunPrinterJobService {
osw.flush();
osw.close();
} catch (java.io.IOException ioe) {
- debug_println(debugPrefix+"IPPPrintService Exception in writeIPPRequest: "+ioe);
+ debug_println(debugPrefix+"writeIPPRequest, IPPPrintService Exception in writeIPPRequest: "+ioe);
return false;
}
return true;
@@ -1747,7 +1747,7 @@ public class IPPPrintService implements PrintService, SunPrinterJobService {
while ((response[0] >= GRPTAG_OP_ATTRIBUTES) &&
(response[0] <= GRPTAG_PRINTER_ATTRIBUTES)
&& (response[0] != GRPTAG_END_ATTRIBUTES)) {
- debug_println(debugPrefix+"checking group tag, response[0]= "+
+ debug_println(debugPrefix+"readIPPResponse, checking group tag, response[0]= "+
response[0]);
outObj = new ByteArrayOutputStream();
@@ -1786,6 +1786,7 @@ public class IPPPrintService implements PrintService, SunPrinterJobService {
outArray);
responseMap.put(ac.getName(), ac);
+ debug_println(debugPrefix+ "readIPPResponse "+ac);
}
outObj = new ByteArrayOutputStream();
@@ -1858,6 +1859,9 @@ public class IPPPrintService implements PrintService, SunPrinterJobService {
} catch (java.io.IOException e) {
debug_println(debugPrefix+"readIPPResponse: "+e);
+ if (debugPrint) {
+ e.printStackTrace();
+ }
return null;
}
}
@@ -1872,4 +1876,8 @@ public class IPPPrintService implements PrintService, SunPrinterJobService {
(obj instanceof IPPPrintService &&
((IPPPrintService)obj).getName().equals(getName())));
}
+
+ public int hashCode() {
+ return this.getClass().hashCode()+getName().hashCode();
+ }
}
diff --git a/src/solaris/classes/sun/print/UnixPrintService.java b/src/solaris/classes/sun/print/UnixPrintService.java
index f451f804c..30d2dc82c 100644
--- a/src/solaris/classes/sun/print/UnixPrintService.java
+++ b/src/solaris/classes/sun/print/UnixPrintService.java
@@ -686,19 +686,7 @@ public class UnixPrintService implements PrintService, AttributeUpdater,
}
if (category == Chromaticity.class) {
- if (flavor == null ||
- flavor.equals(DocFlavor.SERVICE_FORMATTED.PAGEABLE) ||
- flavor.equals(DocFlavor.SERVICE_FORMATTED.PRINTABLE) ||
- flavor.equals(DocFlavor.BYTE_ARRAY.GIF) ||
- flavor.equals(DocFlavor.INPUT_STREAM.GIF) ||
- flavor.equals(DocFlavor.URL.GIF) ||
- flavor.equals(DocFlavor.BYTE_ARRAY.JPEG) ||
- flavor.equals(DocFlavor.INPUT_STREAM.JPEG) ||
- flavor.equals(DocFlavor.URL.JPEG) ||
- flavor.equals(DocFlavor.BYTE_ARRAY.PNG) ||
- flavor.equals(DocFlavor.INPUT_STREAM.PNG) ||
- flavor.equals(DocFlavor.URL.PNG)) {
-
+ if (flavor == null || isServiceFormattedFlavor(flavor)) {
Chromaticity[]arr = new Chromaticity[1];
arr[0] = Chromaticity.COLOR;
return (arr);
@@ -730,18 +718,7 @@ public class UnixPrintService implements PrintService, AttributeUpdater,
}
return new RequestingUserName(userName, null);
} else if (category == OrientationRequested.class) {
- if (flavor == null ||
- flavor.equals(DocFlavor.SERVICE_FORMATTED.PAGEABLE) ||
- flavor.equals(DocFlavor.SERVICE_FORMATTED.PRINTABLE) ||
- flavor.equals(DocFlavor.INPUT_STREAM.GIF) ||
- flavor.equals(DocFlavor.INPUT_STREAM.JPEG) ||
- flavor.equals(DocFlavor.INPUT_STREAM.PNG) ||
- flavor.equals(DocFlavor.BYTE_ARRAY.GIF) ||
- flavor.equals(DocFlavor.BYTE_ARRAY.JPEG) ||
- flavor.equals(DocFlavor.BYTE_ARRAY.PNG) ||
- flavor.equals(DocFlavor.URL.GIF) ||
- flavor.equals(DocFlavor.URL.JPEG) ||
- flavor.equals(DocFlavor.URL.PNG)) {
+ if (flavor == null || isServiceFormattedFlavor(flavor)) {
OrientationRequested []arr = new OrientationRequested[3];
arr[0] = OrientationRequested.PORTRAIT;
arr[1] = OrientationRequested.LANDSCAPE;
@@ -752,7 +729,14 @@ public class UnixPrintService implements PrintService, AttributeUpdater,
}
} else if ((category == Copies.class) ||
(category == CopiesSupported.class)) {
- return new CopiesSupported(1, MAXCOPIES);
+ if (flavor == null ||
+ !(flavor.equals(DocFlavor.INPUT_STREAM.POSTSCRIPT) ||
+ flavor.equals(DocFlavor.URL.POSTSCRIPT) ||
+ flavor.equals(DocFlavor.BYTE_ARRAY.POSTSCRIPT))) {
+ return new CopiesSupported(1, MAXCOPIES);
+ } else {
+ return null;
+ }
} else if (category == Media.class) {
Media []arr = new Media[mediaSizes.length];
System.arraycopy(mediaSizes, 0, arr, 0, mediaSizes.length);
@@ -917,8 +901,10 @@ public class UnixPrintService implements PrintService, AttributeUpdater,
}
}
else if (attr.getCategory() == Copies.class) {
- return
- (flavor == null || isServiceFormattedFlavor(flavor)) &&
+ return (flavor == null ||
+ !(flavor.equals(DocFlavor.INPUT_STREAM.POSTSCRIPT) ||
+ flavor.equals(DocFlavor.URL.POSTSCRIPT) ||
+ flavor.equals(DocFlavor.BYTE_ARRAY.POSTSCRIPT))) &&
isSupportedCopies((Copies)attr);
} else if (attr.getCategory() == Destination.class) {
URI uri = ((Destination)attr).getURI();
diff --git a/src/solaris/native/sun/awt/fontpath.c b/src/solaris/native/sun/awt/fontpath.c
index 8f9f3d9a8..b944ff933 100644
--- a/src/solaris/native/sun/awt/fontpath.c
+++ b/src/solaris/native/sun/awt/fontpath.c
@@ -156,7 +156,7 @@ jboolean isDisplayLocal(JNIEnv *env) {
isLocal = JNU_CallStaticMethodByName(env, NULL,
"sun/awt/X11GraphicsEnvironment",
- "isDisplayLocal",
+ "_isDisplayLocal",
"()Z").z;
isLocalSet = True;
return isLocal;
@@ -1233,7 +1233,7 @@ Java_sun_font_FontManager_getFontConfig
for (j=0; j<nfonts; j++) {
FcPattern *fontPattern = fontset->fonts[j];
FcChar8 *fontformat;
- FcCharSet *unionCharset, *charset;
+ FcCharSet *unionCharset = NULL, *charset;
fontformat = NULL;
(*FcPatternGetString)(fontPattern, FC_FONTFORMAT, 0, &fontformat);
@@ -1256,7 +1256,7 @@ Java_sun_font_FontManager_getFontConfig
if (nfonts==10) {
minGlyphs = 50;
}
- if (j == 0) {
+ if (unionCharset == NULL) {
unionCharset = charset;
} else {
if ((*FcCharSetSubtractCount)(charset, unionCharset)
diff --git a/src/solaris/native/sun/java2d/x11/X11SurfaceData.c b/src/solaris/native/sun/java2d/x11/X11SurfaceData.c
index 8b275bc91..8423f1eee 100644
--- a/src/solaris/native/sun/java2d/x11/X11SurfaceData.c
+++ b/src/solaris/native/sun/java2d/x11/X11SurfaceData.c
@@ -208,6 +208,23 @@ Java_sun_java2d_x11_X11SurfaceData_isDgaAvailable(JNIEnv *env, jobject this)
#endif /* HEADLESS */
}
+
+/*
+ * Class: sun_java2d_x11_X11SurfaceData
+ * Method: isShmPMAvailable
+ * Signature: ()Z
+ */
+JNIEXPORT jboolean JNICALL
+Java_sun_java2d_x11_X11SurfaceData_isShmPMAvailable(JNIEnv *env, jobject this)
+{
+#if defined(HEADLESS) || !defined(MITSHM)
+ return JNI_FALSE;
+#else
+ return useMitShmPixmaps;
+#endif /* HEADLESS, MITSHM */
+}
+
+
/*
* Class: sun_java2d_x11_X11SurfaceData
* Method: initOps
diff --git a/src/windows/classes/sun/awt/Win32GraphicsEnvironment.java b/src/windows/classes/sun/awt/Win32GraphicsEnvironment.java
index 80ee77470..73b73dbb0 100644
--- a/src/windows/classes/sun/awt/Win32GraphicsEnvironment.java
+++ b/src/windows/classes/sun/awt/Win32GraphicsEnvironment.java
@@ -393,4 +393,9 @@ public class Win32GraphicsEnvironment
private static void dwmCompositionChanged(boolean enabled) {
isDWMCompositionEnabled = enabled;
}
+
+ @Override
+ public boolean isDisplayLocal() {
+ return true;
+ }
}
diff --git a/src/windows/classes/sun/java2d/d3d/D3DBlitLoops.java b/src/windows/classes/sun/java2d/d3d/D3DBlitLoops.java
index 459a197fa..45d6cd8fd 100644
--- a/src/windows/classes/sun/java2d/d3d/D3DBlitLoops.java
+++ b/src/windows/classes/sun/java2d/d3d/D3DBlitLoops.java
@@ -85,6 +85,8 @@ class D3DBlitLoops {
D3DSurfaceData.ST_INT_RGB),
new D3DSwToSurfaceBlit(SurfaceType.IntBgr,
D3DSurfaceData.ST_INT_BGR),
+ new D3DSwToSurfaceBlit(SurfaceType.ThreeByteBgr,
+ D3DSurfaceData.ST_3BYTE_BGR),
new D3DSwToSurfaceBlit(SurfaceType.Ushort565Rgb,
D3DSurfaceData.ST_USHORT_565_RGB),
new D3DSwToSurfaceBlit(SurfaceType.Ushort555Rgb,
@@ -106,6 +108,8 @@ class D3DBlitLoops {
D3DSurfaceData.ST_INT_RGB),
new D3DSwToSurfaceScale(SurfaceType.IntBgr,
D3DSurfaceData.ST_INT_BGR),
+ new D3DSwToSurfaceScale(SurfaceType.ThreeByteBgr,
+ D3DSurfaceData.ST_3BYTE_BGR),
new D3DSwToSurfaceScale(SurfaceType.Ushort565Rgb,
D3DSurfaceData.ST_USHORT_565_RGB),
new D3DSwToSurfaceScale(SurfaceType.Ushort555Rgb,
@@ -124,6 +128,8 @@ class D3DBlitLoops {
D3DSurfaceData.ST_INT_RGB),
new D3DSwToSurfaceTransform(SurfaceType.IntBgr,
D3DSurfaceData.ST_INT_BGR),
+ new D3DSwToSurfaceTransform(SurfaceType.ThreeByteBgr,
+ D3DSurfaceData.ST_3BYTE_BGR),
new D3DSwToSurfaceTransform(SurfaceType.Ushort565Rgb,
D3DSurfaceData.ST_USHORT_565_RGB),
new D3DSwToSurfaceTransform(SurfaceType.Ushort555Rgb,
@@ -147,6 +153,8 @@ class D3DBlitLoops {
D3DSurfaceData.ST_INT_ARGB),
new D3DSwToTextureBlit(SurfaceType.IntBgr,
D3DSurfaceData.ST_INT_BGR),
+ new D3DSwToTextureBlit(SurfaceType.ThreeByteBgr,
+ D3DSurfaceData.ST_3BYTE_BGR),
new D3DSwToTextureBlit(SurfaceType.Ushort565Rgb,
D3DSurfaceData.ST_USHORT_565_RGB),
new D3DSwToTextureBlit(SurfaceType.Ushort555Rgb,
diff --git a/src/windows/classes/sun/java2d/d3d/D3DSurfaceData.java b/src/windows/classes/sun/java2d/d3d/D3DSurfaceData.java
index 3d1457c72..722440a77 100644
--- a/src/windows/classes/sun/java2d/d3d/D3DSurfaceData.java
+++ b/src/windows/classes/sun/java2d/d3d/D3DSurfaceData.java
@@ -135,6 +135,7 @@ public class D3DSurfaceData extends SurfaceData implements AccelSurface {
public static final int ST_USHORT_555_RGB = 6;
public static final int ST_BYTE_INDEXED = 7;
public static final int ST_BYTE_INDEXED_BM = 8;
+ public static final int ST_3BYTE_BGR = 9;
/** Equals to D3DSWAPEFFECT_DISCARD */
public static final int SWAP_DISCARD = 1;
@@ -501,12 +502,14 @@ public class D3DSurfaceData extends SurfaceData implements AccelSurface {
* - the pixel shaders are available, and
* - blending is disabled, and
* - the source color is opaque
+ * - and the destination is opaque
*/
public boolean canRenderLCDText(SunGraphics2D sg2d) {
return
graphicsDevice.isCapPresent(CAPS_LCD_SHADER) &&
sg2d.compositeState <= SunGraphics2D.COMP_ISCOPY &&
- sg2d.paintState <= SunGraphics2D.PAINT_OPAQUECOLOR;
+ sg2d.paintState <= SunGraphics2D.PAINT_OPAQUECOLOR &&
+ sg2d.surfaceData.getTransparency() == Transparency.OPAQUE;
}
public void validatePipe(SunGraphics2D sg2d) {
diff --git a/src/windows/classes/sun/java2d/opengl/WGLGraphicsConfig.java b/src/windows/classes/sun/java2d/opengl/WGLGraphicsConfig.java
index 7ff7e1e8d..bdd0ade46 100644
--- a/src/windows/classes/sun/java2d/opengl/WGLGraphicsConfig.java
+++ b/src/windows/classes/sun/java2d/opengl/WGLGraphicsConfig.java
@@ -127,12 +127,14 @@ public class WGLGraphicsConfig
new WGLGetConfigInfo(device.getScreen(), pixfmt);
rq.flushAndInvokeNow(action);
cfginfo = action.getConfigInfo();
- OGLContext.setScratchSurface(cfginfo);
- rq.flushAndInvokeNow(new Runnable() {
- public void run() {
- ids[0] = OGLContext.getOGLIdString();
- }
- });
+ if (cfginfo != 0L) {
+ OGLContext.setScratchSurface(cfginfo);
+ rq.flushAndInvokeNow(new Runnable() {
+ public void run() {
+ ids[0] = OGLContext.getOGLIdString();
+ }
+ });
+ }
} finally {
rq.unlock();
}
diff --git a/src/windows/native/sun/font/fontpath.c b/src/windows/native/sun/font/fontpath.c
index 71b1da85f..2fd3c3af9 100644
--- a/src/windows/native/sun/font/fontpath.c
+++ b/src/windows/native/sun/font/fontpath.c
@@ -153,7 +153,8 @@ static int CALLBACK EnumFontFacesInFamilyProcA(
JNIEnv *env = fmi->env;
jstring fullname, fullnameLC;
- if (FontType != TRUETYPE_FONTTYPE) {
+ /* Both Vista and XP return DEVICE_FONTTYPE for OTF fonts */
+ if (FontType != TRUETYPE_FONTTYPE && FontType != DEVICE_FONTTYPE) {
return 1;
}
@@ -227,7 +228,8 @@ static int CALLBACK EnumFontFacesInFamilyProcW(
JNIEnv *env = fmi->env;
jstring fullname, fullnameLC;
- if (FontType != TRUETYPE_FONTTYPE) {
+ /* Both Vista and XP return DEVICE_FONTTYPE for OTF fonts */
+ if (FontType != TRUETYPE_FONTTYPE && FontType != DEVICE_FONTTYPE) {
return 1;
}
@@ -274,7 +276,8 @@ static int CALLBACK EnumFamilyNamesA(
jstring familyLC;
LOGFONTA lfa;
- if (FontType != TRUETYPE_FONTTYPE) {
+ /* Both Vista and XP return DEVICE_FONTTYPE for OTF fonts */
+ if (FontType != TRUETYPE_FONTTYPE && FontType != DEVICE_FONTTYPE) {
return 1;
}
@@ -323,7 +326,8 @@ static int CALLBACK EnumFamilyNamesW(
int slen;
LOGFONTW lfw;
- if (FontType != TRUETYPE_FONTTYPE) {
+ /* Both Vista and XP return DEVICE_FONTTYPE for OTF fonts */
+ if (FontType != TRUETYPE_FONTTYPE && FontType != DEVICE_FONTTYPE) {
return 1;
}
/* wprintf(L"FAMILY=%s charset=%d FULL=%s\n", */
@@ -383,15 +387,16 @@ static int CALLBACK EnumFamilyNamesW(
* Also if a Font has a name for this locale that name also
* exists in the registry using the appropriate platform encoding.
* What do we do then?
+ *
+ * Note: OpenType fonts seems to have " (TrueType)" suffix on Vista
+ * but " (OpenType)" on XP.
*/
-/* static const wchar_t W_TTSUFFIX[] = L" (TrueType)"; */
-/* static const char C_TTSUFFIX[] = " (TrueType)"; */
-/* static int TTSLEN = 11; hard-coded - be careful */
-static BOOL RegistryToBaseTTNameA(LPCSTR name) {
+static BOOL RegistryToBaseTTNameA(LPSTR name) {
static const char TTSUFFIX[] = " (TrueType)";
+ static const char OTSUFFIX[] = " (OpenType)";
int TTSLEN = strlen(TTSUFFIX);
- char *match;
+ char *suffix;
int len = strlen(name);
if (len == 0) {
@@ -403,19 +408,21 @@ static BOOL RegistryToBaseTTNameA(LPCSTR name) {
if (len <= TTSLEN) {
return FALSE;
}
- match = strstr(name, TTSUFFIX);
- if ((match != NULL) && (match == name+(len-TTSLEN))) {
- match[0] = '\0'; /* truncate name */
+
+ /* suffix length is the same for truetype and opentype fonts */
+ suffix = name + len - TTSLEN;
+ if (strcmp(suffix, TTSUFFIX) == 0 || strcmp(suffix, OTSUFFIX) == 0) {
+ suffix[0] = '\0'; /* truncate name */
return TRUE;
- } else {
- return FALSE;
}
+ return FALSE;
}
static BOOL RegistryToBaseTTNameW(LPWSTR name) {
static const wchar_t TTSUFFIX[] = L" (TrueType)";
+ static const wchar_t OTSUFFIX[] = L" (OpenType)";
int TTSLEN = wcslen(TTSUFFIX);
- wchar_t *match;
+ wchar_t *suffix;
int len = wcslen(name);
if (len == 0) {
@@ -427,13 +434,13 @@ static BOOL RegistryToBaseTTNameW(LPWSTR name) {
if (len <= TTSLEN) {
return FALSE;
}
- match = wcsstr(name, TTSUFFIX);
- if ((match != NULL) && (match == name+(len-TTSLEN))) {
- match[0] = L'\0'; /* truncate name */
+ /* suffix length is the same for truetype and opentype fonts */
+ suffix = name + (len - TTSLEN);
+ if (wcscmp(suffix, TTSUFFIX) == 0 || wcscmp(suffix, OTSUFFIX) == 0) {
+ suffix[0] = L'\0'; /* truncate name */
return TRUE;
- } else {
- return FALSE;
}
+ return FALSE;
}
static void registerFontA(GdiFontMapInfo *fmi, jobject fontToFileMap,
@@ -675,18 +682,19 @@ Java_sun_font_FontManager_populateFontFileNameMap
}
if (IS_NT) {
if (!RegistryToBaseTTNameW((LPWSTR)wname) ) {
- /* If the filename ends with ".ttf" also accept it.
+ /* If the filename ends with ".ttf" or ".otf" also accept it.
* Not expecting to need to do this for .ttc files.
* Also note this code is not mirrored in the "A" (win9x) path.
*/
LPWSTR dot = wcsrchr((LPWSTR)data, L'.');
- if (dot == NULL || (wcsicmp(dot, L".ttf") != 0)) {
+ if (dot == NULL || ((wcsicmp(dot, L".ttf") != 0)
+ && (wcsicmp(dot, L".otf") != 0))) {
continue; /* not a TT font... */
}
}
registerFontW(&fmi, fontToFileMap, (LPWSTR)wname, (LPWSTR)data);
} else {
- if (!RegistryToBaseTTNameA(cname) ) {
+ if (!RegistryToBaseTTNameA((LPSTR)cname)) {
continue; /* not a TT font... */
}
registerFontA(&fmi, fontToFileMap, cname, (LPCSTR)data);
diff --git a/src/windows/native/sun/java2d/d3d/D3DBadHardware.h b/src/windows/native/sun/java2d/d3d/D3DBadHardware.h
index 52629d1a5..20c9ad1e3 100644
--- a/src/windows/native/sun/java2d/d3d/D3DBadHardware.h
+++ b/src/windows/native/sun/java2d/d3d/D3DBadHardware.h
@@ -85,6 +85,19 @@ static const ADAPTER_INFO badHardware[] = {
{ 0x1002, 0x71C5, D_VERSION(6,14,10,6706), OS_WINXP },
{ 0x1002, 0x71C5, D_VERSION(7,14,10,0567), OS_VISTA },
+ // ATI Mobility Radeon 9700
+ // Reason: workaround for 6773336
+ { 0x1002, 0x4E50, D_VERSION(6,14,10,6561), OS_WINXP },
+
+ // Nvidia FX 5200
+ // Reason: workaround for 6717988
+ { 0x10DE, 0x0322, D_VERSION(6,14,11,6921), OS_WINXP },
+
+ // Nvidia FX Go5600, Go5700
+ // Reason: workaround for 6714579
+ { 0x10DE, 0x031A, D_VERSION(6,14,11,6921), OS_WINXP },
+ { 0x10DE, 0x0347, D_VERSION(6,14,11,6921), OS_WINXP },
+
// Nvidia Quadro NVS 110M
// Reason: workaround for 6629891
{ 0x10DE, 0x01D7, D_VERSION(6,14,11,5665), OS_WINXP },
@@ -93,6 +106,32 @@ static const ADAPTER_INFO badHardware[] = {
// Reason: workaround for 6653860
{ 0x10DE, 0x00FD, D_VERSION(6,14,10,6573), OS_WINXP },
+ // Nvidia Quadro FX family
+ // Reason: workaround for 6772137
+ { 0x10DE, 0x00F8, D_VERSION(6,14,10,9381), OS_WINXP },
+ { 0x10DE, 0x009D, D_VERSION(6,14,10,9381), OS_WINXP },
+ { 0x10DE, 0x029C, D_VERSION(6,14,10,9381), OS_WINXP },
+ { 0x10DE, 0x029D, D_VERSION(6,14,10,9381), OS_WINXP },
+ { 0x10DE, 0x029E, D_VERSION(6,14,10,9381), OS_WINXP },
+ { 0x10DE, 0x029F, D_VERSION(6,14,10,9381), OS_WINXP },
+ { 0x10DE, 0x01DE, D_VERSION(6,14,10,9381), OS_WINXP },
+ { 0x10DE, 0x039E, D_VERSION(6,14,10,9381), OS_WINXP },
+ { 0x10DE, 0x019D, D_VERSION(6,14,10,9381), OS_WINXP },
+ { 0x10DE, 0x019E, D_VERSION(6,14,10,9381), OS_WINXP },
+ { 0x10DE, 0x040A, D_VERSION(6,14,10,9381), OS_WINXP },
+ { 0x10DE, 0x040E, D_VERSION(6,14,10,9381), OS_WINXP },
+ { 0x10DE, 0x040F, D_VERSION(6,14,10,9381), OS_WINXP },
+ { 0x10DE, 0x061A, D_VERSION(6,14,10,9381), OS_WINXP },
+ { 0x10DE, 0x06F9, D_VERSION(6,14,10,9381), OS_WINXP },
+ { 0x10DE, 0x05FD, D_VERSION(6,14,10,9381), OS_WINXP },
+ { 0x10DE, 0x05FE, D_VERSION(6,14,10,9381), OS_WINXP },
+ { 0x10DE, 0x004E, D_VERSION(6,14,10,9381), OS_WINXP },
+ { 0x10DE, 0x00CD, D_VERSION(6,14,10,9381), OS_WINXP },
+ { 0x10DE, 0x00CE, D_VERSION(6,14,10,9381), OS_WINXP },
+ { 0x10DE, 0x014C, D_VERSION(6,14,10,9381), OS_WINXP },
+ { 0x10DE, 0x014D, D_VERSION(6,14,10,9381), OS_WINXP },
+ { 0x10DE, 0x014E, D_VERSION(6,14,10,9381), OS_WINXP },
+
// Nvidia GeForce 6200 TurboCache(TM)
// Reason: workaround for 6588384
{ 0x10DE, 0x0161, NO_VERSION, OS_VISTA },
diff --git a/src/windows/native/sun/java2d/d3d/D3DBlitLoops.cpp b/src/windows/native/sun/java2d/d3d/D3DBlitLoops.cpp
index 6792a444a..c8a5d7861 100644
--- a/src/windows/native/sun/java2d/d3d/D3DBlitLoops.cpp
+++ b/src/windows/native/sun/java2d/d3d/D3DBlitLoops.cpp
@@ -47,6 +47,7 @@ extern "C" BlitFunc IntArgbToIntArgbPreConvert;
extern "C" BlitFunc IntArgbPreToIntArgbConvert;
extern "C" BlitFunc IntArgbBmToIntArgbConvert;
extern "C" BlitFunc IntRgbToIntArgbConvert;
+extern "C" BlitFunc ThreeByteBgrToIntArgbConvert;
extern "C" BlitFunc Ushort565RgbToIntArgbConvert;
extern "C" BlitFunc Ushort555RgbToIntArgbConvert;
extern "C" BlitFunc IntBgrToIntArgbConvert;
@@ -220,12 +221,17 @@ D3DBL_CopyImageToIntXrgbSurface(SurfaceDataRasInfo *pSrcInfo,
" srctype=%d rect={%-4d, %-4d, %-4d, %-4d}",
srctype, r.left, r.top, r.right, r.bottom);
- if (pDesc->Usage == D3DUSAGE_DYNAMIC &&
- dstx == 0 && dstx == 0 &&
- srcWidth == pDesc->Width && srcHeight == pDesc->Height)
- {
+ if (pDesc->Usage == D3DUSAGE_DYNAMIC) {
+ // it is safe to lock with discard because we don't care about the
+ // contents of dynamic textures, and some drivers are happier if
+ // dynamic textures are always locked with DISCARD
dwLockFlags |= D3DLOCK_DISCARD;
pR = NULL;
+ } else {
+ // in non-DYNAMIC case we lock the exact rect so there's no need to
+ // offset the destination pointer
+ dstx = 0;
+ dsty = 0;
}
res = pDstSurface->LockRect(&lockedRect, pR, dwLockFlags);
@@ -242,7 +248,9 @@ D3DBL_CopyImageToIntXrgbSurface(SurfaceDataRasInfo *pSrcInfo,
void *pSrcBase = PtrCoord(pSrcInfo->rasBase,
srcx, pSrcInfo->pixelStride,
srcy, pSrcInfo->scanStride);
- void *pDstBase = lockedRect.pBits;
+ void *pDstBase = PtrCoord(lockedRect.pBits,
+ dstx, dstInfo.pixelStride,
+ dsty, dstInfo.scanStride);
switch (srctype) {
case ST_INT_ARGB:
@@ -251,11 +259,15 @@ D3DBL_CopyImageToIntXrgbSurface(SurfaceDataRasInfo *pSrcInfo,
pSrcInfo, &dstInfo, NULL, NULL);
break;
case ST_INT_ARGB_PRE:
- case ST_INT_RGB:
AnyIntIsomorphicCopy(pSrcBase, pDstBase,
srcWidth, srcHeight,
pSrcInfo, &dstInfo, NULL, NULL);
break;
+ case ST_INT_RGB:
+ IntRgbToIntArgbConvert(pSrcBase, pDstBase,
+ srcWidth, srcHeight,
+ pSrcInfo, &dstInfo, NULL, NULL);
+ break;
case ST_INT_ARGB_BM:
// REMIND: we don't have such sw loop
// so this path is disabled for now on java level
@@ -268,6 +280,11 @@ D3DBL_CopyImageToIntXrgbSurface(SurfaceDataRasInfo *pSrcInfo,
srcWidth, srcHeight,
pSrcInfo, &dstInfo, NULL, NULL);
break;
+ case ST_3BYTE_BGR:
+ ThreeByteBgrToIntArgbConvert(pSrcBase, pDstBase,
+ srcWidth, srcHeight,
+ pSrcInfo, &dstInfo, NULL, NULL);
+ break;
case ST_USHORT_555_RGB:
Ushort555RgbToIntArgbConvert(pSrcBase, pDstBase,
srcWidth, srcHeight,
diff --git a/src/windows/native/sun/java2d/d3d/D3DContext.cpp b/src/windows/native/sun/java2d/d3d/D3DContext.cpp
index e3937b8d3..186f4d755 100644
--- a/src/windows/native/sun/java2d/d3d/D3DContext.cpp
+++ b/src/windows/native/sun/java2d/d3d/D3DContext.cpp
@@ -1174,11 +1174,10 @@ D3DContext::UploadTileToTexture(D3DResource *pTextureRes, void *pixels,
" rect={%-4d, %-4d, %-4d, %-4d}",
r.left, r.top, r.right, r.bottom);
- // REMIND: we should also check for dstx, dsty being 0 here,
- // but they're always 0 in dynamic texture case
- if (pDesc->Usage == D3DUSAGE_DYNAMIC &&
- srcWidth == pDesc->Width && srcHeight == pDesc->Height)
- {
+ if (pDesc->Usage == D3DUSAGE_DYNAMIC) {
+ // it is safe to lock with discard because we don't care about the
+ // contents of dynamic textures and dstx,dsty for this case is
+ // always 0,0 because we are uploading into a tile texture
dwLockFlags |= D3DLOCK_DISCARD;
pR = NULL;
}
diff --git a/src/windows/native/sun/java2d/d3d/D3DSurfaceData.h b/src/windows/native/sun/java2d/d3d/D3DSurfaceData.h
index 22a89bc15..b115ed837 100644
--- a/src/windows/native/sun/java2d/d3d/D3DSurfaceData.h
+++ b/src/windows/native/sun/java2d/d3d/D3DSurfaceData.h
@@ -68,6 +68,7 @@ struct _D3DSDOps {
#define ST_USHORT_555_RGB sun_java2d_d3d_D3DSurfaceData_ST_USHORT_555_RGB
#define ST_BYTE_INDEXED sun_java2d_d3d_D3DSurfaceData_ST_BYTE_INDEXED
#define ST_BYTE_INDEXED_BM sun_java2d_d3d_D3DSurfaceData_ST_BYTE_INDEXED_BM
+#define ST_3BYTE_BGR sun_java2d_d3d_D3DSurfaceData_ST_3BYTE_BGR
/**
* These are defined to be the same as ExtendedBufferCapabilities.VSyncType