Merge jdk7-b43
authorlana
Tue, 06 Jan 2009 16:24:03 -0800
changeset 77950c67678b0d1
parent 750 18ab3173fcec
parent 778 bf5dd3128c6a
child 780 8dcc06d43798
child 785 37a9442e3203
Merge
src/share/classes/sun/swing/SwingUtilities2.java
     1.1 --- a/make/sun/awt/mapfile-mawt-vers	Fri Dec 19 10:37:50 2008 -0800
     1.2 +++ b/make/sun/awt/mapfile-mawt-vers	Tue Jan 06 16:24:03 2009 -0800
     1.3 @@ -407,6 +407,7 @@
     1.4  		Java_sun_java2d_x11_X11SurfaceData_initSurface;
     1.5  		Java_sun_java2d_x11_X11SurfaceData_isDrawableValid;
     1.6  		Java_sun_java2d_x11_X11SurfaceData_isDgaAvailable;
     1.7 +		Java_sun_java2d_x11_X11SurfaceData_isShmPMAvailable;
     1.8  		Java_sun_java2d_x11_X11SurfaceData_setInvalid;
     1.9  		Java_sun_java2d_x11_X11SurfaceData_flushNativeSurface;
    1.10                  Java_sun_java2d_x11_X11SurfaceData_XCreateGC;
     2.1 --- a/make/sun/xawt/mapfile-vers	Fri Dec 19 10:37:50 2008 -0800
     2.2 +++ b/make/sun/xawt/mapfile-vers	Tue Jan 06 16:24:03 2009 -0800
     2.3 @@ -337,6 +337,7 @@
     2.4          Java_sun_java2d_x11_X11SurfaceData_initIDs;
     2.5  	Java_sun_java2d_x11_X11SurfaceData_isDrawableValid;
     2.6          Java_sun_java2d_x11_X11SurfaceData_isDgaAvailable;
     2.7 +	Java_sun_java2d_x11_X11SurfaceData_isShmPMAvailable;
     2.8          Java_sun_java2d_x11_X11SurfaceData_initOps;
     2.9          Java_sun_java2d_x11_X11SurfaceData_initSurface;
    2.10          Java_sun_java2d_x11_X11SurfaceData_flushNativeSurface;
     3.1 --- a/src/share/classes/com/sun/imageio/plugins/png/PNGImageReader.java	Fri Dec 19 10:37:50 2008 -0800
     3.2 +++ b/src/share/classes/com/sun/imageio/plugins/png/PNGImageReader.java	Tue Jan 06 16:24:03 2009 -0800
     3.3 @@ -44,7 +44,6 @@
     3.4  import java.util.Arrays;
     3.5  import java.util.Enumeration;
     3.6  import java.util.Iterator;
     3.7 -import java.util.List;
     3.8  import java.util.zip.Inflater;
     3.9  import java.util.zip.InflaterInputStream;
    3.10  import javax.imageio.IIOException;
    3.11 @@ -57,6 +56,7 @@
    3.12  import com.sun.imageio.plugins.common.InputStreamAdapter;
    3.13  import com.sun.imageio.plugins.common.ReaderUtil;
    3.14  import com.sun.imageio.plugins.common.SubImageInputStream;
    3.15 +import java.io.ByteArrayOutputStream;
    3.16  import sun.awt.image.ByteInterleavedRaster;
    3.17  
    3.18  class PNGImageDataEnumeration implements Enumeration {
    3.19 @@ -207,6 +207,15 @@
    3.20          resetStreamSettings();
    3.21      }
    3.22  
    3.23 +    private String readNullTerminatedString(String charset) throws IOException {
    3.24 +        ByteArrayOutputStream baos = new ByteArrayOutputStream();
    3.25 +        int b;
    3.26 +        while ((b = stream.read()) != 0) {
    3.27 +            baos.write(b);
    3.28 +        }
    3.29 +        return new String(baos.toByteArray(), charset);
    3.30 +    }
    3.31 +
    3.32      private String readNullTerminatedString() throws IOException {
    3.33          StringBuilder b = new StringBuilder();
    3.34          int c;
    3.35 @@ -445,26 +454,27 @@
    3.36          metadata.iTXt_keyword.add(keyword);
    3.37  
    3.38          int compressionFlag = stream.readUnsignedByte();
    3.39 -        metadata.iTXt_compressionFlag.add(new Integer(compressionFlag));
    3.40 +        metadata.iTXt_compressionFlag.add(Boolean.valueOf(compressionFlag == 1));
    3.41  
    3.42          int compressionMethod = stream.readUnsignedByte();
    3.43 -        metadata.iTXt_compressionMethod.add(new Integer(compressionMethod));
    3.44 +        metadata.iTXt_compressionMethod.add(Integer.valueOf(compressionMethod));
    3.45  
    3.46 -        String languageTag = readNullTerminatedString();
    3.47 +        String languageTag = readNullTerminatedString("UTF8");
    3.48          metadata.iTXt_languageTag.add(languageTag);
    3.49  
    3.50 -        String translatedKeyword = stream.readUTF();
    3.51 +        String translatedKeyword =
    3.52 +            readNullTerminatedString("UTF8");
    3.53          metadata.iTXt_translatedKeyword.add(translatedKeyword);
    3.54 -        stream.skipBytes(1); // Null separator
    3.55  
    3.56          String text;
    3.57 +        long pos = stream.getStreamPosition();
    3.58 +        byte[] b = new byte[(int)(chunkStart + chunkLength - pos)];
    3.59 +        stream.readFully(b);
    3.60 +
    3.61          if (compressionFlag == 1) { // Decompress the text
    3.62 -            long pos = stream.getStreamPosition();
    3.63 -            byte[] b = new byte[(int)(chunkStart + chunkLength - pos)];
    3.64 -            stream.readFully(b);
    3.65 -            text = inflate(b);
    3.66 +            text = new String(inflate(b), "UTF8");
    3.67          } else {
    3.68 -            text = stream.readUTF();
    3.69 +            text = new String(b, "UTF8");
    3.70          }
    3.71          metadata.iTXt_text.add(text);
    3.72      }
    3.73 @@ -613,15 +623,20 @@
    3.74          metadata.tRNS_present = true;
    3.75      }
    3.76  
    3.77 -    private static String inflate(byte[] b) throws IOException {
    3.78 +    private static byte[] inflate(byte[] b) throws IOException {
    3.79          InputStream bais = new ByteArrayInputStream(b);
    3.80          InputStream iis = new InflaterInputStream(bais);
    3.81 -        StringBuilder sb = new StringBuilder(80);
    3.82 +        ByteArrayOutputStream baos = new ByteArrayOutputStream();
    3.83 +
    3.84          int c;
    3.85 -        while ((c = iis.read()) != -1) {
    3.86 -            sb.append((char)c);
    3.87 +        try {
    3.88 +            while ((c = iis.read()) != -1) {
    3.89 +                baos.write(c);
    3.90 +            }
    3.91 +        } finally {
    3.92 +            iis.close();
    3.93          }
    3.94 -        return sb.toString();
    3.95 +        return baos.toByteArray();
    3.96      }
    3.97  
    3.98      private void parse_zTXt_chunk(int chunkLength) throws IOException {
    3.99 @@ -633,7 +648,7 @@
   3.100  
   3.101          byte[] b = new byte[chunkLength - keyword.length() - 2];
   3.102          stream.readFully(b);
   3.103 -        metadata.zTXt_text.add(inflate(b));
   3.104 +        metadata.zTXt_text.add(new String(inflate(b)));
   3.105      }
   3.106  
   3.107      private void readMetadata() throws IIOException {
   3.108 @@ -1244,13 +1259,26 @@
   3.109              destinationBands = param.getDestinationBands();
   3.110              destinationOffset = param.getDestinationOffset();
   3.111          }
   3.112 -
   3.113 +        Inflater inf = null;
   3.114          try {
   3.115              stream.seek(imageStartPosition);
   3.116  
   3.117              Enumeration e = new PNGImageDataEnumeration(stream);
   3.118              InputStream is = new SequenceInputStream(e);
   3.119 -            is = new InflaterInputStream(is, new Inflater());
   3.120 +
   3.121 +           /* InflaterInputStream uses an Inflater instance which consumes
   3.122 +            * native (non-GC visible) resources. This is normally implicitly
   3.123 +            * freed when the stream is closed. However since the
   3.124 +            * InflaterInputStream wraps a client-supplied input stream,
   3.125 +            * we cannot close it.
   3.126 +            * But the app may depend on GC finalization to close the stream.
   3.127 +            * Therefore to ensure timely freeing of native resources we
   3.128 +            * explicitly create the Inflater instance and free its resources
   3.129 +            * when we are done with the InflaterInputStream by calling
   3.130 +            * inf.end();
   3.131 +            */
   3.132 +            inf = new Inflater();
   3.133 +            is = new InflaterInputStream(is, inf);
   3.134              is = new BufferedInputStream(is);
   3.135              this.pixelStream = new DataInputStream(is);
   3.136  
   3.137 @@ -1283,6 +1311,10 @@
   3.138              }
   3.139          } catch (IOException e) {
   3.140              throw new IIOException("Error reading PNG image data", e);
   3.141 +        } finally {
   3.142 +            if (inf != null) {
   3.143 +                inf.end();
   3.144 +            }
   3.145          }
   3.146      }
   3.147  
     4.1 --- a/src/share/classes/com/sun/imageio/plugins/png/PNGImageWriter.java	Fri Dec 19 10:37:50 2008 -0800
     4.2 +++ b/src/share/classes/com/sun/imageio/plugins/png/PNGImageWriter.java	Tue Jan 06 16:24:03 2009 -0800
     4.3 @@ -244,13 +244,17 @@
     4.4      }
     4.5  
     4.6      public void finish() throws IOException {
     4.7 -        if (!def.finished()) {
     4.8 -            def.finish();
     4.9 -            while (!def.finished()) {
    4.10 -                deflate();
    4.11 +        try {
    4.12 +            if (!def.finished()) {
    4.13 +                def.finish();
    4.14 +                while (!def.finished()) {
    4.15 +                    deflate();
    4.16 +                }
    4.17              }
    4.18 +            finishChunk();
    4.19 +        } finally {
    4.20 +            def.end();
    4.21          }
    4.22 -        finishChunk();
    4.23      }
    4.24  
    4.25      protected void finalize() throws Throwable {
    4.26 @@ -667,13 +671,13 @@
    4.27          }
    4.28      }
    4.29  
    4.30 -    private byte[] deflate(String s) throws IOException {
    4.31 +    private byte[] deflate(byte[] b) throws IOException {
    4.32          ByteArrayOutputStream baos = new ByteArrayOutputStream();
    4.33          DeflaterOutputStream dos = new DeflaterOutputStream(baos);
    4.34  
    4.35 -        int len = s.length();
    4.36 +        int len = b.length;
    4.37          for (int i = 0; i < len; i++) {
    4.38 -            dos.write((int)s.charAt(i));
    4.39 +            dos.write((int)(0xff & b[i]));
    4.40          }
    4.41          dos.close();
    4.42  
    4.43 @@ -681,38 +685,37 @@
    4.44      }
    4.45  
    4.46      private void write_iTXt() throws IOException {
    4.47 -        Iterator keywordIter = metadata.iTXt_keyword.iterator();
    4.48 -        Iterator flagIter = metadata.iTXt_compressionFlag.iterator();
    4.49 -        Iterator methodIter = metadata.iTXt_compressionMethod.iterator();
    4.50 -        Iterator languageIter = metadata.iTXt_languageTag.iterator();
    4.51 -        Iterator translatedKeywordIter =
    4.52 +        Iterator<String> keywordIter = metadata.iTXt_keyword.iterator();
    4.53 +        Iterator<Boolean> flagIter = metadata.iTXt_compressionFlag.iterator();
    4.54 +        Iterator<Integer> methodIter = metadata.iTXt_compressionMethod.iterator();
    4.55 +        Iterator<String> languageIter = metadata.iTXt_languageTag.iterator();
    4.56 +        Iterator<String> translatedKeywordIter =
    4.57              metadata.iTXt_translatedKeyword.iterator();
    4.58 -        Iterator textIter = metadata.iTXt_text.iterator();
    4.59 +        Iterator<String> textIter = metadata.iTXt_text.iterator();
    4.60  
    4.61          while (keywordIter.hasNext()) {
    4.62              ChunkStream cs = new ChunkStream(PNGImageReader.iTXt_TYPE, stream);
    4.63 -            String keyword = (String)keywordIter.next();
    4.64 -            cs.writeBytes(keyword);
    4.65 +
    4.66 +            cs.writeBytes(keywordIter.next());
    4.67              cs.writeByte(0);
    4.68  
    4.69 -            int flag = ((Integer)flagIter.next()).intValue();
    4.70 -            cs.writeByte(flag);
    4.71 -            int method = ((Integer)methodIter.next()).intValue();
    4.72 -            cs.writeByte(method);
    4.73 +            Boolean compressed = flagIter.next();
    4.74 +            cs.writeByte(compressed ? 1 : 0);
    4.75  
    4.76 -            String languageTag = (String)languageIter.next();
    4.77 -            cs.writeBytes(languageTag);
    4.78 +            cs.writeByte(methodIter.next().intValue());
    4.79 +
    4.80 +            cs.writeBytes(languageIter.next());
    4.81              cs.writeByte(0);
    4.82  
    4.83 -            String translatedKeyword = (String)translatedKeywordIter.next();
    4.84 -            cs.writeBytes(translatedKeyword);
    4.85 +
    4.86 +            cs.write(translatedKeywordIter.next().getBytes("UTF8"));
    4.87              cs.writeByte(0);
    4.88  
    4.89 -            String text = (String)textIter.next();
    4.90 -            if (flag == 1) {
    4.91 -                cs.write(deflate(text));
    4.92 +            String text = textIter.next();
    4.93 +            if (compressed) {
    4.94 +                cs.write(deflate(text.getBytes("UTF8")));
    4.95              } else {
    4.96 -                cs.writeUTF(text);
    4.97 +                cs.write(text.getBytes("UTF8"));
    4.98              }
    4.99              cs.finish();
   4.100          }
   4.101 @@ -733,7 +736,7 @@
   4.102              cs.writeByte(compressionMethod);
   4.103  
   4.104              String text = (String)textIter.next();
   4.105 -            cs.write(deflate(text));
   4.106 +            cs.write(deflate(text.getBytes()));
   4.107              cs.finish();
   4.108          }
   4.109      }
   4.110 @@ -928,23 +931,24 @@
   4.111      // Use sourceXOffset, etc.
   4.112      private void write_IDAT(RenderedImage image) throws IOException {
   4.113          IDATOutputStream ios = new IDATOutputStream(stream, 32768);
   4.114 -
   4.115 -        if (metadata.IHDR_interlaceMethod == 1) {
   4.116 -            for (int i = 0; i < 7; i++) {
   4.117 -                encodePass(ios, image,
   4.118 -                           PNGImageReader.adam7XOffset[i],
   4.119 -                           PNGImageReader.adam7YOffset[i],
   4.120 -                           PNGImageReader.adam7XSubsampling[i],
   4.121 -                           PNGImageReader.adam7YSubsampling[i]);
   4.122 -                if (abortRequested()) {
   4.123 -                    break;
   4.124 +        try {
   4.125 +            if (metadata.IHDR_interlaceMethod == 1) {
   4.126 +                for (int i = 0; i < 7; i++) {
   4.127 +                    encodePass(ios, image,
   4.128 +                               PNGImageReader.adam7XOffset[i],
   4.129 +                               PNGImageReader.adam7YOffset[i],
   4.130 +                               PNGImageReader.adam7XSubsampling[i],
   4.131 +                               PNGImageReader.adam7YSubsampling[i]);
   4.132 +                    if (abortRequested()) {
   4.133 +                        break;
   4.134 +                    }
   4.135                  }
   4.136 +            } else {
   4.137 +                encodePass(ios, image, 0, 0, 1, 1);
   4.138              }
   4.139 -        } else {
   4.140 -            encodePass(ios, image, 0, 0, 1, 1);
   4.141 +        } finally {
   4.142 +            ios.finish();
   4.143          }
   4.144 -
   4.145 -        ios.finish();
   4.146      }
   4.147  
   4.148      private void writeIEND() throws IOException {
     5.1 --- a/src/share/classes/com/sun/imageio/plugins/png/PNGMetadata.java	Fri Dec 19 10:37:50 2008 -0800
     5.2 +++ b/src/share/classes/com/sun/imageio/plugins/png/PNGMetadata.java	Tue Jan 06 16:24:03 2009 -0800
     5.3 @@ -174,12 +174,12 @@
     5.4      public byte[] iCCP_compressedProfile;
     5.5  
     5.6      // iTXt chunk
     5.7 -    public ArrayList iTXt_keyword = new ArrayList(); // Strings
     5.8 -    public ArrayList iTXt_compressionFlag = new ArrayList(); // Integers
     5.9 -    public ArrayList iTXt_compressionMethod = new ArrayList(); // Integers
    5.10 -    public ArrayList iTXt_languageTag = new ArrayList(); // Strings
    5.11 -    public ArrayList iTXt_translatedKeyword = new ArrayList(); // Strings
    5.12 -    public ArrayList iTXt_text = new ArrayList(); // Strings
    5.13 +    public ArrayList<String> iTXt_keyword = new ArrayList<String>();
    5.14 +    public ArrayList<Boolean> iTXt_compressionFlag = new ArrayList<Boolean>();
    5.15 +    public ArrayList<Integer> iTXt_compressionMethod = new ArrayList<Integer>();
    5.16 +    public ArrayList<String> iTXt_languageTag = new ArrayList<String>();
    5.17 +    public ArrayList<String> iTXt_translatedKeyword = new ArrayList<String>();
    5.18 +    public ArrayList<String> iTXt_text = new ArrayList<String>();
    5.19  
    5.20      // pHYs chunk
    5.21      public boolean pHYs_present;
    5.22 @@ -597,19 +597,17 @@
    5.23          if (iTXt_keyword.size() > 0) {
    5.24              IIOMetadataNode iTXt_parent = new IIOMetadataNode("iTXt");
    5.25              for (int i = 0; i < iTXt_keyword.size(); i++) {
    5.26 -                Integer val;
    5.27 -
    5.28                  IIOMetadataNode iTXt_node = new IIOMetadataNode("iTXtEntry");
    5.29 -                iTXt_node.setAttribute("keyword", (String)iTXt_keyword.get(i));
    5.30 -                val = (Integer)iTXt_compressionFlag.get(i);
    5.31 -                iTXt_node.setAttribute("compressionFlag", val.toString());
    5.32 -                val = (Integer)iTXt_compressionMethod.get(i);
    5.33 -                iTXt_node.setAttribute("compressionMethod", val.toString());
    5.34 +                iTXt_node.setAttribute("keyword", iTXt_keyword.get(i));
    5.35 +                iTXt_node.setAttribute("compressionFlag",
    5.36 +                        iTXt_compressionFlag.get(i) ? "1" : "0");
    5.37 +                iTXt_node.setAttribute("compressionMethod",
    5.38 +                        iTXt_compressionMethod.get(i).toString());
    5.39                  iTXt_node.setAttribute("languageTag",
    5.40 -                                       (String)iTXt_languageTag.get(i));
    5.41 +                                       iTXt_languageTag.get(i));
    5.42                  iTXt_node.setAttribute("translatedKeyword",
    5.43 -                                       (String)iTXt_translatedKeyword.get(i));
    5.44 -                iTXt_node.setAttribute("text", (String)iTXt_text.get(i));
    5.45 +                                       iTXt_translatedKeyword.get(i));
    5.46 +                iTXt_node.setAttribute("text", iTXt_text.get(i));
    5.47  
    5.48                  iTXt_parent.appendChild(iTXt_node);
    5.49              }
    5.50 @@ -1037,11 +1035,11 @@
    5.51  
    5.52          for (int i = 0; i < iTXt_keyword.size(); i++) {
    5.53              node = new IIOMetadataNode("TextEntry");
    5.54 -            node.setAttribute("keyword", (String)iTXt_keyword.get(i));
    5.55 -            node.setAttribute("value", (String)iTXt_text.get(i));
    5.56 +            node.setAttribute("keyword", iTXt_keyword.get(i));
    5.57 +            node.setAttribute("value", iTXt_text.get(i));
    5.58              node.setAttribute("language",
    5.59 -                              (String)iTXt_languageTag.get(i));
    5.60 -            if (((Integer)iTXt_compressionFlag.get(i)).intValue() == 1) {
    5.61 +                              iTXt_languageTag.get(i));
    5.62 +            if (iTXt_compressionFlag.get(i)) {
    5.63                  node.setAttribute("compression", "deflate");
    5.64              } else {
    5.65                  node.setAttribute("compression", "none");
    5.66 @@ -1427,11 +1425,11 @@
    5.67  
    5.68                      boolean compressionFlag =
    5.69                          getBooleanAttribute(iTXt_node, "compressionFlag");
    5.70 -                    iTXt_compressionFlag.add(new Boolean(compressionFlag));
    5.71 +                    iTXt_compressionFlag.add(Boolean.valueOf(compressionFlag));
    5.72  
    5.73                      String compressionMethod =
    5.74                          getAttribute(iTXt_node, "compressionMethod");
    5.75 -                    iTXt_compressionMethod.add(compressionMethod);
    5.76 +                    iTXt_compressionMethod.add(Integer.valueOf(compressionMethod));
    5.77  
    5.78                      String languageTag =
    5.79                          getAttribute(iTXt_node, "languageTag");
    5.80 @@ -1950,13 +1948,10 @@
    5.81                                  tEXt_text.add(value);
    5.82                              }
    5.83                          } else {
    5.84 -                            int flag = compression.equals("zip") ?
    5.85 -                                1 : 0;
    5.86 -
    5.87                              // Use an iTXt node
    5.88                              iTXt_keyword.add(keyword);
    5.89 -                            iTXt_compressionFlag.add(new Integer(flag));
    5.90 -                            iTXt_compressionMethod.add(new Integer(0));
    5.91 +                            iTXt_compressionFlag.add(Boolean.valueOf(compression.equals("zip")));
    5.92 +                            iTXt_compressionMethod.add(Integer.valueOf(0));
    5.93                              iTXt_languageTag.add(language);
    5.94                              iTXt_translatedKeyword.add(keyword); // fake it
    5.95                              iTXt_text.add(value);
    5.96 @@ -1993,12 +1988,12 @@
    5.97          gAMA_present = false;
    5.98          hIST_present = false;
    5.99          iCCP_present = false;
   5.100 -        iTXt_keyword = new ArrayList();
   5.101 -        iTXt_compressionFlag = new ArrayList();
   5.102 -        iTXt_compressionMethod = new ArrayList();
   5.103 -        iTXt_languageTag = new ArrayList();
   5.104 -        iTXt_translatedKeyword = new ArrayList();
   5.105 -        iTXt_text = new ArrayList();
   5.106 +        iTXt_keyword = new ArrayList<String>();
   5.107 +        iTXt_compressionFlag = new ArrayList<Boolean>();
   5.108 +        iTXt_compressionMethod = new ArrayList<Integer>();
   5.109 +        iTXt_languageTag = new ArrayList<String>();
   5.110 +        iTXt_translatedKeyword = new ArrayList<String>();
   5.111 +        iTXt_text = new ArrayList<String>();
   5.112          pHYs_present = false;
   5.113          sBIT_present = false;
   5.114          sPLT_present = false;
     6.1 --- a/src/share/classes/java/awt/print/PrinterJob.java	Fri Dec 19 10:37:50 2008 -0800
     6.2 +++ b/src/share/classes/java/awt/print/PrinterJob.java	Tue Jan 06 16:24:03 2009 -0800
     6.3 @@ -117,15 +117,18 @@
     6.4       * FileOutputStream outstream;
     6.5       * StreamPrintService psPrinter;
     6.6       * String psMimeType = "application/postscript";
     6.7 +     * PrinterJob pj = PrinterJob.getPrinterJob();
     6.8       *
     6.9       * StreamPrintServiceFactory[] factories =
    6.10       *     PrinterJob.lookupStreamPrintServices(psMimeType);
    6.11       * if (factories.length > 0) {
    6.12       *     try {
    6.13       *         outstream = new File("out.ps");
    6.14 -     *         psPrinter =  factories[0].getPrintService(fos);
    6.15 +     *         psPrinter =  factories[0].getPrintService(outstream);
    6.16       *         // psPrinter can now be set as the service on a PrinterJob
    6.17 -     *     } catch (FileNotFoundException e) {
    6.18 +     *         pj.setPrintService(psPrinter)
    6.19 +     *     } catch (Exception e) {
    6.20 +     *         e.printStackTrace();
    6.21       *     }
    6.22       * }
    6.23       * </pre>
     7.1 --- a/src/share/classes/javax/print/Doc.java	Fri Dec 19 10:37:50 2008 -0800
     7.2 +++ b/src/share/classes/javax/print/Doc.java	Tue Jan 06 16:24:03 2009 -0800
     7.3 @@ -28,9 +28,7 @@
     7.4  import java.io.InputStream;
     7.5  import java.io.IOException;
     7.6  import java.io.Reader;
     7.7 -import java.io.UnsupportedEncodingException;
     7.8  
     7.9 -import javax.print.attribute.AttributeSet;
    7.10  import javax.print.attribute.DocAttributeSet;
    7.11  
    7.12  
     8.1 --- a/src/share/classes/javax/print/DocFlavor.java	Fri Dec 19 10:37:50 2008 -0800
     8.2 +++ b/src/share/classes/javax/print/DocFlavor.java	Tue Jan 06 16:24:03 2009 -0800
     8.3 @@ -30,7 +30,6 @@
     8.4  import java.io.ObjectOutputStream;
     8.5  import java.io.Serializable;
     8.6  
     8.7 -import java.util.Map;
     8.8  
     8.9  /**
    8.10   * Class <code>DocFlavor</code> encapsulates an object that specifies the
     9.1 --- a/src/share/classes/javax/print/DocPrintJob.java	Fri Dec 19 10:37:50 2008 -0800
     9.2 +++ b/src/share/classes/javax/print/DocPrintJob.java	Tue Jan 06 16:24:03 2009 -0800
     9.3 @@ -25,7 +25,6 @@
     9.4  
     9.5  package javax.print;
     9.6  
     9.7 -import javax.print.attribute.AttributeSet;
     9.8  import javax.print.attribute.PrintJobAttributeSet;
     9.9  import javax.print.attribute.PrintRequestAttributeSet;
    9.10  import javax.print.event.PrintJobAttributeListener;
    10.1 --- a/src/share/classes/javax/print/MultiDocPrintService.java	Fri Dec 19 10:37:50 2008 -0800
    10.2 +++ b/src/share/classes/javax/print/MultiDocPrintService.java	Tue Jan 06 16:24:03 2009 -0800
    10.3 @@ -25,11 +25,6 @@
    10.4  
    10.5  package javax.print;
    10.6  
    10.7 -import java.util.Map;
    10.8 -
    10.9 -import javax.print.attribute.Attribute;
   10.10 -import javax.print.event.PrintServiceAttributeListener;
   10.11 -
   10.12  
   10.13   /** Interface MultiPrintService is the factory for a MultiDocPrintJob.
   10.14    * A MultiPrintService
    11.1 --- a/src/share/classes/javax/print/PrintServiceLookup.java	Fri Dec 19 10:37:50 2008 -0800
    11.2 +++ b/src/share/classes/javax/print/PrintServiceLookup.java	Tue Jan 06 16:24:03 2009 -0800
    11.3 @@ -28,7 +28,6 @@
    11.4  
    11.5  import java.util.ArrayList;
    11.6  import java.util.Iterator;
    11.7 -import java.util.List;
    11.8  import javax.print.attribute.AttributeSet;
    11.9  
   11.10  import sun.awt.AppContext;
    12.1 --- a/src/share/classes/javax/print/attribute/URISyntax.java	Fri Dec 19 10:37:50 2008 -0800
    12.2 +++ b/src/share/classes/javax/print/attribute/URISyntax.java	Tue Jan 06 16:24:03 2009 -0800
    12.3 @@ -28,7 +28,6 @@
    12.4  
    12.5  import java.io.Serializable;
    12.6  import java.net.URI;
    12.7 -import java.net.URISyntaxException;
    12.8  
    12.9  /**
   12.10   * Class URISyntax is an abstract base class providing the common
    13.1 --- a/src/share/classes/javax/print/event/PrintServiceAttributeEvent.java	Fri Dec 19 10:37:50 2008 -0800
    13.2 +++ b/src/share/classes/javax/print/event/PrintServiceAttributeEvent.java	Tue Jan 06 16:24:03 2009 -0800
    13.3 @@ -25,7 +25,6 @@
    13.4  
    13.5  package javax.print.event;
    13.6  
    13.7 -import java.util.List;
    13.8  import javax.print.PrintService;
    13.9  import javax.print.attribute.AttributeSetUtilities;
   13.10  import javax.print.attribute.PrintServiceAttributeSet;
    14.1 --- a/src/share/classes/sun/font/Decoration.java	Fri Dec 19 10:37:50 2008 -0800
    14.2 +++ b/src/share/classes/sun/font/Decoration.java	Tue Jan 06 16:24:03 2009 -0800
    14.3 @@ -267,7 +267,9 @@
    14.4              CoreMetrics cm = label.getCoreMetrics();
    14.5              if (strikethrough) {
    14.6                  Stroke savedStroke = g2d.getStroke();
    14.7 -                g2d.setStroke(new BasicStroke(cm.strikethroughThickness));
    14.8 +                g2d.setStroke(new BasicStroke(cm.strikethroughThickness,
    14.9 +                                              BasicStroke.CAP_BUTT,
   14.10 +                                              BasicStroke.JOIN_MITER));
   14.11                  float strikeY = y + cm.strikethroughOffset;
   14.12                  g2d.draw(new Line2D.Float(x1, strikeY, x2, strikeY));
   14.13                  g2d.setStroke(savedStroke);
   14.14 @@ -341,7 +343,7 @@
   14.15  
   14.16              Rectangle2D visBounds = label.handleGetVisualBounds();
   14.17  
   14.18 -            if (swapColors || bgPaint != null
   14.19 +            if (swapColors || bgPaint != null || strikethrough
   14.20                          || stdUnderline != null || imUnderline != null) {
   14.21  
   14.22                  float minX = 0;
   14.23 @@ -377,6 +379,7 @@
   14.24              // NOTE:  The performace of the following code may
   14.25              // be very poor.
   14.26              float ulThickness = cm.underlineThickness;
   14.27 +            float ulOffset = cm.underlineOffset;
   14.28  
   14.29              Rectangle2D lb = label.getLogicalBounds();
   14.30              float x1 = x;
   14.31 @@ -385,12 +388,15 @@
   14.32              Area area = null;
   14.33  
   14.34              if (stdUnderline != null) {
   14.35 -                Shape ul = stdUnderline.getUnderlineShape(ulThickness, x1, x2, y);
   14.36 +                Shape ul = stdUnderline.getUnderlineShape(ulThickness,
   14.37 +                                                          x1, x2, y+ulOffset);
   14.38                  area = new Area(ul);
   14.39              }
   14.40  
   14.41              if (strikethrough) {
   14.42 -                Stroke stStroke = new BasicStroke(cm.strikethroughThickness);
   14.43 +                Stroke stStroke = new BasicStroke(cm.strikethroughThickness,
   14.44 +                                                  BasicStroke.CAP_BUTT,
   14.45 +                                                  BasicStroke.JOIN_MITER);
   14.46                  float shiftY = y + cm.strikethroughOffset;
   14.47                  Line2D line = new Line2D.Float(x1, shiftY, x2, shiftY);
   14.48                  Area slArea = new Area(stStroke.createStrokedShape(line));
   14.49 @@ -402,7 +408,8 @@
   14.50              }
   14.51  
   14.52              if (imUnderline != null) {
   14.53 -                Shape ul = imUnderline.getUnderlineShape(ulThickness, x1, x2, y);
   14.54 +                Shape ul = imUnderline.getUnderlineShape(ulThickness,
   14.55 +                                                         x1, x2, y+ulOffset);
   14.56                  Area ulArea = new Area(ul);
   14.57                  if (area == null) {
   14.58                      area = ulArea;
    15.1 --- a/src/share/classes/sun/font/FontManager.java	Fri Dec 19 10:37:50 2008 -0800
    15.2 +++ b/src/share/classes/sun/font/FontManager.java	Tue Jan 06 16:24:03 2009 -0800
    15.3 @@ -3344,7 +3344,7 @@
    15.4              int fontFormat = FONTFORMAT_NONE;
    15.5              int fontRank = Font2D.UNKNOWN_RANK;
    15.6  
    15.7 -            if (ext.equals(".ttf") || isTTC) {
    15.8 +            if (ext.equals(".ttf") || ext.equals(".otf") || isTTC) {
    15.9                  fontFormat = FONTFORMAT_TRUETYPE;
   15.10                  fontRank = Font2D.TTF_RANK;
   15.11              } else if (ext.equals(".pfa") || ext.equals(".pfb")) {
    16.1 --- a/src/share/classes/sun/font/TrueTypeFont.java	Fri Dec 19 10:37:50 2008 -0800
    16.2 +++ b/src/share/classes/sun/font/TrueTypeFont.java	Tue Jan 06 16:24:03 2009 -0800
    16.3 @@ -90,6 +90,7 @@
    16.4      public static final int ttcfTag = 0x74746366; // 'ttcf' - TTC file
    16.5      public static final int v1ttTag = 0x00010000; // 'v1tt' - Version 1 TT font
    16.6      public static final int trueTag = 0x74727565; // 'true' - Version 2 TT font
    16.7 +    public static final int ottoTag = 0x4f54544f; // 'otto' - OpenType font
    16.8  
    16.9      /* -- ID's used in the 'name' table */
   16.10      public static final int MS_PLATFORM_ID = 3;
   16.11 @@ -490,6 +491,7 @@
   16.12  
   16.13              case v1ttTag:
   16.14              case trueTag:
   16.15 +            case ottoTag:
   16.16                  break;
   16.17  
   16.18              default:
    17.1 --- a/src/share/classes/sun/font/Underline.java	Fri Dec 19 10:37:50 2008 -0800
    17.2 +++ b/src/share/classes/sun/font/Underline.java	Tue Jan 06 16:24:03 2009 -0800
    17.3 @@ -126,7 +126,9 @@
    17.4          private BasicStroke createStroke(float lineThickness) {
    17.5  
    17.6              if (dashPattern == null) {
    17.7 -                return new BasicStroke(lineThickness);
    17.8 +                return new BasicStroke(lineThickness,
    17.9 +                                       BasicStroke.CAP_BUTT,
   17.10 +                                       BasicStroke.JOIN_MITER);
   17.11              }
   17.12              else {
   17.13                  return new BasicStroke(lineThickness,
    18.1 --- a/src/share/classes/sun/java2d/SunGraphicsEnvironment.java	Fri Dec 19 10:37:50 2008 -0800
    18.2 +++ b/src/share/classes/sun/java2d/SunGraphicsEnvironment.java	Tue Jan 06 16:24:03 2009 -0800
    18.3 @@ -812,7 +812,9 @@
    18.4                  return(name.startsWith(".ttf", offset) ||
    18.5                         name.startsWith(".TTF", offset) ||
    18.6                         name.startsWith(".ttc", offset) ||
    18.7 -                       name.startsWith(".TTC", offset));
    18.8 +                       name.startsWith(".TTC", offset) ||
    18.9 +                       name.startsWith(".otf", offset) ||
   18.10 +                       name.startsWith(".OTF", offset));
   18.11              }
   18.12          }
   18.13      }
   18.14 @@ -835,31 +837,11 @@
   18.15          }
   18.16      }
   18.17  
   18.18 -     public static class TTorT1Filter implements FilenameFilter {
   18.19 -        public boolean accept(File dir, String name) {
   18.20 -
   18.21 -            /* all conveniently have the same suffix length */
   18.22 -            int offset = name.length()-4;
   18.23 -            if (offset <= 0) { /* must be at least A.ttf or A.pfa */
   18.24 -                return false;
   18.25 -            } else {
   18.26 -                boolean isTT =
   18.27 -                    name.startsWith(".ttf", offset) ||
   18.28 -                    name.startsWith(".TTF", offset) ||
   18.29 -                    name.startsWith(".ttc", offset) ||
   18.30 -                    name.startsWith(".TTC", offset);
   18.31 -                if (isTT) {
   18.32 -                    return true;
   18.33 -                } else if (noType1Font) {
   18.34 -                    return false;
   18.35 -                } else {
   18.36 -                    return(name.startsWith(".pfa", offset) ||
   18.37 -                           name.startsWith(".pfb", offset) ||
   18.38 -                           name.startsWith(".PFA", offset) ||
   18.39 -                           name.startsWith(".PFB", offset));
   18.40 -                }
   18.41 -            }
   18.42 -        }
   18.43 +    public static class TTorT1Filter implements FilenameFilter {
   18.44 +         public boolean accept(File dir, String name) {
   18.45 +             return SunGraphicsEnvironment.ttFilter.accept(dir, name) ||
   18.46 +                 SunGraphicsEnvironment.t1Filter.accept(dir, name);
   18.47 +         }
   18.48      }
   18.49  
   18.50      /* No need to keep consing up new instances - reuse a singleton.
   18.51 @@ -1290,6 +1272,13 @@
   18.52          displayChanger.notifyPaletteChanged();
   18.53      }
   18.54  
   18.55 +    /**
   18.56 +     * Returns true when the display is local, false for remote displays.
   18.57 +     *
   18.58 +     * @return true when the display is local, false for remote displays
   18.59 +     */
   18.60 +    public abstract boolean isDisplayLocal();
   18.61 +
   18.62      /*
   18.63       * ----DISPLAY CHANGE SUPPORT----
   18.64       */
    19.1 --- a/src/share/classes/sun/java2d/SurfaceData.java	Fri Dec 19 10:37:50 2008 -0800
    19.2 +++ b/src/share/classes/sun/java2d/SurfaceData.java	Tue Jan 06 16:24:03 2009 -0800
    19.3 @@ -449,7 +449,8 @@
    19.4          // For now the answer can only be true in the following cases:
    19.5          if (sg2d.compositeState <= SunGraphics2D.COMP_ISCOPY &&
    19.6              sg2d.paintState <= SunGraphics2D.PAINT_ALPHACOLOR &&
    19.7 -            sg2d.clipState <= SunGraphics2D.CLIP_RECTANGULAR)
    19.8 +            sg2d.clipState <= SunGraphics2D.CLIP_RECTANGULAR &&
    19.9 +            sg2d.surfaceData.getTransparency() == Transparency.OPAQUE)
   19.10          {
   19.11              if (haveLCDLoop == LCDLOOP_UNKNOWN) {
   19.12                  DrawGlyphListLCD loop =
    20.1 --- a/src/share/classes/sun/java2d/opengl/OGLBlitLoops.java	Fri Dec 19 10:37:50 2008 -0800
    20.2 +++ b/src/share/classes/sun/java2d/opengl/OGLBlitLoops.java	Tue Jan 06 16:24:03 2009 -0800
    20.3 @@ -25,17 +25,13 @@
    20.4  
    20.5  package sun.java2d.opengl;
    20.6  
    20.7 -import java.awt.AlphaComposite;
    20.8 -import java.awt.Color;
    20.9  import java.awt.Composite;
   20.10  import java.awt.Transparency;
   20.11  import java.awt.geom.AffineTransform;
   20.12  import java.awt.image.AffineTransformOp;
   20.13  import java.awt.image.BufferedImage;
   20.14  import java.awt.image.BufferedImageOp;
   20.15 -import java.awt.image.ColorModel;
   20.16  import java.lang.ref.WeakReference;
   20.17 -import sun.awt.image.BufImgSurfaceData;
   20.18  import sun.java2d.SurfaceData;
   20.19  import sun.java2d.loops.Blit;
   20.20  import sun.java2d.loops.CompositeType;
   20.21 @@ -84,6 +80,8 @@
   20.22                                     OGLSurfaceData.PF_INT_BGR),
   20.23              new OGLSwToSurfaceBlit(SurfaceType.IntBgrx,
   20.24                                     OGLSurfaceData.PF_INT_BGRX),
   20.25 +            new OGLSwToSurfaceBlit(SurfaceType.ThreeByteBgr,
   20.26 +                                   OGLSurfaceData.PF_3BYTE_BGR),
   20.27              new OGLSwToSurfaceBlit(SurfaceType.Ushort565Rgb,
   20.28                                     OGLSurfaceData.PF_USHORT_565_RGB),
   20.29              new OGLSwToSurfaceBlit(SurfaceType.Ushort555Rgb,
   20.30 @@ -106,6 +104,8 @@
   20.31                                      OGLSurfaceData.PF_INT_BGR),
   20.32              new OGLSwToSurfaceScale(SurfaceType.IntBgrx,
   20.33                                      OGLSurfaceData.PF_INT_BGRX),
   20.34 +            new OGLSwToSurfaceScale(SurfaceType.ThreeByteBgr,
   20.35 +                                    OGLSurfaceData.PF_3BYTE_BGR),
   20.36              new OGLSwToSurfaceScale(SurfaceType.Ushort565Rgb,
   20.37                                      OGLSurfaceData.PF_USHORT_565_RGB),
   20.38              new OGLSwToSurfaceScale(SurfaceType.Ushort555Rgb,
   20.39 @@ -127,6 +127,8 @@
   20.40                                          OGLSurfaceData.PF_INT_BGR),
   20.41              new OGLSwToSurfaceTransform(SurfaceType.IntBgrx,
   20.42                                          OGLSurfaceData.PF_INT_BGRX),
   20.43 +            new OGLSwToSurfaceTransform(SurfaceType.ThreeByteBgr,
   20.44 +                                        OGLSurfaceData.PF_3BYTE_BGR),
   20.45              new OGLSwToSurfaceTransform(SurfaceType.Ushort565Rgb,
   20.46                                          OGLSurfaceData.PF_USHORT_565_RGB),
   20.47              new OGLSwToSurfaceTransform(SurfaceType.Ushort555Rgb,
   20.48 @@ -155,6 +157,8 @@
   20.49                                     OGLSurfaceData.PF_INT_BGR),
   20.50              new OGLSwToTextureBlit(SurfaceType.IntBgrx,
   20.51                                     OGLSurfaceData.PF_INT_BGRX),
   20.52 +            new OGLSwToTextureBlit(SurfaceType.ThreeByteBgr,
   20.53 +                                   OGLSurfaceData.PF_3BYTE_BGR),
   20.54              new OGLSwToTextureBlit(SurfaceType.Ushort565Rgb,
   20.55                                     OGLSurfaceData.PF_USHORT_565_RGB),
   20.56              new OGLSwToTextureBlit(SurfaceType.Ushort555Rgb,
    21.1 --- a/src/share/classes/sun/java2d/opengl/OGLSurfaceData.java	Fri Dec 19 10:37:50 2008 -0800
    21.2 +++ b/src/share/classes/sun/java2d/opengl/OGLSurfaceData.java	Tue Jan 06 16:24:03 2009 -0800
    21.3 @@ -120,6 +120,7 @@
    21.4      public static final int PF_USHORT_555_RGBX = 8;
    21.5      public static final int PF_BYTE_GRAY       = 9;
    21.6      public static final int PF_USHORT_GRAY     = 10;
    21.7 +    public static final int PF_3BYTE_BGR       = 11;
    21.8  
    21.9      /**
   21.10       * SurfaceTypes
   21.11 @@ -401,6 +402,7 @@
   21.12       *   - the fragment shader extension is available, and
   21.13       *   - blending is disabled, and
   21.14       *   - the source color is opaque
   21.15 +     *   - and the destination is opaque
   21.16       *
   21.17       * Eventually, we could enhance the native OGL text rendering code
   21.18       * and remove the above restrictions, but that would require significantly
   21.19 @@ -410,7 +412,8 @@
   21.20          return
   21.21              graphicsConfig.isCapPresent(CAPS_EXT_LCD_SHADER) &&
   21.22              sg2d.compositeState <= SunGraphics2D.COMP_ISCOPY &&
   21.23 -            sg2d.paintState <= SunGraphics2D.PAINT_OPAQUECOLOR;
   21.24 +            sg2d.paintState <= SunGraphics2D.PAINT_OPAQUECOLOR &&
   21.25 +            sg2d.surfaceData.getTransparency() == Transparency.OPAQUE;
   21.26      }
   21.27  
   21.28      public void validatePipe(SunGraphics2D sg2d) {
    22.1 --- a/src/share/classes/sun/java2d/pipe/BufferedContext.java	Fri Dec 19 10:37:50 2008 -0800
    22.2 +++ b/src/share/classes/sun/java2d/pipe/BufferedContext.java	Tue Jan 06 16:24:03 2009 -0800
    22.3 @@ -90,7 +90,8 @@
    22.4      private Region          validatedClip;
    22.5      private Composite       validatedComp;
    22.6      private Paint           validatedPaint;
    22.7 -    private boolean         isValidatedPaintAColor;
    22.8 +    // renamed from isValidatedPaintAColor as part of a work around for 6764257
    22.9 +    private boolean         isValidatedPaintJustAColor;
   22.10      private int             validatedRGB;
   22.11      private int             validatedFlags;
   22.12      private boolean         xformInUse;
   22.13 @@ -182,7 +183,7 @@
   22.14          if (paint instanceof Color) {
   22.15              // REMIND: not 30-bit friendly
   22.16              int newRGB = ((Color)paint).getRGB();
   22.17 -            if (isValidatedPaintAColor) {
   22.18 +            if (isValidatedPaintJustAColor) {
   22.19                  if (newRGB != validatedRGB) {
   22.20                      validatedRGB = newRGB;
   22.21                      updatePaint = true;
   22.22 @@ -190,13 +191,13 @@
   22.23              } else {
   22.24                  validatedRGB = newRGB;
   22.25                  updatePaint = true;
   22.26 -                isValidatedPaintAColor = true;
   22.27 +                isValidatedPaintJustAColor = true;
   22.28              }
   22.29          } else if (validatedPaint != paint) {
   22.30              updatePaint = true;
   22.31              // this should be set when we are switching from paint to color
   22.32              // in which case this condition will be true
   22.33 -            isValidatedPaintAColor = false;
   22.34 +            isValidatedPaintJustAColor = false;
   22.35          }
   22.36  
   22.37          if ((currentContext != this) ||
   22.38 @@ -281,7 +282,7 @@
   22.39              txChanged = true;
   22.40          }
   22.41          // non-Color paints may require paint revalidation
   22.42 -        if (!isValidatedPaintAColor && txChanged) {
   22.43 +        if (!isValidatedPaintJustAColor && txChanged) {
   22.44              updatePaint = true;
   22.45          }
   22.46  
   22.47 @@ -427,10 +428,12 @@
   22.48          resetTransform();
   22.49          resetComposite();
   22.50          resetClip();
   22.51 +        BufferedPaints.resetPaint(rq);
   22.52          invalidateSurfaces();
   22.53          validatedComp = null;
   22.54          validatedClip = null;
   22.55          validatedPaint = null;
   22.56 +        isValidatedPaintJustAColor = false;
   22.57          xformInUse = false;
   22.58      }
   22.59  
    23.1 --- a/src/share/classes/sun/print/PSPathGraphics.java	Fri Dec 19 10:37:50 2008 -0800
    23.2 +++ b/src/share/classes/sun/print/PSPathGraphics.java	Tue Jan 06 16:24:03 2009 -0800
    23.3 @@ -30,7 +30,6 @@
    23.4  import java.awt.Graphics;
    23.5  import java.awt.Graphics2D;
    23.6  import java.awt.Image;
    23.7 -import java.awt.Paint;
    23.8  import java.awt.Shape;
    23.9  import java.awt.Transparency;
   23.10  
    24.1 --- a/src/share/classes/sun/print/PrintJobAttributeException.java	Fri Dec 19 10:37:50 2008 -0800
    24.2 +++ b/src/share/classes/sun/print/PrintJobAttributeException.java	Tue Jan 06 16:24:03 2009 -0800
    24.3 @@ -25,7 +25,6 @@
    24.4  
    24.5  package sun.print;
    24.6  
    24.7 -import javax.print.DocFlavor;
    24.8  import javax.print.AttributeException;
    24.9  import javax.print.PrintException;
   24.10  import javax.print.attribute.Attribute;
    25.1 --- a/src/share/classes/sun/print/SunMinMaxPage.java	Fri Dec 19 10:37:50 2008 -0800
    25.2 +++ b/src/share/classes/sun/print/SunMinMaxPage.java	Tue Jan 06 16:24:03 2009 -0800
    25.3 @@ -25,7 +25,6 @@
    25.4  
    25.5  package sun.print;
    25.6  
    25.7 -import javax.print.attribute.EnumSyntax;
    25.8  import javax.print.attribute.PrintRequestAttribute;
    25.9  
   25.10  /*
    26.1 --- a/src/share/classes/sun/print/SunPageSelection.java	Fri Dec 19 10:37:50 2008 -0800
    26.2 +++ b/src/share/classes/sun/print/SunPageSelection.java	Tue Jan 06 16:24:03 2009 -0800
    26.3 @@ -26,7 +26,6 @@
    26.4  package sun.print;
    26.5  
    26.6  import javax.print.attribute.PrintRequestAttribute;
    26.7 -import javax.print.attribute.standard.Media;
    26.8  
    26.9  /*
   26.10   * A class used to determine the range of pages to be printed.
    27.1 --- a/src/share/classes/sun/swing/SwingUtilities2.java	Fri Dec 19 10:37:50 2008 -0800
    27.2 +++ b/src/share/classes/sun/swing/SwingUtilities2.java	Tue Jan 06 16:24:03 2009 -0800
    27.3 @@ -55,6 +55,7 @@
    27.4  import java.util.*;
    27.5  import sun.font.FontDesignMetrics;
    27.6  import sun.font.FontManager;
    27.7 +import sun.java2d.SunGraphicsEnvironment;
    27.8  
    27.9  import java.util.concurrent.Callable;
   27.10  import java.util.concurrent.Future;
   27.11 @@ -1478,22 +1479,14 @@
   27.12       * appear capable of performing gamma correction needed for LCD text.
   27.13       */
   27.14      public static boolean isLocalDisplay() {
   27.15 -        try {
   27.16 -            // On Windows just return true. Permission to read os.name
   27.17 -            // is granted to all code but wrapped in try to be safe.
   27.18 -            if (OSInfo.getOSType() == OSInfo.OSType.WINDOWS) {
   27.19 -                return true;
   27.20 -            }
   27.21 -            // Else probably Solaris or Linux in which case may be remote X11
   27.22 -            Class<?> x11Class = Class.forName("sun.awt.X11GraphicsEnvironment");
   27.23 -            Method isDisplayLocalMethod = x11Class.getMethod(
   27.24 -                      "isDisplayLocal", new Class[0]);
   27.25 -            return (Boolean)isDisplayLocalMethod.invoke(null, (Object[])null);
   27.26 -        } catch (Throwable t) {
   27.27 +        boolean isLocal;
   27.28 +        GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
   27.29 +        if (ge instanceof SunGraphicsEnvironment) {
   27.30 +            isLocal = ((SunGraphicsEnvironment) ge).isDisplayLocal();
   27.31 +        } else {
   27.32 +            isLocal = true;
   27.33          }
   27.34 -        // If we get here we're most likely being run on some other O/S
   27.35 -        // or we didn't properly detect Windows.
   27.36 -        return true;
   27.37 +        return isLocal;
   27.38      }
   27.39  
   27.40      /**
    28.1 --- a/src/share/demo/java2d/J2DBench/src/j2dbench/tests/ImageTests.java	Fri Dec 19 10:37:50 2008 -0800
    28.2 +++ b/src/share/demo/java2d/J2DBench/src/j2dbench/tests/ImageTests.java	Tue Jan 06 16:24:03 2009 -0800
    28.3 @@ -60,6 +60,9 @@
    28.4  import java.awt.image.WritableRaster;
    28.5  import java.awt.Transparency;
    28.6  import java.awt.geom.AffineTransform;
    28.7 +import java.awt.image.DataBufferByte;
    28.8 +import java.awt.image.DataBufferInt;
    28.9 +import java.awt.image.DataBufferShort;
   28.10  import java.util.ArrayList;
   28.11  import javax.swing.JComponent;
   28.12  
   28.13 @@ -84,6 +87,7 @@
   28.14      static Group.EnableSet bufimgsrcroot;
   28.15  
   28.16      static Group imgtestroot;
   28.17 +    static Group imgoptionsroot;
   28.18  
   28.19      static Group imageOpRoot;
   28.20      static Group imageOpOptRoot;
   28.21 @@ -92,6 +96,7 @@
   28.22      static Group bufImgOpTestRoot;
   28.23      static Group rasterOpTestRoot;
   28.24      static Option opList;
   28.25 +    static Option doTouchSrc;
   28.26  
   28.27      static String transNodeNames[] = {
   28.28          null, "opaque", "bitmask", "translucent",
   28.29 @@ -105,9 +110,19 @@
   28.30          imageroot = new Group(graphicsroot, "imaging",
   28.31                                "Imaging Benchmarks");
   28.32          imageroot.setTabbed();
   28.33 +
   28.34          imgsrcroot = new Group.EnableSet(imageroot, "src",
   28.35                                           "Image Rendering Sources");
   28.36          imgsrcroot.setBordered(true);
   28.37 +
   28.38 +        imgoptionsroot = new Group(imgsrcroot, "options",
   28.39 +                                "Image Source Options");
   28.40 +        imgoptionsroot.setBordered(true);
   28.41 +        doTouchSrc =
   28.42 +            new Option.Toggle(imgoptionsroot, "touchsrc",
   28.43 +                              "Touch src image before every operation",
   28.44 +                               Option.Toggle.Off);
   28.45 +
   28.46          imgtestroot = new Group(imageroot, "tests",
   28.47                                  "Image Rendering Tests");
   28.48          imgtestroot.setBordered(true);
   28.49 @@ -131,7 +146,11 @@
   28.50              new BufImg(BufferedImage.TYPE_INT_RGB);
   28.51              new BufImg(BufferedImage.TYPE_INT_ARGB);
   28.52              new BufImg(BufferedImage.TYPE_BYTE_GRAY);
   28.53 +            new BufImg(BufferedImage.TYPE_3BYTE_BGR);
   28.54              new BmByteIndexBufImg();
   28.55 +            new BufImg(BufferedImage.TYPE_INT_RGB, true);
   28.56 +            new BufImg(BufferedImage.TYPE_INT_ARGB, true);
   28.57 +            new BufImg(BufferedImage.TYPE_3BYTE_BGR, true);
   28.58  
   28.59              imageOpRoot = new Group(imageroot, "imageops",
   28.60                                      "Image Op Benchmarks");
   28.61 @@ -193,6 +212,7 @@
   28.62      }
   28.63  
   28.64      public static class Context extends GraphicsTests.Context {
   28.65 +        boolean touchSrc;
   28.66          Image src;
   28.67          AffineTransform tx;
   28.68      }
   28.69 @@ -206,6 +226,7 @@
   28.70      {
   28.71          super(parent, nodeName, description);
   28.72          addDependency(imgsrcroot, srcFilter);
   28.73 +        addDependency(doTouchSrc);
   28.74      }
   28.75  
   28.76      public GraphicsTests.Context createContext() {
   28.77 @@ -217,6 +238,7 @@
   28.78          ImageTests.Context ictx = (ImageTests.Context) ctx;
   28.79  
   28.80          ictx.src = env.getSrcImage();
   28.81 +        ictx.touchSrc = env.isEnabled(doTouchSrc);
   28.82      }
   28.83  
   28.84      public abstract static class TriStateImageType extends Group {
   28.85 @@ -272,13 +294,6 @@
   28.86      public static class CompatImg extends TriStateImageType {
   28.87          int transparency;
   28.88  
   28.89 -        public static String Descriptions[] = {
   28.90 -            "Default Compatible Image",
   28.91 -            "Opaque Compatible Image",
   28.92 -            "Bitmask Compatible Image",
   28.93 -            "Translucent Compatible Image",
   28.94 -        };
   28.95 -
   28.96          public CompatImg(int transparency) {
   28.97              super(imgsrcroot,
   28.98                    Destinations.CompatImg.ShortNames[transparency],
   28.99 @@ -296,6 +311,7 @@
  28.100  
  28.101      public static class BufImg extends TriStateImageType {
  28.102          int type;
  28.103 +        boolean unmanaged;
  28.104  
  28.105          static int Transparencies[] = {
  28.106              Transparency.TRANSLUCENT, // "custom",
  28.107 @@ -315,15 +331,37 @@
  28.108          };
  28.109  
  28.110          public BufImg(int type) {
  28.111 +            this(type, false);
  28.112 +        }
  28.113 +
  28.114 +        public BufImg(int type, boolean unmanaged) {
  28.115              super(bufimgsrcroot,
  28.116 +                  (unmanaged ? "unmanaged" : "") +
  28.117                    Destinations.BufImg.ShortNames[type],
  28.118 +                  (unmanaged ? "Unmanaged " : "") +
  28.119                    Destinations.BufImg.Descriptions[type],
  28.120                    Transparencies[type]);
  28.121              this.type = type;
  28.122 +            this.unmanaged = unmanaged;
  28.123          }
  28.124  
  28.125          public Image makeImage(TestEnvironment env, int w, int h) {
  28.126 -            return new BufferedImage(w, h, type);
  28.127 +            BufferedImage img = new BufferedImage(w, h, type);
  28.128 +            if (unmanaged) {
  28.129 +                DataBuffer db = img.getRaster().getDataBuffer();
  28.130 +                if (db instanceof DataBufferInt) {
  28.131 +                    ((DataBufferInt)db).getData();
  28.132 +                } else if (db instanceof DataBufferShort) {
  28.133 +                    ((DataBufferShort)db).getData();
  28.134 +                } else if (db instanceof DataBufferByte) {
  28.135 +                    ((DataBufferByte)db).getData();
  28.136 +                } else {
  28.137 +                    try {
  28.138 +                        img.setAccelerationPriority(0.0f);
  28.139 +                    } catch (Throwable e) {}
  28.140 +                }
  28.141 +            }
  28.142 +            return img;
  28.143          }
  28.144      }
  28.145  
  28.146 @@ -471,15 +509,33 @@
  28.147              g.translate(ictx.orgX, ictx.orgY);
  28.148              Image src = ictx.src;
  28.149              if (ictx.animate) {
  28.150 -                do {
  28.151 -                    g.drawImage(src, x, y, null);
  28.152 -                    if ((x -= 3) < 0) x += ictx.maxX;
  28.153 -                    if ((y -= 1) < 0) y += ictx.maxY;
  28.154 -                } while (--numReps > 0);
  28.155 +                if (ictx.touchSrc) {
  28.156 +                    Graphics srcG = src.getGraphics();
  28.157 +                    do {
  28.158 +                        srcG.fillRect(0, 0, 1, 1);
  28.159 +                        g.drawImage(src, x, y, null);
  28.160 +                        if ((x -= 3) < 0) x += ictx.maxX;
  28.161 +                        if ((y -= 1) < 0) y += ictx.maxY;
  28.162 +                    } while (--numReps > 0);
  28.163 +                } else {
  28.164 +                    do {
  28.165 +                        g.drawImage(src, x, y, null);
  28.166 +                        if ((x -= 3) < 0) x += ictx.maxX;
  28.167 +                        if ((y -= 1) < 0) y += ictx.maxY;
  28.168 +                    } while (--numReps > 0);
  28.169 +                }
  28.170              } else {
  28.171 -                do {
  28.172 -                    g.drawImage(src, x, y, null);
  28.173 -                } while (--numReps > 0);
  28.174 +                if (ictx.touchSrc) {
  28.175 +                    Graphics srcG = src.getGraphics();
  28.176 +                    do {
  28.177 +                        srcG.fillRect(0, 0, 1, 1);
  28.178 +                        g.drawImage(src, x, y, null);
  28.179 +                    } while (--numReps > 0);
  28.180 +                } else {
  28.181 +                    do {
  28.182 +                        g.drawImage(src, x, y, null);
  28.183 +                    } while (--numReps > 0);
  28.184 +                }
  28.185              }
  28.186              g.translate(-ictx.orgX, -ictx.orgY);
  28.187          }
  28.188 @@ -505,15 +561,33 @@
  28.189              Image src = ictx.src;
  28.190              Color bg = Color.orange;
  28.191              if (ictx.animate) {
  28.192 -                do {
  28.193 -                    g.drawImage(src, x, y, bg, null);
  28.194 -                    if ((x -= 3) < 0) x += ictx.maxX;
  28.195 -                    if ((y -= 1) < 0) y += ictx.maxY;
  28.196 -                } while (--numReps > 0);
  28.197 +                if (ictx.touchSrc) {
  28.198 +                    Graphics srcG = src.getGraphics();
  28.199 +                    do {
  28.200 +                        srcG.fillRect(0, 0, 1, 1);
  28.201 +                        g.drawImage(src, x, y, bg, null);
  28.202 +                        if ((x -= 3) < 0) x += ictx.maxX;
  28.203 +                        if ((y -= 1) < 0) y += ictx.maxY;
  28.204 +                    } while (--numReps > 0);
  28.205 +                } else {
  28.206 +                    do {
  28.207 +                        g.drawImage(src, x, y, bg, null);
  28.208 +                        if ((x -= 3) < 0) x += ictx.maxX;
  28.209 +                        if ((y -= 1) < 0) y += ictx.maxY;
  28.210 +                    } while (--numReps > 0);
  28.211 +                }
  28.212              } else {
  28.213 -                do {
  28.214 -                    g.drawImage(src, x, y, bg, null);
  28.215 -                } while (--numReps > 0);
  28.216 +                if (ictx.touchSrc) {
  28.217 +                    Graphics srcG = src.getGraphics();
  28.218 +                    do {
  28.219 +                        srcG.fillRect(0, 0, 1, 1);
  28.220 +                        g.drawImage(src, x, y, bg, null);
  28.221 +                    } while (--numReps > 0);
  28.222 +                } else {
  28.223 +                    do {
  28.224 +                        g.drawImage(src, x, y, bg, null);
  28.225 +                    } while (--numReps > 0);
  28.226 +                }
  28.227              }
  28.228              g.translate(-ictx.orgX, -ictx.orgY);
  28.229          }
  28.230 @@ -524,7 +598,7 @@
  28.231  
  28.232          public DrawImageScale(String dir, float scale) {
  28.233              super(imgtestroot, "drawimagescale"+dir,
  28.234 -                  "drawImage(img, x, y, w*"+scale+", h*"+scale+", obs);");
  28.235 +                               "drawImage(img, x, y, w*"+scale+", h*"+scale+", obs);");
  28.236              this.scale = scale;
  28.237          }
  28.238  
  28.239 @@ -546,15 +620,33 @@
  28.240              g.translate(ictx.orgX, ictx.orgY);
  28.241              Image src = ictx.src;
  28.242              if (ictx.animate) {
  28.243 -                do {
  28.244 -                    g.drawImage(src, x, y, w, h, null);
  28.245 -                    if ((x -= 3) < 0) x += ictx.maxX;
  28.246 -                    if ((y -= 1) < 0) y += ictx.maxY;
  28.247 -                } while (--numReps > 0);
  28.248 +                if (ictx.touchSrc) {
  28.249 +                    Graphics srcG = src.getGraphics();
  28.250 +                    do {
  28.251 +                        srcG.fillRect(0, 0, 1, 1);
  28.252 +                        g.drawImage(src, x, y, w, h, null);
  28.253 +                        if ((x -= 3) < 0) x += ictx.maxX;
  28.254 +                        if ((y -= 1) < 0) y += ictx.maxY;
  28.255 +                    } while (--numReps > 0);
  28.256 +                } else {
  28.257 +                    do {
  28.258 +                        g.drawImage(src, x, y, w, h, null);
  28.259 +                        if ((x -= 3) < 0) x += ictx.maxX;
  28.260 +                        if ((y -= 1) < 0) y += ictx.maxY;
  28.261 +                    } while (--numReps > 0);
  28.262 +                }
  28.263              } else {
  28.264 -                do {
  28.265 -                    g.drawImage(src, x, y, w, h, null);
  28.266 -                } while (--numReps > 0);
  28.267 +                Graphics srcG = src.getGraphics();
  28.268 +                if (ictx.touchSrc) {
  28.269 +                    do {
  28.270 +                        srcG.fillRect(0, 0, 1, 1);
  28.271 +                        g.drawImage(src, x, y, w, h, null);
  28.272 +                    } while (--numReps > 0);
  28.273 +                } else {
  28.274 +                    do {
  28.275 +                        g.drawImage(src, x, y, w, h, null);
  28.276 +                    } while (--numReps > 0);
  28.277 +                }
  28.278              }
  28.279              g.translate(-ictx.orgX, -ictx.orgY);
  28.280          }
  28.281 @@ -588,17 +680,36 @@
  28.282              Image src = ictx.src;
  28.283              AffineTransform tx = ictx.tx;
  28.284              if (ictx.animate) {
  28.285 -                do {
  28.286 -                    tx.setTransform(1.0, 0.1, 0.1, 1.0, x, y);
  28.287 -                    g.drawImage(src, tx, null);
  28.288 -                    if ((x -= 3) < 0) x += ictx.maxX;
  28.289 -                    if ((y -= 1) < 0) y += ictx.maxY;
  28.290 -                } while (--numReps > 0);
  28.291 +                if (ictx.touchSrc) {
  28.292 +                    Graphics srcG = src.getGraphics();
  28.293 +                    do {
  28.294 +                        tx.setTransform(1.0, 0.1, 0.1, 1.0, x, y);
  28.295 +                        srcG.fillRect(0, 0, 1, 1);
  28.296 +                        g.drawImage(src, tx, null);
  28.297 +                        if ((x -= 3) < 0) x += ictx.maxX;
  28.298 +                        if ((y -= 1) < 0) y += ictx.maxY;
  28.299 +                    } while (--numReps > 0);
  28.300 +                } else {
  28.301 +                    do {
  28.302 +                        tx.setTransform(1.0, 0.1, 0.1, 1.0, x, y);
  28.303 +                        g.drawImage(src, tx, null);
  28.304 +                        if ((x -= 3) < 0) x += ictx.maxX;
  28.305 +                        if ((y -= 1) < 0) y += ictx.maxY;
  28.306 +                    } while (--numReps > 0);
  28.307 +                }
  28.308              } else {
  28.309                  tx.setTransform(1.0, 0.1, 0.1, 1.0, x, y);
  28.310 -                do {
  28.311 -                    g.drawImage(src, tx, null);
  28.312 -                } while (--numReps > 0);
  28.313 +                if (ictx.touchSrc) {
  28.314 +                    Graphics srcG = src.getGraphics();
  28.315 +                    do {
  28.316 +                        srcG.fillRect(0, 0, 1, 1);
  28.317 +                        g.drawImage(src, tx, null);
  28.318 +                    } while (--numReps > 0);
  28.319 +                } else {
  28.320 +                    do {
  28.321 +                        g.drawImage(src, tx, null);
  28.322 +                    } while (--numReps > 0);
  28.323 +                }
  28.324              }
  28.325              g.translate(-ictx.orgX, -ictx.orgY);
  28.326          }
  28.327 @@ -736,15 +847,33 @@
  28.328              Graphics2D g2 = (Graphics2D)ictx.graphics;
  28.329              g2.translate(ictx.orgX, ictx.orgY);
  28.330              if (ictx.animate) {
  28.331 -                do {
  28.332 -                    g2.drawImage(src, op, x, y);
  28.333 -                    if ((x -= 3) < 0) x += ictx.maxX;
  28.334 -                    if ((y -= 1) < 0) y += ictx.maxY;
  28.335 -                } while (--numReps > 0);
  28.336 +                if (ictx.touchSrc) {
  28.337 +                    Graphics gSrc = src.getGraphics();
  28.338 +                    do {
  28.339 +                        gSrc.fillRect(0, 0, 1, 1);
  28.340 +                        g2.drawImage(src, op, x, y);
  28.341 +                        if ((x -= 3) < 0) x += ictx.maxX;
  28.342 +                        if ((y -= 1) < 0) y += ictx.maxY;
  28.343 +                    } while (--numReps > 0);
  28.344 +                } else {
  28.345 +                    do {
  28.346 +                        g2.drawImage(src, op, x, y);
  28.347 +                        if ((x -= 3) < 0) x += ictx.maxX;
  28.348 +                        if ((y -= 1) < 0) y += ictx.maxY;
  28.349 +                    } while (--numReps > 0);
  28.350 +                }
  28.351              } else {
  28.352 -                do {
  28.353 -                    g2.drawImage(src, op, x, y);
  28.354 -                } while (--numReps > 0);
  28.355 +                if (ictx.touchSrc) {
  28.356 +                    Graphics gSrc = src.getGraphics();
  28.357 +                    do {
  28.358 +                        gSrc.fillRect(0, 0, 1, 1);
  28.359 +                        g2.drawImage(src, op, x, y);
  28.360 +                    } while (--numReps > 0);
  28.361 +                } else {
  28.362 +                    do {
  28.363 +                        g2.drawImage(src, op, x, y);
  28.364 +                    } while (--numReps > 0);
  28.365 +                }
  28.366              }
  28.367              g2.translate(-ictx.orgX, -ictx.orgY);
  28.368          }
  28.369 @@ -778,9 +907,17 @@
  28.370              BufferedImageOp op = ictx.bufImgOp;
  28.371              BufferedImage src = ictx.bufSrc;
  28.372              BufferedImage dst = ictx.bufDst;
  28.373 -            do {
  28.374 -                op.filter(src, dst);
  28.375 -            } while (--numReps > 0);
  28.376 +            if (ictx.touchSrc) {
  28.377 +                Graphics gSrc = src.getGraphics();
  28.378 +                do {
  28.379 +                    gSrc.fillRect(0, 0, 1, 1);
  28.380 +                    op.filter(src, dst);
  28.381 +                } while (--numReps > 0);
  28.382 +            } else {
  28.383 +                do {
  28.384 +                    op.filter(src, dst);
  28.385 +                } while (--numReps > 0);
  28.386 +            }
  28.387          }
  28.388      }
  28.389  
  28.390 @@ -814,9 +951,17 @@
  28.391              RasterOp op = ictx.rasterOp;
  28.392              Raster src = ictx.rasSrc;
  28.393              WritableRaster dst = ictx.rasDst;
  28.394 -            do {
  28.395 -                op.filter(src, dst);
  28.396 -            } while (--numReps > 0);
  28.397 +            if (ictx.touchSrc) {
  28.398 +                Graphics gSrc = ictx.bufSrc.getGraphics();
  28.399 +                do {
  28.400 +                    gSrc.fillRect(0, 0, 1, 1);
  28.401 +                    op.filter(src, dst);
  28.402 +                } while (--numReps > 0);
  28.403 +            } else {
  28.404 +                do {
  28.405 +                    op.filter(src, dst);
  28.406 +                } while (--numReps > 0);
  28.407 +            }
  28.408          }
  28.409      }
  28.410  }
    29.1 --- a/src/share/native/sun/font/freetypeScaler.c	Fri Dec 19 10:37:50 2008 -0800
    29.2 +++ b/src/share/native/sun/font/freetypeScaler.c	Tue Jan 06 16:24:03 2009 -0800
    29.3 @@ -1281,7 +1281,7 @@
    29.4                                     sunFontIDs.rect2DFloatClass,
    29.5                                     sunFontIDs.rect2DFloatCtr4,
    29.6                                     F26Dot6ToFloat(bbox.xMin),
    29.7 -                                   F26Dot6ToFloat(bbox.yMax),
    29.8 +                                   F26Dot6ToFloat(-bbox.yMax),
    29.9                                     F26Dot6ToFloat(bbox.xMax-bbox.xMin),
   29.10                                     F26Dot6ToFloat(bbox.yMax-bbox.yMin));
   29.11      }
    30.1 --- a/src/share/native/sun/java2d/opengl/OGLBlitLoops.c	Fri Dec 19 10:37:50 2008 -0800
    30.2 +++ b/src/share/native/sun/java2d/opengl/OGLBlitLoops.c	Tue Jan 06 16:24:03 2009 -0800
    30.3 @@ -203,7 +203,24 @@
    30.4      j2d_glBitmap(0, 0, 0, 0, (GLfloat)dx1, (GLfloat)-dy1, NULL);
    30.5  
    30.6      j2d_glPixelZoom(scalex, -scaley);
    30.7 -    j2d_glDrawPixels(sx2-sx1, sy2-sy1, pf->format, pf->type, srcInfo->rasBase);
    30.8 +
    30.9 +    // in case pixel stride is not a multiple of scanline stride the copy
   30.10 +    // has to be done line by line (see 6207877)
   30.11 +    if (srcInfo->scanStride % srcInfo->pixelStride != 0) {
   30.12 +        jint width = sx2-sx1;
   30.13 +        jint height = sy2-sy1;
   30.14 +        GLvoid *pSrc = srcInfo->rasBase;
   30.15 +
   30.16 +        while (height > 0) {
   30.17 +            j2d_glDrawPixels(width, 1, pf->format, pf->type, pSrc);
   30.18 +            j2d_glBitmap(0, 0, 0, 0, (GLfloat)0, (GLfloat)-1, NULL);
   30.19 +            pSrc = PtrAddBytes(pSrc, srcInfo->scanStride);
   30.20 +            height--;
   30.21 +        }
   30.22 +    } else {
   30.23 +        j2d_glDrawPixels(sx2-sx1, sy2-sy1, pf->format, pf->type, srcInfo->rasBase);
   30.24 +    }
   30.25 +
   30.26      j2d_glPixelZoom(1.0, 1.0);
   30.27  
   30.28      if (oglc->extraAlpha != 1.0f) {
   30.29 @@ -250,6 +267,7 @@
   30.30      jint sx, sy, sw, sh;
   30.31      GLint glhint = (hint == OGLSD_XFORM_BILINEAR) ? GL_LINEAR : GL_NEAREST;
   30.32      jboolean adjustAlpha = (pf != NULL && !pf->hasAlpha);
   30.33 +    jboolean slowPath;
   30.34  
   30.35      if (oglc->blitTextureID == 0) {
   30.36          if (!OGLContext_InitBlitTileTexture(oglc)) {
   30.37 @@ -279,6 +297,10 @@
   30.38          j2d_glPixelTransferf(GL_ALPHA_BIAS, 1.0f);
   30.39      }
   30.40  
   30.41 +    // in case pixel stride is not a multiple of scanline stride the copy
   30.42 +    // has to be done line by line (see 6207877)
   30.43 +    slowPath = srcInfo->scanStride % srcInfo->pixelStride != 0;
   30.44 +
   30.45      for (sy = sy1, dy = dy1; sy < sy2; sy += th, dy += cdh) {
   30.46          sh = ((sy + th) > sy2) ? (sy2 - sy) : th;
   30.47          dh = ((dy + cdh) > dy2) ? (dy2 - dy) : cdh;
   30.48 @@ -291,13 +313,29 @@
   30.49              ty2 = ((GLdouble)sh) / th;
   30.50  
   30.51              if (swsurface) {
   30.52 -                j2d_glPixelStorei(GL_UNPACK_SKIP_PIXELS, sx);
   30.53 -                j2d_glPixelStorei(GL_UNPACK_SKIP_ROWS, sy);
   30.54 +                if (slowPath) {
   30.55 +                    jint tmph = sh;
   30.56 +                    GLvoid *pSrc = PtrCoord(srcInfo->rasBase,
   30.57 +                                            sx, srcInfo->pixelStride,
   30.58 +                                            sy, srcInfo->scanStride);
   30.59  
   30.60 -                j2d_glTexSubImage2D(GL_TEXTURE_2D, 0,
   30.61 -                                    0, 0, sw, sh,
   30.62 -                                    pf->format, pf->type,
   30.63 -                                    srcInfo->rasBase);
   30.64 +                    while (tmph > 0) {
   30.65 +                        j2d_glTexSubImage2D(GL_TEXTURE_2D, 0,
   30.66 +                                            0, sh - tmph, sw, 1,
   30.67 +                                            pf->format, pf->type,
   30.68 +                                            pSrc);
   30.69 +                        pSrc = PtrAddBytes(pSrc, srcInfo->scanStride);
   30.70 +                        tmph--;
   30.71 +                    }
   30.72 +                } else {
   30.73 +                    j2d_glPixelStorei(GL_UNPACK_SKIP_PIXELS, sx);
   30.74 +                    j2d_glPixelStorei(GL_UNPACK_SKIP_ROWS, sy);
   30.75 +
   30.76 +                    j2d_glTexSubImage2D(GL_TEXTURE_2D, 0,
   30.77 +                                        0, 0, sw, sh,
   30.78 +                                        pf->format, pf->type,
   30.79 +                                        srcInfo->rasBase);
   30.80 +                }
   30.81  
   30.82                  // the texture image is "right side up", so we align the
   30.83                  // upper-left texture corner with the upper-left quad corner
   30.84 @@ -356,9 +394,25 @@
   30.85                     jint dx1, jint dy1, jint dx2, jint dy2)
   30.86  {
   30.87      j2d_glBindTexture(dstOps->textureTarget, dstOps->textureID);
   30.88 -    j2d_glTexSubImage2D(dstOps->textureTarget, 0,
   30.89 -                        dx1, dy1, dx2-dx1, dy2-dy1,
   30.90 -                        pf->format, pf->type, srcInfo->rasBase);
   30.91 +    // in case pixel stride is not a multiple of scanline stride the copy
   30.92 +    // has to be done line by line (see 6207877)
   30.93 +    if (srcInfo->scanStride % srcInfo->pixelStride != 0) {
   30.94 +        jint width = dx2 - dx1;
   30.95 +        jint height = dy2 - dy1;
   30.96 +        GLvoid *pSrc = srcInfo->rasBase;
   30.97 +
   30.98 +        while (height > 0) {
   30.99 +            j2d_glTexSubImage2D(dstOps->textureTarget, 0,
  30.100 +                                dx1, dy2 - height, width, 1,
  30.101 +                                pf->format, pf->type, pSrc);
  30.102 +            pSrc = PtrAddBytes(pSrc, srcInfo->scanStride);
  30.103 +            height--;
  30.104 +        }
  30.105 +    } else {
  30.106 +        j2d_glTexSubImage2D(dstOps->textureTarget, 0,
  30.107 +                            dx1, dy1, dx2-dx1, dy2-dy1,
  30.108 +                            pf->format, pf->type, srcInfo->rasBase);
  30.109 +    }
  30.110  }
  30.111  
  30.112  /**
    31.1 --- a/src/share/native/sun/java2d/opengl/OGLSurfaceData.c	Fri Dec 19 10:37:50 2008 -0800
    31.2 +++ b/src/share/native/sun/java2d/opengl/OGLSurfaceData.c	Tue Jan 06 16:24:03 2009 -0800
    31.3 @@ -73,7 +73,8 @@
    31.4        1, 0, 1,                                     }, /* 9 - ByteGray     */
    31.5      { GL_LUMINANCE, GL_UNSIGNED_SHORT,
    31.6        2, 0, 1,                                     }, /*10 - UshortGray   */
    31.7 -};
    31.8 +    { GL_BGR,  GL_UNSIGNED_BYTE,
    31.9 +      1, 0, 1,                                     }, /*11 - ThreeByteBgr */};
   31.10  
   31.11  /**
   31.12   * Given a starting value and a maximum limit, returns the first power-of-two
    32.1 --- a/src/solaris/classes/sun/awt/X11GraphicsEnvironment.java	Fri Dec 19 10:37:50 2008 -0800
    32.2 +++ b/src/solaris/classes/sun/awt/X11GraphicsEnvironment.java	Tue Jan 06 16:24:03 2009 -0800
    32.3 @@ -209,7 +209,7 @@
    32.4      private static native int checkShmExt();
    32.5  
    32.6      private static  native String getDisplayString();
    32.7 -    private static Boolean isDisplayLocal;
    32.8 +    private Boolean isDisplayLocal;
    32.9  
   32.10      /**
   32.11       * This should only be called from the static initializer, so no need for
   32.12 @@ -234,7 +234,8 @@
   32.13          return getScreenDevices()[getDefaultScreenNum()];
   32.14      }
   32.15  
   32.16 -    public static boolean isDisplayLocal() {
   32.17 +    @Override
   32.18 +    public boolean isDisplayLocal() {
   32.19          if (isDisplayLocal == null) {
   32.20              SunToolkit.awtLock();
   32.21              try {
    33.1 --- a/src/solaris/classes/sun/java2d/opengl/GLXGraphicsConfig.java	Fri Dec 19 10:37:50 2008 -0800
    33.2 +++ b/src/solaris/classes/sun/java2d/opengl/GLXGraphicsConfig.java	Tue Jan 06 16:24:03 2009 -0800
    33.3 @@ -120,12 +120,14 @@
    33.4                  new GLXGetConfigInfo(device.getScreen(), visualnum);
    33.5              rq.flushAndInvokeNow(action);
    33.6              cfginfo = action.getConfigInfo();
    33.7 -            OGLContext.setScratchSurface(cfginfo);
    33.8 -            rq.flushAndInvokeNow(new Runnable() {
    33.9 -                public void run() {
   33.10 -                    ids[0] = OGLContext.getOGLIdString();
   33.11 -                }
   33.12 -            });
   33.13 +            if (cfginfo != 0L) {
   33.14 +                OGLContext.setScratchSurface(cfginfo);
   33.15 +                rq.flushAndInvokeNow(new Runnable() {
   33.16 +                    public void run() {
   33.17 +                        ids[0] = OGLContext.getOGLIdString();
   33.18 +                    }
   33.19 +                });
   33.20 +            }
   33.21          } finally {
   33.22              rq.unlock();
   33.23          }
    34.1 --- a/src/solaris/classes/sun/java2d/x11/X11SurfaceData.java	Fri Dec 19 10:37:50 2008 -0800
    34.2 +++ b/src/solaris/classes/sun/java2d/x11/X11SurfaceData.java	Tue Jan 06 16:24:03 2009 -0800
    34.3 @@ -50,6 +50,7 @@
    34.4  import sun.font.X11TextRenderer;
    34.5  import sun.java2d.InvalidPipeException;
    34.6  import sun.java2d.SunGraphics2D;
    34.7 +import sun.java2d.SunGraphicsEnvironment;
    34.8  import sun.java2d.SurfaceData;
    34.9  import sun.java2d.SurfaceDataProxy;
   34.10  import sun.java2d.loops.SurfaceType;
   34.11 @@ -240,6 +241,11 @@
   34.12       */
   34.13      public static native boolean isDgaAvailable();
   34.14  
   34.15 +    /**
   34.16 +     * Returns true if shared memory pixmaps are available
   34.17 +     */
   34.18 +    private static native boolean isShmPMAvailable();
   34.19 +
   34.20      public static boolean isAccelerationEnabled() {
   34.21          if (accelerationEnabled == null) {
   34.22  
   34.23 @@ -253,8 +259,17 @@
   34.24                      // true iff prop==true, false otherwise
   34.25                      accelerationEnabled = Boolean.valueOf(prop);
   34.26                  } else {
   34.27 -                    // use pixmaps if there is no dga, no matter local or remote
   34.28 -                    accelerationEnabled = Boolean.valueOf(!isDgaAvailable());
   34.29 +                    boolean isDisplayLocal = false;
   34.30 +                    GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
   34.31 +                    if (ge instanceof SunGraphicsEnvironment) {
   34.32 +                        isDisplayLocal = ((SunGraphicsEnvironment) ge).isDisplayLocal();
   34.33 +                     }
   34.34 +
   34.35 +                    // EXA based drivers tend to place pixmaps in VRAM, slowing down readbacks.
   34.36 +                    // Don't use pixmaps if dga is available,
   34.37 +                    // or we are local and shared memory Pixmaps are not available.
   34.38 +                    accelerationEnabled =
   34.39 +                        !(isDgaAvailable() || (isDisplayLocal && !isShmPMAvailable()));
   34.40                  }
   34.41              }
   34.42          }
    35.1 --- a/src/solaris/classes/sun/print/CUPSPrinter.java	Fri Dec 19 10:37:50 2008 -0800
    35.2 +++ b/src/solaris/classes/sun/print/CUPSPrinter.java	Tue Jan 06 16:24:03 2009 -0800
    35.3 @@ -46,9 +46,9 @@
    35.4  
    35.5  
    35.6  public class CUPSPrinter  {
    35.7 -
    35.8 +    private static final String debugPrefix = "CUPSPrinter>> ";
    35.9      private static final double PRINTER_DPI = 72.0;
   35.10 -    private static boolean initialized;
   35.11 +    private boolean initialized;
   35.12      private static native String getCupsServer();
   35.13      private static native int getCupsPort();
   35.14      private static native boolean canConnect(String server, int port);
   35.15 @@ -156,7 +156,7 @@
   35.16      /**
   35.17       * Initialize media by translating PPD info to PrintService attributes.
   35.18       */
   35.19 -    private void initMedia() {
   35.20 +    private synchronized void initMedia() {
   35.21          if (initialized) {
   35.22              return;
   35.23          } else {
   35.24 @@ -392,9 +392,9 @@
   35.25       * Detects if CUPS is running.
   35.26       */
   35.27      public static boolean isCupsRunning() {
   35.28 -        IPPPrintService.debug_println("libFound "+libFound);
   35.29 +        IPPPrintService.debug_println(debugPrefix+"libFound "+libFound);
   35.30          if (libFound) {
   35.31 -            IPPPrintService.debug_println("CUPS server "+getServer()+
   35.32 +            IPPPrintService.debug_println(debugPrefix+"CUPS server "+getServer()+
   35.33                                            " port "+getPort());
   35.34              return canConnect(getServer(), getPort());
   35.35          } else {
    36.1 --- a/src/solaris/classes/sun/print/IPPPrintService.java	Fri Dec 19 10:37:50 2008 -0800
    36.2 +++ b/src/solaris/classes/sun/print/IPPPrintService.java	Tue Jan 06 16:24:03 2009 -0800
    36.3 @@ -1,5 +1,5 @@
    36.4  /*
    36.5 - * Copyright 2003-2008 Sun Microsystems, Inc.  All Rights Reserved.
    36.6 + * Copyright 2003-2007 Sun Microsystems, Inc.  All Rights Reserved.
    36.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    36.8   *
    36.9   * This code is free software; you can redistribute it and/or modify it
   36.10 @@ -57,18 +57,28 @@
   36.11  import java.nio.charset.Charset;
   36.12  
   36.13  import java.util.Iterator;
   36.14 +import java.util.HashSet;
   36.15  
   36.16  
   36.17  public class IPPPrintService implements PrintService, SunPrinterJobService {
   36.18  
   36.19 -    public static boolean debugPrint = false;
   36.20 -    private static String debugPrefix = "IPPPrintService>> ";
   36.21 +    public static final boolean debugPrint;
   36.22 +    private static final String debugPrefix = "IPPPrintService>> ";
   36.23      protected static void debug_println(String str) {
   36.24          if (debugPrint) {
   36.25              System.out.println(str);
   36.26          }
   36.27      }
   36.28  
   36.29 +    private static final String FORCE_PIPE_PROP = "sun.print.ippdebug";
   36.30 +
   36.31 +    static {
   36.32 +        String debugStr =
   36.33 +                (String)java.security.AccessController.doPrivileged(
   36.34 +                  new sun.security.action.GetPropertyAction(FORCE_PIPE_PROP));
   36.35 +
   36.36 +        debugPrint = "true".equalsIgnoreCase(debugStr);
   36.37 +    }
   36.38  
   36.39      private String printer;
   36.40      private URI    myURI;
   36.41 @@ -382,7 +392,7 @@
   36.42              if ((urlConnection = getIPPConnection(myURL)) == null) {
   36.43                  mediaSizeNames = new MediaSizeName[0];
   36.44                  mediaTrays = new MediaTray[0];
   36.45 -                debug_println("NULL urlConnection ");
   36.46 +                debug_println(debugPrefix+"initAttributes, NULL urlConnection ");
   36.47                  init = true;
   36.48                  return;
   36.49              }
   36.50 @@ -407,7 +417,7 @@
   36.51                      return;
   36.52                  } catch (Exception e) {
   36.53                      IPPPrintService.debug_println(debugPrefix+
   36.54 -                                       " error creating CUPSPrinter e="+e);
   36.55 +                                       "initAttributes, error creating CUPSPrinter e="+e);
   36.56                  }
   36.57              }
   36.58  
   36.59 @@ -486,28 +496,26 @@
   36.60          /* Test if the flavor is compatible with the category */
   36.61          if ((category == Copies.class) ||
   36.62              (category == CopiesSupported.class)) {
   36.63 -            CopiesSupported cs = new CopiesSupported(1, MAXCOPIES);
   36.64 -            AttributeClass attribClass = (getAttMap != null) ?
   36.65 -                (AttributeClass)getAttMap.get(cs.getName()) : null;
   36.66 -            if (attribClass != null) {
   36.67 -                int[] range = attribClass.getIntRangeValue();
   36.68 -                cs = new CopiesSupported(range[0], range[1]);
   36.69 +            if (flavor == null ||
   36.70 +                !(flavor.equals(DocFlavor.INPUT_STREAM.POSTSCRIPT) ||
   36.71 +                  flavor.equals(DocFlavor.URL.POSTSCRIPT) ||
   36.72 +                  flavor.equals(DocFlavor.BYTE_ARRAY.POSTSCRIPT))) {
   36.73 +                CopiesSupported cs = new CopiesSupported(1, MAXCOPIES);
   36.74 +                AttributeClass attribClass = (getAttMap != null) ?
   36.75 +                    (AttributeClass)getAttMap.get(cs.getName()) : null;
   36.76 +                if (attribClass != null) {
   36.77 +                    int[] range = attribClass.getIntRangeValue();
   36.78 +                    cs = new CopiesSupported(range[0], range[1]);
   36.79 +                }
   36.80 +                return cs;
   36.81 +            } else {
   36.82 +                return null;
   36.83              }
   36.84 -            return cs;
   36.85          } else  if (category == Chromaticity.class) {
   36.86              if (flavor == null ||
   36.87                  flavor.equals(DocFlavor.SERVICE_FORMATTED.PAGEABLE) ||
   36.88                  flavor.equals(DocFlavor.SERVICE_FORMATTED.PRINTABLE) ||
   36.89 -                flavor.equals(DocFlavor.BYTE_ARRAY.GIF) ||
   36.90 -                flavor.equals(DocFlavor.INPUT_STREAM.GIF) ||
   36.91 -                flavor.equals(DocFlavor.URL.GIF) ||
   36.92 -                flavor.equals(DocFlavor.BYTE_ARRAY.JPEG) ||
   36.93 -                flavor.equals(DocFlavor.INPUT_STREAM.JPEG) ||
   36.94 -                flavor.equals(DocFlavor.URL.JPEG) ||
   36.95 -                flavor.equals(DocFlavor.BYTE_ARRAY.PNG) ||
   36.96 -                flavor.equals(DocFlavor.INPUT_STREAM.PNG) ||
   36.97 -                flavor.equals(DocFlavor.URL.PNG)) {
   36.98 -
   36.99 +                !isIPPSupportedImages(flavor.getMimeType())) {
  36.100                  Chromaticity[]arr = new Chromaticity[1];
  36.101                  arr[0] = Chromaticity.COLOR;
  36.102                  return (arr);
  36.103 @@ -822,7 +830,7 @@
  36.104                  boolean psSupported = false;
  36.105                  String[] docFlavors = attribClass.getArrayOfStringValues();
  36.106                  DocFlavor[] flavors;
  36.107 -                ArrayList docList = new ArrayList();
  36.108 +                HashSet docList = new HashSet();
  36.109                  int j;
  36.110                  String hostEnc = DocFlavor.hostEncoding.
  36.111                      toLowerCase(Locale.ENGLISH);
  36.112 @@ -839,18 +847,6 @@
  36.113  
  36.114                              docList.addAll(Arrays.asList(flavors));
  36.115  
  36.116 -                            if (isCupsPrinter) {
  36.117 -                            /*
  36.118 -                              Always add Pageable and Printable for CUPS
  36.119 -                              since it uses Filters to convert from Postscript
  36.120 -                              to device printer language.
  36.121 -                             */
  36.122 -                                docList.add(
  36.123 -                                        DocFlavor.SERVICE_FORMATTED.PAGEABLE);
  36.124 -                                docList.add(
  36.125 -                                        DocFlavor.SERVICE_FORMATTED.PRINTABLE);
  36.126 -                            }
  36.127 -
  36.128                              if (mimeType.equals("text/plain") &&
  36.129                                  addHostEncoding) {
  36.130                                  docList.add(Arrays.asList(textPlainHost));
  36.131 @@ -880,16 +876,19 @@
  36.132                  }
  36.133  
  36.134                  // check if we need to add image DocFlavors
  36.135 +                // and Pageable/Printable flavors
  36.136                  if (psSupported || isCupsPrinter) {
  36.137 -                    if (!jpgImagesAdded) {
  36.138 -                        docList.addAll(Arrays.asList(imageJPG));
  36.139 -                    }
  36.140 -                    if (!pngImagesAdded) {
  36.141 -                        docList.addAll(Arrays.asList(imagePNG));
  36.142 -                    }
  36.143 -                    if (!gifImagesAdded) {
  36.144 -                        docList.addAll(Arrays.asList(imageGIF));
  36.145 -                    }
  36.146 +                    /*
  36.147 +                     Always add Pageable and Printable for CUPS
  36.148 +                     since it uses Filters to convert from Postscript
  36.149 +                     to device printer language.
  36.150 +                    */
  36.151 +                    docList.add(DocFlavor.SERVICE_FORMATTED.PAGEABLE);
  36.152 +                    docList.add(DocFlavor.SERVICE_FORMATTED.PRINTABLE);
  36.153 +
  36.154 +                    docList.addAll(Arrays.asList(imageJPG));
  36.155 +                    docList.addAll(Arrays.asList(imagePNG));
  36.156 +                    docList.addAll(Arrays.asList(imageGIF));
  36.157                  }
  36.158                  supportedDocFlavors = new DocFlavor[docList.size()];
  36.159                  docList.toArray(supportedDocFlavors);
  36.160 @@ -922,6 +921,9 @@
  36.161       * Finds matching CustomMediaSizeName of given media.
  36.162       */
  36.163      public CustomMediaSizeName findCustomMedia(MediaSizeName media) {
  36.164 +        if (customMediaSizeNames == null) {
  36.165 +            return null;
  36.166 +        }
  36.167          for (int i=0; i< customMediaSizeNames.length; i++) {
  36.168              CustomMediaSizeName custom =
  36.169                  (CustomMediaSizeName)customMediaSizeNames[i];
  36.170 @@ -1203,7 +1205,7 @@
  36.171              return true;
  36.172          }
  36.173          for (int i=0; i<mediaSizeNames.length; i++) {
  36.174 -            debug_println("mediaSizeNames[i] "+mediaSizeNames[i]);
  36.175 +            debug_println(debugPrefix+"isSupportedMedia, mediaSizeNames[i] "+mediaSizeNames[i]);
  36.176              if (msn.equals(mediaSizeNames[i])) {
  36.177                  return true;
  36.178              }
  36.179 @@ -1228,7 +1230,7 @@
  36.180      }
  36.181  
  36.182  
  36.183 -   public boolean isAttributeValueSupported(Attribute attr,
  36.184 +    public boolean isAttributeValueSupported(Attribute attr,
  36.185                                               DocFlavor flavor,
  36.186                                               AttributeSet attributes) {
  36.187          if (attr == null) {
  36.188 @@ -1257,21 +1259,18 @@
  36.189              if ((flavor == null) ||
  36.190                  flavor.equals(DocFlavor.SERVICE_FORMATTED.PAGEABLE) ||
  36.191                  flavor.equals(DocFlavor.SERVICE_FORMATTED.PRINTABLE) ||
  36.192 -                flavor.equals(DocFlavor.BYTE_ARRAY.GIF) ||
  36.193 -                flavor.equals(DocFlavor.INPUT_STREAM.GIF) ||
  36.194 -                flavor.equals(DocFlavor.URL.GIF) ||
  36.195 -                flavor.equals(DocFlavor.BYTE_ARRAY.JPEG) ||
  36.196 -                flavor.equals(DocFlavor.INPUT_STREAM.JPEG) ||
  36.197 -                flavor.equals(DocFlavor.URL.JPEG) ||
  36.198 -                flavor.equals(DocFlavor.BYTE_ARRAY.PNG) ||
  36.199 -                flavor.equals(DocFlavor.INPUT_STREAM.PNG) ||
  36.200 -                flavor.equals(DocFlavor.URL.PNG)) {
  36.201 +                !isIPPSupportedImages(flavor.getMimeType())) {
  36.202                  return attr == Chromaticity.COLOR;
  36.203              } else {
  36.204                  return false;
  36.205              }
  36.206          } else if (attr.getCategory() == Copies.class) {
  36.207 -            return isSupportedCopies((Copies)attr);
  36.208 +            return (flavor == null ||
  36.209 +                   !(flavor.equals(DocFlavor.INPUT_STREAM.POSTSCRIPT) ||
  36.210 +                   flavor.equals(DocFlavor.URL.POSTSCRIPT) ||
  36.211 +                   flavor.equals(DocFlavor.BYTE_ARRAY.POSTSCRIPT))) &&
  36.212 +                isSupportedCopies((Copies)attr);
  36.213 +
  36.214          } else if (attr.getCategory() == Destination.class) {
  36.215              if (flavor == null ||
  36.216                  flavor.equals(DocFlavor.SERVICE_FORMATTED.PAGEABLE) ||
  36.217 @@ -1667,9 +1666,10 @@
  36.218          try {
  36.219              osw = new OutputStreamWriter(os, "UTF-8");
  36.220          } catch (java.io.UnsupportedEncodingException exc) {
  36.221 -            debug_println("UTF-8 not supported? Exception: "+exc);
  36.222 +            debug_println(debugPrefix+"writeIPPRequest, UTF-8 not supported? Exception: "+exc);
  36.223              return false;
  36.224          }
  36.225 +        debug_println(debugPrefix+"writeIPPRequest, op code= "+operCode);
  36.226          char[] opCode =  new char[2];
  36.227          opCode[0] =  (char)Byte.parseByte(operCode.substring(0,2), 16);
  36.228          opCode[1] =  (char)Byte.parseByte(operCode.substring(2,4), 16);
  36.229 @@ -1710,7 +1710,7 @@
  36.230              osw.flush();
  36.231              osw.close();
  36.232          } catch (java.io.IOException ioe) {
  36.233 -            debug_println(debugPrefix+"IPPPrintService Exception in writeIPPRequest: "+ioe);
  36.234 +            debug_println(debugPrefix+"writeIPPRequest, IPPPrintService Exception in writeIPPRequest: "+ioe);
  36.235              return false;
  36.236          }
  36.237          return true;
  36.238 @@ -1747,7 +1747,7 @@
  36.239                  while ((response[0] >= GRPTAG_OP_ATTRIBUTES) &&
  36.240                         (response[0] <= GRPTAG_PRINTER_ATTRIBUTES)
  36.241                            && (response[0] != GRPTAG_END_ATTRIBUTES)) {
  36.242 -                    debug_println(debugPrefix+"checking group tag,  response[0]= "+
  36.243 +                    debug_println(debugPrefix+"readIPPResponse, checking group tag,  response[0]= "+
  36.244                                    response[0]);
  36.245  
  36.246                      outObj = new ByteArrayOutputStream();
  36.247 @@ -1786,6 +1786,7 @@
  36.248                                                         outArray);
  36.249  
  36.250                                  responseMap.put(ac.getName(), ac);
  36.251 +                                debug_println(debugPrefix+ "readIPPResponse "+ac);
  36.252                              }
  36.253  
  36.254                              outObj = new ByteArrayOutputStream();
  36.255 @@ -1858,6 +1859,9 @@
  36.256  
  36.257          } catch (java.io.IOException e) {
  36.258              debug_println(debugPrefix+"readIPPResponse: "+e);
  36.259 +            if (debugPrint) {
  36.260 +                e.printStackTrace();
  36.261 +            }
  36.262              return null;
  36.263          }
  36.264      }
  36.265 @@ -1872,4 +1876,8 @@
  36.266                   (obj instanceof IPPPrintService &&
  36.267                    ((IPPPrintService)obj).getName().equals(getName())));
  36.268      }
  36.269 +
  36.270 +    public int hashCode() {
  36.271 +        return this.getClass().hashCode()+getName().hashCode();
  36.272 +    }
  36.273  }
    37.1 --- a/src/solaris/classes/sun/print/UnixPrintService.java	Fri Dec 19 10:37:50 2008 -0800
    37.2 +++ b/src/solaris/classes/sun/print/UnixPrintService.java	Tue Jan 06 16:24:03 2009 -0800
    37.3 @@ -686,19 +686,7 @@
    37.4          }
    37.5  
    37.6          if (category == Chromaticity.class) {
    37.7 -            if (flavor == null ||
    37.8 -                flavor.equals(DocFlavor.SERVICE_FORMATTED.PAGEABLE) ||
    37.9 -                flavor.equals(DocFlavor.SERVICE_FORMATTED.PRINTABLE) ||
   37.10 -                flavor.equals(DocFlavor.BYTE_ARRAY.GIF) ||
   37.11 -                flavor.equals(DocFlavor.INPUT_STREAM.GIF) ||
   37.12 -                flavor.equals(DocFlavor.URL.GIF) ||
   37.13 -                flavor.equals(DocFlavor.BYTE_ARRAY.JPEG) ||
   37.14 -                flavor.equals(DocFlavor.INPUT_STREAM.JPEG) ||
   37.15 -                flavor.equals(DocFlavor.URL.JPEG) ||
   37.16 -                flavor.equals(DocFlavor.BYTE_ARRAY.PNG) ||
   37.17 -                flavor.equals(DocFlavor.INPUT_STREAM.PNG) ||
   37.18 -                flavor.equals(DocFlavor.URL.PNG)) {
   37.19 -
   37.20 +            if (flavor == null || isServiceFormattedFlavor(flavor)) {
   37.21                  Chromaticity[]arr = new Chromaticity[1];
   37.22                  arr[0] = Chromaticity.COLOR;
   37.23                  return (arr);
   37.24 @@ -730,18 +718,7 @@
   37.25              }
   37.26              return new RequestingUserName(userName, null);
   37.27          } else if (category == OrientationRequested.class) {
   37.28 -            if (flavor == null ||
   37.29 -                flavor.equals(DocFlavor.SERVICE_FORMATTED.PAGEABLE) ||
   37.30 -                flavor.equals(DocFlavor.SERVICE_FORMATTED.PRINTABLE) ||
   37.31 -                flavor.equals(DocFlavor.INPUT_STREAM.GIF) ||
   37.32 -                flavor.equals(DocFlavor.INPUT_STREAM.JPEG) ||
   37.33 -                flavor.equals(DocFlavor.INPUT_STREAM.PNG) ||
   37.34 -                flavor.equals(DocFlavor.BYTE_ARRAY.GIF) ||
   37.35 -                flavor.equals(DocFlavor.BYTE_ARRAY.JPEG) ||
   37.36 -                flavor.equals(DocFlavor.BYTE_ARRAY.PNG) ||
   37.37 -                flavor.equals(DocFlavor.URL.GIF) ||
   37.38 -                flavor.equals(DocFlavor.URL.JPEG) ||
   37.39 -                flavor.equals(DocFlavor.URL.PNG)) {
   37.40 +            if (flavor == null || isServiceFormattedFlavor(flavor)) {
   37.41                  OrientationRequested []arr = new OrientationRequested[3];
   37.42                  arr[0] = OrientationRequested.PORTRAIT;
   37.43                  arr[1] = OrientationRequested.LANDSCAPE;
   37.44 @@ -752,7 +729,14 @@
   37.45              }
   37.46          } else if ((category == Copies.class) ||
   37.47                     (category == CopiesSupported.class)) {
   37.48 -            return new CopiesSupported(1, MAXCOPIES);
   37.49 +            if (flavor == null ||
   37.50 +                !(flavor.equals(DocFlavor.INPUT_STREAM.POSTSCRIPT) ||
   37.51 +                  flavor.equals(DocFlavor.URL.POSTSCRIPT) ||
   37.52 +                  flavor.equals(DocFlavor.BYTE_ARRAY.POSTSCRIPT))) {
   37.53 +                return new CopiesSupported(1, MAXCOPIES);
   37.54 +            } else {
   37.55 +                return null;
   37.56 +            }
   37.57          } else if (category == Media.class) {
   37.58              Media []arr = new Media[mediaSizes.length];
   37.59              System.arraycopy(mediaSizes, 0, arr, 0, mediaSizes.length);
   37.60 @@ -917,8 +901,10 @@
   37.61              }
   37.62          }
   37.63          else if (attr.getCategory() == Copies.class) {
   37.64 -            return
   37.65 -                (flavor == null || isServiceFormattedFlavor(flavor)) &&
   37.66 +            return (flavor == null ||
   37.67 +                   !(flavor.equals(DocFlavor.INPUT_STREAM.POSTSCRIPT) ||
   37.68 +                     flavor.equals(DocFlavor.URL.POSTSCRIPT) ||
   37.69 +                     flavor.equals(DocFlavor.BYTE_ARRAY.POSTSCRIPT))) &&
   37.70                  isSupportedCopies((Copies)attr);
   37.71          } else if (attr.getCategory() == Destination.class) {
   37.72              URI uri = ((Destination)attr).getURI();
    38.1 --- a/src/solaris/native/sun/awt/fontpath.c	Fri Dec 19 10:37:50 2008 -0800
    38.2 +++ b/src/solaris/native/sun/awt/fontpath.c	Tue Jan 06 16:24:03 2009 -0800
    38.3 @@ -156,7 +156,7 @@
    38.4  
    38.5      isLocal = JNU_CallStaticMethodByName(env, NULL,
    38.6                                           "sun/awt/X11GraphicsEnvironment",
    38.7 -                                         "isDisplayLocal",
    38.8 +                                         "_isDisplayLocal",
    38.9                                           "()Z").z;
   38.10      isLocalSet = True;
   38.11      return isLocal;
   38.12 @@ -1233,7 +1233,7 @@
   38.13          for (j=0; j<nfonts; j++) {
   38.14              FcPattern *fontPattern = fontset->fonts[j];
   38.15              FcChar8 *fontformat;
   38.16 -            FcCharSet *unionCharset, *charset;
   38.17 +            FcCharSet *unionCharset = NULL, *charset;
   38.18  
   38.19              fontformat = NULL;
   38.20              (*FcPatternGetString)(fontPattern, FC_FONTFORMAT, 0, &fontformat);
   38.21 @@ -1256,7 +1256,7 @@
   38.22              if (nfonts==10) {
   38.23                  minGlyphs = 50;
   38.24              }
   38.25 -            if (j == 0) {
   38.26 +            if (unionCharset == NULL) {
   38.27                  unionCharset = charset;
   38.28              } else {
   38.29                  if ((*FcCharSetSubtractCount)(charset, unionCharset)
    39.1 --- a/src/solaris/native/sun/java2d/x11/X11SurfaceData.c	Fri Dec 19 10:37:50 2008 -0800
    39.2 +++ b/src/solaris/native/sun/java2d/x11/X11SurfaceData.c	Tue Jan 06 16:24:03 2009 -0800
    39.3 @@ -208,6 +208,23 @@
    39.4  #endif /* HEADLESS */
    39.5  }
    39.6  
    39.7 +
    39.8 +/*
    39.9 + * Class:     sun_java2d_x11_X11SurfaceData
   39.10 + * Method:    isShmPMAvailable
   39.11 + * Signature: ()Z
   39.12 + */
   39.13 +JNIEXPORT jboolean JNICALL
   39.14 +Java_sun_java2d_x11_X11SurfaceData_isShmPMAvailable(JNIEnv *env, jobject this)
   39.15 +{
   39.16 +#if defined(HEADLESS) || !defined(MITSHM)
   39.17 +    return JNI_FALSE;
   39.18 +#else
   39.19 +    return useMitShmPixmaps;
   39.20 +#endif /* HEADLESS, MITSHM */
   39.21 +}
   39.22 +
   39.23 +
   39.24  /*
   39.25   * Class:     sun_java2d_x11_X11SurfaceData
   39.26   * Method:    initOps
    40.1 --- a/src/windows/classes/sun/awt/Win32GraphicsEnvironment.java	Fri Dec 19 10:37:50 2008 -0800
    40.2 +++ b/src/windows/classes/sun/awt/Win32GraphicsEnvironment.java	Tue Jan 06 16:24:03 2009 -0800
    40.3 @@ -393,4 +393,9 @@
    40.4      private static void dwmCompositionChanged(boolean enabled) {
    40.5          isDWMCompositionEnabled = enabled;
    40.6      }
    40.7 +
    40.8 +    @Override
    40.9 +    public boolean isDisplayLocal() {
   40.10 +        return true;
   40.11 +    }
   40.12  }
    41.1 --- a/src/windows/classes/sun/java2d/d3d/D3DBlitLoops.java	Fri Dec 19 10:37:50 2008 -0800
    41.2 +++ b/src/windows/classes/sun/java2d/d3d/D3DBlitLoops.java	Tue Jan 06 16:24:03 2009 -0800
    41.3 @@ -85,6 +85,8 @@
    41.4                                     D3DSurfaceData.ST_INT_RGB),
    41.5              new D3DSwToSurfaceBlit(SurfaceType.IntBgr,
    41.6                                     D3DSurfaceData.ST_INT_BGR),
    41.7 +            new D3DSwToSurfaceBlit(SurfaceType.ThreeByteBgr,
    41.8 +                                   D3DSurfaceData.ST_3BYTE_BGR),
    41.9              new D3DSwToSurfaceBlit(SurfaceType.Ushort565Rgb,
   41.10                                     D3DSurfaceData.ST_USHORT_565_RGB),
   41.11              new D3DSwToSurfaceBlit(SurfaceType.Ushort555Rgb,
   41.12 @@ -106,6 +108,8 @@
   41.13                                      D3DSurfaceData.ST_INT_RGB),
   41.14              new D3DSwToSurfaceScale(SurfaceType.IntBgr,
   41.15                                      D3DSurfaceData.ST_INT_BGR),
   41.16 +            new D3DSwToSurfaceScale(SurfaceType.ThreeByteBgr,
   41.17 +                                    D3DSurfaceData.ST_3BYTE_BGR),
   41.18              new D3DSwToSurfaceScale(SurfaceType.Ushort565Rgb,
   41.19                                      D3DSurfaceData.ST_USHORT_565_RGB),
   41.20              new D3DSwToSurfaceScale(SurfaceType.Ushort555Rgb,
   41.21 @@ -124,6 +128,8 @@
   41.22                                          D3DSurfaceData.ST_INT_RGB),
   41.23              new D3DSwToSurfaceTransform(SurfaceType.IntBgr,
   41.24                                          D3DSurfaceData.ST_INT_BGR),
   41.25 +            new D3DSwToSurfaceTransform(SurfaceType.ThreeByteBgr,
   41.26 +                                        D3DSurfaceData.ST_3BYTE_BGR),
   41.27              new D3DSwToSurfaceTransform(SurfaceType.Ushort565Rgb,
   41.28                                          D3DSurfaceData.ST_USHORT_565_RGB),
   41.29              new D3DSwToSurfaceTransform(SurfaceType.Ushort555Rgb,
   41.30 @@ -147,6 +153,8 @@
   41.31                                     D3DSurfaceData.ST_INT_ARGB),
   41.32              new D3DSwToTextureBlit(SurfaceType.IntBgr,
   41.33                                     D3DSurfaceData.ST_INT_BGR),
   41.34 +            new D3DSwToTextureBlit(SurfaceType.ThreeByteBgr,
   41.35 +                                   D3DSurfaceData.ST_3BYTE_BGR),
   41.36              new D3DSwToTextureBlit(SurfaceType.Ushort565Rgb,
   41.37                                     D3DSurfaceData.ST_USHORT_565_RGB),
   41.38              new D3DSwToTextureBlit(SurfaceType.Ushort555Rgb,
    42.1 --- a/src/windows/classes/sun/java2d/d3d/D3DSurfaceData.java	Fri Dec 19 10:37:50 2008 -0800
    42.2 +++ b/src/windows/classes/sun/java2d/d3d/D3DSurfaceData.java	Tue Jan 06 16:24:03 2009 -0800
    42.3 @@ -135,6 +135,7 @@
    42.4      public static final int ST_USHORT_555_RGB  = 6;
    42.5      public static final int ST_BYTE_INDEXED    = 7;
    42.6      public static final int ST_BYTE_INDEXED_BM = 8;
    42.7 +    public static final int ST_3BYTE_BGR       = 9;
    42.8  
    42.9      /** Equals to D3DSWAPEFFECT_DISCARD */
   42.10      public static final int SWAP_DISCARD       = 1;
   42.11 @@ -501,12 +502,14 @@
   42.12       *   - the pixel shaders are available, and
   42.13       *   - blending is disabled, and
   42.14       *   - the source color is opaque
   42.15 +     *   - and the destination is opaque
   42.16       */
   42.17      public boolean canRenderLCDText(SunGraphics2D sg2d) {
   42.18          return
   42.19              graphicsDevice.isCapPresent(CAPS_LCD_SHADER) &&
   42.20              sg2d.compositeState <= SunGraphics2D.COMP_ISCOPY &&
   42.21 -            sg2d.paintState <= SunGraphics2D.PAINT_OPAQUECOLOR;
   42.22 +            sg2d.paintState <= SunGraphics2D.PAINT_OPAQUECOLOR   &&
   42.23 +            sg2d.surfaceData.getTransparency() == Transparency.OPAQUE;
   42.24      }
   42.25  
   42.26      public void validatePipe(SunGraphics2D sg2d) {
    43.1 --- a/src/windows/classes/sun/java2d/opengl/WGLGraphicsConfig.java	Fri Dec 19 10:37:50 2008 -0800
    43.2 +++ b/src/windows/classes/sun/java2d/opengl/WGLGraphicsConfig.java	Tue Jan 06 16:24:03 2009 -0800
    43.3 @@ -127,12 +127,14 @@
    43.4                  new WGLGetConfigInfo(device.getScreen(), pixfmt);
    43.5              rq.flushAndInvokeNow(action);
    43.6              cfginfo = action.getConfigInfo();
    43.7 -            OGLContext.setScratchSurface(cfginfo);
    43.8 -            rq.flushAndInvokeNow(new Runnable() {
    43.9 -                public void run() {
   43.10 -                    ids[0] = OGLContext.getOGLIdString();
   43.11 -                }
   43.12 -            });
   43.13 +            if (cfginfo != 0L) {
   43.14 +                OGLContext.setScratchSurface(cfginfo);
   43.15 +                rq.flushAndInvokeNow(new Runnable() {
   43.16 +                    public void run() {
   43.17 +                        ids[0] = OGLContext.getOGLIdString();
   43.18 +                    }
   43.19 +                });
   43.20 +            }
   43.21          } finally {
   43.22              rq.unlock();
   43.23          }
    44.1 --- a/src/windows/native/sun/font/fontpath.c	Fri Dec 19 10:37:50 2008 -0800
    44.2 +++ b/src/windows/native/sun/font/fontpath.c	Tue Jan 06 16:24:03 2009 -0800
    44.3 @@ -153,7 +153,8 @@
    44.4      JNIEnv *env = fmi->env;
    44.5      jstring fullname, fullnameLC;
    44.6  
    44.7 -    if (FontType != TRUETYPE_FONTTYPE) {
    44.8 +    /* Both Vista and XP return DEVICE_FONTTYPE for OTF fonts */
    44.9 +    if (FontType != TRUETYPE_FONTTYPE && FontType != DEVICE_FONTTYPE) {
   44.10          return 1;
   44.11      }
   44.12  
   44.13 @@ -227,7 +228,8 @@
   44.14      JNIEnv *env = fmi->env;
   44.15      jstring fullname, fullnameLC;
   44.16  
   44.17 -    if (FontType != TRUETYPE_FONTTYPE) {
   44.18 +    /* Both Vista and XP return DEVICE_FONTTYPE for OTF fonts */
   44.19 +    if (FontType != TRUETYPE_FONTTYPE && FontType != DEVICE_FONTTYPE) {
   44.20          return 1;
   44.21      }
   44.22  
   44.23 @@ -274,7 +276,8 @@
   44.24      jstring familyLC;
   44.25      LOGFONTA lfa;
   44.26  
   44.27 -    if (FontType != TRUETYPE_FONTTYPE) {
   44.28 +    /* Both Vista and XP return DEVICE_FONTTYPE for OTF fonts */
   44.29 +    if (FontType != TRUETYPE_FONTTYPE && FontType != DEVICE_FONTTYPE) {
   44.30          return 1;
   44.31      }
   44.32  
   44.33 @@ -323,7 +326,8 @@
   44.34      int slen;
   44.35      LOGFONTW lfw;
   44.36  
   44.37 -    if (FontType != TRUETYPE_FONTTYPE) {
   44.38 +    /* Both Vista and XP return DEVICE_FONTTYPE for OTF fonts */
   44.39 +    if (FontType != TRUETYPE_FONTTYPE && FontType != DEVICE_FONTTYPE) {
   44.40          return 1;
   44.41      }
   44.42  /*     wprintf(L"FAMILY=%s charset=%d FULL=%s\n", */
   44.43 @@ -383,15 +387,16 @@
   44.44   * Also if a Font has a name for this locale that name also
   44.45   * exists in the registry using the appropriate platform encoding.
   44.46   * What do we do then?
   44.47 + *
   44.48 + * Note: OpenType fonts seems to have " (TrueType)" suffix on Vista
   44.49 + *   but " (OpenType)" on XP.
   44.50   */
   44.51  
   44.52 -/* static const wchar_t W_TTSUFFIX[] = L" (TrueType)"; */
   44.53 -/* static const char C_TTSUFFIX[] = " (TrueType)"; */
   44.54 -/* static int TTSLEN = 11;  hard-coded - be careful */
   44.55 -static BOOL RegistryToBaseTTNameA(LPCSTR name) {
   44.56 +static BOOL RegistryToBaseTTNameA(LPSTR name) {
   44.57      static const char TTSUFFIX[] = " (TrueType)";
   44.58 +    static const char OTSUFFIX[] = " (OpenType)";
   44.59      int TTSLEN = strlen(TTSUFFIX);
   44.60 -    char *match;
   44.61 +    char *suffix;
   44.62  
   44.63      int len = strlen(name);
   44.64      if (len == 0) {
   44.65 @@ -403,19 +408,21 @@
   44.66      if (len <= TTSLEN) {
   44.67          return FALSE;
   44.68      }
   44.69 -    match = strstr(name, TTSUFFIX);
   44.70 -    if ((match != NULL) && (match == name+(len-TTSLEN))) {
   44.71 -        match[0] = '\0'; /* truncate name */
   44.72 +
   44.73 +    /* suffix length is the same for truetype and opentype fonts */
   44.74 +    suffix = name + len - TTSLEN;
   44.75 +    if (strcmp(suffix, TTSUFFIX) == 0 || strcmp(suffix, OTSUFFIX) == 0) {
   44.76 +        suffix[0] = '\0'; /* truncate name */
   44.77          return TRUE;
   44.78 -    } else {
   44.79 -        return FALSE;
   44.80      }
   44.81 +    return FALSE;
   44.82  }
   44.83  
   44.84  static BOOL RegistryToBaseTTNameW(LPWSTR name) {
   44.85      static const wchar_t TTSUFFIX[] = L" (TrueType)";
   44.86 +    static const wchar_t OTSUFFIX[] = L" (OpenType)";
   44.87      int TTSLEN = wcslen(TTSUFFIX);
   44.88 -    wchar_t *match;
   44.89 +    wchar_t *suffix;
   44.90  
   44.91      int len = wcslen(name);
   44.92      if (len == 0) {
   44.93 @@ -427,13 +434,13 @@
   44.94      if (len <= TTSLEN) {
   44.95          return FALSE;
   44.96      }
   44.97 -    match = wcsstr(name, TTSUFFIX);
   44.98 -    if ((match != NULL) && (match == name+(len-TTSLEN))) {
   44.99 -        match[0] = L'\0'; /* truncate name */
  44.100 +    /* suffix length is the same for truetype and opentype fonts */
  44.101 +    suffix = name + (len - TTSLEN);
  44.102 +    if (wcscmp(suffix, TTSUFFIX) == 0 || wcscmp(suffix, OTSUFFIX) == 0) {
  44.103 +        suffix[0] = L'\0'; /* truncate name */
  44.104          return TRUE;
  44.105 -    } else {
  44.106 -        return FALSE;
  44.107      }
  44.108 +    return FALSE;
  44.109  }
  44.110  
  44.111  static void registerFontA(GdiFontMapInfo *fmi, jobject fontToFileMap,
  44.112 @@ -675,18 +682,19 @@
  44.113          }
  44.114          if (IS_NT) {
  44.115              if (!RegistryToBaseTTNameW((LPWSTR)wname) ) {
  44.116 -                /* If the filename ends with ".ttf" also accept it.
  44.117 +                /* If the filename ends with ".ttf" or ".otf" also accept it.
  44.118                   * Not expecting to need to do this for .ttc files.
  44.119                   * Also note this code is not mirrored in the "A" (win9x) path.
  44.120                   */
  44.121                  LPWSTR dot = wcsrchr((LPWSTR)data, L'.');
  44.122 -                if (dot == NULL || (wcsicmp(dot, L".ttf") != 0)) {
  44.123 +                if (dot == NULL || ((wcsicmp(dot, L".ttf") != 0)
  44.124 +                                      && (wcsicmp(dot, L".otf") != 0))) {
  44.125                      continue;  /* not a TT font... */
  44.126                  }
  44.127              }
  44.128              registerFontW(&fmi, fontToFileMap, (LPWSTR)wname, (LPWSTR)data);
  44.129          } else {
  44.130 -            if (!RegistryToBaseTTNameA(cname) ) {
  44.131 +            if (!RegistryToBaseTTNameA((LPSTR)cname)) {
  44.132                  continue; /* not a TT font... */
  44.133              }
  44.134              registerFontA(&fmi, fontToFileMap, cname, (LPCSTR)data);
    45.1 --- a/src/windows/native/sun/java2d/d3d/D3DBadHardware.h	Fri Dec 19 10:37:50 2008 -0800
    45.2 +++ b/src/windows/native/sun/java2d/d3d/D3DBadHardware.h	Tue Jan 06 16:24:03 2009 -0800
    45.3 @@ -85,6 +85,19 @@
    45.4      { 0x1002, 0x71C5, D_VERSION(6,14,10,6706), OS_WINXP },
    45.5      { 0x1002, 0x71C5, D_VERSION(7,14,10,0567), OS_VISTA },
    45.6  
    45.7 +    // ATI Mobility Radeon 9700
    45.8 +    // Reason: workaround for 6773336
    45.9 +    { 0x1002, 0x4E50, D_VERSION(6,14,10,6561), OS_WINXP },
   45.10 +
   45.11 +    // Nvidia FX 5200
   45.12 +    // Reason: workaround for 6717988
   45.13 +    { 0x10DE, 0x0322, D_VERSION(6,14,11,6921), OS_WINXP },
   45.14 +
   45.15 +    // Nvidia FX Go5600, Go5700
   45.16 +    // Reason: workaround for 6714579
   45.17 +    { 0x10DE, 0x031A, D_VERSION(6,14,11,6921), OS_WINXP },
   45.18 +    { 0x10DE, 0x0347, D_VERSION(6,14,11,6921), OS_WINXP },
   45.19 +
   45.20      // Nvidia Quadro NVS 110M
   45.21      // Reason: workaround for 6629891
   45.22      { 0x10DE, 0x01D7, D_VERSION(6,14,11,5665), OS_WINXP },
   45.23 @@ -93,6 +106,32 @@
   45.24      // Reason: workaround for 6653860
   45.25      { 0x10DE, 0x00FD, D_VERSION(6,14,10,6573), OS_WINXP },
   45.26  
   45.27 +    // Nvidia Quadro FX family
   45.28 +    // Reason: workaround for 6772137
   45.29 +    { 0x10DE, 0x00F8, D_VERSION(6,14,10,9381), OS_WINXP },
   45.30 +    { 0x10DE, 0x009D, D_VERSION(6,14,10,9381), OS_WINXP },
   45.31 +    { 0x10DE, 0x029C, D_VERSION(6,14,10,9381), OS_WINXP },
   45.32 +    { 0x10DE, 0x029D, D_VERSION(6,14,10,9381), OS_WINXP },
   45.33 +    { 0x10DE, 0x029E, D_VERSION(6,14,10,9381), OS_WINXP },
   45.34 +    { 0x10DE, 0x029F, D_VERSION(6,14,10,9381), OS_WINXP },
   45.35 +    { 0x10DE, 0x01DE, D_VERSION(6,14,10,9381), OS_WINXP },
   45.36 +    { 0x10DE, 0x039E, D_VERSION(6,14,10,9381), OS_WINXP },
   45.37 +    { 0x10DE, 0x019D, D_VERSION(6,14,10,9381), OS_WINXP },
   45.38 +    { 0x10DE, 0x019E, D_VERSION(6,14,10,9381), OS_WINXP },
   45.39 +    { 0x10DE, 0x040A, D_VERSION(6,14,10,9381), OS_WINXP },
   45.40 +    { 0x10DE, 0x040E, D_VERSION(6,14,10,9381), OS_WINXP },
   45.41 +    { 0x10DE, 0x040F, D_VERSION(6,14,10,9381), OS_WINXP },
   45.42 +    { 0x10DE, 0x061A, D_VERSION(6,14,10,9381), OS_WINXP },
   45.43 +    { 0x10DE, 0x06F9, D_VERSION(6,14,10,9381), OS_WINXP },
   45.44 +    { 0x10DE, 0x05FD, D_VERSION(6,14,10,9381), OS_WINXP },
   45.45 +    { 0x10DE, 0x05FE, D_VERSION(6,14,10,9381), OS_WINXP },
   45.46 +    { 0x10DE, 0x004E, D_VERSION(6,14,10,9381), OS_WINXP },
   45.47 +    { 0x10DE, 0x00CD, D_VERSION(6,14,10,9381), OS_WINXP },
   45.48 +    { 0x10DE, 0x00CE, D_VERSION(6,14,10,9381), OS_WINXP },
   45.49 +    { 0x10DE, 0x014C, D_VERSION(6,14,10,9381), OS_WINXP },
   45.50 +    { 0x10DE, 0x014D, D_VERSION(6,14,10,9381), OS_WINXP },
   45.51 +    { 0x10DE, 0x014E, D_VERSION(6,14,10,9381), OS_WINXP },
   45.52 +
   45.53      // Nvidia GeForce 6200 TurboCache(TM)
   45.54      // Reason: workaround for 6588384
   45.55      { 0x10DE, 0x0161, NO_VERSION, OS_VISTA },
    46.1 --- a/src/windows/native/sun/java2d/d3d/D3DBlitLoops.cpp	Fri Dec 19 10:37:50 2008 -0800
    46.2 +++ b/src/windows/native/sun/java2d/d3d/D3DBlitLoops.cpp	Tue Jan 06 16:24:03 2009 -0800
    46.3 @@ -47,6 +47,7 @@
    46.4  extern "C" BlitFunc IntArgbPreToIntArgbConvert;
    46.5  extern "C" BlitFunc IntArgbBmToIntArgbConvert;
    46.6  extern "C" BlitFunc IntRgbToIntArgbConvert;
    46.7 +extern "C" BlitFunc ThreeByteBgrToIntArgbConvert;
    46.8  extern "C" BlitFunc Ushort565RgbToIntArgbConvert;
    46.9  extern "C" BlitFunc Ushort555RgbToIntArgbConvert;
   46.10  extern "C" BlitFunc IntBgrToIntArgbConvert;
   46.11 @@ -220,12 +221,17 @@
   46.12                  " srctype=%d rect={%-4d, %-4d, %-4d, %-4d}",
   46.13                  srctype, r.left, r.top, r.right, r.bottom);
   46.14  
   46.15 -    if (pDesc->Usage == D3DUSAGE_DYNAMIC &&
   46.16 -        dstx == 0 && dstx == 0 &&
   46.17 -        srcWidth == pDesc->Width && srcHeight == pDesc->Height)
   46.18 -    {
   46.19 +    if (pDesc->Usage == D3DUSAGE_DYNAMIC) {
   46.20 +        // it is safe to lock with discard because we don't care about the
   46.21 +        // contents of dynamic textures, and some drivers are happier if
   46.22 +        // dynamic textures are always locked with DISCARD
   46.23          dwLockFlags |= D3DLOCK_DISCARD;
   46.24          pR = NULL;
   46.25 +    } else {
   46.26 +        // in non-DYNAMIC case we lock the exact rect so there's no need to
   46.27 +        // offset the destination pointer
   46.28 +        dstx = 0;
   46.29 +        dsty = 0;
   46.30      }
   46.31  
   46.32      res = pDstSurface->LockRect(&lockedRect, pR, dwLockFlags);
   46.33 @@ -242,7 +248,9 @@
   46.34      void *pSrcBase = PtrCoord(pSrcInfo->rasBase,
   46.35                                srcx, pSrcInfo->pixelStride,
   46.36                                srcy, pSrcInfo->scanStride);
   46.37 -    void *pDstBase = lockedRect.pBits;
   46.38 +    void *pDstBase = PtrCoord(lockedRect.pBits,
   46.39 +                              dstx, dstInfo.pixelStride,
   46.40 +                              dsty, dstInfo.scanStride);
   46.41  
   46.42      switch (srctype) {
   46.43          case ST_INT_ARGB:
   46.44 @@ -251,11 +259,15 @@
   46.45                                         pSrcInfo, &dstInfo, NULL, NULL);
   46.46              break;
   46.47          case ST_INT_ARGB_PRE:
   46.48 -        case ST_INT_RGB:
   46.49              AnyIntIsomorphicCopy(pSrcBase, pDstBase,
   46.50                                   srcWidth, srcHeight,
   46.51                                   pSrcInfo, &dstInfo, NULL, NULL);
   46.52              break;
   46.53 +        case ST_INT_RGB:
   46.54 +            IntRgbToIntArgbConvert(pSrcBase, pDstBase,
   46.55 +                                   srcWidth, srcHeight,
   46.56 +                                   pSrcInfo, &dstInfo, NULL, NULL);
   46.57 +            break;
   46.58          case ST_INT_ARGB_BM:
   46.59              // REMIND: we don't have such sw loop
   46.60              // so this path is disabled for now on java level
   46.61 @@ -268,6 +280,11 @@
   46.62                                     srcWidth, srcHeight,
   46.63                                     pSrcInfo, &dstInfo, NULL, NULL);
   46.64              break;
   46.65 +        case ST_3BYTE_BGR:
   46.66 +            ThreeByteBgrToIntArgbConvert(pSrcBase, pDstBase,
   46.67 +                                         srcWidth, srcHeight,
   46.68 +                                         pSrcInfo, &dstInfo, NULL, NULL);
   46.69 +            break;
   46.70          case ST_USHORT_555_RGB:
   46.71              Ushort555RgbToIntArgbConvert(pSrcBase, pDstBase,
   46.72                                           srcWidth, srcHeight,
    47.1 --- a/src/windows/native/sun/java2d/d3d/D3DContext.cpp	Fri Dec 19 10:37:50 2008 -0800
    47.2 +++ b/src/windows/native/sun/java2d/d3d/D3DContext.cpp	Tue Jan 06 16:24:03 2009 -0800
    47.3 @@ -1174,11 +1174,10 @@
    47.4          " rect={%-4d, %-4d, %-4d, %-4d}",
    47.5          r.left, r.top, r.right, r.bottom);
    47.6  
    47.7 -    // REMIND: we should also check for dstx, dsty being 0 here,
    47.8 -    // but they're always 0 in dynamic texture case
    47.9 -    if (pDesc->Usage == D3DUSAGE_DYNAMIC &&
   47.10 -        srcWidth == pDesc->Width && srcHeight == pDesc->Height)
   47.11 -    {
   47.12 +    if (pDesc->Usage == D3DUSAGE_DYNAMIC) {
   47.13 +        // it is safe to lock with discard because we don't care about the
   47.14 +        // contents of dynamic textures and dstx,dsty for this case is
   47.15 +        // always 0,0 because we are uploading into a tile texture
   47.16          dwLockFlags |= D3DLOCK_DISCARD;
   47.17          pR = NULL;
   47.18      }
    48.1 --- a/src/windows/native/sun/java2d/d3d/D3DSurfaceData.h	Fri Dec 19 10:37:50 2008 -0800
    48.2 +++ b/src/windows/native/sun/java2d/d3d/D3DSurfaceData.h	Tue Jan 06 16:24:03 2009 -0800
    48.3 @@ -68,6 +68,7 @@
    48.4  #define ST_USHORT_555_RGB  sun_java2d_d3d_D3DSurfaceData_ST_USHORT_555_RGB
    48.5  #define ST_BYTE_INDEXED    sun_java2d_d3d_D3DSurfaceData_ST_BYTE_INDEXED
    48.6  #define ST_BYTE_INDEXED_BM sun_java2d_d3d_D3DSurfaceData_ST_BYTE_INDEXED_BM
    48.7 +#define ST_3BYTE_BGR       sun_java2d_d3d_D3DSurfaceData_ST_3BYTE_BGR
    48.8  
    48.9  /**
   48.10   * These are defined to be the same as ExtendedBufferCapabilities.VSyncType
    49.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    49.2 +++ b/test/java/awt/FullScreen/UninitializedDisplayModeChangeTest/DisplayModeChanger.java	Tue Jan 06 16:24:03 2009 -0800
    49.3 @@ -0,0 +1,93 @@
    49.4 +/*
    49.5 + * Copyright 2006-2008 Sun Microsystems, Inc.  All Rights Reserved.
    49.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    49.7 + *
    49.8 + * This code is free software; you can redistribute it and/or modify it
    49.9 + * under the terms of the GNU General Public License version 2 only, as
   49.10 + * published by the Free Software Foundation.
   49.11 + *
   49.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
   49.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   49.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   49.15 + * version 2 for more details (a copy is included in the LICENSE file that
   49.16 + * accompanied this code).
   49.17 + *
   49.18 + * You should have received a copy of the GNU General Public License version
   49.19 + * 2 along with this work; if not, write to the Free Software Foundation,
   49.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   49.21 + *
   49.22 + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
   49.23 + * CA 95054 USA or visit www.sun.com if you need additional information or
   49.24 + * have any questions.
   49.25 + */
   49.26 +
   49.27 +import java.awt.DisplayMode;
   49.28 +import java.awt.EventQueue;
   49.29 +import java.awt.Frame;
   49.30 +import java.awt.GraphicsDevice;
   49.31 +import java.awt.GraphicsEnvironment;
   49.32 +import java.lang.reflect.InvocationTargetException;
   49.33 +
   49.34 +/**
   49.35 + * Used by the UninitializedDisplayModeChangeTest to change the
   49.36 + * display mode.
   49.37 + */
   49.38 +public class DisplayModeChanger {
   49.39 +
   49.40 +    public static void main(String[] args)
   49.41 +        throws InterruptedException, InvocationTargetException
   49.42 +    {
   49.43 +        final GraphicsDevice gd =
   49.44 +            GraphicsEnvironment.getLocalGraphicsEnvironment().
   49.45 +                getDefaultScreenDevice();
   49.46 +
   49.47 +        EventQueue.invokeAndWait(new Runnable() {
   49.48 +            public void run() {
   49.49 +                Frame f = null;
   49.50 +                if (gd.isFullScreenSupported()) {
   49.51 +                    try {
   49.52 +                        f = new Frame("DisplayChanger Frame");
   49.53 +                        gd.setFullScreenWindow(f);
   49.54 +                        if (gd.isDisplayChangeSupported()) {
   49.55 +                            DisplayMode dm = findDisplayMode(gd);
   49.56 +                            if (gd != null) {
   49.57 +                                gd.setDisplayMode(dm);
   49.58 +                            }
   49.59 +                        }
   49.60 +                        try {
   49.61 +                            Thread.sleep(1000);
   49.62 +                        } catch (InterruptedException ex) {
   49.63 +                            ex.printStackTrace();
   49.64 +                        }
   49.65 +                        gd.setFullScreenWindow(null);
   49.66 +                    } finally {
   49.67 +                        if (f != null) {
   49.68 +                            f.dispose();
   49.69 +                        }
   49.70 +                    }
   49.71 +                }
   49.72 +            }
   49.73 +        });
   49.74 +    }
   49.75 +
   49.76 +    /**
   49.77 +     * Finds a display mode that is different from the current display
   49.78 +     * mode and is likely to cause a display change event.
   49.79 +     */
   49.80 +    private static DisplayMode findDisplayMode(GraphicsDevice gd) {
   49.81 +        DisplayMode dms[] = gd.getDisplayModes();
   49.82 +        DisplayMode currentDM = gd.getDisplayMode();
   49.83 +        for (DisplayMode dm : dms) {
   49.84 +            if (!dm.equals(currentDM) &&
   49.85 +                 dm.getRefreshRate() == currentDM.getRefreshRate())
   49.86 +            {
   49.87 +                // different from the current dm and refresh rate is the same
   49.88 +                // means that something else is different => more likely to
   49.89 +                // cause a DM change event
   49.90 +                return dm;
   49.91 +            }
   49.92 +        }
   49.93 +        return null;
   49.94 +    }
   49.95 +
   49.96 +}
    50.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    50.2 +++ b/test/java/awt/font/TextLayout/DecorationBoundsTest.java	Tue Jan 06 16:24:03 2009 -0800
    50.3 @@ -0,0 +1,98 @@
    50.4 +/*
    50.5 + * Copyright 2008 Sun Microsystems, Inc.  All Rights Reserved.
    50.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    50.7 + *
    50.8 + * This code is free software; you can redistribute it and/or modify it
    50.9 + * under the terms of the GNU General Public License version 2 only, as
   50.10 + * published by the Free Software Foundation.
   50.11 + *
   50.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
   50.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   50.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   50.15 + * version 2 for more details (a copy is included in the LICENSE file that
   50.16 + * accompanied this code).
   50.17 + *
   50.18 + * You should have received a copy of the GNU General Public License version
   50.19 + * 2 along with this work; if not, write to the Free Software Foundation,
   50.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   50.21 + *
   50.22 + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
   50.23 + * CA 95054 USA or visit www.sun.com if you need additional information or
   50.24 + * have any questions.
   50.25 + */
   50.26 +
   50.27 +/* @test
   50.28 + * @summary verify bounds enclose rendering of decorations.
   50.29 + * @bug 6751621
   50.30 + */
   50.31 +
   50.32 +import java.awt.*;
   50.33 +import java.awt.font.*;
   50.34 +import java.awt.geom.*;
   50.35 +import java.awt.image.*;
   50.36 +import java.util.*;
   50.37 +
   50.38 +public class DecorationBoundsTest {
   50.39 +
   50.40 +    public static void main(String[] args) {
   50.41 +        BufferedImage bi =
   50.42 +           new BufferedImage(600, 300, BufferedImage.TYPE_INT_RGB);
   50.43 +       Graphics2D g2d = bi.createGraphics();
   50.44 +       g2d.setColor(Color.white);
   50.45 +       g2d.fillRect(0, 0, 600, 300);
   50.46 +
   50.47 +       float x = 10;
   50.48 +       float y = 90;
   50.49 +       Map map = new HashMap();
   50.50 +       map.put(TextAttribute.STRIKETHROUGH,
   50.51 +               TextAttribute.STRIKETHROUGH_ON);
   50.52 +       map.put(TextAttribute.SIZE, new Float(80));
   50.53 +
   50.54 +       FontRenderContext frc = g2d.getFontRenderContext();
   50.55 +
   50.56 +       String text = "Welcome to ";
   50.57 +       TextLayout tl = new TextLayout(text, map, frc);
   50.58 +       g2d.translate(x, y);
   50.59 +       g2d.setColor(Color.RED);
   50.60 +       tl.draw(g2d, 0, 0);
   50.61 +       g2d.setColor(Color.GREEN);
   50.62 +       Rectangle2D bds = tl.getBounds();
   50.63 +       /* Since due to pixelisation the glyphs may touch above
   50.64 +        * or below the theoretical outline bounds, pad in the
   50.65 +        * y direction to avoid spurious failures.
   50.66 +        */
   50.67 +       bds.setRect(bds.getX(), bds.getY()-1,
   50.68 +                   bds.getWidth(), bds.getHeight()+2);
   50.69 +       g2d.fill(bds);
   50.70 +
   50.71 +       map = new HashMap();
   50.72 +       map.put(TextAttribute.UNDERLINE, TextAttribute.UNDERLINE_ON);
   50.73 +       map.put(TextAttribute.SIZE, new Float(80));
   50.74 +       tl = new TextLayout(text, map, frc);
   50.75 +       g2d.translate(0, 100);
   50.76 +       g2d.setColor(Color.RED);
   50.77 +       tl.draw(g2d, 0, 0);
   50.78 +
   50.79 +       g2d.setColor(Color.GREEN);
   50.80 +       bds = tl.getBounds();
   50.81 +       bds.setRect(bds.getX(), bds.getY()-1,
   50.82 +                   bds.getWidth(), bds.getHeight()+2);
   50.83 +       g2d.fill(bds);
   50.84 +
   50.85 +       checkBI(bi, Color.RED);
   50.86 +   }
   50.87 +
   50.88 +   static void checkBI(BufferedImage bi, Color badColor) {
   50.89 +      int badrgb = badColor.getRGB();
   50.90 +      int w = bi.getWidth(null);
   50.91 +      int h = bi.getHeight(null);
   50.92 +      for (int x=0; x<w; x++) {
   50.93 +          for (int y=0; y<h; y++) {
   50.94 +             int col = bi.getRGB(x, y);
   50.95 +             if (col == badrgb) {
   50.96 +                  throw new RuntimeException("Got " + col);
   50.97 +             }
   50.98 +          }
   50.99 +      }
  50.100 +   }
  50.101 +}
    51.1 --- a/test/java/awt/font/TextLayout/TextLayoutBounds.java	Fri Dec 19 10:37:50 2008 -0800
    51.2 +++ b/test/java/awt/font/TextLayout/TextLayoutBounds.java	Tue Jan 06 16:24:03 2009 -0800
    51.3 @@ -22,7 +22,7 @@
    51.4   */
    51.5  /* @test
    51.6   * @summary verify TextLayout.getBounds() return visual bounds
    51.7 - * @bug 6323611
    51.8 + * @bug 6323611 6761856
    51.9   */
   51.10  
   51.11  import java.awt.*;
   51.12 @@ -39,10 +39,15 @@
   51.13         Rectangle2D tlBounds = tl.getBounds();
   51.14         GlyphVector gv = f.createGlyphVector(frc, s);
   51.15         Rectangle2D gvvBounds = gv.getVisualBounds();
   51.16 +       Rectangle2D oBounds = tl.getOutline(null).getBounds2D();
   51.17         System.out.println("tlbounds="+tlBounds);
   51.18         System.out.println("gvbounds="+gvvBounds);
   51.19 +       System.out.println("outlineBounds="+oBounds);
   51.20         if (!gvvBounds.equals(tlBounds)) {
   51.21 -          throw new RuntimeException("Bounds differ");
   51.22 +          throw new RuntimeException("Bounds differ [gvv != tl]");
   51.23 +       }
   51.24 +       if (!tlBounds.equals(oBounds)) {
   51.25 +          throw new RuntimeException("Bounds differ [tl != outline]");
   51.26         }
   51.27      }
   51.28  }
    52.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    52.2 +++ b/test/java/awt/font/TextLayout/UnderlinePositionTest.java	Tue Jan 06 16:24:03 2009 -0800
    52.3 @@ -0,0 +1,88 @@
    52.4 +/*
    52.5 + * Copyright 2008 Sun Microsystems, Inc.  All Rights Reserved.
    52.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    52.7 + *
    52.8 + * This code is free software; you can redistribute it and/or modify it
    52.9 + * under the terms of the GNU General Public License version 2 only, as
   52.10 + * published by the Free Software Foundation.
   52.11 + *
   52.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
   52.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   52.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   52.15 + * version 2 for more details (a copy is included in the LICENSE file that
   52.16 + * accompanied this code).
   52.17 + *
   52.18 + * You should have received a copy of the GNU General Public License version
   52.19 + * 2 along with this work; if not, write to the Free Software Foundation,
   52.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   52.21 + *
   52.22 + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
   52.23 + * CA 95054 USA or visit www.sun.com if you need additional information or
   52.24 + * have any questions.
   52.25 + */
   52.26 +
   52.27 +/* @test
   52.28 + * @summary verify outline and stroking of underline match.
   52.29 + * @bug 6751616
   52.30 + */
   52.31 +
   52.32 +import java.awt.*;
   52.33 +import java.awt.font.*;
   52.34 +import java.awt.geom.*;
   52.35 +import java.awt.image.*;
   52.36 +import java.util.*;
   52.37 +
   52.38 +public class UnderlinePositionTest {
   52.39 +
   52.40 +    public static void main(String[] args) {
   52.41 +        BufferedImage bi =
   52.42 +           new BufferedImage(600, 150, BufferedImage.TYPE_INT_RGB);
   52.43 +       Graphics2D g2d = bi.createGraphics();
   52.44 +       g2d.setColor(Color.white);
   52.45 +       g2d.fillRect(0, 0, 600, 150);
   52.46 +
   52.47 +       float x = 10;
   52.48 +       float y = 90;
   52.49 +       Map map = new HashMap();
   52.50 +       map.put(TextAttribute.UNDERLINE, TextAttribute.UNDERLINE_ON);
   52.51 +       map.put(TextAttribute.SIZE, new Float(80));
   52.52 +
   52.53 +       FontRenderContext frc = g2d.getFontRenderContext();
   52.54 +
   52.55 +       // Use all spaces for the text so we know we are dealing
   52.56 +       // only with pixels from the underline.
   52.57 +       String text = "           ";
   52.58 +       TextLayout tl = new TextLayout(text, map, frc);
   52.59 +       Shape outline = tl.getOutline(null);
   52.60 +       Rectangle2D bounds = outline.getBounds();
   52.61 +
   52.62 +       g2d.translate(x, y);
   52.63 +       g2d.setColor(Color.RED);
   52.64 +       tl.draw(g2d, 0, 0);
   52.65 +
   52.66 +       /* By getting the outline, then its bounds, then filling
   52.67 +        * according to the same pixelisation rules, this ought to
   52.68 +        * match the position of the original underline. If any
   52.69 +        * red pixels are left, then the test will fail.
   52.70 +        */
   52.71 +       g2d.setColor(Color.BLUE);
   52.72 +       g2d.fill(bounds);
   52.73 +       g2d.dispose();
   52.74 +
   52.75 +       checkBI(bi, Color.RED);
   52.76 +   }
   52.77 +
   52.78 +   static void checkBI(BufferedImage bi, Color badColor) {
   52.79 +      int badrgb = badColor.getRGB();
   52.80 +      int w = bi.getWidth(null);
   52.81 +      int h = bi.getHeight(null);
   52.82 +      for (int x=0; x<w; x++) {
   52.83 +          for (int y=0; y<h; y++) {
   52.84 +             int col = bi.getRGB(x, y);
   52.85 +             if (col == badrgb) {
   52.86 +                  throw new RuntimeException("Got " + col);
   52.87 +             }
   52.88 +          }
   52.89 +      }
   52.90 +   }
   52.91 +}
    53.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    53.2 +++ b/test/java/awt/print/PrinterJob/GetMediasTest.java	Tue Jan 06 16:24:03 2009 -0800
    53.3 @@ -0,0 +1,46 @@
    53.4 +/*
    53.5 + * Copyright 2008 Sun Microsystems, Inc.  All Rights Reserved.
    53.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    53.7 + *
    53.8 + * This code is free software; you can redistribute it and/or modify it
    53.9 + * under the terms of the GNU General Public License version 2 only, as
   53.10 + * published by the Free Software Foundation.
   53.11 + *
   53.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
   53.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   53.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   53.15 + * version 2 for more details (a copy is included in the LICENSE file that
   53.16 + * accompanied this code).
   53.17 + *
   53.18 + * You should have received a copy of the GNU General Public License version
   53.19 + * 2 along with this work; if not, write to the Free Software Foundation,
   53.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   53.21 + *
   53.22 + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
   53.23 + * CA 95054 USA or visit www.sun.com if you need additional information or
   53.24 + * have any questions.
   53.25 + */
   53.26 +
   53.27 +/**
   53.28 + * @test
   53.29 + * @bug 6653384
   53.30 + * @summary No exception should be thrown.
   53.31 + * @run main GetMediasTest
   53.32 + */
   53.33 +import javax.print.PrintService;
   53.34 +import javax.print.PrintServiceLookup;
   53.35 +import javax.print.attribute.standard.Media;
   53.36 +
   53.37 +public class GetMediasTest {
   53.38 +    public static void main(String[] args) {
   53.39 +        PrintService[] services = PrintServiceLookup.lookupPrintServices(null, null);
   53.40 +        for(final PrintService service: services) {
   53.41 +            Thread thread = new Thread() {
   53.42 +                public void run() {
   53.43 +                    service.getSupportedAttributeValues(Media.class, null, null);
   53.44 +                }
   53.45 +            };
   53.46 +            thread.start();
   53.47 +        }
   53.48 +    }
   53.49 +}
    54.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    54.2 +++ b/test/javax/imageio/plugins/png/ITXtTest.java	Tue Jan 06 16:24:03 2009 -0800
    54.3 @@ -0,0 +1,236 @@
    54.4 +/*
    54.5 + * Copyright 2008 Sun Microsystems, Inc.  All Rights Reserved.
    54.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    54.7 + *
    54.8 + * This code is free software; you can redistribute it and/or modify it
    54.9 + * under the terms of the GNU General Public License version 2 only, as
   54.10 + * published by the Free Software Foundation.
   54.11 + *
   54.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
   54.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   54.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   54.15 + * version 2 for more details (a copy is included in the LICENSE file that
   54.16 + * accompanied this code).
   54.17 + *
   54.18 + * You should have received a copy of the GNU General Public License version
   54.19 + * 2 along with this work; if not, write to the Free Software Foundation,
   54.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   54.21 + *
   54.22 + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
   54.23 + * CA 95054 USA or visit www.sun.com if you need additional information or
   54.24 + * have any questions.
   54.25 + */
   54.26 +
   54.27 +/**
   54.28 + * @test
   54.29 + * @bug     6541476
   54.30 + * @summary Test verifies that ImageIO PNG plugin correcly handles the
   54.31 + *          iTxt chunk (International textual data).
   54.32 + *
   54.33 + * @run     main ITXtTest
   54.34 + */
   54.35 +
   54.36 +
   54.37 +import java.awt.Color;
   54.38 +import java.awt.Graphics2D;
   54.39 +import java.awt.image.BufferedImage;
   54.40 +import java.io.File;
   54.41 +
   54.42 +import javax.imageio.ImageIO;
   54.43 +import javax.imageio.ImageReader;
   54.44 +import javax.imageio.IIOImage;
   54.45 +import javax.imageio.ImageTypeSpecifier;
   54.46 +import javax.imageio.ImageWriter;
   54.47 +import javax.imageio.metadata.IIOMetadata;
   54.48 +import javax.imageio.metadata.IIOMetadataNode;
   54.49 +import javax.imageio.stream.ImageOutputStream;
   54.50 +import javax.imageio.stream.ImageInputStream;
   54.51 +
   54.52 +import org.w3c.dom.Node;
   54.53 +
   54.54 +public class ITXtTest {
   54.55 +    static public void main(String args[]) {
   54.56 +        ITXtTest t_en = new ITXtTest();
   54.57 +        t_en.description = "xml - en";
   54.58 +        t_en.keyword = "XML:com.adobe.xmp";
   54.59 +        t_en.isCompressed = false;
   54.60 +        t_en.compression = 0;
   54.61 +        t_en.language = "en";
   54.62 +        t_en.trasKeyword = "XML:com.adobe.xmp";
   54.63 +        t_en.text = "<xml>Something</xml>";
   54.64 +
   54.65 +        doTest(t_en);
   54.66 +
   54.67 +        // check compression case
   54.68 +        t_en.isCompressed = true;
   54.69 +        t_en.description = "xml - en - compressed";
   54.70 +
   54.71 +        doTest(t_en);
   54.72 +
   54.73 +        ITXtTest t_ru = new ITXtTest();
   54.74 +        t_ru.description = "xml - ru";
   54.75 +        t_ru.keyword = "XML:com.adobe.xmp";
   54.76 +        t_ru.isCompressed = false;
   54.77 +        t_ru.compression = 0;
   54.78 +        t_ru.language = "ru";
   54.79 +        t_ru.trasKeyword = "\u0410\u0410\u0410\u0410\u0410 XML";
   54.80 +        t_ru.text = "<xml>\u042A\u042F\u042F\u042F\u042F\u042F\u042F</xml>";
   54.81 +
   54.82 +        doTest(t_ru);
   54.83 +
   54.84 +        t_ru.isCompressed = true;
   54.85 +        t_ru.description = "xml - ru - compressed";
   54.86 +
   54.87 +        doTest(t_ru);
   54.88 +    }
   54.89 +
   54.90 +
   54.91 +    String description;
   54.92 +
   54.93 +    String keyword;
   54.94 +    boolean isCompressed;
   54.95 +    int compression;
   54.96 +    String language;
   54.97 +    String trasKeyword;
   54.98 +    String text;
   54.99 +
  54.100 +
  54.101 +    public IIOMetadataNode getNode() {
  54.102 +        IIOMetadataNode iTXt = new IIOMetadataNode("iTXt");
  54.103 +        IIOMetadataNode iTXtEntry = new IIOMetadataNode("iTXtEntry");
  54.104 +        iTXtEntry.setAttribute("keyword", keyword);
  54.105 +        iTXtEntry.setAttribute("compressionFlag",
  54.106 +                               isCompressed ? "true" : "false");
  54.107 +        iTXtEntry.setAttribute("compressionMethod",
  54.108 +                               Integer.toString(compression));
  54.109 +        iTXtEntry.setAttribute("languageTag", language);
  54.110 +        iTXtEntry.setAttribute("translatedKeyword",
  54.111 +                               trasKeyword);
  54.112 +        iTXtEntry.setAttribute("text", text);
  54.113 +        iTXt.appendChild(iTXtEntry);
  54.114 +        return iTXt;
  54.115 +    }
  54.116 +
  54.117 +    public static ITXtTest getFromNode(IIOMetadataNode n) {
  54.118 +        ITXtTest t = new ITXtTest();
  54.119 +
  54.120 +        if (!"iTXt".equals(n.getNodeName())) {
  54.121 +            throw new RuntimeException("Invalid node");
  54.122 +        }
  54.123 +        IIOMetadataNode e = (IIOMetadataNode)n.getFirstChild();
  54.124 +        if (!"iTXtEntry".equals(e.getNodeName())) {
  54.125 +            throw new RuntimeException("Invalid entry node");
  54.126 +        }
  54.127 +        t.keyword = e.getAttribute("keyword");
  54.128 +        t.isCompressed =
  54.129 +            (Integer.valueOf(e.getAttribute("compressionFlag")).intValue() == 1);
  54.130 +        t.compression =
  54.131 +            Integer.valueOf(e.getAttribute("compressionMethod")).intValue();
  54.132 +        t.language = e.getAttribute("languageTag");
  54.133 +        t.trasKeyword = e.getAttribute("translatedKeyword");
  54.134 +        t.text = e.getAttribute("text");
  54.135 +
  54.136 +        return t;
  54.137 +    }
  54.138 +
  54.139 +    @Override
  54.140 +    public boolean equals(Object o) {
  54.141 +        if (! (o instanceof ITXtTest)) {
  54.142 +            return false;
  54.143 +        }
  54.144 +        ITXtTest t = (ITXtTest)o;
  54.145 +        if (!keyword.equals(t.keyword)) { return false; }
  54.146 +        if (isCompressed != t.isCompressed) { return false; }
  54.147 +        if (compression != t.compression) { return false; }
  54.148 +        if (!language.equals(t.language)) { return false; }
  54.149 +        if (!trasKeyword.equals(t.trasKeyword)) { return false; }
  54.150 +        if (!text.equals(t.text)) { return false; }
  54.151 +
  54.152 +        return true;
  54.153 +    }
  54.154 +
  54.155 +
  54.156 +
  54.157 +    private static void doTest(ITXtTest src) {
  54.158 +
  54.159 +        System.out.println("Test: " + src.description);
  54.160 +
  54.161 +        File file = new File("test.png");
  54.162 +
  54.163 +        writeTo(file, src);
  54.164 +        ITXtTest dst = readFrom(file);
  54.165 +
  54.166 +        if (dst == null || !dst.equals(src)) {
  54.167 +            throw new RuntimeException("Test failed.");
  54.168 +        }
  54.169 +
  54.170 +        System.out.println("Test passed.");
  54.171 +    }
  54.172 +
  54.173 +    private static void writeTo(File f, ITXtTest t) {
  54.174 +        BufferedImage src = createBufferedImage();
  54.175 +        try {
  54.176 +            ImageOutputStream imageOutputStream =
  54.177 +                ImageIO.createImageOutputStream(f);
  54.178 +
  54.179 +            ImageTypeSpecifier imageTypeSpecifier =
  54.180 +                new ImageTypeSpecifier(src);
  54.181 +            ImageWriter imageWriter =
  54.182 +                ImageIO.getImageWritersByFormatName("PNG").next();
  54.183 +
  54.184 +            imageWriter.setOutput(imageOutputStream);
  54.185 +
  54.186 +            IIOMetadata m =
  54.187 +                imageWriter.getDefaultImageMetadata(imageTypeSpecifier, null);
  54.188 +
  54.189 +            String format = m.getNativeMetadataFormatName();
  54.190 +            Node root = m.getAsTree(format);
  54.191 +
  54.192 +            IIOMetadataNode iTXt = t.getNode();
  54.193 +            root.appendChild(iTXt);
  54.194 +            m.setFromTree(format, root);
  54.195 +
  54.196 +            imageWriter.write(new IIOImage(src, null, m));
  54.197 +            imageOutputStream.close();
  54.198 +            System.out.println("Writing done.");
  54.199 +        } catch (Throwable e) {
  54.200 +            throw new RuntimeException("Writing test failed.", e);
  54.201 +        }
  54.202 +    }
  54.203 +
  54.204 +    private static ITXtTest readFrom(File f) {
  54.205 +        try {
  54.206 +            ImageInputStream iis = ImageIO.createImageInputStream(f);
  54.207 +            ImageReader r = ImageIO.getImageReaders(iis).next();
  54.208 +            r.setInput(iis);
  54.209 +
  54.210 +            IIOImage dst = r.readAll(0, null);
  54.211 +
  54.212 +            // look for iTXt node
  54.213 +            IIOMetadata m = dst.getMetadata();
  54.214 +            Node root = m.getAsTree(m.getNativeMetadataFormatName());
  54.215 +            Node n = root.getFirstChild();
  54.216 +            while (n != null && !"iTXt".equals(n.getNodeName())) {
  54.217 +                n = n.getNextSibling();
  54.218 +            }
  54.219 +            if (n == null) {
  54.220 +                throw new RuntimeException("No iTXt node!");
  54.221 +            }
  54.222 +            ITXtTest t = ITXtTest.getFromNode((IIOMetadataNode)n);
  54.223 +            return t;
  54.224 +        } catch (Throwable e) {
  54.225 +            throw new RuntimeException("Reading test failed.", e);
  54.226 +        }
  54.227 +    }
  54.228 +
  54.229 +    private static BufferedImage createBufferedImage() {
  54.230 +        BufferedImage image = new BufferedImage(128, 128,
  54.231 +                      BufferedImage.TYPE_4BYTE_ABGR_PRE);
  54.232 +        Graphics2D graph = image.createGraphics();
  54.233 +        graph.setPaintMode();
  54.234 +        graph.setColor(Color.orange);
  54.235 +        graph.fillRect(32, 32, 64, 64);
  54.236 +        graph.dispose();
  54.237 +        return image;
  54.238 +    }
  54.239 +}
    55.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    55.2 +++ b/test/javax/print/CheckDupFlavor.java	Tue Jan 06 16:24:03 2009 -0800
    55.3 @@ -0,0 +1,67 @@
    55.4 +/*
    55.5 + * Copyright 2004-2008 Sun Microsystems, Inc.  All Rights Reserved.
    55.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    55.7 + *
    55.8 + * This code is free software; you can redistribute it and/or modify it
    55.9 + * under the terms of the GNU General Public License version 2 only, as
   55.10 + * published by the Free Software Foundation.
   55.11 + *
   55.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
   55.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   55.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   55.15 + * version 2 for more details (a copy is included in the LICENSE file that
   55.16 + * accompanied this code).
   55.17 + *
   55.18 + * You should have received a copy of the GNU General Public License version
   55.19 + * 2 along with this work; if not, write to the Free Software Foundation,
   55.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   55.21 + *
   55.22 + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
   55.23 + * CA 95054 USA or visit www.sun.com if you need additional information or
   55.24 + * have any questions.
   55.25 + */
   55.26 +
   55.27 +/*
   55.28 + * @test
   55.29 + * @bug 4996318 6731937
   55.30 + * @summary  There should be no duplicates returned by getSupportedDocFlavors.
   55.31 + * @run main CheckDupFlavor
   55.32 + */
   55.33 +import javax.print.*;
   55.34 +import javax.print.attribute.*;
   55.35 +import javax.print.attribute.standard.*;
   55.36 +import java.util.ArrayList;
   55.37 +
   55.38 +
   55.39 +public class CheckDupFlavor {
   55.40 +    public static void main(String[] args){
   55.41 +        PrintService pservice =
   55.42 +                     PrintServiceLookup.lookupDefaultPrintService();
   55.43 +
   55.44 +        if (pservice == null) {
   55.45 +                System.out.println("No default PrintService found. Test ABORTED.");
   55.46 +            return;
   55.47 +        }
   55.48 +
   55.49 +        System.out.println("Default service = "+pservice);
   55.50 +
   55.51 +        DocFlavor[] flavors = pservice.getSupportedDocFlavors();
   55.52 +        if (flavors==null) {
   55.53 +            System.out.println("No flavors supported. Test PASSED.");
   55.54 +            return;
   55.55 +        }
   55.56 +
   55.57 +
   55.58 +        ArrayList flavorList = new ArrayList();
   55.59 +        for (int i=0; i<flavors.length; i++) {
   55.60 +                if (flavors[i] == null) {
   55.61 +                        throw new RuntimeException("Null flavor. Test FAILED.");
   55.62 +                } else if (flavorList.contains(flavors[i])) {
   55.63 +                        throw new RuntimeException("\n\tDuplicate flavor found : "+flavors[i]+" : Test FAILED.");
   55.64 +                } else {
   55.65 +                        flavorList.add(flavors[i]);
   55.66 +                }
   55.67 +        }
   55.68 +        System.out.println("No duplicate found. Test PASSED.");
   55.69 +    }
   55.70 +}
    56.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    56.2 +++ b/test/javax/print/TestRaceCond.java	Tue Jan 06 16:24:03 2009 -0800
    56.3 @@ -0,0 +1,53 @@
    56.4 +/*
    56.5 + * Copyright 2008 Sun Microsystems, Inc.  All Rights Reserved.
    56.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    56.7 + *
    56.8 + * This code is free software; you can redistribute it and/or modify it
    56.9 + * under the terms of the GNU General Public License version 2 only, as
   56.10 + * published by the Free Software Foundation.
   56.11 + *
   56.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
   56.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   56.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   56.15 + * version 2 for more details (a copy is included in the LICENSE file that
   56.16 + * accompanied this code).
   56.17 + *
   56.18 + * You should have received a copy of the GNU General Public License version
   56.19 + * 2 along with this work; if not, write to the Free Software Foundation,
   56.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   56.21 + *
   56.22 + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
   56.23 + * CA 95054 USA or visit www.sun.com if you need additional information or
   56.24 + * have any questions.
   56.25 + */
   56.26 +
   56.27 +/*
   56.28 + * @test
   56.29 + * @bug 6731826
   56.30 + * @summary  There should be no RuntimeException.
   56.31 + * @run main TestRaceCond
   56.32 + */
   56.33 +
   56.34 +import javax.print.PrintService;
   56.35 +import javax.print.PrintServiceLookup;
   56.36 +
   56.37 +
   56.38 +public class TestRaceCond {
   56.39 +
   56.40 +    public static void main(String argv[]) {
   56.41 +        trial();
   56.42 +    }
   56.43 +
   56.44 +    static void trial() {
   56.45 +        PrintService pserv1 = PrintServiceLookup.lookupDefaultPrintService();
   56.46 +        PrintService[] pservs = PrintServiceLookup.lookupPrintServices(null, null);
   56.47 +        PrintService pserv2 = PrintServiceLookup.lookupDefaultPrintService();
   56.48 +
   56.49 +        if (pserv1.hashCode() != pserv2.hashCode()) {
   56.50 +            throw new RuntimeException("Different hashCodes for equal print "
   56.51 +                            + "services: " + pserv1.hashCode() + " "
   56.52 +                            + pserv2.hashCode());
   56.53 +        }
   56.54 +    }
   56.55 +}
   56.56 +
    57.1 --- a/test/javax/print/attribute/PSCopiesFlavorTest.java	Fri Dec 19 10:37:50 2008 -0800
    57.2 +++ b/test/javax/print/attribute/PSCopiesFlavorTest.java	Tue Jan 06 16:24:03 2009 -0800
    57.3 @@ -23,7 +23,7 @@
    57.4  
    57.5  /**
    57.6   * @test
    57.7 - * @bug 6527316
    57.8 + * @bug 6527316 6732647
    57.9   * @summary Copies isn't supported for PS flavors.
   57.10   * @run main PSCopiesFlavorTest
   57.11   */
   57.12 @@ -50,5 +50,13 @@
   57.13         if (suppVal || us == null) {
   57.14             throw new RuntimeException("Copies should be unsupported value");
   57.15         }
   57.16 +
   57.17 +       Object value = ps.getSupportedAttributeValues(Copies.class, flavor, null);
   57.18 +
   57.19 +        //Copies Supported
   57.20 +        if(value instanceof CopiesSupported) {
   57.21 +            throw new RuntimeException("Copies should have no supported values.");
   57.22 +        }
   57.23 +
   57.24     }
   57.25  }
    58.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    58.2 +++ b/test/sun/java2d/DirectX/NonOpaqueDestLCDAATest/NonOpaqueDestLCDAATest.java	Tue Jan 06 16:24:03 2009 -0800
    58.3 @@ -0,0 +1,212 @@
    58.4 +/*
    58.5 + * Copyright 2008 Sun Microsystems, Inc.  All Rights Reserved.
    58.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    58.7 + *
    58.8 + * This code is free software; you can redistribute it and/or modify it
    58.9 + * under the terms of the GNU General Public License version 2 only, as
   58.10 + * published by the Free Software Foundation.
   58.11 + *
   58.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
   58.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   58.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   58.15 + * version 2 for more details (a copy is included in the LICENSE file that
   58.16 + * accompanied this code).
   58.17 + *
   58.18 + * You should have received a copy of the GNU General Public License version
   58.19 + * 2 along with this work; if not, write to the Free Software Foundation,
   58.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   58.21 + *
   58.22 + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
   58.23 + * CA 95054 USA or visit www.sun.com if you need additional information or
   58.24 + * have any questions.
   58.25 + */
   58.26 +
   58.27 +/*
   58.28 + * @test
   58.29 + * @bug 6728834 6749060
   58.30 + * @summary Tests that LCD AA text rendering works properly with destinations
   58.31 + * being VolatileImage of all transparency types
   58.32 + * @author Dmitri.Trembovetski: area=Graphics
   58.33 + * @run main/manual/othervm -Dsun.java2d.d3d=false NonOpaqueDestLCDAATest
   58.34 + * @run main/manual/othervm NonOpaqueDestLCDAATest
   58.35 + * @run main/manual/othervm -Dsun.java2d.opengl=True NonOpaqueDestLCDAATest
   58.36 + */
   58.37 +
   58.38 +import java.awt.AlphaComposite;
   58.39 +import java.awt.Color;
   58.40 +import java.awt.Dimension;
   58.41 +import java.awt.EventQueue;
   58.42 +import java.awt.Font;
   58.43 +import java.awt.Graphics;
   58.44 +import java.awt.Graphics2D;
   58.45 +import java.awt.GraphicsConfiguration;
   58.46 +import java.awt.Image;
   58.47 +import java.awt.RenderingHints;
   58.48 +import java.awt.event.ActionEvent;
   58.49 +import java.awt.event.ActionListener;
   58.50 +import java.awt.event.ComponentAdapter;
   58.51 +import java.awt.event.ComponentEvent;
   58.52 +import java.awt.event.WindowAdapter;
   58.53 +import java.awt.event.WindowEvent;
   58.54 +import java.awt.image.BufferedImage;
   58.55 +import java.awt.image.VolatileImage;
   58.56 +import java.io.File;
   58.57 +import java.util.concurrent.CountDownLatch;
   58.58 +import javax.imageio.ImageIO;
   58.59 +import javax.swing.JButton;
   58.60 +import javax.swing.JFrame;
   58.61 +import javax.swing.JPanel;
   58.62 +import javax.swing.JTextArea;
   58.63 +import static java.awt.Transparency.*;
   58.64 +
   58.65 +public class NonOpaqueDestLCDAATest extends JFrame implements ActionListener {
   58.66 +    private static volatile boolean passed = true;
   58.67 +    private static CountDownLatch complete = new CountDownLatch(1);
   58.68 +
   58.69 +    public NonOpaqueDestLCDAATest() {
   58.70 +        JTextArea desc = new JTextArea();
   58.71 +        desc.setText(
   58.72 +            "\n  Instructions: the three text strings below should appear" +
   58.73 +            "  readable, without smudges or misshapen bold glyphs.\n" +
   58.74 +            "  You may need a magnifier to notice some bad colorfringing in "+
   58.75 +            "  in SW Translucent case, especially in vertical stems.\n\n"+
   58.76 +            "  Basically text rendered to TRANSLUCENT destination should look"+
   58.77 +            "  similar to one rendered to OPAQUE - it may differ in whether or" +
   58.78 +            "  not it's LCD, but it should look 'correct'\n\n"+
   58.79 +            "If the text looks fine the test PASSED otherwise it FAILED.\n");
   58.80 +        desc.setEditable(false);
   58.81 +        desc.setBackground(Color.black);
   58.82 +        desc.setForeground(Color.green);
   58.83 +        add("North", desc);
   58.84 +        JPanel renderPanel = new JPanel() {
   58.85 +            @Override
   58.86 +            public void paintComponent(Graphics g) {
   58.87 +                render(g, getWidth(), getHeight());
   58.88 +            }
   58.89 +        };
   58.90 +        renderPanel.setPreferredSize(new Dimension(1024, 650));
   58.91 +        renderPanel.addComponentListener(new ComponentAdapter() {
   58.92 +            @Override
   58.93 +            public void componentResized(ComponentEvent e) {
   58.94 +                images = null;
   58.95 +            }
   58.96 +        });
   58.97 +        add("Center", renderPanel);
   58.98 +
   58.99 +        JButton passedBtn = new JButton("Passed");
  58.100 +        JButton failedBtn = new JButton("Failed");
  58.101 +        passedBtn.addActionListener(this);
  58.102 +        failedBtn.addActionListener(this);
  58.103 +        JPanel p = new JPanel();
  58.104 +        p.add(passedBtn);
  58.105 +        p.add(failedBtn);
  58.106 +        add("South", p);
  58.107 +        addWindowListener(new WindowAdapter() {
  58.108 +            @Override
  58.109 +            public void windowClosing(WindowEvent e) {
  58.110 +                complete.countDown();
  58.111 +            }
  58.112 +        });
  58.113 +        setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
  58.114 +    }
  58.115 +
  58.116 +    public void render(Graphics g, int w, int h) {
  58.117 +        initImages(w, h);
  58.118 +
  58.119 +        g.setColor(new Color(0xAD, 0xD8, 0xE6));
  58.120 +        g.fillRect(0, 0, w, h);
  58.121 +
  58.122 +        Graphics2D g2d = (Graphics2D) g.create();
  58.123 +        for (Image im : images) {
  58.124 +            g2d.drawImage(im, 0, 0, null);
  58.125 +            g2d.translate(0, im.getHeight(null));
  58.126 +        }
  58.127 +    }
  58.128 +
  58.129 +    String tr[] = { "OPAQUE", "BITMASK", "TRANSLUCENT" };
  58.130 +    @Override
  58.131 +    public void actionPerformed(ActionEvent e) {
  58.132 +        if (e.getActionCommand().equals("Passed")) {
  58.133 +            passed = true;
  58.134 +            System.out.println("Test Passed");
  58.135 +        } else if (e.getActionCommand().equals("Failed")) {
  58.136 +            System.out.println("Test Failed");
  58.137 +            for (int i = 0; i < images.length; i++) {
  58.138 +                String f = "NonOpaqueDestLCDAATest_"+tr[i];
  58.139 +                try {
  58.140 +                    if (images[i] instanceof VolatileImage) {
  58.141 +                        f += "_vi.png";
  58.142 +                        ImageIO.write(((VolatileImage)images[i]).
  58.143 +                                getSnapshot(), "png", new File(f));
  58.144 +                    } else {
  58.145 +                        f += "_bi.png";
  58.146 +                        ImageIO.write((BufferedImage)images[i],
  58.147 +                                       "png", new File(f));
  58.148 +                    }
  58.149 +                    System.out.printf("Dumped %s image to %s\n", tr[i], f);
  58.150 +                } catch (Throwable t) {}
  58.151 +            }
  58.152 +            passed = false;
  58.153 +        }
  58.154 +        dispose();
  58.155 +        complete.countDown();
  58.156 +    }
  58.157 +
  58.158 +    static void clear(Graphics2D  g, int type, int w, int h) {
  58.159 +        Graphics2D gg = (Graphics2D) g.create();
  58.160 +        if (type > OPAQUE) {
  58.161 +            gg.setColor(new Color(0, 0, 0, 0));
  58.162 +            gg.setComposite(AlphaComposite.Src);
  58.163 +        } else {
  58.164 +            gg.setColor(new Color(0xAD, 0xD8, 0xE6));
  58.165 +        }
  58.166 +        gg.fillRect(0, 0, w, h);
  58.167 +    }
  58.168 +
  58.169 +    private void render(Image im, int type, String s) {
  58.170 +        Graphics2D g2d = (Graphics2D) im.getGraphics();
  58.171 +        clear(g2d, type, im.getWidth(null), im.getHeight(null));
  58.172 +        g2d.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING,
  58.173 +                RenderingHints.VALUE_TEXT_ANTIALIAS_LCD_HRGB);
  58.174 +        Font f = new Font("Dialog", Font.BOLD, 40);// g2d.getFont().deriveFont(32.0f);
  58.175 +        g2d.setColor(Color.white);
  58.176 +        g2d.setFont(g2d.getFont().deriveFont(36.0f));
  58.177 +        g2d.drawString(s, 10, im.getHeight(null) / 2);
  58.178 +    }
  58.179 +
  58.180 +    Image images[];
  58.181 +    private void initImages(int w, int h) {
  58.182 +        if (images == null) {
  58.183 +            images = new Image[6];
  58.184 +            GraphicsConfiguration gc = getGraphicsConfiguration();
  58.185 +            for (int i = OPAQUE; i <= TRANSLUCENT; i++) {
  58.186 +                VolatileImage vi =
  58.187 +                    gc.createCompatibleVolatileImage(w,h/images.length,i);
  58.188 +                images[i-1] = vi;
  58.189 +                vi.validate(gc);
  58.190 +                String s = "LCD AA Text rendered to " + tr[i - 1] + " HW destination";
  58.191 +                render(vi, i, s);
  58.192 +
  58.193 +                s = "LCD AA Text rendered to " + tr[i - 1] + " SW destination";
  58.194 +                images[i-1+3] = gc.createCompatibleImage(w, h/images.length, i);
  58.195 +                render(images[i-1+3], i, s);
  58.196 +            }
  58.197 +        }
  58.198 +    }
  58.199 +
  58.200 +    public static void main(String[] args) throws InterruptedException {
  58.201 +        EventQueue.invokeLater(new Runnable() {
  58.202 +            @Override
  58.203 +            public void run() {
  58.204 +                NonOpaqueDestLCDAATest t = new NonOpaqueDestLCDAATest();
  58.205 +                t.pack();
  58.206 +                t.setVisible(true);
  58.207 +            }
  58.208 +        });
  58.209 +
  58.210 +        complete.await();
  58.211 +        if (!passed) {
  58.212 +            throw new RuntimeException("Test Failed!");
  58.213 +        }
  58.214 +    }
  58.215 +}
    59.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    59.2 +++ b/test/sun/java2d/DirectX/OpaqueImageToSurfaceBlitTest/OpaqueImageToSurfaceBlitTest.java	Tue Jan 06 16:24:03 2009 -0800
    59.3 @@ -0,0 +1,75 @@
    59.4 +/*
    59.5 + * Copyright 2007-2008 Sun Microsystems, Inc.  All Rights Reserved.
    59.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    59.7 + *
    59.8 + * This code is free software; you can redistribute it and/or modify it
    59.9 + * under the terms of the GNU General Public License version 2 only, as
   59.10 + * published by the Free Software Foundation.
   59.11 + *
   59.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
   59.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   59.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   59.15 + * version 2 for more details (a copy is included in the LICENSE file that
   59.16 + * accompanied this code).
   59.17 + *
   59.18 + * You should have received a copy of the GNU General Public License version
   59.19 + * 2 along with this work; if not, write to the Free Software Foundation,
   59.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   59.21 + *
   59.22 + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
   59.23 + * CA 95054 USA or visit www.sun.com if you need additional information or
   59.24 + * have any questions.
   59.25 + */
   59.26 +
   59.27 +/*
   59.28 + * @test
   59.29 + * @bug 6764257
   59.30 + * @summary Tests that the alpha in opaque images doesn't affect result of alpha
   59.31 + * compositing
   59.32 + * @author Dmitri.Trembovetski@sun.com: area=Graphics
   59.33 + * @run main/othervm OpaqueImageToSurfaceBlitTest
   59.34 + * @run main/othervm -Dsun.java2d.noddraw=true OpaqueImageToSurfaceBlitTest
   59.35 + * @run main/othervm -Dsun.java2d.opengl=True OpaqueImageToSurfaceBlitTest
   59.36 + */
   59.37 +
   59.38 +import java.awt.AlphaComposite;
   59.39 +import java.awt.Graphics2D;
   59.40 +import java.awt.GraphicsConfiguration;
   59.41 +import java.awt.GraphicsDevice;
   59.42 +import java.awt.GraphicsEnvironment;
   59.43 +import java.awt.image.BufferedImage;
   59.44 +import java.awt.image.DataBufferInt;
   59.45 +import java.awt.image.VolatileImage;
   59.46 +
   59.47 +public class OpaqueImageToSurfaceBlitTest {
   59.48 +
   59.49 +    public static void main(String[] args) {
   59.50 +
   59.51 +        GraphicsEnvironment ge =
   59.52 +            GraphicsEnvironment.getLocalGraphicsEnvironment();
   59.53 +        GraphicsDevice gd = ge.getDefaultScreenDevice();
   59.54 +        GraphicsConfiguration gc = gd.getDefaultConfiguration();
   59.55 +        VolatileImage vi = gc.createCompatibleVolatileImage(16, 16);
   59.56 +        vi.validate(gc);
   59.57 +
   59.58 +        BufferedImage bi =
   59.59 +            new BufferedImage(2, 2, BufferedImage.TYPE_INT_RGB);
   59.60 +        int data[] = ((DataBufferInt)bi.getRaster().getDataBuffer()).getData();
   59.61 +        data[0] = 0x0000007f;
   59.62 +        data[1] = 0x0000007f;
   59.63 +        data[2] = 0xff00007f;
   59.64 +        data[3] = 0xff00007f;
   59.65 +        Graphics2D g = vi.createGraphics();
   59.66 +        g.setComposite(AlphaComposite.SrcOver.derive(0.999f));
   59.67 +        g.drawImage(bi, 0, 0, null);
   59.68 +
   59.69 +        bi = vi.getSnapshot();
   59.70 +        if (bi.getRGB(0, 0) != bi.getRGB(1, 1)) {
   59.71 +            throw new RuntimeException("Test FAILED: color at 0x0 ="+
   59.72 +                Integer.toHexString(bi.getRGB(0, 0))+" differs from 1x1 ="+
   59.73 +                Integer.toHexString(bi.getRGB(1,1)));
   59.74 +        }
   59.75 +
   59.76 +        System.out.println("Test PASSED.");
   59.77 +    }
   59.78 +}
    60.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    60.2 +++ b/test/sun/java2d/pipe/hw/RSLContextInvalidationTest/RSLContextInvalidationTest.java	Tue Jan 06 16:24:03 2009 -0800
    60.3 @@ -0,0 +1,107 @@
    60.4 +/*
    60.5 + * Copyright 2007-2008 Sun Microsystems, Inc.  All Rights Reserved.
    60.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    60.7 + *
    60.8 + * This code is free software; you can redistribute it and/or modify it
    60.9 + * under the terms of the GNU General Public License version 2 only, as
   60.10 + * published by the Free Software Foundation.
   60.11 + *
   60.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
   60.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   60.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   60.15 + * version 2 for more details (a copy is included in the LICENSE file that
   60.16 + * accompanied this code).
   60.17 + *
   60.18 + * You should have received a copy of the GNU General Public License version
   60.19 + * 2 along with this work; if not, write to the Free Software Foundation,
   60.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   60.21 + *
   60.22 + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
   60.23 + * CA 95054 USA or visit www.sun.com if you need additional information or
   60.24 + * have any questions.
   60.25 + */
   60.26 +
   60.27 +/*
   60.28 + * @test
   60.29 + * @bug 6764257
   60.30 + * @summary Tests that the color is reset properly after save/restore context
   60.31 + * @author Dmitri.Trembovetski@sun.com: area=Graphics
   60.32 + * @compile -XDignore.symbol.file=true RSLContextInvalidationTest.java
   60.33 + * @run main/othervm RSLContextInvalidationTest
   60.34 + * @run main/othervm -Dsun.java2d.noddraw=true RSLContextInvalidationTest
   60.35 + * @run main/othervm -Dsun.java2d.opengl=True RSLContextInvalidationTest
   60.36 + */
   60.37 +
   60.38 +import java.awt.Color;
   60.39 +import java.awt.Graphics;
   60.40 +import java.awt.GraphicsConfiguration;
   60.41 +import java.awt.GraphicsDevice;
   60.42 +import java.awt.GraphicsEnvironment;
   60.43 +import java.awt.image.BufferedImage;
   60.44 +import java.awt.image.VolatileImage;
   60.45 +import sun.java2d.DestSurfaceProvider;
   60.46 +import sun.java2d.Surface;
   60.47 +import sun.java2d.pipe.RenderQueue;
   60.48 +import sun.java2d.pipe.hw.*;
   60.49 +
   60.50 +public class RSLContextInvalidationTest {
   60.51 +
   60.52 +    public static void main(String[] args) {
   60.53 +        GraphicsEnvironment ge =
   60.54 +            GraphicsEnvironment.getLocalGraphicsEnvironment();
   60.55 +        GraphicsDevice gd = ge.getDefaultScreenDevice();
   60.56 +        GraphicsConfiguration gc = gd.getDefaultConfiguration();
   60.57 +        VolatileImage vi = gc.createCompatibleVolatileImage(100, 100);
   60.58 +        vi.validate(gc);
   60.59 +        VolatileImage vi1 = gc.createCompatibleVolatileImage(100, 100);
   60.60 +        vi1.validate(gc);
   60.61 +
   60.62 +        if (!(vi instanceof DestSurfaceProvider)) {
   60.63 +            System.out.println("Test considered PASSED: no HW acceleration");
   60.64 +            return;
   60.65 +        }
   60.66 +
   60.67 +        DestSurfaceProvider p = (DestSurfaceProvider)vi;
   60.68 +        Surface s = p.getDestSurface();
   60.69 +        if (!(s instanceof AccelSurface)) {
   60.70 +            System.out.println("Test considered PASSED: no HW acceleration");
   60.71 +            return;
   60.72 +        }
   60.73 +        AccelSurface dst = (AccelSurface)s;
   60.74 +
   60.75 +        Graphics g = vi.createGraphics();
   60.76 +        g.drawImage(vi1, 95, 95, null);
   60.77 +        g.setColor(Color.red);
   60.78 +        g.fillRect(0, 0, 100, 100);
   60.79 +        g.setColor(Color.black);
   60.80 +        g.fillRect(0, 0, 100, 100);
   60.81 +        // after this the validated context color is black
   60.82 +
   60.83 +        RenderQueue rq = dst.getContext().getRenderQueue();
   60.84 +        rq.lock();
   60.85 +        try {
   60.86 +            dst.getContext().saveState();
   60.87 +            dst.getContext().restoreState();
   60.88 +        } finally {
   60.89 +            rq.unlock();
   60.90 +        }
   60.91 +
   60.92 +        // this will cause ResetPaint (it will set color to extended EA=ff,
   60.93 +        // which is ffffffff==Color.white)
   60.94 +        g.drawImage(vi1, 95, 95, null);
   60.95 +
   60.96 +        // now try filling with black again, but it will come up as white
   60.97 +        // because this fill rect won't validate the color properly
   60.98 +        g.setColor(Color.black);
   60.99 +        g.fillRect(0, 0, 100, 100);
  60.100 +
  60.101 +        BufferedImage bi = vi.getSnapshot();
  60.102 +        if (bi.getRGB(50, 50) != Color.black.getRGB()) {
  60.103 +            throw new RuntimeException("Test FAILED: found color="+
  60.104 +                Integer.toHexString(bi.getRGB(50, 50))+" instead of "+
  60.105 +                Integer.toHexString(Color.black.getRGB()));
  60.106 +        }
  60.107 +
  60.108 +        System.out.println("Test PASSED.");
  60.109 +    }
  60.110 +}