Merge
authorlana
Thu, 31 Oct 2013 15:45:57 -0700
changeset 21238 25abb19f0d7e
parent 21217 18e2f75d9321 (current diff)
parent 21237 1b9c1510de61 (diff)
child 21283 b24d2a6e59b8
Merge
--- a/jdk/src/macosx/classes/sun/lwawt/macosx/CPrinterJob.java	Thu Oct 31 12:36:25 2013 -0700
+++ b/jdk/src/macosx/classes/sun/lwawt/macosx/CPrinterJob.java	Thu Oct 31 15:45:57 2013 -0700
@@ -233,6 +233,10 @@
 
 
         setAttributes(attributes);
+        // throw exception for invalid destination
+        if (destinationAttr != null) {
+            validateDestination(destinationAttr);
+        }
 
         /* Get the range of pages we are to print. If the
          * last page to print is unknown, then we print to
--- a/jdk/src/macosx/native/sun/awt/CPrinterJob.m	Thu Oct 31 12:36:25 2013 -0700
+++ b/jdk/src/macosx/native/sun/awt/CPrinterJob.m	Thu Oct 31 15:45:57 2013 -0700
@@ -359,7 +359,11 @@
     static JNF_CLASS_CACHE(jc_Pageable, "java/awt/print/Pageable");
     static JNF_MEMBER_CACHE(jm_getCopies, sjc_CPrinterJob, "getCopiesInt", "()I");
     static JNF_MEMBER_CACHE(jm_isCollated, sjc_CPrinterJob, "isCollated", "()Z");
+    static JNF_MEMBER_CACHE(jm_getFromPage, sjc_CPrinterJob, "getFromPageAttrib", "()I");
+    static JNF_MEMBER_CACHE(jm_getToPage, sjc_CPrinterJob, "getToPageAttrib", "()I");
+    static JNF_MEMBER_CACHE(jm_getSelectAttrib, sjc_CPrinterJob, "getSelectAttrib", "()I");
     static JNF_MEMBER_CACHE(jm_getNumberOfPages, jc_Pageable, "getNumberOfPages", "()I");
+    static JNF_MEMBER_CACHE(jm_getPageFormat, sjc_CPrinterJob, "getPageFormatFromAttributes", "()Ljava/awt/print/PageFormat;");
 
     NSMutableDictionary* printingDictionary = [dst dictionary];
 
@@ -368,19 +372,35 @@
 
     jboolean collated = JNFCallBooleanMethod(env, srcPrinterJob, jm_isCollated); // AWT_THREADING Safe (known object)
     [printingDictionary setObject:[NSNumber numberWithBool:collated ? YES : NO] forKey:NSPrintMustCollate];
-
     jint jNumPages = JNFCallIntMethod(env, srcPageable, jm_getNumberOfPages); // AWT_THREADING Safe (!appKit)
     if (jNumPages != java_awt_print_Pageable_UNKNOWN_NUMBER_OF_PAGES)
     {
-        [printingDictionary setObject:[NSNumber numberWithBool:NO] forKey:NSPrintAllPages];
+        jint selectID = JNFCallIntMethod(env, srcPrinterJob, jm_getSelectAttrib);
+        if (selectID ==0) {
+            [printingDictionary setObject:[NSNumber numberWithBool:YES] forKey:NSPrintAllPages];
+        } else if (selectID == 2) {
+            // In Mac 10.7,  Print ALL is deselected if PrintSelection is YES whether
+            // NSPrintAllPages is YES or NO
+            [printingDictionary setObject:[NSNumber numberWithBool:NO] forKey:NSPrintAllPages];
+            [printingDictionary setObject:[NSNumber numberWithBool:YES] forKey:NSPrintSelectionOnly];
+        } else {
+            [printingDictionary setObject:[NSNumber numberWithBool:NO] forKey:NSPrintAllPages];
+        }
 
-        [printingDictionary setObject:[NSNumber numberWithInteger:1] forKey:NSPrintFirstPage];
-        [printingDictionary setObject:[NSNumber numberWithInteger:jNumPages] forKey:NSPrintLastPage];
+        jint fromPage = JNFCallIntMethod(env, srcPrinterJob, jm_getFromPage);
+        jint toPage = JNFCallIntMethod(env, srcPrinterJob, jm_getToPage);
+        // setting fromPage and toPage will not be shown in the dialog if printing All pages
+        [printingDictionary setObject:[NSNumber numberWithInteger:fromPage] forKey:NSPrintFirstPage];
+        [printingDictionary setObject:[NSNumber numberWithInteger:toPage] forKey:NSPrintLastPage];
     }
     else
     {
         [printingDictionary setObject:[NSNumber numberWithBool:YES] forKey:NSPrintAllPages];
     }
+    jobject page = JNFCallObjectMethod(env, srcPrinterJob, jm_getPageFormat); 
+    if (page != NULL) {
+        javaPageFormatToNSPrintInfo(env, NULL, page, dst);
+    }
 }
 
 /*
--- a/jdk/src/share/classes/com/sun/imageio/plugins/bmp/BMPImageReader.java	Thu Oct 31 12:36:25 2013 -0700
+++ b/jdk/src/share/classes/com/sun/imageio/plugins/bmp/BMPImageReader.java	Thu Oct 31 15:45:57 2013 -0700
@@ -187,15 +187,24 @@
         return 1;
     }
 
+    @Override
     public int getWidth(int imageIndex) throws IOException {
         checkIndex(imageIndex);
-        readHeader();
+        try {
+            readHeader();
+        } catch (IllegalArgumentException e) {
+            throw new IIOException(I18N.getString("BMPImageReader6"), e);
+        }
         return width;
     }
 
     public int getHeight(int imageIndex) throws IOException {
         checkIndex(imageIndex);
-        readHeader();
+        try {
+            readHeader();
+        } catch (IllegalArgumentException e) {
+            throw new IIOException(I18N.getString("BMPImageReader6"), e);
+        }
         return height;
     }
 
@@ -205,7 +214,18 @@
         }
     }
 
-    public void readHeader() throws IOException {
+    /**
+     * Process the image header.
+     *
+     * @exception IllegalStateException if source stream is not set.
+     *
+     * @exception IOException if image stream is corrupted.
+     *
+     * @exception IllegalArgumentException if the image stream does not contain
+     *             a BMP image, or if a sample model instance to describe the
+     *             image can not be created.
+     */
+    protected void readHeader() throws IOException, IllegalArgumentException {
         if (gotHeader)
             return;
 
@@ -307,6 +327,9 @@
                 case BI_RLE4:  // 4-bit RLE compression
 
                     // Read in the palette
+                    if (bitmapOffset < (size + 14)) {
+                        throw new IIOException(I18N.getString("BMPImageReader7"));
+                    }
                     int numberOfEntries = (int)((bitmapOffset-14-size) / 4);
                     int sizeOfPalette = numberOfEntries * 4;
                     palette = new byte[sizeOfPalette];
@@ -375,7 +398,7 @@
                     break;
                 default:
                     throw new
-                        RuntimeException(I18N.getString("BMPImageReader2"));
+                        IIOException(I18N.getString("BMPImageReader2"));
                 }
             } else if (size == 108 || size == 124) {
                 // Windows 4.x BMP
@@ -478,7 +501,7 @@
                 }
             } else {
                 throw new
-                    RuntimeException(I18N.getString("BMPImageReader3"));
+                    IIOException(I18N.getString("BMPImageReader3"));
             }
         }
 
@@ -660,7 +683,11 @@
     public Iterator getImageTypes(int imageIndex)
       throws IOException {
         checkIndex(imageIndex);
-        readHeader();
+        try {
+            readHeader();
+        } catch (IllegalArgumentException e) {
+            throw new IIOException(I18N.getString("BMPImageReader6"), e);
+        }
         ArrayList list = new ArrayList(1);
         list.add(new ImageTypeSpecifier(originalColorModel,
                                         originalSampleModel));
@@ -675,7 +702,11 @@
       throws IOException {
         checkIndex(imageIndex);
         if (metadata == null) {
-            readHeader();
+            try {
+                readHeader();
+            } catch (IllegalArgumentException e) {
+                throw new IIOException(I18N.getString("BMPImageReader6"), e);
+            }
         }
         return metadata;
     }
@@ -686,7 +717,11 @@
 
     public boolean isRandomAccessEasy(int imageIndex) throws IOException {
         checkIndex(imageIndex);
-        readHeader();
+        try {
+            readHeader();
+        } catch (IllegalArgumentException e) {
+            throw new IIOException(I18N.getString("BMPImageReader6"), e);
+        }
         return metadata.compression == BI_RGB;
     }
 
@@ -705,7 +740,11 @@
             param = getDefaultReadParam();
 
         //read header
-        readHeader();
+        try {
+            readHeader();
+        } catch (IllegalArgumentException e) {
+            throw new IIOException(I18N.getString("BMPImageReader6"), e);
+        }
 
         sourceRegion = new Rectangle(0, 0, 0, 0);
         destinationRegion = new Rectangle(0, 0, 0, 0);
@@ -817,7 +856,7 @@
 
             default:
                 throw new
-                    RuntimeException(I18N.getString("BMPImageReader1"));
+                    IIOException(I18N.getString("BMPImageReader1"));
             }
             break;
 
@@ -833,7 +872,7 @@
 
             default:
                 throw new
-                    RuntimeException(I18N.getString("BMPImageReader1"));
+                    IIOException(I18N.getString("BMPImageReader1"));
             }
 
             break;
@@ -874,7 +913,7 @@
 
             default:
                 throw new
-                    RuntimeException(I18N.getString("BMPImageReader1"));
+                    IIOException(I18N.getString("BMPImageReader1"));
             }
 
         case VERSION_4_8_BIT:
@@ -890,7 +929,7 @@
 
             default:
                 throw new
-                    RuntimeException(I18N.getString("BMPImageReader1"));
+                    IIOException(I18N.getString("BMPImageReader1"));
             }
             break;
 
--- a/jdk/src/share/classes/com/sun/imageio/plugins/common/iio-plugin.properties	Thu Oct 31 12:36:25 2013 -0700
+++ b/jdk/src/share/classes/com/sun/imageio/plugins/common/iio-plugin.properties	Thu Oct 31 15:45:57 2013 -0700
@@ -21,6 +21,8 @@
 BMPImageReader3=New BMP version not implemented yet.
 BMPImageReader4=No ImageIO-style reader is found for
 BMPImageReader5=Input has not been set.
+BMPImageReader6=Unable to read the image header.
+BMPImageReader7=Invalid bitmap offset.
 BMPImageWriter0=Output is not an ImageOutputStream.
 BMPImageWriter1=The image region to be encoded is empty.
 BMPImageWriter2=Only 1 or 3 band image is encoded.
@@ -34,7 +36,7 @@
 BMPMetadata1=Metadata is read-only.
 
 
-# WBMP plugin properties 
+# WBMP plugin properties
 WBMPImageReader0=Only one image exists in the stream.
 WBMPImageReader1=Input has not been set.
 WBMPImageReader2=Bad WBMP header.
--- a/jdk/src/share/classes/com/sun/imageio/plugins/gif/GIFImageReader.java	Thu Oct 31 12:36:25 2013 -0700
+++ b/jdk/src/share/classes/com/sun/imageio/plugins/gif/GIFImageReader.java	Thu Oct 31 15:45:57 2013 -0700
@@ -115,6 +115,8 @@
     // The current interlace pass, starting with 0.
     int interlacePass = 0;
 
+    private byte[] fallbackColorTable = null;
+
     // End per-stream settings
 
     // Constants used to control interlacing.
@@ -239,10 +241,22 @@
         byte[] colorTable;
         if (imageMetadata.localColorTable != null) {
             colorTable = imageMetadata.localColorTable;
+            fallbackColorTable = imageMetadata.localColorTable;
         } else {
             colorTable = streamMetadata.globalColorTable;
         }
 
+        if (colorTable == null) {
+            if (fallbackColorTable == null) {
+                this.processWarningOccurred("Use default color table.");
+
+                // no color table, the spec allows to use any palette.
+                fallbackColorTable = getDefaultPalette();
+            }
+
+            colorTable = fallbackColorTable;
+        }
+
         // Normalize color table length to 2^1, 2^2, 2^4, or 2^8
         int length = colorTable.length/3;
         int bits;
@@ -1036,5 +1050,34 @@
         streamY = -1;
         rowsDone = 0;
         interlacePass = 0;
+
+        fallbackColorTable = null;
+    }
+
+    private static byte[] defaultPalette = null;
+
+    private static synchronized byte[] getDefaultPalette() {
+        if (defaultPalette == null) {
+            BufferedImage img = new BufferedImage(1, 1,
+                    BufferedImage.TYPE_BYTE_INDEXED);
+            IndexColorModel icm = (IndexColorModel) img.getColorModel();
+
+            final int size = icm.getMapSize();
+            byte[] r = new byte[size];
+            byte[] g = new byte[size];
+            byte[] b = new byte[size];
+            icm.getReds(r);
+            icm.getGreens(g);
+            icm.getBlues(b);
+
+            defaultPalette = new byte[size * 3];
+
+            for (int i = 0; i < size; i++) {
+                defaultPalette[3 * i + 0] = r[i];
+                defaultPalette[3 * i + 1] = g[i];
+                defaultPalette[3 * i + 2] = b[i];
+            }
+        }
+        return defaultPalette;
     }
 }
--- a/jdk/src/share/classes/com/sun/imageio/plugins/jpeg/MarkerSegment.java	Thu Oct 31 12:36:25 2013 -0700
+++ b/jdk/src/share/classes/com/sun/imageio/plugins/jpeg/MarkerSegment.java	Thu Oct 31 15:45:57 2013 -0700
@@ -28,6 +28,7 @@
 import javax.imageio.metadata.IIOInvalidTreeException;
 import javax.imageio.metadata.IIOMetadataNode;
 import javax.imageio.stream.ImageOutputStream;
+import javax.imageio.IIOException;
 
 import java.io.IOException;
 
@@ -60,6 +61,10 @@
         length = (buffer.buf[buffer.bufPtr++] & 0xff) << 8;
         length |= buffer.buf[buffer.bufPtr++] & 0xff;
         length -= 2;  // JPEG length includes itself, we don't
+
+        if (length < 0) {
+            throw new IIOException("Invalid segment length: " + length);
+        }
         buffer.bufAvail -= 3;
         // Now that we know the true length, ensure that we've got it,
         // or at least a bufferful if length is too big.
--- a/jdk/src/share/classes/com/sun/imageio/plugins/jpeg/SOFMarkerSegment.java	Thu Oct 31 12:36:25 2013 -0700
+++ b/jdk/src/share/classes/com/sun/imageio/plugins/jpeg/SOFMarkerSegment.java	Thu Oct 31 15:45:57 2013 -0700
@@ -78,7 +78,7 @@
         numLines |= buffer.buf[buffer.bufPtr++] & 0xff;
         samplesPerLine = (buffer.buf[buffer.bufPtr++] & 0xff) << 8;
         samplesPerLine |= buffer.buf[buffer.bufPtr++] & 0xff;
-        int numComponents = buffer.buf[buffer.bufPtr++];
+        int numComponents = buffer.buf[buffer.bufPtr++] & 0xff;
         componentSpecs = new ComponentSpec [numComponents];
         for (int i = 0; i < numComponents; i++) {
             componentSpecs[i] = new ComponentSpec(buffer);
--- a/jdk/src/share/classes/com/sun/imageio/plugins/png/PNGImageReader.java	Thu Oct 31 12:36:25 2013 -0700
+++ b/jdk/src/share/classes/com/sun/imageio/plugins/png/PNGImageReader.java	Thu Oct 31 15:45:57 2013 -0700
@@ -688,6 +688,21 @@
             loop: while (true) {
                 int chunkLength = stream.readInt();
                 int chunkType = stream.readInt();
+                int chunkCRC;
+
+                // verify the chunk length
+                if (chunkLength < 0) {
+                    throw new IIOException("Invalid chunk lenght " + chunkLength);
+                };
+
+                try {
+                    stream.mark();
+                    stream.seek(stream.getStreamPosition() + chunkLength);
+                    chunkCRC = stream.readInt();
+                    stream.reset();
+                } catch (IOException e) {
+                    throw new IIOException("Invalid chunk length " + chunkLength);
+                }
 
                 switch (chunkType) {
                 case IDAT_TYPE:
@@ -762,7 +777,11 @@
                     break;
                 }
 
-                int chunkCRC = stream.readInt();
+                // double check whether all chunk data were consumed
+                if (chunkCRC != stream.readInt()) {
+                    throw new IIOException("Failed to read a chunk of type " +
+                            chunkType);
+                }
                 stream.flushBefore(stream.getStreamPosition());
             }
         } catch (IOException e) {
@@ -1277,6 +1296,16 @@
             is = new BufferedInputStream(is);
             this.pixelStream = new DataInputStream(is);
 
+            /*
+             * NB: the PNG spec declares that valid range for width
+             * and height is [1, 2^31-1], so here we may fail to allocate
+             * a buffer for destination image due to memory limitation.
+             *
+             * However, the recovery strategy for this case should be
+             * defined on the level of application, so we will not
+             * try to estimate the required amount of the memory and/or
+             * handle OOM in any way.
+             */
             theImage = getDestination(param,
                                       getImageTypes(0),
                                       width,
--- a/jdk/src/share/classes/java/awt/image/ComponentSampleModel.java	Thu Oct 31 12:36:25 2013 -0700
+++ b/jdk/src/share/classes/java/awt/image/ComponentSampleModel.java	Thu Oct 31 15:45:57 2013 -0700
@@ -167,6 +167,7 @@
         for (int i=0; i<numBands; i++) {
             bankIndices[i] = 0;
         }
+        verify();
     }
 
 
@@ -244,24 +245,53 @@
             throw new IllegalArgumentException("Length of bandOffsets must "+
                                                "equal length of bankIndices.");
         }
+        verify();
+    }
+
+    private void verify() {
+        int requiredSize = getBufferSize();
     }
 
     /**
      * Returns the size of the data buffer (in data elements) needed
      * for a data buffer that matches this ComponentSampleModel.
      */
-     private long getBufferSize() {
+     private int getBufferSize() {
          int maxBandOff=bandOffsets[0];
-         for (int i=1; i<bandOffsets.length; i++)
+         for (int i=1; i<bandOffsets.length; i++) {
              maxBandOff = Math.max(maxBandOff,bandOffsets[i]);
+         }
+
+         if (maxBandOff < 0 || maxBandOff > (Integer.MAX_VALUE - 1)) {
+             throw new IllegalArgumentException("Invalid band offset");
+         }
+
+         if (pixelStride < 0 || pixelStride > (Integer.MAX_VALUE / width)) {
+             throw new IllegalArgumentException("Invalid pixel stride");
+         }
+
+         if (scanlineStride < 0 || scanlineStride > (Integer.MAX_VALUE / height)) {
+             throw new IllegalArgumentException("Invalid scanline stride");
+         }
 
-         long size = 0;
-         if (maxBandOff >= 0)
-             size += maxBandOff+1;
-         if (pixelStride > 0)
-             size += pixelStride * (width-1);
-         if (scanlineStride > 0)
-             size += scanlineStride*(height-1);
+         int size = maxBandOff + 1;
+
+         int val = pixelStride * (width - 1);
+
+         if (val > (Integer.MAX_VALUE - size)) {
+             throw new IllegalArgumentException("Invalid pixel stride");
+         }
+
+         size += val;
+
+         val = scanlineStride * (height - 1);
+
+         if (val > (Integer.MAX_VALUE - size)) {
+             throw new IllegalArgumentException("Invalid scan stride");
+         }
+
+         size += val;
+
          return size;
      }
 
@@ -409,7 +439,7 @@
     public DataBuffer createDataBuffer() {
         DataBuffer dataBuffer = null;
 
-        int size = (int)getBufferSize();
+        int size = getBufferSize();
         switch (dataType) {
         case DataBuffer.TYPE_BYTE:
             dataBuffer = new DataBufferByte(size, numBanks);
--- a/jdk/src/share/classes/sun/font/StandardTextSource.java	Thu Oct 31 12:36:25 2013 -0700
+++ b/jdk/src/share/classes/sun/font/StandardTextSource.java	Thu Oct 31 15:45:57 2013 -0700
@@ -97,7 +97,7 @@
       throw new IllegalArgumentException("bad frc: null");
     }
 
-    this.chars = chars;
+    this.chars = chars.clone();
     this.start = start;
     this.len = len;
     this.cstart = cstart;
@@ -148,7 +148,7 @@
   // TextSource API
 
   public char[] getChars() {
-    return chars;
+    return chars.clone();
   }
 
   public int getStart() {
--- a/jdk/src/share/classes/sun/font/TextLabelFactory.java	Thu Oct 31 12:36:25 2013 -0700
+++ b/jdk/src/share/classes/sun/font/TextLabelFactory.java	Thu Oct 31 15:45:57 2013 -0700
@@ -32,7 +32,6 @@
 import java.awt.Font;
 
 import java.awt.font.FontRenderContext;
-import java.awt.font.LineMetrics;
 import java.text.Bidi;
 
   /**
@@ -70,7 +69,7 @@
                           Bidi bidi,
                           int flags) {
     this.frc = frc;
-    this.text = text;
+    this.text = text.clone();
     this.bidi = bidi;
     this.flags = flags;
     this.lineBidi = bidi;
@@ -82,30 +81,10 @@
     return frc;
   }
 
-  public char[] getText() {
-    return text;
-  }
-
-  public Bidi getParagraphBidi() {
-    return bidi;
-  }
-
   public Bidi getLineBidi() {
     return lineBidi;
   }
 
-  public int getLayoutFlags() {
-    return flags;
-  }
-
-  public int getLineStart() {
-    return lineStart;
-  }
-
-  public int getLineLimit() {
-    return lineLimit;
-  }
-
   /**
    * Set a line context for the factory.  Shaping only occurs on this line.
    * Characters are ordered as they would appear on this line.
--- a/jdk/src/share/classes/sun/print/RasterPrinterJob.java	Thu Oct 31 12:36:25 2013 -0700
+++ b/jdk/src/share/classes/sun/print/RasterPrinterJob.java	Thu Oct 31 15:45:57 2013 -0700
@@ -118,6 +118,16 @@
     protected static final int STREAM = 2;
 
     /**
+     * Pageable MAX pages
+     */
+    protected static final int MAX_UNKNOWN_PAGES = 9999;
+
+    protected static final int PD_ALLPAGES = 0x00000000;
+    protected static final int PD_SELECTION = 0x00000001;
+    protected static final int PD_PAGENUMS = 0x00000002;
+    protected static final int PD_NOSELECTION = 0x00000004;
+
+    /**
      * Maximum amount of memory in bytes to use for the
      * buffered image "band". 4Mb is a compromise between
      * limiting the number of bands on hi-res printers and
@@ -800,6 +810,14 @@
         }
    }
 
+   protected PageFormat getPageFormatFromAttributes() {
+       if (attributes == null) {
+            return null;
+        }
+        return attributeToPageFormat(getPrintService(), this.attributes);
+   }
+
+
    /**
      * Presents the user a dialog for changing properties of the
      * print job interactively.
@@ -1359,34 +1377,7 @@
             setAttributes(attributes);
             // throw exception for invalid destination
             if (destinationAttr != null) {
-                // destinationAttr is null for Destination(new URI(""))
-                // because isAttributeValueSupported returns false in setAttributes
-
-                // Destination(new URI(" ")) throws URISyntaxException
-                File f = new File(destinationAttr);
-                try {
-                    // check if this is a new file and if filename chars are valid
-                    if (f.createNewFile()) {
-                        f.delete();
-                    }
-                } catch (IOException ioe) {
-                    throw new PrinterException("Cannot write to file:"+
-                                               destinationAttr);
-                } catch (SecurityException se) {
-                    //There is already file read/write access so at this point
-                    // only delete access is denied.  Just ignore it because in
-                    // most cases the file created in createNewFile gets overwritten
-                    // anyway.
-                }
-
-                File pFile = f.getParentFile();
-                if ((f.exists() &&
-                     (!f.isFile() || !f.canWrite())) ||
-                    ((pFile != null) &&
-                     (!pFile.exists() || (pFile.exists() && !pFile.canWrite())))) {
-                    throw new PrinterException("Cannot write to file:"+
-                                               destinationAttr);
-                }
+                validateDestination(destinationAttr);
             }
         } else {
             spoolToService(psvc, attributes);
@@ -1509,6 +1500,40 @@
         }
     }
 
+    protected void validateDestination(String dest) throws PrinterException {
+        if (dest == null) {
+            return;
+        }
+        // dest is null for Destination(new URI(""))
+        // because isAttributeValueSupported returns false in setAttributes
+
+        // Destination(new URI(" ")) throws URISyntaxException
+        File f = new File(dest);
+        try {
+            // check if this is a new file and if filename chars are valid
+            if (f.createNewFile()) {
+                f.delete();
+            }
+        } catch (IOException ioe) {
+            throw new PrinterException("Cannot write to file:"+
+                                       dest);
+        } catch (SecurityException se) {
+            //There is already file read/write access so at this point
+            // only delete access is denied.  Just ignore it because in
+            // most cases the file created in createNewFile gets overwritten
+            // anyway.
+        }
+
+        File pFile = f.getParentFile();
+        if ((f.exists() &&
+             (!f.isFile() || !f.canWrite())) ||
+            ((pFile != null) &&
+             (!pFile.exists() || (pFile.exists() && !pFile.canWrite())))) {
+            throw new PrinterException("Cannot write to file:"+
+                                       dest);
+        }
+    }
+
     /**
      * updates a Paper object to reflect the current printer's selected
      * paper size and imageable area for that paper size.
@@ -1755,6 +1780,78 @@
             return mCollate;
     }
 
+    protected final int getSelectAttrib() {
+        if (attributes != null) {
+            SunPageSelection pages =
+                (SunPageSelection)attributes.get(SunPageSelection.class);
+            if (pages == SunPageSelection.RANGE) {
+                return PD_PAGENUMS;
+            } else if (pages == SunPageSelection.SELECTION) {
+                return PD_SELECTION;
+            } else if (pages ==  SunPageSelection.ALL) {
+                return PD_ALLPAGES;
+            }
+        }
+        return PD_NOSELECTION;
+    }
+
+    //returns 1-based index for "From" page
+    protected final int getFromPageAttrib() {
+        if (attributes != null) {
+            PageRanges pageRangesAttr =
+                (PageRanges)attributes.get(PageRanges.class);
+            if (pageRangesAttr != null) {
+                int[][] range = pageRangesAttr.getMembers();
+                return range[0][0];
+            }
+        }
+        return getMinPageAttrib();
+    }
+
+    //returns 1-based index for "To" page
+    protected final int getToPageAttrib() {
+        if (attributes != null) {
+            PageRanges pageRangesAttr =
+                (PageRanges)attributes.get(PageRanges.class);
+            if (pageRangesAttr != null) {
+                int[][] range = pageRangesAttr.getMembers();
+                return range[range.length-1][1];
+            }
+        }
+        return getMaxPageAttrib();
+    }
+
+    protected final int getMinPageAttrib() {
+        if (attributes != null) {
+            SunMinMaxPage s =
+                (SunMinMaxPage)attributes.get(SunMinMaxPage.class);
+            if (s != null) {
+                return s.getMin();
+            }
+        }
+        return 1;
+    }
+
+    protected final int getMaxPageAttrib() {
+        if (attributes != null) {
+            SunMinMaxPage s =
+                (SunMinMaxPage)attributes.get(SunMinMaxPage.class);
+            if (s != null) {
+                return s.getMax();
+            }
+        }
+
+        Pageable pageable = getPageable();
+        if (pageable != null) {
+            int numPages = pageable.getNumberOfPages();
+            if (numPages <= Pageable.UNKNOWN_NUMBER_OF_PAGES) {
+                numPages = MAX_UNKNOWN_PAGES;
+            }
+            return  ((numPages == 0) ? 1 : numPages);
+        }
+
+        return Integer.MAX_VALUE;
+    }
     /**
      * Called by the print() method at the start of
      * a print job.
--- a/jdk/src/share/native/sun/java2d/cmm/lcms/LCMS.c	Thu Oct 31 12:36:25 2013 -0700
+++ b/jdk/src/share/native/sun/java2d/cmm/lcms/LCMS.c	Thu Oct 31 15:45:57 2013 -0700
@@ -31,6 +31,7 @@
 #include "Trace.h"
 #include "Disposer.h"
 #include "lcms2.h"
+#include "jlong.h"
 
 
 #define ALIGNLONG(x) (((x)+3) & ~(3))         // Aligns to DWORD boundary
@@ -98,13 +99,6 @@
     cmsHPROFILE pf;
 } lcmsProfile_t, *lcmsProfile_p;
 
-typedef union storeID_s {    /* store SProfile stuff in a Java Long */
-    lcmsProfile_p lcmsPf;
-    cmsHTRANSFORM xf;
-    jobject jobj;
-    jlong j;
-} storeID_t, *storeID_p;
-
 typedef union {
     cmsTagSignature cms;
     jint j;
@@ -148,23 +142,21 @@
 }
 
 void LCMS_freeProfile(JNIEnv *env, jlong ptr) {
-    storeID_t sProfile;
-    sProfile.j = ptr;
+    lcmsProfile_p p = (lcmsProfile_p)jlong_to_ptr(ptr);
 
-    if (sProfile.lcmsPf != NULL) {
-        if (sProfile.lcmsPf->pf != NULL) {
-            cmsCloseProfile(sProfile.lcmsPf->pf);
+    if (p != NULL) {
+        if (p->pf != NULL) {
+            cmsCloseProfile(p->pf);
         }
-        free(sProfile.lcmsPf);
+        free(p);
     }
 }
 
 void LCMS_freeTransform(JNIEnv *env, jlong ID)
 {
-    storeID_t sTrans;
-    sTrans.j = ID;
+    cmsHTRANSFORM sTrans = jlong_to_ptr(ID);
     /* Passed ID is always valid native ref so there is no check for zero */
-    cmsDeleteTransform(sTrans.xf);
+    cmsDeleteTransform(sTrans);
 }
 
 /*
@@ -179,12 +171,16 @@
 {
     cmsHPROFILE _iccArray[DF_ICC_BUF_SIZE];
     cmsHPROFILE *iccArray = &_iccArray[0];
-    storeID_t sTrans;
+    cmsHTRANSFORM sTrans = NULL;
     int i, j, size;
     jlong* ids;
 
     size = (*env)->GetArrayLength (env, profileIDs);
     ids = (*env)->GetLongArrayElements(env, profileIDs, 0);
+    if (ids == NULL) {
+        // An exception should have already been thrown.
+        return 0L;
+    }
 
 #ifdef _LITTLE_ENDIAN
     /* Reversing data packed into int for LE archs */
@@ -209,11 +205,10 @@
 
     j = 0;
     for (i = 0; i < size; i++) {
-        cmsHPROFILE icc;
         cmsColorSpaceSignature cs;
+        lcmsProfile_p profilePtr = (lcmsProfile_p)jlong_to_ptr(ids[i]);
+        cmsHPROFILE icc = profilePtr->pf;
 
-        sTrans.j = ids[i];
-        icc = sTrans.lcmsPf->pf;
         iccArray[j++] = icc;
 
         /* Middle non-abstract profiles should be doubled before passing to
@@ -228,26 +223,26 @@
         }
     }
 
-    sTrans.xf = cmsCreateMultiprofileTransform(iccArray, j,
+    sTrans = cmsCreateMultiprofileTransform(iccArray, j,
         inFormatter, outFormatter, renderType, 0);
 
     (*env)->ReleaseLongArrayElements(env, profileIDs, ids, 0);
 
-    if (sTrans.xf == NULL) {
+    if (sTrans == NULL) {
         J2dRlsTraceLn(J2D_TRACE_ERROR, "LCMS_createNativeTransform: "
-                                       "sTrans.xf == NULL");
+                                       "sTrans == NULL");
         if ((*env)->ExceptionOccurred(env) == NULL) {
             JNU_ThrowByName(env, "java/awt/color/CMMException",
                             "Cannot get color transform");
         }
     } else {
-        Disposer_AddRecord(env, disposerRef, LCMS_freeTransform, sTrans.j);
+        Disposer_AddRecord(env, disposerRef, LCMS_freeTransform, ptr_to_jlong(sTrans));
     }
 
     if (iccArray != &_iccArray[0]) {
         free(iccArray);
     }
-    return sTrans.j;
+    return ptr_to_jlong(sTrans);
 }
 
 
@@ -261,7 +256,7 @@
 {
     jbyte* dataArray;
     jint dataSize;
-    storeID_t sProf;
+    lcmsProfile_p sProf = NULL;
     cmsHPROFILE pf;
 
     if (JNU_IsNull(env, data)) {
@@ -269,16 +264,14 @@
         return 0L;
     }
 
-    sProf.j = 0L;
-
     dataArray = (*env)->GetByteArrayElements (env, data, 0);
-    dataSize = (*env)->GetArrayLength (env, data);
-
     if (dataArray == NULL) {
-        JNU_ThrowIllegalArgumentException(env, "Invalid profile data");
+        // An exception should have already been thrown.
         return 0L;
     }
 
+    dataSize = (*env)->GetArrayLength (env, data);
+
     pf = cmsOpenProfileFromMem((const void *)dataArray,
                                      (cmsUInt32Number) dataSize);
 
@@ -303,17 +296,17 @@
 
     if (pf != NULL) {
         // create profile holder
-        sProf.lcmsPf = (lcmsProfile_p)malloc(sizeof(lcmsProfile_t));
-        if (sProf.lcmsPf != NULL) {
+        sProf = (lcmsProfile_p)malloc(sizeof(lcmsProfile_t));
+        if (sProf != NULL) {
             // register the disposer record
-            sProf.lcmsPf->pf = pf;
-            Disposer_AddRecord(env, disposerRef, LCMS_freeProfile, sProf.j);
+            sProf->pf = pf;
+            Disposer_AddRecord(env, disposerRef, LCMS_freeProfile, ptr_to_jlong(sProf));
         } else {
             cmsCloseProfile(pf);
         }
     }
 
-    return sProf.j;
+    return ptr_to_jlong(sProf);
 }
 
 /*
@@ -324,11 +317,10 @@
 JNIEXPORT jint JNICALL Java_sun_java2d_cmm_lcms_LCMS_getProfileSizeNative
   (JNIEnv *env, jobject obj, jlong id)
 {
-    storeID_t sProf;
+    lcmsProfile_p sProf = (lcmsProfile_p)jlong_to_ptr(id);
     cmsUInt32Number pfSize = 0;
-    sProf.j = id;
 
-    if (cmsSaveProfileToMem(sProf.lcmsPf->pf, NULL, &pfSize) && ((jint)pfSize > 0)) {
+    if (cmsSaveProfileToMem(sProf->pf, NULL, &pfSize) && ((jint)pfSize > 0)) {
         return (jint)pfSize;
     } else {
       JNU_ThrowByName(env, "java/awt/color/CMMException",
@@ -345,16 +337,14 @@
 JNIEXPORT void JNICALL Java_sun_java2d_cmm_lcms_LCMS_getProfileDataNative
   (JNIEnv *env, jobject obj, jlong id, jbyteArray data)
 {
-    storeID_t sProf;
+    lcmsProfile_p sProf = (lcmsProfile_p)jlong_to_ptr(id);
     jint size;
     jbyte* dataArray;
     cmsUInt32Number pfSize = 0;
     cmsBool status;
 
-    sProf.j = id;
-
     // determine actual profile size
-    if (!cmsSaveProfileToMem(sProf.lcmsPf->pf, NULL, &pfSize)) {
+    if (!cmsSaveProfileToMem(sProf->pf, NULL, &pfSize)) {
         JNU_ThrowByName(env, "java/awt/color/CMMException",
                         "Can not access specified profile.");
         return;
@@ -369,8 +359,12 @@
     }
 
     dataArray = (*env)->GetByteArrayElements (env, data, 0);
+    if (dataArray == NULL) {
+        // An exception should have already been thrown.
+        return;
+    }
 
-    status = cmsSaveProfileToMem(sProf.lcmsPf->pf, dataArray, &pfSize);
+    status = cmsSaveProfileToMem(sProf->pf, dataArray, &pfSize);
 
     (*env)->ReleaseByteArrayElements (env, data, dataArray, 0);
 
@@ -395,7 +389,7 @@
 JNIEXPORT jbyteArray JNICALL Java_sun_java2d_cmm_lcms_LCMS_getTagNative
   (JNIEnv *env, jobject obj, jlong id, jint tagSig)
 {
-    storeID_t sProf;
+    lcmsProfile_p sProf = (lcmsProfile_p)jlong_to_ptr(id);
     TagSignature_t sig;
     cmsInt32Number tagSize;
 
@@ -404,7 +398,6 @@
 
     jint bufSize;
 
-    sProf.j = id;
     sig.j = tagSig;
 
     if (tagSig == SigHead) {
@@ -415,20 +408,18 @@
         data = (*env)->NewByteArray(env, bufSize);
 
         if (data == NULL) {
-            JNU_ThrowByName(env, "java/awt/color/CMMException",
-                            "Unable to allocate buffer");
+            // An exception should have already been thrown.
             return NULL;
         }
 
         dataArray = (*env)->GetByteArrayElements (env, data, 0);
 
         if (dataArray == NULL) {
-           JNU_ThrowByName(env, "java/awt/color/CMMException",
-                            "Unable to get buffer");
-           return NULL;
+            // An exception should have already been thrown.
+            return NULL;
         }
 
-        status = _getHeaderInfo(sProf.lcmsPf->pf, dataArray, bufSize);
+        status = _getHeaderInfo(sProf->pf, dataArray, bufSize);
 
         (*env)->ReleaseByteArrayElements (env, data, dataArray, 0);
 
@@ -441,8 +432,8 @@
         return data;
     }
 
-    if (cmsIsTag(sProf.lcmsPf->pf, sig.cms)) {
-        tagSize = cmsReadRawTag(sProf.lcmsPf->pf, sig.cms, NULL, 0);
+    if (cmsIsTag(sProf->pf, sig.cms)) {
+        tagSize = cmsReadRawTag(sProf->pf, sig.cms, NULL, 0);
     } else {
         JNU_ThrowByName(env, "java/awt/color/CMMException",
                         "ICC profile tag not found");
@@ -452,20 +443,18 @@
     // allocate java array
     data = (*env)->NewByteArray(env, tagSize);
     if (data == NULL) {
-        JNU_ThrowByName(env, "java/awt/color/CMMException",
-                        "Unable to allocate buffer");
+        // An exception should have already been thrown.
         return NULL;
     }
 
     dataArray = (*env)->GetByteArrayElements (env, data, 0);
 
     if (dataArray == NULL) {
-        JNU_ThrowByName(env, "java/awt/color/CMMException",
-                        "Unable to get buffer");
+        // An exception should have already been thrown.
         return NULL;
     }
 
-    bufSize = cmsReadRawTag(sProf.lcmsPf->pf, sig.cms, dataArray, tagSize);
+    bufSize = cmsReadRawTag(sProf->pf, sig.cms, dataArray, tagSize);
 
     (*env)->ReleaseByteArrayElements (env, data, dataArray, 0);
 
@@ -485,7 +474,7 @@
 JNIEXPORT void JNICALL Java_sun_java2d_cmm_lcms_LCMS_setTagDataNative
   (JNIEnv *env, jobject obj, jlong id, jint tagSig, jbyteArray data)
 {
-    storeID_t sProf;
+    lcmsProfile_p sProf = (lcmsProfile_p)jlong_to_ptr(id);
     cmsHPROFILE pfReplace = NULL;
 
     TagSignature_t sig;
@@ -493,7 +482,6 @@
     jbyte* dataArray;
     int tagSize;
 
-    sProf.j = id;
     sig.j = tagSig;
 
     if (JNU_IsNull(env, data)) {
@@ -506,19 +494,19 @@
     dataArray = (*env)->GetByteArrayElements(env, data, 0);
 
     if (dataArray == NULL) {
-        JNU_ThrowIllegalArgumentException(env, "Can not write tag data.");
+        // An exception should have already been thrown.
         return;
     }
 
     if (tagSig == SigHead) {
-        status  = _setHeaderInfo(sProf.lcmsPf->pf, dataArray, tagSize);
+        status  = _setHeaderInfo(sProf->pf, dataArray, tagSize);
     } else {
         /*
         * New strategy for generic tags: create a place holder,
         * dump all existing tags there, dump externally supplied
         * tag, and return the new profile to the java.
         */
-        pfReplace = _writeCookedTag(sProf.lcmsPf->pf, sig.cms, dataArray, tagSize);
+        pfReplace = _writeCookedTag(sProf->pf, sig.cms, dataArray, tagSize);
         status = (pfReplace != NULL);
     }
 
@@ -527,8 +515,8 @@
     if (!status) {
         JNU_ThrowIllegalArgumentException(env, "Can not write tag data.");
     } else if (pfReplace != NULL) {
-        cmsCloseProfile(sProf.lcmsPf->pf);
-        sProf.lcmsPf->pf = pfReplace;
+        cmsCloseProfile(sProf->pf);
+        sProf->pf = pfReplace;
     }
 }
 
@@ -582,7 +570,7 @@
 JNIEXPORT void JNICALL Java_sun_java2d_cmm_lcms_LCMS_colorConvert
   (JNIEnv *env, jclass obj, jobject trans, jobject src, jobject dst)
 {
-    storeID_t sTrans;
+    cmsHTRANSFORM sTrans = NULL;
     int srcDType, dstDType;
     int srcOffset, srcNextRowOffset, dstOffset, dstNextRowOffset;
     int width, height, i;
@@ -603,9 +591,9 @@
     srcAtOnce = (*env)->GetBooleanField(env, src, IL_imageAtOnce_fID);
     dstAtOnce = (*env)->GetBooleanField(env, dst, IL_imageAtOnce_fID);
 
-    sTrans.j = (*env)->GetLongField (env, trans, Trans_ID_fID);
+    sTrans = jlong_to_ptr((*env)->GetLongField (env, trans, Trans_ID_fID));
 
-    if (sTrans.xf == NULL) {
+    if (sTrans == NULL) {
         J2dRlsTraceLn(J2D_TRACE_ERROR, "LCMS_colorConvert: transform == NULL");
         JNU_ThrowByName(env, "java/awt/color/CMMException",
                         "Cannot get color transform");
@@ -617,8 +605,7 @@
 
     if (inputBuffer == NULL) {
         J2dRlsTraceLn(J2D_TRACE_ERROR, "");
-        JNU_ThrowByName(env, "java/awt/color/CMMException",
-                        "Cannot get input data");
+        // An exception should have already been thrown.
         return;
     }
 
@@ -626,8 +613,7 @@
 
     if (outputBuffer == NULL) {
         releaseILData(env, inputBuffer, srcDType, srcData);
-        JNU_ThrowByName(env, "java/awt/color/CMMException",
-                        "Cannot get output data");
+        // An exception should have already been thrown.
         return;
     }
 
@@ -635,10 +621,10 @@
     outputRow = (char*)outputBuffer + dstOffset;
 
     if (srcAtOnce && dstAtOnce) {
-        cmsDoTransform(sTrans.xf, inputRow, outputRow, width * height);
+        cmsDoTransform(sTrans, inputRow, outputRow, width * height);
     } else {
         for (i = 0; i < height; i++) {
-            cmsDoTransform(sTrans.xf, inputRow, outputRow, width);
+            cmsDoTransform(sTrans, inputRow, outputRow, width);
             inputRow += srcNextRowOffset;
             outputRow += dstNextRowOffset;
         }
@@ -656,14 +642,22 @@
 JNIEXPORT jobject JNICALL Java_sun_java2d_cmm_lcms_LCMS_getProfileID
   (JNIEnv *env, jclass cls, jobject pf)
 {
+    jclass clsLcmsProfile;
+    jobject cmmProfile;
     jfieldID fid = (*env)->GetFieldID (env,
         (*env)->GetObjectClass(env, pf),
         "cmmProfile", "Lsun/java2d/cmm/Profile;");
+    if (fid == NULL) {
+        return NULL;
+    }
 
-    jclass clsLcmsProfile = (*env)->FindClass(env,
+    clsLcmsProfile = (*env)->FindClass(env,
             "sun/java2d/cmm/lcms/LCMSProfile");
+    if (clsLcmsProfile == NULL) {
+        return NULL;
+    }
 
-    jobject cmmProfile = (*env)->GetObjectField (env, pf, fid);
+    cmmProfile = (*env)->GetObjectField (env, pf, fid);
 
     if (JNU_IsNull(env, cmmProfile)) {
         return NULL;
@@ -687,18 +681,51 @@
      * unloading
      */
     Trans_renderType_fID = (*env)->GetFieldID (env, Trans, "renderType", "I");
+    if (Trans_renderType_fID == NULL) {
+        return;
+    }
     Trans_ID_fID = (*env)->GetFieldID (env, Trans, "ID", "J");
+    if (Trans_ID_fID == NULL) {
+        return;
+    }
 
     IL_isIntPacked_fID = (*env)->GetFieldID (env, IL, "isIntPacked", "Z");
+    if (IL_isIntPacked_fID == NULL) {
+        return;
+    }
     IL_dataType_fID = (*env)->GetFieldID (env, IL, "dataType", "I");
+    if (IL_dataType_fID == NULL) {
+        return;
+    }
     IL_pixelType_fID = (*env)->GetFieldID (env, IL, "pixelType", "I");
+    if (IL_pixelType_fID == NULL) {
+        return;
+    }
     IL_dataArray_fID = (*env)->GetFieldID(env, IL, "dataArray",
                                           "Ljava/lang/Object;");
+    if (IL_dataArray_fID == NULL) {
+        return;
+    }
     IL_width_fID = (*env)->GetFieldID (env, IL, "width", "I");
+    if (IL_width_fID == NULL) {
+        return;
+    }
     IL_height_fID = (*env)->GetFieldID (env, IL, "height", "I");
+    if (IL_height_fID == NULL) {
+        return;
+    }
     IL_offset_fID = (*env)->GetFieldID (env, IL, "offset", "I");
+    if (IL_offset_fID == NULL) {
+        return;
+    }
     IL_imageAtOnce_fID = (*env)->GetFieldID (env, IL, "imageAtOnce", "Z");
+    if (IL_imageAtOnce_fID == NULL) {
+        return;
+    }
     IL_nextRowOffset_fID = (*env)->GetFieldID (env, IL, "nextRowOffset", "I");
+    if (IL_nextRowOffset_fID == NULL) {
+        return;
+    }
 }
 
 static cmsBool _getHeaderInfo(cmsHPROFILE pf, jbyte* pBuffer, jint bufferSize)
@@ -709,7 +736,7 @@
 
   if (!cmsSaveProfileToMem(pf, NULL, &pfSize) ||
       pfSize < sizeof(cmsICCHeader) ||
-      bufferSize < sizeof(cmsICCHeader))
+      bufferSize < (jint)sizeof(cmsICCHeader))
   {
     return FALSE;
   }
@@ -730,9 +757,9 @@
 
 static cmsBool _setHeaderInfo(cmsHPROFILE pf, jbyte* pBuffer, jint bufferSize)
 {
-  cmsICCHeader pfHeader = { 0 };
+  cmsICCHeader pfHeader;
 
-  if (pBuffer == NULL || bufferSize < sizeof(cmsICCHeader)) {
+  if (pBuffer == NULL || bufferSize < (jint)sizeof(cmsICCHeader)) {
     return FALSE;
   }
 
@@ -765,13 +792,14 @@
     cmsInt32Number i;
     cmsHPROFILE pfSanity = NULL;
 
-    cmsICCHeader hdr = { 0 };
+    cmsICCHeader hdr;
 
     cmsHPROFILE p = cmsCreateProfilePlaceholder(NULL);
 
     if (NULL == p) {
         return NULL;
     }
+    memset(&hdr, 0, sizeof(cmsICCHeader));
 
     // Populate the placeholder's header according to target profile
     hdr.flags = cmsGetHeaderFlags(pfTarget);
--- a/jdk/src/share/native/sun/java2d/opengl/OGLBlitLoops.c	Thu Oct 31 12:36:25 2013 -0700
+++ b/jdk/src/share/native/sun/java2d/opengl/OGLBlitLoops.c	Thu Oct 31 15:45:57 2013 -0700
@@ -661,7 +661,12 @@
                             (sy2-sy1) != (jint)(dy2-dy1) ||
                             oglc->extraAlpha != 1.0f;
                         break;
-
+#ifdef MACOSX
+                    case OGLC_VENDOR_ATI:
+                        // see 8024461
+                        viaTexture = JNI_TRUE;
+                        break;
+#endif
                     default:
                         // just use the glDrawPixels() codepath
                         viaTexture = JNI_FALSE;
--- a/jdk/src/solaris/classes/sun/font/FontConfigManager.java	Thu Oct 31 12:36:25 2013 -0700
+++ b/jdk/src/solaris/classes/sun/font/FontConfigManager.java	Thu Oct 31 15:45:57 2013 -0700
@@ -108,10 +108,6 @@
     public FontConfigManager() {
     }
 
-    public static String[] getFontConfigNames() {
-        return fontConfigNames;
-    }
-
     /* Called from code that needs to know what are the AA settings
      * that apps using FC would pick up for the default desktop font.
      * Note apps can change the default desktop font. etc, so this
@@ -182,7 +178,6 @@
             t0 = System.nanoTime();
         }
 
-        String[] fontConfigNames = FontConfigManager.getFontConfigNames();
         FcCompFont[] fontArr = new FcCompFont[fontConfigNames.length];
 
         for (int i = 0; i< fontArr.length; i++) {
--- a/jdk/src/solaris/classes/sun/java2d/xr/MaskTileManager.java	Thu Oct 31 12:36:25 2013 -0700
+++ b/jdk/src/solaris/classes/sun/java2d/xr/MaskTileManager.java	Thu Oct 31 15:45:57 2013 -0700
@@ -76,8 +76,9 @@
     public void fillMask(XRSurfaceData dst) {
 
         boolean maskRequired = xrMgr.maskRequired();
+        boolean maskEvaluated = XRUtils.isMaskEvaluated(xrMgr.compRule);
 
-        if (maskRequired) {
+        if (maskRequired && maskEvaluated) {
             mainTile.calculateDirtyAreas();
             DirtyRegion dirtyArea = mainTile.getDirtyArea().cloneRegion();
             mainTile.translate(-dirtyArea.x, -dirtyArea.y);
@@ -106,7 +107,15 @@
                 }
             }
         } else {
-            xrMgr.XRRenderRectangles(dst, mainTile.getRects());
+            /*
+             * If a mask would be required to store geometry (maskRequired)
+             * composition has to be done rectangle-by-rectagle.
+             */
+            if(xrMgr.isSolidPaintActive()) {
+                xrMgr.XRRenderRectangles(dst, mainTile.getRects());
+            } else {
+                xrMgr.XRCompositeRectangles(dst, mainTile.getRects());
+            }
         }
 
         mainTile.reset();
--- a/jdk/src/solaris/classes/sun/java2d/xr/XRBackend.java	Thu Oct 31 12:36:25 2013 -0700
+++ b/jdk/src/solaris/classes/sun/java2d/xr/XRBackend.java	Thu Oct 31 15:45:57 2013 -0700
@@ -100,14 +100,13 @@
                                      int xSrc, int ySrc, int xDst, int yDst,
                                      int glyphset, GrowableEltArray elts);
 
-    public int createRadialGradient(Point2D inner, Point2D outer,
+    public int createRadialGradient(float centerX, float centerY,
                                     float innerRadius, float outerRadius,
                                     float[] fractions, int[] pixels,
-                                    int repeat, AffineTransform transform);
+                                    int repeat);
 
     public int createLinearGradient(Point2D p1, Point2D p2, float[] fractions,
-                                    int[] pixels, int repeat,
-                                     AffineTransform transform);
+                                    int[] pixels, int repeat);
 
     public void setGCMode(long gc, boolean copy);
 
--- a/jdk/src/solaris/classes/sun/java2d/xr/XRBackendNative.java	Thu Oct 31 12:36:25 2013 -0700
+++ b/jdk/src/solaris/classes/sun/java2d/xr/XRBackendNative.java	Thu Oct 31 15:45:57 2013 -0700
@@ -105,17 +105,14 @@
         XRCreateLinearGradientPaintNative(float[] fractionsArray,
                                           short[] pixelsArray,
                                           int x1, int y1, int x2, int y2,
-                                          int numStops, int repeat,
-                                          int m00, int m01, int m02,
-                                           int m10, int m11, int m12);
+                                          int numStops, int repeat);
 
     private native static int
         XRCreateRadialGradientPaintNative(float[] fractionsArray,
                                           short[] pixelsArray, int numStops,
+                                          int centerX, int centerY,
                                           int innerRadius, int outerRadius,
-                                          int repeat,
-                                          int m00, int m01, int m02,
-                                          int m10, int m11, int m12);
+                                          int repeat);
 
     public native void setFilter(int picture, int filter);
 
@@ -175,40 +172,29 @@
     }
 
     public int createLinearGradient(Point2D p1, Point2D p2, float[] fractions,
-                              int[] pixels,  int repeat, AffineTransform trx) {
+                              int[] pixels,  int repeat) {
 
         short[] colorValues = getRenderColors(pixels);
         int gradient =
            XRCreateLinearGradientPaintNative(fractions, colorValues,
                 XDoubleToFixed(p1.getX()), XDoubleToFixed(p1.getY()),
                 XDoubleToFixed(p2.getX()), XDoubleToFixed(p2.getY()),
-                fractions.length, repeat,
-                XDoubleToFixed(trx.getScaleX()),
-                XDoubleToFixed(trx.getShearX()),
-                XDoubleToFixed(trx.getTranslateX()),
-                XDoubleToFixed(trx.getShearY()),
-                XDoubleToFixed(trx.getScaleY()),
-                XDoubleToFixed(trx.getTranslateY()));
+                fractions.length, repeat);
         return gradient;
     }
 
-    public int createRadialGradient(Point2D inner, Point2D outer,
+    public int createRadialGradient(float centerX, float centerY,
                                    float innerRadius, float outerRadius,
-                                   float[] fractions, int[] pixels, int repeat,
-                                   AffineTransform trx) {
+                                   float[] fractions, int[] pixels, int repeat) {
 
         short[] colorValues = getRenderColors(pixels);
         return XRCreateRadialGradientPaintNative
              (fractions, colorValues, fractions.length,
+              XDoubleToFixed(centerX),
+              XDoubleToFixed(centerY),
               XDoubleToFixed(innerRadius),
               XDoubleToFixed(outerRadius),
-              repeat,
-              XDoubleToFixed(trx.getScaleX()),
-              XDoubleToFixed(trx.getShearX()),
-              XDoubleToFixed(trx.getTranslateX()),
-              XDoubleToFixed(trx.getShearY()),
-              XDoubleToFixed(trx.getScaleY()),
-              XDoubleToFixed(trx.getTranslateY()));
+              repeat);
     }
 
     public void setGCClipRectangles(long gc, Region clip) {
--- a/jdk/src/solaris/classes/sun/java2d/xr/XRColor.java	Thu Oct 31 12:36:25 2013 -0700
+++ b/jdk/src/solaris/classes/sun/java2d/xr/XRColor.java	Thu Oct 31 15:45:57 2013 -0700
@@ -54,6 +54,7 @@
     }
 
     public XRColor(Color color) {
+        setColorValues(color);
     }
 
     public void setColorValues(Color color) {
--- a/jdk/src/solaris/classes/sun/java2d/xr/XRCompositeManager.java	Thu Oct 31 12:36:25 2013 -0700
+++ b/jdk/src/solaris/classes/sun/java2d/xr/XRCompositeManager.java	Thu Oct 31 15:45:57 2013 -0700
@@ -48,7 +48,12 @@
     private static boolean enableGradCache = true;
     private static XRCompositeManager instance;
 
-    XRSurfaceData src;
+    private final static int SOLID = 0;
+    private final static int TEXTURE = 1;
+    private final static int GRADIENT = 2;
+
+    int srcType;
+    XRSolidSrcPict solidSrc32;
     XRSurfaceData texture;
     XRSurfaceData gradient;
     int alphaMask = XRUtils.None;
@@ -84,7 +89,6 @@
 
     private XRCompositeManager(XRSurfaceData surface) {
         con = new XRBackendNative();
-        // con = XRBackendJava.getInstance();
 
         String gradProp =
             AccessController.doPrivileged(new PrivilegedAction<String>() {
@@ -109,14 +113,7 @@
     public void initResources(XRSurfaceData surface) {
         int parentXid = surface.getXid();
 
-        int solidPixmap = con.createPixmap(parentXid, 32, 1, 1);
-        int solidSrcPictXID = con.createPicture(solidPixmap,
-                XRUtils.PictStandardARGB32);
-        con.setPictureRepeat(solidSrcPictXID, XRUtils.RepeatNormal);
-        con.renderRectangle(solidSrcPictXID, XRUtils.PictOpSrc,
-                XRColor.FULL_ALPHA, 0, 0, 1, 1);
-        solidSrcPict = new XRSurfaceData.XRInternalSurfaceData(con,
-                solidSrcPictXID, null);
+        solidSrc32 = new XRSolidSrcPict(con, parentXid);
         setForeground(0);
 
         int extraAlphaMask = con.createPixmap(parentXid, 8, 1, 1);
@@ -135,9 +132,7 @@
     }
 
     public void setForeground(int pixel) {
-        solidColor.setColorValues(pixel, false);
-        con.renderRectangle(solidSrcPict.picture, XRUtils.PictOpSrc,
-                solidColor, 0, 0, 1, 1);
+        solidColor.setColorValues(pixel, true);
     }
 
     public void setGradientPaint(XRSurfaceData gradient) {
@@ -145,16 +140,16 @@
             con.freePicture(this.gradient.picture);
         }
         this.gradient = gradient;
-        src = gradient;
+        srcType = GRADIENT;
     }
 
     public void setTexturePaint(XRSurfaceData texture) {
         this.texture = texture;
-        src = texture;
+        this.srcType = TEXTURE;
     }
 
     public void XRResetPaint() {
-        src = solidSrcPict;
+        srcType = SOLID;
     }
 
     public void validateCompositeState(Composite comp, AffineTransform xform,
@@ -175,7 +170,7 @@
             validatedComp = comp;
         }
 
-        if (sg2d != null && validatedPixel != sg2d.pixel) {
+        if (sg2d != null && (validatedPixel != sg2d.pixel  || updatePaint)) {
             validatedPixel = sg2d.pixel;
             setForeground(validatedPixel);
         }
@@ -191,14 +186,14 @@
             validatedPaint = paint;
         }
 
-        if (src != solidSrcPict) {
+        if (srcType != SOLID) {
             AffineTransform at = (AffineTransform) xform.clone();
             try {
                 at.invert();
             } catch (NoninvertibleTransformException e) {
                 at.setToIdentity();
             }
-            src.validateAsSource(at, -1, -1);
+            getCurrentSource().validateAsSource(at, -1, XRUtils.ATransOpToXRQuality(sg2d.interpolationType));
         }
     }
 
@@ -234,13 +229,13 @@
 
     public boolean maskRequired() {
         return (!xorEnabled)
-                && ((src != solidSrcPict)
-                        || (src == solidSrcPict && solidColor.alpha != 0xffff) || (extraAlpha != 1.0f));
+                && ((srcType != SOLID)
+                        || (srcType == SOLID && (solidColor.alpha != 0xffff) || (extraAlpha != 1.0f)));
     }
 
     public void XRComposite(int src, int mask, int dst, int srcX, int srcY,
             int maskX, int maskY, int dstX, int dstY, int width, int height) {
-        int cachedSrc = (src == XRUtils.None) ? this.src.picture : src;
+        int cachedSrc = (src == XRUtils.None) ? getCurrentSource().picture : src;
         int cachedX = srcX;
         int cachedY = srcY;
 
@@ -276,7 +271,7 @@
         renderReferenceY = (int) Math.floor(XRUtils
                 .XFixedToDouble(renderReferenceY));
 
-        con.renderCompositeTrapezoids(compRule, src.picture,
+        con.renderCompositeTrapezoids(compRule, getCurrentSource().picture,
                 XRUtils.PictStandardA8, dst, renderReferenceX,
                 renderReferenceY, trapList);
     }
@@ -294,15 +289,46 @@
         }
     }
 
+    public void XRCompositeRectangles(XRSurfaceData dst, GrowableRectArray rects) {
+        int srcPict = getCurrentSource().picture;
+
+        for(int i=0; i < rects.getSize(); i++) {
+            int x = rects.getX(i);
+            int y = rects.getY(i);
+            int width = rects.getWidth(i);
+            int height = rects.getHeight(i);
+
+            con.renderComposite(compRule, srcPict, XRUtils.None, dst.picture, x, y, 0, 0, x, y, width, height);
+        }
+    }
+
+    protected XRSurfaceData getCurrentSource() {
+        switch(srcType) {
+        case SOLID:
+            return solidSrc32.prepareSrcPict(validatedPixel);
+        case TEXTURE:
+            return texture;
+        case GRADIENT:
+            return gradient;
+        }
+
+        return null;
+    }
+
     public void compositeBlit(XRSurfaceData src, XRSurfaceData dst, int sx,
             int sy, int dx, int dy, int w, int h) {
         con.renderComposite(compRule, src.picture, alphaMask, dst.picture, sx,
                 sy, 0, 0, dx, dy, w, h);
     }
 
-    public void compositeText(XRSurfaceData dst, int sx, int sy,
-            int glyphSet, int maskFormat, GrowableEltArray elts) {
-        con.XRenderCompositeText(compRule, src.picture, dst.picture,
+    public void compositeText(XRSurfaceData dst, int sx, int sy, int glyphSet,
+            int maskFormat, GrowableEltArray elts) {
+        /*
+         * Try to emulate the SRC blend mode with SRC_OVER.
+         * We bail out during pipe validation for cases where this is not possible.
+         */
+        byte textCompRule = (compRule != XRUtils.PictOpSrc) ? compRule : XRUtils.PictOpOver;
+        con.XRenderCompositeText(textCompRule, getCurrentSource().picture, dst.picture,
                 maskFormat, sx, sy, 0, 0, glyphSet, elts);
     }
 
@@ -315,7 +341,11 @@
     }
 
     public boolean isTexturePaintActive() {
-        return src == texture;
+        return srcType == TEXTURE;
+    }
+
+    public boolean isSolidPaintActive() {
+        return srcType == SOLID;
     }
 
     public XRColor getAlphaColor() {
--- a/jdk/src/solaris/classes/sun/java2d/xr/XRDrawImage.java	Thu Oct 31 12:36:25 2013 -0700
+++ b/jdk/src/solaris/classes/sun/java2d/xr/XRDrawImage.java	Thu Oct 31 15:45:57 2013 -0700
@@ -38,6 +38,7 @@
  */
 
 public class XRDrawImage extends DrawImage {
+
     @Override
     protected void renderImageXform(SunGraphics2D sg, Image img,
             AffineTransform tx, int interpType, int sx1, int sy1, int sx2,
@@ -45,20 +46,24 @@
         SurfaceData dstData = sg.surfaceData;
         SurfaceData srcData = dstData.getSourceSurfaceData(img,
                 SunGraphics2D.TRANSFORM_GENERIC, sg.imageComp, bgColor);
+        int compRule = ((AlphaComposite) sg.composite).getRule();
+        float extraAlpha = ((AlphaComposite) sg.composite).getAlpha();
 
         if (srcData != null && !isBgOperation(srcData, bgColor)
-                && interpType <= AffineTransformOp.TYPE_BILINEAR) {
+                && interpType <= AffineTransformOp.TYPE_BILINEAR
+                && (XRUtils.isMaskEvaluated(XRUtils.j2dAlphaCompToXR(compRule))
+                        || (XRUtils.isTransformQuadrantRotated(tx)) && extraAlpha == 1.0f))
+                         {
             SurfaceType srcType = srcData.getSurfaceType();
             SurfaceType dstType = dstData.getSurfaceType();
 
             TransformBlit blit = TransformBlit.getFromCache(srcType,
                     sg.imageComp, dstType);
-
             if (blit != null) {
                 blit.Transform(srcData, dstData, sg.composite,
                         sg.getCompClip(), tx, interpType, sx1, sy1, 0, 0, sx2
                                 - sx1, sy2 - sy1);
-                return;
+                    return;
             }
         }
 
--- a/jdk/src/solaris/classes/sun/java2d/xr/XRMaskBlit.java	Thu Oct 31 12:36:25 2013 -0700
+++ b/jdk/src/solaris/classes/sun/java2d/xr/XRMaskBlit.java	Thu Oct 31 15:45:57 2013 -0700
@@ -84,7 +84,7 @@
 
             int maskPict = maskBuffer.getMaskBuffer().
                          uploadMask(width, height, maskscan, maskoff, mask);
-            maskBuffer.XRComposite(x11sd.getPicture(), maskPict, x11sd.picture,
+            maskBuffer.XRComposite(x11sd.getPicture(), maskPict, x11dst.getPicture(),
                                   srcx, srcy, 0, 0, dstx, dsty, width, height);
             maskBuffer.getMaskBuffer().clearUploadMask(maskPict, width, height);
         } finally {
--- a/jdk/src/solaris/classes/sun/java2d/xr/XRPMBlitLoops.java	Thu Oct 31 12:36:25 2013 -0700
+++ b/jdk/src/solaris/classes/sun/java2d/xr/XRPMBlitLoops.java	Thu Oct 31 15:45:57 2013 -0700
@@ -178,9 +178,6 @@
         super(srcType, CompositeType.AnyAlpha, dstType);
     }
 
-    /*
-     * TODO: This breaks scales with non-integer coordinates!?!?!
-     */
     public void Scale(SurfaceData src, SurfaceData dst, Composite comp, Region clip, int sx1, int sy1, int sx2, int sy2, double dx1, double dy1,
             double dx2, double dy2) {
         try {
@@ -199,19 +196,14 @@
             sy1 *= yScale;
             sy2 *= yScale;
 
+            dx1 = Math.ceil(dx1 - 0.5);
+            dy1 = Math.ceil(dy1 - 0.5);
+            dx2 = Math.ceil(dx2 - 0.5);
+            dy2 = Math.ceil(dy2 - 0.5);
+
             AffineTransform xForm = AffineTransform.getScaleInstance(1 / xScale, 1 / yScale);
 
-            x11sdSrc.validateAsSource(xForm, XRUtils.RepeatNone, XRUtils.FAST); /*
-                                                                                 * TODO:
-                                                                                 * padded
-                                                                                 * blit
-                                                                                 * required
-                                                                                 * :
-                                                                                 * -
-                                                                                 * /
-                                                                                 * ?
-                                                                                 * ?
-                                                                                 */
+            x11sdSrc.validateAsSource(xForm, XRUtils.RepeatNone, XRUtils.FAST);
             x11sdDst.maskBuffer.compositeBlit(x11sdSrc, x11sdDst, (int) sx1, (int) sy1, (int) dx1, (int) dy1, (int) (dx2 - dx1), (int) (dy2 - dy1));
         } finally {
             SunToolkit.awtUnlock();
@@ -234,43 +226,55 @@
     }
 
     /*
-     * Calculates the composite-rectangle required for transformed blits. This
-     * method is functionally equal to: Shape shp =
-     * xform.createTransformedShape(rect); Rectangle bounds = shp.getBounds();
-     * but performs significantly better.
-     * Returns true if the destination shape is parallel to x/y axis
+     * Calculates the composition-rectangle required for transformed blits.
+     * For composite operations where the composition-rectangle defines
+     * the modified destination area, coordinates are rounded.
+     * Otherwise the composition window rectangle is sized large enough
+     * to not clip away any pixels.
      */
-    protected boolean adjustCompositeBounds(AffineTransform tr, int dstx, int dsty, int width, int height) {
+    protected void adjustCompositeBounds(boolean isQuadrantRotated, AffineTransform tr,
+            int dstx, int dsty, int width, int height) {
         srcCoords[0] = dstx;
         srcCoords[1] = dsty;
         srcCoords[2] = dstx + width;
-        srcCoords[3] = dsty;
-        srcCoords[4] = dstx + width;
-        srcCoords[5] = dsty + height;
-        srcCoords[6] = dstx;
-        srcCoords[7] = dsty + height;
+        srcCoords[3] = dsty + height;
 
-        tr.transform(srcCoords, 0, dstCoords, 0, 4);
+        double minX, minY, maxX, maxY;
+        if (isQuadrantRotated) {
+            tr.transform(srcCoords, 0, dstCoords, 0, 2);
+
+            minX = Math.min(dstCoords[0], dstCoords[2]);
+            minY = Math.min(dstCoords[1], dstCoords[3]);
+            maxX = Math.max(dstCoords[0], dstCoords[2]);
+            maxY = Math.max(dstCoords[1], dstCoords[3]);
 
-        double minX = Math.min(dstCoords[0], Math.min(dstCoords[2], Math.min(dstCoords[4], dstCoords[6])));
-        double minY = Math.min(dstCoords[1], Math.min(dstCoords[3], Math.min(dstCoords[5], dstCoords[7])));
-        double maxX = Math.max(dstCoords[0], Math.max(dstCoords[2], Math.max(dstCoords[4], dstCoords[6])));
-        double maxY = Math.max(dstCoords[1], Math.max(dstCoords[3], Math.max(dstCoords[5], dstCoords[7])));
+            minX = Math.ceil(minX - 0.5);
+            minY = Math.ceil(minY - 0.5);
+            maxX = Math.ceil(maxX - 0.5);
+            maxY = Math.ceil(maxY - 0.5);
+        } else {
+            srcCoords[4] = dstx;
+            srcCoords[5] = dsty + height;
+            srcCoords[6] = dstx + width;
+            srcCoords[7] = dsty;
 
-        minX = Math.round(minX);
-        minY = Math.round(minY);
-        maxX = Math.round(maxX);
-        maxY = Math.round(maxY);
+            tr.transform(srcCoords, 0, dstCoords, 0, 4);
+
+            minX = Math.min(dstCoords[0], Math.min(dstCoords[2], Math.min(dstCoords[4], dstCoords[6])));
+            minY = Math.min(dstCoords[1], Math.min(dstCoords[3], Math.min(dstCoords[5], dstCoords[7])));
+            maxX = Math.max(dstCoords[0], Math.max(dstCoords[2], Math.max(dstCoords[4], dstCoords[6])));
+            maxY = Math.max(dstCoords[1], Math.max(dstCoords[3], Math.max(dstCoords[5], dstCoords[7])));
+
+            minX = Math.floor(minX);
+            minY = Math.floor(minY);
+            maxX = Math.ceil(maxX);
+            maxY = Math.ceil(maxY);
+        }
 
         compositeBounds.x = (int) minX;
         compositeBounds.y = (int) minY;
         compositeBounds.width = (int) (maxX - minX);
         compositeBounds.height = (int) (maxY - minY);
-
-        boolean is0or180 = (dstCoords[1] == dstCoords[3]) && (dstCoords[2] == dstCoords[4]);
-        boolean is90or270 = (dstCoords[0] == dstCoords[2]) && (dstCoords[3] == dstCoords[5]);
-
-        return is0or180 || is90or270;
     }
 
     public void Transform(SurfaceData src, SurfaceData dst, Composite comp, Region clip, AffineTransform xform,
@@ -280,9 +284,13 @@
 
             XRSurfaceData x11sdDst = (XRSurfaceData) dst;
             XRSurfaceData x11sdSrc = (XRSurfaceData) src;
+            XRCompositeManager xrMgr = XRCompositeManager.getInstance(x11sdSrc);
 
+            float extraAlpha = ((AlphaComposite) comp).getAlpha();
             int filter = XRUtils.ATransOpToXRQuality(hint);
-            boolean isAxisAligned = adjustCompositeBounds(xform, dstx, dsty, width, height);
+            boolean isQuadrantRotated = XRUtils.isTransformQuadrantRotated(xform);
+
+            adjustCompositeBounds(isQuadrantRotated, xform, dstx, dsty, width, height);
 
             x11sdDst.validateAsDestination(null, clip);
             x11sdDst.maskBuffer.validateCompositeState(comp, null, null, null);
@@ -298,21 +306,26 @@
                 trx.setToIdentity();
             }
 
-            boolean omitMask = (filter == XRUtils.FAST)
-                    || (isAxisAligned && ((AlphaComposite) comp).getAlpha() == 1.0f);
-
-            if (!omitMask) {
+            if (filter != XRUtils.FAST && (!isQuadrantRotated || extraAlpha != 1.0f)) {
                 XRMaskImage mask = x11sdSrc.maskBuffer.getMaskImage();
 
+                // For quadrant-transformed blits geometry is not stored inside the mask
+                // therefore we can use a repeating 1x1 mask for applying extra alpha.
+                int maskPicture = isQuadrantRotated ? xrMgr.getExtraAlphaMask()
+                        : mask.prepareBlitMask(x11sdDst, maskTX, width, height);
+
                 x11sdSrc.validateAsSource(trx, XRUtils.RepeatPad, filter);
-                int maskPicture = mask.prepareBlitMask(x11sdDst, maskTX, width, height);
-                x11sdDst.maskBuffer.con.renderComposite(XRCompositeManager.getInstance(x11sdSrc).getCompRule(), x11sdSrc.picture, maskPicture, x11sdDst.picture,
-                        0, 0, 0, 0, compositeBounds.x, compositeBounds.y, compositeBounds.width, compositeBounds.height);
+                x11sdDst.maskBuffer.con.renderComposite(xrMgr.getCompRule(), x11sdSrc.picture,
+                        maskPicture, x11sdDst.picture, 0, 0, 0, 0, compositeBounds.x, compositeBounds.y,
+                        compositeBounds.width, compositeBounds.height);
             } else {
                 int repeat = filter == XRUtils.FAST ? XRUtils.RepeatNone : XRUtils.RepeatPad;
 
                 x11sdSrc.validateAsSource(trx, repeat, filter);
-                x11sdDst.maskBuffer.compositeBlit(x11sdSrc, x11sdDst, 0, 0, compositeBounds.x, compositeBounds.y, compositeBounds.width, compositeBounds.height);
+
+                // compositeBlit takes care of extra alpha
+                x11sdDst.maskBuffer.compositeBlit(x11sdSrc, x11sdDst, 0, 0, compositeBounds.x,
+                        compositeBounds.y, compositeBounds.width, compositeBounds.height);
             }
         } finally {
             SunToolkit.awtUnlock();
@@ -329,9 +342,7 @@
     }
 
     public void Blit(SurfaceData src, SurfaceData dst, Composite comp, Region clip, int sx, int sy, int dx, int dy, int w, int h) {
-        /*
-         * If the blit is write-only (putimge), no need for a temporary VI.
-         */
+        // If the blit is write-only (putimge), no need for a temporary VI.
         if (CompositeType.SrcOverNoEa.equals(comp) && (src.getTransparency() == Transparency.OPAQUE)) {
             Blit opaqueSwToSurfaceBlit = Blit.getFromCache(src.getSurfaceType(), CompositeType.SrcNoEa, dst.getSurfaceType());
             opaqueSwToSurfaceBlit.Blit(src, dst, comp, clip, sx, sy, dx, dy, w, h);
--- a/jdk/src/solaris/classes/sun/java2d/xr/XRPaints.java	Thu Oct 31 12:36:25 2013 -0700
+++ b/jdk/src/solaris/classes/sun/java2d/xr/XRPaints.java	Thu Oct 31 15:45:57 2013 -0700
@@ -29,10 +29,9 @@
 import java.awt.MultipleGradientPaint.*;
 import java.awt.geom.*;
 import java.awt.image.*;
-
 import sun.java2d.*;
 import sun.java2d.loops.*;
-import sun.java2d.pipe.*;
+import sun.java2d.xr.XRSurfaceData.XRInternalSurfaceData;
 
 abstract class XRPaints {
     static XRCompositeManager xrCompMan;
@@ -108,27 +107,16 @@
         void setXRPaint(SunGraphics2D sg2d, Paint pt) {
             GradientPaint paint = (GradientPaint) pt;
 
-            int[] pixels = convertToIntArgbPixels(new Color[] { paint.getColor1(), paint.getColor2() }, false);
-
-            float fractions[] = new float[2];
-            fractions[0] = 0;
-            fractions[1] = 1;
+            int repeat = paint.isCyclic() ? XRUtils.RepeatReflect : XRUtils.RepeatPad;
+            float fractions[] = {0, 1};
+            int[] pixels = convertToIntArgbPixels(new Color[] { paint.getColor1(), paint.getColor2() });
 
             Point2D pt1 = paint.getPoint1();
             Point2D pt2 = paint.getPoint2();
 
-            AffineTransform at = (AffineTransform) sg2d.transform.clone();
-            try {
-                at.invert();
-            } catch (NoninvertibleTransformException ex) {
-                at.setToIdentity();
-            }
-
-            int repeat = paint.isCyclic() ? XRUtils.RepeatReflect : XRUtils.RepeatPad;
-
             XRBackend con = xrCompMan.getBackend();
-            int gradient = con.createLinearGradient(pt1, pt2, fractions, pixels, repeat, at);
-            xrCompMan.setGradientPaint(new XRSurfaceData.XRInternalSurfaceData(con, gradient, at));
+            int gradient = con.createLinearGradient(pt1, pt2, fractions, pixels, repeat);
+            xrCompMan.setGradientPaint(new XRSurfaceData.XRInternalSurfaceData(con, gradient));
         }
     }
 
@@ -142,26 +130,22 @@
 
         @Override
         boolean isPaintValid(SunGraphics2D sg2d) {
-            return true;
+            return ((LinearGradientPaint) sg2d.getPaint()).getColorSpace() == ColorSpaceType.SRGB;
         }
 
         @Override
         void setXRPaint(SunGraphics2D sg2d, Paint pt) {
             LinearGradientPaint paint = (LinearGradientPaint) pt;
-            boolean linear = (paint.getColorSpace() == ColorSpaceType.LINEAR_RGB);
 
             Color[] colors = paint.getColors();
             Point2D pt1 = paint.getStartPoint();
             Point2D pt2 = paint.getEndPoint();
 
+            int repeat = XRUtils.getRepeatForCycleMethod(paint.getCycleMethod());
+            float[] fractions = paint.getFractions();
+            int[] pixels = convertToIntArgbPixels(colors);
 
             AffineTransform at = paint.getTransform();
-            at.preConcatenate(sg2d.transform);
-
-            int repeat = XRUtils.getRepeatForCycleMethod(paint.getCycleMethod());
-            float[] fractions = paint.getFractions();
-            int[] pixels = convertToIntArgbPixels(colors, linear);
-
             try {
                 at.invert();
             } catch (NoninvertibleTransformException ex) {
@@ -169,8 +153,10 @@
             }
 
             XRBackend con = xrCompMan.getBackend();
-            int gradient = con.createLinearGradient(pt1, pt2, fractions, pixels, repeat, at);
-            xrCompMan.setGradientPaint(new XRSurfaceData.XRInternalSurfaceData(con, gradient, at));
+            int gradient = con.createLinearGradient(pt1, pt2, fractions, pixels, repeat);
+            XRInternalSurfaceData x11sd = new XRSurfaceData.XRInternalSurfaceData(con, gradient);
+            x11sd.setStaticSrcTx(at);
+            xrCompMan.setGradientPaint(x11sd);
         }
     }
 
@@ -179,136 +165,101 @@
         @Override
         boolean isPaintValid(SunGraphics2D sg2d) {
             RadialGradientPaint grad = (RadialGradientPaint) sg2d.paint;
-            return grad.getFocusPoint().equals(grad.getCenterPoint());
+            return grad.getFocusPoint().equals(grad.getCenterPoint())
+                   && grad.getColorSpace() == ColorSpaceType.SRGB;
         }
 
         @Override
         void setXRPaint(SunGraphics2D sg2d, Paint pt) {
             RadialGradientPaint paint = (RadialGradientPaint) pt;
-            boolean linear = (paint.getColorSpace() == ColorSpaceType.LINEAR_RGB);
             Color[] colors = paint.getColors();
             Point2D center = paint.getCenterPoint();
-            Point2D focus = paint.getFocusPoint();
 
             int repeat = XRUtils.getRepeatForCycleMethod(paint.getCycleMethod());
             float[] fractions = paint.getFractions();
-            int[] pixels = convertToIntArgbPixels(colors, linear);
+            int[] pixels = convertToIntArgbPixels(colors);
             float radius = paint.getRadius();
 
-            // save original (untransformed) center and focus points
-            double cx = center.getX();
-            double cy = center.getY();
-            double fx = focus.getX();
-            double fy = focus.getY();
+            float cx = (float) center.getX();
+            float cy = (float) center.getY();
 
             AffineTransform at = paint.getTransform();
-            at.preConcatenate(sg2d.transform);
-            focus = at.transform(focus, focus);
-
-            // transform unit circle to gradient coords; we start with the
-            // unit circle (center=(0,0), focus on positive x-axis, radius=1)
-            // and then transform into gradient space
-            at.translate(cx, cy);
-            at.rotate(fx - cx, fy - cy);
-            // at.scale(radius, radius);
-
-            // invert to get mapping from device coords to unit circle
             try {
                 at.invert();
-            } catch (Exception e) {
-                at.setToScale(0.0, 0.0);
+            } catch (NoninvertibleTransformException ex) {
+                ex.printStackTrace();
             }
-            focus = at.transform(focus, focus);
-
-            // clamp the focus point so that it does not rest on, or outside
-            // of, the circumference of the gradient circle
-            fx = Math.min(focus.getX(), 0.99);
 
             XRBackend con = xrCompMan.getBackend();
-            int gradient = con.createRadialGradient(new Point2D.Float(0, 0), new Point2D.Float(0, 0), 0, radius, fractions, pixels, repeat, at);
-            xrCompMan.setGradientPaint(new XRSurfaceData.XRInternalSurfaceData(con, gradient, at));
+            int gradient = con.createRadialGradient(cx, cy, 0, radius, fractions, pixels, repeat);
+            XRInternalSurfaceData x11sd = new XRSurfaceData.XRInternalSurfaceData(con, gradient);
+            x11sd.setStaticSrcTx(at);
+            xrCompMan.setGradientPaint(x11sd);
         }
     }
 
     private static class XRTexture extends XRPaints {
 
+        private XRSurfaceData getAccSrcSurface(XRSurfaceData dstData, BufferedImage bi) {
+            // REMIND: this is a hack that attempts to cache the system
+            // memory image from the TexturePaint instance into an
+            // XRender pixmap...
+            SurfaceData srcData = dstData.getSourceSurfaceData(bi, SunGraphics2D.TRANSFORM_ISIDENT, CompositeType.SrcOver, null);
+            if (!(srcData instanceof XRSurfaceData)) {
+                srcData = dstData.getSourceSurfaceData(bi, SunGraphics2D.TRANSFORM_ISIDENT, CompositeType.SrcOver, null);
+                if (!(srcData instanceof XRSurfaceData)) {
+                    throw new InternalError("Surface not cachable");
+                }
+            }
+
+            return (XRSurfaceData) srcData;
+        }
+
         @Override
         boolean isPaintValid(SunGraphics2D sg2d) {
             TexturePaint paint = (TexturePaint) sg2d.paint;
             BufferedImage bi = paint.getImage();
             XRSurfaceData dstData = (XRSurfaceData) sg2d.getDestSurface();
 
-            SurfaceData srcData = dstData.getSourceSurfaceData(bi, SunGraphics2D.TRANSFORM_ISIDENT, CompositeType.SrcOver, null);
-            if (!(srcData instanceof XRSurfaceData)) {
-                // REMIND: this is a hack that attempts to cache the system
-                // memory image from the TexturePaint instance into an
-                // OpenGL texture...
-                srcData = dstData.getSourceSurfaceData(bi, SunGraphics2D.TRANSFORM_ISIDENT, CompositeType.SrcOver, null);
-                if (!(srcData instanceof XRSurfaceData)) {
-                    return false;
-                }
-            }
-
-            return true;
+            return getAccSrcSurface(dstData, bi) != null;
         }
 
         @Override
         void setXRPaint(SunGraphics2D sg2d, Paint pt) {
             TexturePaint paint = (TexturePaint) pt;
-
             BufferedImage bi = paint.getImage();
-            SurfaceData dstData = sg2d.surfaceData;
-            SurfaceData srcData = dstData.getSourceSurfaceData(bi, SunGraphics2D.TRANSFORM_ISIDENT, CompositeType.SrcOver, null);
+            Rectangle2D anchor = paint.getAnchorRect();
 
-            // REMIND: this hack tries to ensure that we have a cached texture
-            if (!(srcData instanceof XRSurfaceData)) {
-                srcData = dstData.getSourceSurfaceData(paint.getImage(), SunGraphics2D.TRANSFORM_ISIDENT, CompositeType.SrcOver, null);
-                if (!(srcData instanceof XRSurfaceData)) {
-                    throw new InternalError("Surface not cachable");
-                }
-            }
+            XRSurfaceData dstData = (XRSurfaceData) sg2d.surfaceData;
+            XRSurfaceData srcData = (XRSurfaceData) getAccSrcSurface(dstData, bi);
 
-            XRSurfaceData x11SrcData = (XRSurfaceData) srcData;
-
-            AffineTransform at = (AffineTransform) sg2d.transform.clone();
-            Rectangle2D anchor = paint.getAnchorRect();
+            AffineTransform at = new AffineTransform();
             at.translate(anchor.getX(), anchor.getY());
             at.scale(anchor.getWidth() / ((double) bi.getWidth()), anchor.getHeight() / ((double) bi.getHeight()));
 
             try {
                 at.invert();
             } catch (NoninvertibleTransformException ex) {
-                at.setToIdentity(); /* TODO: Right thing to do in this case? */
+                at.setToIdentity();
             }
+            srcData.setStaticSrcTx(at);
 
-            x11SrcData.validateAsSource(at, XRUtils.RepeatNormal, XRUtils.ATransOpToXRQuality(sg2d.interpolationType));
-            xrCompMan.setTexturePaint(((XRSurfaceData) srcData));
+            srcData.validateAsSource(at, XRUtils.RepeatNormal, XRUtils.ATransOpToXRQuality(sg2d.interpolationType));
+            xrCompMan.setTexturePaint(srcData);
         }
     }
 
-    public int[] convertToIntArgbPixels(Color[] colors, boolean linear) {
+    public int[] convertToIntArgbPixels(Color[] colors) {
         int[] pixels = new int[colors.length];
         for (int i = 0; i < colors.length; i++) {
-            pixels[i] = colorToIntArgbPixel(colors[i], linear);
+            pixels[i] = colorToIntArgbPixel(colors[i]);
         }
         return pixels;
     }
 
-    public int colorToIntArgbPixel(Color c, boolean linear) {
+    public int colorToIntArgbPixel(Color c) {
         int rgb = c.getRGB();
-
-        int a = rgb >>> 24;
-        int r = (rgb >> 16) & 0xff;
-        int g = (rgb >> 8) & 0xff;
-        int b = (rgb) & 0xff;
-        if (linear) {
-            r = BufferedPaints.convertSRGBtoLinearRGB(r);
-            g = BufferedPaints.convertSRGBtoLinearRGB(g);
-            b = BufferedPaints.convertSRGBtoLinearRGB(b);
-        }
-
-        a *= xrCompMan.getExtraAlpha();
-
-        return ((a << 24) | (r << 16) | (g << 8) | (b));
+        int a = (int) Math.round(xrCompMan.getExtraAlpha() * (rgb >>> 24));
+        return ((a << 24) | (rgb & 0x00FFFFFF));
     }
 }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/solaris/classes/sun/java2d/xr/XRSolidSrcPict.java	Thu Oct 31 15:45:57 2013 -0700
@@ -0,0 +1,57 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package sun.java2d.xr;
+
+public class XRSolidSrcPict {
+    XRBackend con;
+
+    XRSurfaceData srcPict;
+    XRColor xrCol;
+    int curPixVal = -1;
+
+    public XRSolidSrcPict(XRBackend con, int parentXid) {
+        this.con = con;
+
+        xrCol = new XRColor();
+        int solidPixmap = con.createPixmap(parentXid, 32, 1, 1);
+        int solidSrcPictXID = con.createPicture(solidPixmap, XRUtils.PictStandardARGB32);
+        con.setPictureRepeat(solidSrcPictXID, XRUtils.RepeatNormal);
+        con.renderRectangle(solidSrcPictXID, XRUtils.PictOpSrc, XRColor.FULL_ALPHA, 0, 0, 1, 1);
+        srcPict = new XRSurfaceData.XRInternalSurfaceData(con, solidSrcPictXID);
+    }
+
+    public XRSurfaceData prepareSrcPict(int pixelVal) {
+        if(pixelVal != curPixVal) {
+            xrCol.setColorValues(pixelVal, false);
+            con.renderRectangle(srcPict.picture, XRUtils.PictOpSrc, xrCol, 0, 0, 1, 1);
+            this.curPixVal = pixelVal;
+        }
+
+        return srcPict;
+    }
+
+}
--- a/jdk/src/solaris/classes/sun/java2d/xr/XRSurfaceData.java	Thu Oct 31 12:36:25 2013 -0700
+++ b/jdk/src/solaris/classes/sun/java2d/xr/XRSurfaceData.java	Thu Oct 31 15:45:57 2013 -0700
@@ -109,6 +109,7 @@
         return XRSurfaceDataProxy.createProxy(srcData, graphicsConfig);
     }
 
+    @Override
     public void validatePipe(SunGraphics2D sg2d) {
         TextPipe textpipe;
         boolean validated = false;
@@ -117,14 +118,8 @@
          * The textpipe for now can't handle TexturePaint when extra-alpha is
          * specified nore XOR mode
          */
-        if (sg2d.compositeState < SunGraphics2D.COMP_XOR &&
-            (sg2d.paintState < SunGraphics2D.PAINT_TEXTURE ||
-             sg2d.composite == null ||
-             !(sg2d.composite instanceof AlphaComposite) ||
-             ((AlphaComposite) sg2d.composite).getAlpha() == 1.0f))
+        if ((textpipe = getTextPipe(sg2d)) == null)
         {
-            textpipe = xrtextpipe;
-        } else {
             super.validatePipe(sg2d);
             textpipe = sg2d.textpipe;
             validated = true;
@@ -184,13 +179,38 @@
         sg2d.imagepipe = xrDrawImage;
     }
 
+    protected TextPipe getTextPipe(SunGraphics2D sg2d) {
+        boolean supportedPaint = sg2d.compositeState <= SunGraphics2D.COMP_ALPHA
+                && (sg2d.paintState <= SunGraphics2D.PAINT_ALPHACOLOR || sg2d.composite == null);
+
+        boolean supportedCompOp = false;
+        if (sg2d.composite instanceof AlphaComposite) {
+            int compRule = ((AlphaComposite) sg2d.composite).getRule();
+            supportedCompOp = XRUtils.isMaskEvaluated(XRUtils.j2dAlphaCompToXR(compRule))
+                    || (compRule == AlphaComposite.SRC
+                                && sg2d.paintState <= SunGraphics2D.PAINT_ALPHACOLOR);
+        }
+
+        return (supportedPaint && supportedCompOp) ? xrtextpipe : null;
+    }
+
     protected MaskFill getMaskFill(SunGraphics2D sg2d) {
-        if (sg2d.paintState > SunGraphics2D.PAINT_ALPHACOLOR &&
-            !XRPaints.isValid(sg2d))
-        {
-            return null;
+        AlphaComposite aComp = null;
+        if(sg2d.composite != null
+                && sg2d.composite instanceof AlphaComposite) {
+            aComp = (AlphaComposite) sg2d.composite;
         }
-        return super.getMaskFill(sg2d);
+
+        boolean supportedPaint = sg2d.paintState <= SunGraphics2D.PAINT_ALPHACOLOR
+                || XRPaints.isValid(sg2d);
+
+        boolean supportedCompOp = false;
+        if(aComp != null) {
+            int rule = aComp.getRule();
+            supportedCompOp = XRUtils.isMaskEvaluated(XRUtils.j2dAlphaCompToXR(rule));
+        }
+
+        return (supportedPaint && supportedCompOp) ?  super.getMaskFill(sg2d) : null;
     }
 
     public RenderLoops getRenderLoops(SunGraphics2D sg2d) {
@@ -395,6 +415,7 @@
 
     boolean transformInUse = false;
     AffineTransform validatedSourceTransform = new AffineTransform();
+    AffineTransform staticSrcTx = null;
     int validatedRepeat = XRUtils.RepeatNone;
     int validatedFilter = XRUtils.FAST;
 
@@ -423,13 +444,24 @@
             }
         } else if (!transformInUse ||
                    (transformInUse && !sxForm.equals(validatedSourceTransform))) {
+
             validatedSourceTransform.setTransform(sxForm.getScaleX(),
                                                   sxForm.getShearY(),
                                                   sxForm.getShearX(),
                                                   sxForm.getScaleY(),
                                                   sxForm.getTranslateX(),
                                                   sxForm.getTranslateY());
-            renderQueue.setPictureTransform(picture, validatedSourceTransform);
+
+            AffineTransform srcTransform = validatedSourceTransform;
+            if(staticSrcTx != null) {
+                // Apply static transform set when used as texture or gradient.
+                // Create a copy to not modify validatedSourceTransform as
+                // this would confuse the validation logic.
+                srcTransform = new AffineTransform(validatedSourceTransform);
+                srcTransform.preConcatenate(staticSrcTx);
+            }
+
+            renderQueue.setPictureTransform(picture, srcTransform);
             transformInUse = true;
         }
 
@@ -547,15 +579,10 @@
     }
 
     public static class XRInternalSurfaceData extends XRSurfaceData {
-        public XRInternalSurfaceData(XRBackend renderQueue, int pictXid,
-                                     AffineTransform transform) {
+        public XRInternalSurfaceData(XRBackend renderQueue, int pictXid) {
           super(renderQueue);
           this.picture = pictXid;
-          this.validatedSourceTransform = transform;
-
-          if (validatedSourceTransform != null) {
-              transformInUse = true;
-          }
+          this.transformInUse = false;
         }
 
         public boolean canSourceSendExposures(int x, int y, int w, int h) {
@@ -677,4 +704,8 @@
     public XRGraphicsConfig getGraphicsConfig() {
         return graphicsConfig;
     }
+
+    public void setStaticSrcTx(AffineTransform staticSrcTx) {
+        this.staticSrcTx = staticSrcTx;
+    }
 }
--- a/jdk/src/solaris/classes/sun/java2d/xr/XRUtils.java	Thu Oct 31 12:36:25 2013 -0700
+++ b/jdk/src/solaris/classes/sun/java2d/xr/XRUtils.java	Thu Oct 31 15:45:57 2013 -0700
@@ -27,6 +27,7 @@
 
 import java.awt.*;
 import java.awt.MultipleGradientPaint.*;
+import java.awt.geom.AffineTransform;
 import java.awt.image.*;
 import sun.java2d.loops.*;
 import static java.awt.AlphaComposite.*;
@@ -258,4 +259,21 @@
     public static int clampToUShort(int x) {
         return (x > 65535 ? 65535 : (x < 0) ? 0 : x);
     }
+
+    public static boolean isTransformQuadrantRotated(AffineTransform tr) {
+        return ((tr.getType() & (AffineTransform.TYPE_GENERAL_ROTATION |
+                 AffineTransform.TYPE_GENERAL_TRANSFORM)) == 0);
+    }
+
+    public static boolean isMaskEvaluated(byte xrCompRule) {
+        switch (xrCompRule) {
+        case PictOpOver:
+        case PictOpOverReverse:
+        case PictOpAtop:
+        case PictOpXor:
+            return true;
+        }
+
+        return false;
+    }
 }
--- a/jdk/src/solaris/classes/sun/print/CUPSPrinter.java	Thu Oct 31 12:36:25 2013 -0700
+++ b/jdk/src/solaris/classes/sun/print/CUPSPrinter.java	Thu Oct 31 15:45:57 2013 -0700
@@ -237,8 +237,9 @@
 
     /**
      * Get CUPS default printer using IPP.
+     * Returns 2 values - index 0 is printer name, index 1 is the uri.
      */
-    public static String getDefaultPrinter() {
+    static String[] getDefaultPrinter() {
         try {
             URL url = new URL("http", getServer(), getPort(), "");
             final HttpURLConnection urlConnection =
@@ -264,8 +265,8 @@
                     AttributeClass.ATTRIBUTES_CHARSET,
                     AttributeClass.ATTRIBUTES_NATURAL_LANGUAGE,
                     new AttributeClass("requested-attributes",
-                                       AttributeClass.TAG_KEYWORD,
-                                       "printer-name")
+                                       AttributeClass.TAG_URI,
+                                       "printer-uri")
                 };
 
                 if (IPPPrintService.writeIPPRequest(os,
@@ -273,6 +274,7 @@
                                         attCl)) {
 
                     HashMap defaultMap = null;
+                    String[] printerInfo = new String[2];
                     InputStream is = urlConnection.getInputStream();
                     HashMap[] responseMap = IPPPrintService.readIPPResponse(
                                          is);
@@ -293,21 +295,30 @@
                          * special behaviour for this built in.
                          */
                          if (UnixPrintServiceLookup.isMac()) {
-                             return UnixPrintServiceLookup.
+                             printerInfo[0] = UnixPrintServiceLookup.
                                                    getDefaultPrinterNameSysV();
+                             printerInfo[1] = null;
+                             return (String[])printerInfo.clone();
                          } else {
                              return null;
                          }
                     }
 
+
                     AttributeClass attribClass = (AttributeClass)
                         defaultMap.get("printer-name");
 
                     if (attribClass != null) {
-                        String nameStr = attribClass.getStringValue();
+                        printerInfo[0] = attribClass.getStringValue();
+                        attribClass = (AttributeClass)defaultMap.get("device-uri");
+                        if (attribClass != null) {
+                            printerInfo[1] = attribClass.getStringValue();
+                        } else {
+                            printerInfo[1] = null;
+                        }
                         os.close();
                         urlConnection.disconnect();
-                        return nameStr;
+                        return (String [])printerInfo.clone();
                     }
                 }
                 os.close();
@@ -322,7 +333,7 @@
     /**
      * Get list of all CUPS printers using IPP.
      */
-    public static String[] getAllPrinters() {
+    static String[] getAllPrinters() {
         try {
             URL url = new URL("http", getServer(), getPort(), "");
 
--- a/jdk/src/solaris/classes/sun/print/IPPPrintService.java	Thu Oct 31 12:36:25 2013 -0700
+++ b/jdk/src/solaris/classes/sun/print/IPPPrintService.java	Thu Oct 31 15:45:57 2013 -0700
@@ -366,6 +366,7 @@
                                           " IPPPrintService, myURL="+
                                           myURL+" Exception= "+
                                           e);
+            throw new IllegalArgumentException("invalid url");
         }
 
         isCupsPrinter = isCups;
@@ -1145,6 +1146,8 @@
                 // REMIND: check attribute values
                 return (T)PDLOverrideSupported.NOT_ATTEMPTED;
             }
+        } else if (category == PrinterURI.class) {
+            return (T)(new PrinterURI(myURI));
         } else {
             return null;
         }
--- a/jdk/src/solaris/classes/sun/print/UnixPrintServiceLookup.java	Thu Oct 31 12:36:25 2013 -0700
+++ b/jdk/src/solaris/classes/sun/print/UnixPrintServiceLookup.java	Thu Oct 31 15:45:57 2013 -0700
@@ -48,6 +48,7 @@
 import javax.print.attribute.PrintServiceAttribute;
 import javax.print.attribute.PrintServiceAttributeSet;
 import javax.print.attribute.standard.PrinterName;
+import javax.print.attribute.standard.PrinterURI;
 import java.io.File;
 import java.io.FileReader;
 import java.net.URL;
@@ -203,6 +204,33 @@
         }
     }
 
+    private int addPrintServiceToList(ArrayList printerList, PrintService ps) {
+        int index = printerList.indexOf(ps);
+        // Check if PrintService with same name is already in the list.
+        if (CUPSPrinter.isCupsRunning() && index != -1) {
+            // Bug in Linux: Duplicate entry of a remote printer
+            // and treats it as local printer but it is returning wrong
+            // information when queried using IPP. Workaround is to remove it.
+            // Even CUPS ignores these entries as shown in lpstat or using
+            // their web configuration.
+            PrinterURI uri = (PrinterURI)ps.getAttribute(PrinterURI.class);
+            if (uri.getURI().getHost().equals("localhost")) {
+                IPPPrintService.debug_println(debugPrefix+"duplicate PrintService, ignoring the new local printer: "+ps);
+                return index;  // Do not add this.
+            }
+            PrintService oldPS = (PrintService)(printerList.get(index));
+            uri = (PrinterURI)oldPS.getAttribute(PrinterURI.class);
+            if (uri.getURI().getHost().equals("localhost")) {
+                IPPPrintService.debug_println(debugPrefix+"duplicate PrintService, removing existing local printer: "+oldPS);
+                printerList.remove(oldPS);
+            } else {
+                return index;
+            }
+        }
+        printerList.add(ps);
+        return (printerList.size() - 1);
+    }
+
 
     // refreshes "printServices"
     public synchronized void refreshServices() {
@@ -246,8 +274,7 @@
             }
             if ((defaultPrintService != null)
                 && printers[p].equals(getPrinterDestName(defaultPrintService))) {
-                printerList.add(defaultPrintService);
-                defaultIndex = printerList.size() - 1;
+                defaultIndex = addPrintServiceToList(printerList, defaultPrintService);
             } else {
                 if (printServices == null) {
                     IPPPrintService.debug_println(debugPrefix+
@@ -255,9 +282,10 @@
 
                     if (CUPSPrinter.isCupsRunning()) {
                         try {
-                            printerList.add(new IPPPrintService(printers[p],
-                                                                printerURIs[p],
-                                                                true));
+                            addPrintServiceToList(printerList,
+                                                  new IPPPrintService(printers[p],
+                                                                   printerURIs[p],
+                                                                   true));
                         } catch (Exception e) {
                             IPPPrintService.debug_println(debugPrefix+
                                                           " getAllPrinters Exception "+
@@ -282,10 +310,10 @@
                     if (j == printServices.length) {      // not found?
                         if (CUPSPrinter.isCupsRunning()) {
                             try {
-                                printerList.add(new IPPPrintService(
-                                                               printers[p],
-                                                               printerURIs[p],
-                                                               true));
+                                addPrintServiceToList(printerList,
+                                             new IPPPrintService(printers[p],
+                                                                 printerURIs[p],
+                                                                 true));
                             } catch (Exception e) {
                                 IPPPrintService.debug_println(debugPrefix+
                                                               " getAllPrinters Exception "+
@@ -312,9 +340,7 @@
 
         //if defaultService is not found in printerList
         if (defaultIndex == -1 && defaultPrintService != null) {
-            //add default to the list
-            printerList.add(defaultPrintService);
-            defaultIndex = printerList.size() - 1;
+            defaultIndex = addPrintServiceToList(printerList, defaultPrintService);
         }
 
         printServices = (PrintService[])printerList.toArray(
@@ -563,11 +589,14 @@
 
         // clear defaultPrintService
         defaultPrintService = null;
+        String psuri = null;
 
         IPPPrintService.debug_println("isRunning ? "+
                                       (CUPSPrinter.isCupsRunning()));
         if (CUPSPrinter.isCupsRunning()) {
-            defaultPrinter = CUPSPrinter.getDefaultPrinter();
+            String[] printerInfo = CUPSPrinter.getDefaultPrinter();
+            defaultPrinter = printerInfo[0];
+            psuri = printerInfo[1];
         } else {
             if (isMac() || isSysV()) {
                 defaultPrinter = getDefaultPrinterNameSysV();
@@ -590,12 +619,17 @@
         if (defaultPrintService == null) {
             if (CUPSPrinter.isCupsRunning()) {
                 try {
-                    PrintService defaultPS =
-                        new IPPPrintService(defaultPrinter,
+                    PrintService defaultPS;
+                    if (psuri != null) {
+                        defaultPS = new IPPPrintService(defaultPrinter,
+                                                        psuri, true);
+                    } else {
+                        defaultPS = new IPPPrintService(defaultPrinter,
                                             new URL("http://"+
                                                     CUPSPrinter.getServer()+":"+
                                                     CUPSPrinter.getPort()+"/"+
                                                     defaultPrinter));
+                    }
                     defaultPrintService = defaultPS;
                 } catch (Exception e) {
                 }
--- a/jdk/src/solaris/native/sun/java2d/x11/XRBackendNative.c	Thu Oct 31 12:36:25 2013 -0700
+++ b/jdk/src/solaris/native/sun/java2d/x11/XRBackendNative.c	Thu Oct 31 15:45:57 2013 -0700
@@ -523,12 +523,10 @@
 Java_sun_java2d_xr_XRBackendNative_XRCreateLinearGradientPaintNative
     (JNIEnv *env, jclass xsd, jfloatArray fractionsArray,
      jshortArray pixelsArray, jint x1, jint y1, jint x2, jint y2,
-     jint numStops, jint repeat,
-     jint m00, jint m01, jint m02, jint m10, jint m11, jint m12) {
+     jint numStops, jint repeat) {
    jint i;
    jshort* pixels;
    jfloat* fractions;
-   XTransform tr;
    XRenderPictureAttributes pict_attr;
    Picture gradient = 0;
    XRenderColor *colors;
@@ -594,8 +592,6 @@
    (*env)->ReleasePrimitiveArrayCritical(env, fractionsArray, fractions, JNI_ABORT);
 
     if (gradient != 0) {
-        BUILD_TRANSFORM_MATRIX(tr, m00, m01, m02, m10, m11, m12);
-        XRenderSetPictureTransform (awt_display, gradient, &tr);
         pict_attr.repeat = repeat;
         XRenderChangePicture (awt_display, gradient, CPRepeat, &pict_attr);
     }
@@ -608,12 +604,11 @@
 Java_sun_java2d_xr_XRBackendNative_XRCreateRadialGradientPaintNative
     (JNIEnv *env, jclass xsd, jfloatArray fractionsArray,
      jshortArray pixelsArray, jint numStops,
-     jint innerRadius, jint outerRadius, jint repeat,
-     jint m00, jint m01, jint m02, jint m10, jint m11, jint m12) {
+     jint centerX, jint centerY,
+     jint innerRadius, jint outerRadius, jint repeat) {
    jint i;
    jshort* pixels;
    jfloat* fractions;
-   XTransform tr;
    XRenderPictureAttributes pict_attr;
    Picture gradient = 0;
    XRenderColor *colors;
@@ -637,11 +632,11 @@
        return -1; //TODO release pixels first
    }
 
-    grad.inner.x = 0;
-    grad.inner.y = 0;
+    grad.inner.x = centerX;
+    grad.inner.y = centerY;
     grad.inner.radius = innerRadius;
-    grad.outer.x = 0;
-    grad.outer.y = 0;
+    grad.outer.x = centerX;
+    grad.outer.y = centerY;
     grad.outer.radius = outerRadius;
 
     /*TODO optimized & malloc check*/
@@ -682,8 +677,6 @@
 
 
     if (gradient != 0) {
-        BUILD_TRANSFORM_MATRIX(tr, m00, m01, m02, m10, m11, m12);
-        XRenderSetPictureTransform (awt_display, gradient, &tr);
         pict_attr.repeat = repeat;
         XRenderChangePicture (awt_display, gradient, CPRepeat, &pict_attr);
     }
--- a/jdk/src/windows/classes/sun/awt/windows/WPrinterJob.java	Thu Oct 31 12:36:25 2013 -0700
+++ b/jdk/src/windows/classes/sun/awt/windows/WPrinterJob.java	Thu Oct 31 15:45:57 2013 -0700
@@ -183,10 +183,6 @@
     /**
      * Values must match those defined in wingdi.h & commdlg.h
      */
-    private static final int PD_ALLPAGES = 0x00000000;
-    private static final int PD_SELECTION = 0x00000001;
-    private static final int PD_PAGENUMS = 0x00000002;
-    private static final int PD_NOSELECTION = 0x00000004;
     private static final int PD_COLLATE = 0x00000010;
     private static final int PD_PRINTTOFILE = 0x00000020;
     private static final int DM_ORIENTATION   = 0x00000001;
@@ -1639,63 +1635,7 @@
         }
     }
 
-    //returns 1-based index for "From" page
-    private final int getFromPageAttrib() {
-        if (attributes != null) {
-            PageRanges pageRangesAttr =
-                (PageRanges)attributes.get(PageRanges.class);
-            if (pageRangesAttr != null) {
-                int[][] range = pageRangesAttr.getMembers();
-                return range[0][0];
-            }
-        }
-        return getMinPageAttrib();
-    }
 
-    //returns 1-based index for "To" page
-    private final int getToPageAttrib() {
-        if (attributes != null) {
-            PageRanges pageRangesAttr =
-                (PageRanges)attributes.get(PageRanges.class);
-            if (pageRangesAttr != null) {
-                int[][] range = pageRangesAttr.getMembers();
-                return range[range.length-1][1];
-            }
-        }
-        return getMaxPageAttrib();
-    }
-
-    private final int getMinPageAttrib() {
-        if (attributes != null) {
-            SunMinMaxPage s =
-                (SunMinMaxPage)attributes.get(SunMinMaxPage.class);
-            if (s != null) {
-                return s.getMin();
-            }
-        }
-        return 1;
-    }
-
-    private final int getMaxPageAttrib() {
-        if (attributes != null) {
-            SunMinMaxPage s =
-                (SunMinMaxPage)attributes.get(SunMinMaxPage.class);
-            if (s != null) {
-                return s.getMax();
-            }
-        }
-
-        Pageable pageable = getPageable();
-        if (pageable != null) {
-            int numPages = pageable.getNumberOfPages();
-            if (numPages <= Pageable.UNKNOWN_NUMBER_OF_PAGES) {
-                numPages = MAX_UNKNOWN_PAGES;
-            }
-            return  ((numPages == 0) ? 1 : numPages);
-        }
-
-        return Integer.MAX_VALUE;
-    }
 
     private final boolean getDestAttrib() {
         return (mDestination != null);
@@ -1847,20 +1787,7 @@
         return mAttMediaTray;
     }
 
-    private final int getSelectAttrib() {
-        if (attributes != null) {
-            SunPageSelection pages =
-                (SunPageSelection)attributes.get(SunPageSelection.class);
-            if (pages == SunPageSelection.RANGE) {
-                return PD_PAGENUMS;
-            } else if (pages == SunPageSelection.SELECTION) {
-                return PD_SELECTION;
-            } else if (pages ==  SunPageSelection.ALL) {
-                return PD_ALLPAGES;
-            }
-        }
-        return PD_NOSELECTION;
-    }
+
 
     private final boolean getPrintToFileEnabled() {
         SecurityManager security = System.getSecurityManager();
--- a/jdk/src/windows/native/sun/java2d/d3d/D3DBadHardware.h	Thu Oct 31 12:36:25 2013 -0700
+++ b/jdk/src/windows/native/sun/java2d/d3d/D3DBadHardware.h	Thu Oct 31 15:45:57 2013 -0700
@@ -53,26 +53,73 @@
 
     // Intel HD
     // Clarkdale (Desktop) GMA HD Lines
-    { 0x8086, 0x0042, D_VERSION(6,14,10,5337), OS_WINXP | OS_WINXP_64 },
-    { 0x8086, 0x0042, D_VERSION(8,15,10,2302), OS_VISTA | OS_WINDOWS7 },
+    { 0x8086, 0x0042, D_VERSION(6,14,10,5394), OS_WINXP | OS_WINXP_64 },
+    { 0x8086, 0x0042, D_VERSION(8,15,10,2993), OS_VISTA | OS_WINDOWS7 },
     // Arrandale (Mobile) GMA HD Lines
-    { 0x8086, 0x0046, D_VERSION(6,14,10,5337), OS_WINXP | OS_WINXP_64 },
-    { 0x8086, 0x0046, D_VERSION(8,15,10,2302), OS_VISTA | OS_WINDOWS7 },
-    // Sandy Bridge GMA HD Lines
-    { 0x8086, 0x0102, D_VERSION(6,14,10,5337), OS_WINXP | OS_WINXP_64 },
-    { 0x8086, 0x0102, D_VERSION(8,15,10,2302), OS_VISTA | OS_WINDOWS7 },
-    { 0x8086, 0x0106, D_VERSION(6,14,10,5337), OS_WINXP | OS_WINXP_64 },
-    { 0x8086, 0x0106, D_VERSION(8,15,10,2302), OS_VISTA | OS_WINDOWS7 },
-    { 0x8086, 0x0112, D_VERSION(6,14,10,5337), OS_WINXP | OS_WINXP_64 },
-    { 0x8086, 0x0112, D_VERSION(8,15,10,2302), OS_VISTA | OS_WINDOWS7 },
-    { 0x8086, 0x0116, D_VERSION(6,14,10,5337), OS_WINXP | OS_WINXP_64 },
-    { 0x8086, 0x0116, D_VERSION(8,15,10,2302), OS_VISTA | OS_WINDOWS7 },
-    { 0x8086, 0x0122, D_VERSION(6,14,10,5337), OS_WINXP | OS_WINXP_64 },
-    { 0x8086, 0x0122, D_VERSION(8,15,10,2302), OS_VISTA | OS_WINDOWS7 },
-    { 0x8086, 0x0126, D_VERSION(6,14,10,5337), OS_WINXP | OS_WINXP_64 },
-    { 0x8086, 0x0126, D_VERSION(8,15,10,2302), OS_VISTA | OS_WINDOWS7 },
-    { 0x8086, 0x010A, D_VERSION(6,14,10,5337), OS_WINXP | OS_WINXP_64 },
-    { 0x8086, 0x010A, D_VERSION(8,15,10,2302), OS_VISTA | OS_WINDOWS7 },
+    { 0x8086, 0x0046, D_VERSION(6,14,10,5394), OS_WINXP | OS_WINXP_64 },
+    { 0x8086, 0x0046, D_VERSION(8,15,10,2993), OS_VISTA | OS_WINDOWS7 },
+
+    // Sandy Bridge HD Graphics 3000/2000
+    { 0x8086, 0x0102, D_VERSION(6,14,10,5437), OS_WINXP | OS_WINXP_64 },
+    { 0x8086, 0x0102, D_VERSION(9,17,10,3223), OS_VISTA | OS_WINDOWS7 },
+    { 0x8086, 0x0106, D_VERSION(6,14,10,5437), OS_WINXP | OS_WINXP_64 },
+    { 0x8086, 0x0106, D_VERSION(9,17,10,3223), OS_VISTA | OS_WINDOWS7 },
+    { 0x8086, 0x0112, D_VERSION(6,14,10,5437), OS_WINXP | OS_WINXP_64 },
+    { 0x8086, 0x0112, D_VERSION(9,17,10,3223), OS_VISTA | OS_WINDOWS7 },
+    { 0x8086, 0x0116, D_VERSION(6,14,10,5437), OS_WINXP | OS_WINXP_64 },
+    { 0x8086, 0x0116, D_VERSION(9,17,10,3223), OS_VISTA | OS_WINDOWS7 },
+    { 0x8086, 0x0122, D_VERSION(6,14,10,5437), OS_WINXP | OS_WINXP_64 },
+    { 0x8086, 0x0122, D_VERSION(9,17,10,3223), OS_VISTA | OS_WINDOWS7 },
+    { 0x8086, 0x0126, D_VERSION(6,14,10,5437), OS_WINXP | OS_WINXP_64 },
+    { 0x8086, 0x0126, D_VERSION(9,17,10,3223), OS_VISTA | OS_WINDOWS7 },
+    { 0x8086, 0x010A, D_VERSION(6,14,10,5437), OS_WINXP | OS_WINXP_64 },
+    { 0x8086, 0x010A, D_VERSION(9,17,10,3223), OS_VISTA | OS_WINDOWS7 },
+
+    // Ivy Bridge
+    { 0x8086, 0x0162, D_VERSION(6,14,10,5437), OS_WINXP | OS_WINXP_64 },
+    { 0x8086, 0x0162, D_VERSION(9,18,10,3257), OS_VISTA | OS_WINDOWS7 },
+    { 0x8086, 0x0166, D_VERSION(6,14,10,5437), OS_WINXP | OS_WINXP_64 },
+    { 0x8086, 0x0166, D_VERSION(9,18,10,3257), OS_VISTA | OS_WINDOWS7 },
+    { 0x8086, 0x016A, D_VERSION(6,14,10,5437), OS_WINXP | OS_WINXP_64 },
+    { 0x8086, 0x016A, D_VERSION(9,18,10,3257), OS_VISTA | OS_WINDOWS7 },
+    { 0x8086, 0x0152, D_VERSION(6,14,10,5437), OS_WINXP | OS_WINXP_64 },
+    { 0x8086, 0x0152, D_VERSION(9,18,10,3257), OS_VISTA | OS_WINDOWS7 },
+    { 0x8086, 0x0156, D_VERSION(6,14,10,5437), OS_WINXP | OS_WINXP_64 },
+    { 0x8086, 0x0156, D_VERSION(9,18,10,3257), OS_VISTA | OS_WINDOWS7 },
+    { 0x8086, 0x015A, D_VERSION(6,14,10,5437), OS_WINXP | OS_WINXP_64 },
+    { 0x8086, 0x015A, D_VERSION(9,18,10,3257), OS_VISTA | OS_WINDOWS7 },
+
+    // Haswell
+    { 0x8086, 0x0402, D_VERSION(6,14,10,5437), OS_WINXP | OS_WINXP_64 },
+    { 0x8086, 0x0402, D_VERSION(9,18,10,3257), OS_VISTA | OS_WINDOWS7 },
+    { 0x8086, 0x0406, D_VERSION(6,14,10,5437), OS_WINXP | OS_WINXP_64 },
+    { 0x8086, 0x0406, D_VERSION(9,18,10,3257), OS_VISTA | OS_WINDOWS7 },
+    { 0x8086, 0x0412, D_VERSION(6,14,10,5437), OS_WINXP | OS_WINXP_64 },
+    { 0x8086, 0x0412, D_VERSION(9,18,10,3257), OS_VISTA | OS_WINDOWS7 },
+    { 0x8086, 0x0416, D_VERSION(6,14,10,5437), OS_WINXP | OS_WINXP_64 },
+    { 0x8086, 0x0416, D_VERSION(9,18,10,3257), OS_VISTA | OS_WINDOWS7 },
+    { 0x8086, 0x041E, D_VERSION(6,14,10,5437), OS_WINXP | OS_WINXP_64 },
+    { 0x8086, 0x041E, D_VERSION(9,18,10,3257), OS_VISTA | OS_WINDOWS7 },
+    { 0x8086, 0x040A, D_VERSION(6,14,10,5437), OS_WINXP | OS_WINXP_64 },
+    { 0x8086, 0x040A, D_VERSION(9,18,10,3257), OS_VISTA | OS_WINDOWS7 },
+    { 0x8086, 0x041A, D_VERSION(6,14,10,5437), OS_WINXP | OS_WINXP_64 },
+    { 0x8086, 0x041A, D_VERSION(9,18,10,3257), OS_VISTA | OS_WINDOWS7 },
+    { 0x8086, 0x0A06, D_VERSION(6,14,10,5437), OS_WINXP | OS_WINXP_64 },
+    { 0x8086, 0x0A06, D_VERSION(9,18,10,3257), OS_VISTA | OS_WINDOWS7 },
+    { 0x8086, 0x0A16, D_VERSION(6,14,10,5437), OS_WINXP | OS_WINXP_64 },
+    { 0x8086, 0x0A16, D_VERSION(9,18,10,3257), OS_VISTA | OS_WINDOWS7 },
+    { 0x8086, 0x0A26, D_VERSION(6,14,10,5437), OS_WINXP | OS_WINXP_64 },
+    { 0x8086, 0x0A26, D_VERSION(9,18,10,3257), OS_VISTA | OS_WINDOWS7 },
+    { 0x8086, 0x0A2E, D_VERSION(6,14,10,5437), OS_WINXP | OS_WINXP_64 },
+    { 0x8086, 0x0A2E, D_VERSION(9,18,10,3257), OS_VISTA | OS_WINDOWS7 },
+    { 0x8086, 0x0A1E, D_VERSION(6,14,10,5437), OS_WINXP | OS_WINXP_64 },
+    { 0x8086, 0x0A1E, D_VERSION(9,18,10,3257), OS_VISTA | OS_WINDOWS7 },
+    { 0x8086, 0x0A0E, D_VERSION(6,14,10,5437), OS_WINXP | OS_WINXP_64 },
+    { 0x8086, 0x0A0E, D_VERSION(9,18,10,3257), OS_VISTA | OS_WINDOWS7 },
+    { 0x8086, 0x0D26, D_VERSION(6,14,10,5437), OS_WINXP | OS_WINXP_64 },
+    { 0x8086, 0x0D26, D_VERSION(9,18,10,3257), OS_VISTA | OS_WINDOWS7 },
+    { 0x8086, 0x0D22, D_VERSION(6,14,10,5437), OS_WINXP | OS_WINXP_64 },
+    { 0x8086, 0x0D22, D_VERSION(9,18,10,3257), OS_VISTA | OS_WINDOWS7 },
 
     // Reason: workaround for 6620073, 6612195
     // Intel 740
@@ -123,33 +170,33 @@
     { 0x8086, 0x2A13, NO_VERSION, OS_ALL },
 
     // Eaglelake (Desktop) GMA 4500 Lines
-    { 0x8086, 0x2E42, D_VERSION(6,14,10,5303), OS_WINXP | OS_WINXP_64 },
-    { 0x8086, 0x2E42, D_VERSION(8,15,10,2302), OS_VISTA | OS_WINDOWS7 },
-    { 0x8086, 0x2E43, D_VERSION(6,14,10,5303), OS_WINXP | OS_WINXP_64 },
-    { 0x8086, 0x2E43, D_VERSION(8,15,10,2302), OS_VISTA | OS_WINDOWS7 },
-    { 0x8086, 0x2E92, D_VERSION(6,14,10,5303), OS_WINXP | OS_WINXP_64 },
-    { 0x8086, 0x2E92, D_VERSION(8,15,10,2302), OS_VISTA | OS_WINDOWS7 },
-    { 0x8086, 0x2E93, D_VERSION(6,14,10,5303), OS_WINXP | OS_WINXP_64 },
-    { 0x8086, 0x2E93, D_VERSION(8,15,10,2302), OS_VISTA | OS_WINDOWS7 },
-    { 0x8086, 0x2E12, D_VERSION(6,14,10,5303), OS_WINXP | OS_WINXP_64 },
-    { 0x8086, 0x2E12, D_VERSION(8,15,10,2302), OS_VISTA | OS_WINDOWS7 },
-    { 0x8086, 0x2E13, D_VERSION(6,14,10,5303), OS_WINXP | OS_WINXP_64 },
-    { 0x8086, 0x2E13, D_VERSION(8,15,10,2302), OS_VISTA | OS_WINDOWS7 },
+    { 0x8086, 0x2E42, D_VERSION(6,14,10,5420), OS_WINXP | OS_WINXP_64 },
+    { 0x8086, 0x2E42, D_VERSION(8,15,10,2869), OS_VISTA | OS_WINDOWS7 },
+    { 0x8086, 0x2E43, D_VERSION(6,14,10,5420), OS_WINXP | OS_WINXP_64 },
+    { 0x8086, 0x2E43, D_VERSION(8,15,10,2869), OS_VISTA | OS_WINDOWS7 },
+    { 0x8086, 0x2E92, D_VERSION(6,14,10,5420), OS_WINXP | OS_WINXP_64 },
+    { 0x8086, 0x2E92, D_VERSION(8,15,10,2869), OS_VISTA | OS_WINDOWS7 },
+    { 0x8086, 0x2E93, D_VERSION(6,14,10,5420), OS_WINXP | OS_WINXP_64 },
+    { 0x8086, 0x2E93, D_VERSION(8,15,10,2869), OS_VISTA | OS_WINDOWS7 },
+    { 0x8086, 0x2E12, D_VERSION(6,14,10,5420), OS_WINXP | OS_WINXP_64 },
+    { 0x8086, 0x2E12, D_VERSION(8,15,10,2869), OS_VISTA | OS_WINDOWS7 },
+    { 0x8086, 0x2E13, D_VERSION(6,14,10,5420), OS_WINXP | OS_WINXP_64 },
+    { 0x8086, 0x2E13, D_VERSION(8,15,10,2869), OS_VISTA | OS_WINDOWS7 },
     // Eaglelake (Desktop) GMA X4500 Lines
-    { 0x8086, 0x2E32, D_VERSION(6,14,10,5303), OS_WINXP | OS_WINXP_64 },
-    { 0x8086, 0x2E32, D_VERSION(8,15,10,2302), OS_VISTA | OS_WINDOWS7 },
-    { 0x8086, 0x2E33, D_VERSION(6,14,10,5303), OS_WINXP | OS_WINXP_64 },
-    { 0x8086, 0x2E33, D_VERSION(8,15,10,2302), OS_VISTA | OS_WINDOWS7 },
-    { 0x8086, 0x2E22, D_VERSION(6,14,10,5303), OS_WINXP | OS_WINXP_64 },
-    { 0x8086, 0x2E22, D_VERSION(8,15,10,2302), OS_VISTA | OS_WINDOWS7 },
+    { 0x8086, 0x2E32, D_VERSION(6,14,10,5420), OS_WINXP | OS_WINXP_64 },
+    { 0x8086, 0x2E32, D_VERSION(8,15,10,2869), OS_VISTA | OS_WINDOWS7 },
+    { 0x8086, 0x2E33, D_VERSION(6,14,10,5420), OS_WINXP | OS_WINXP_64 },
+    { 0x8086, 0x2E33, D_VERSION(8,15,10,2869), OS_VISTA | OS_WINDOWS7 },
+    { 0x8086, 0x2E22, D_VERSION(6,14,10,5420), OS_WINXP | OS_WINXP_64 },
+    { 0x8086, 0x2E22, D_VERSION(8,15,10,2869), OS_VISTA | OS_WINDOWS7 },
     // Eaglelake (Desktop) GMA X4500HD Lines
-    { 0x8086, 0x2E23, D_VERSION(6,14,10,5303), OS_WINXP | OS_WINXP_64 },
-    { 0x8086, 0x2E23, D_VERSION(8,15,10,2302), OS_VISTA | OS_WINDOWS7 },
+    { 0x8086, 0x2E23, D_VERSION(6,14,10,5420), OS_WINXP | OS_WINXP_64 },
+    { 0x8086, 0x2E23, D_VERSION(8,15,10,2869), OS_VISTA | OS_WINDOWS7 },
     // Cantiga (Mobile) GMA 4500MHD Lines
-    { 0x8086, 0x2A42, D_VERSION(6,14,10,5303), OS_WINXP | OS_WINXP_64 },
-    { 0x8086, 0x2A42, D_VERSION(8,15,10,2302), OS_VISTA | OS_WINDOWS7 },
-    { 0x8086, 0x2A43, D_VERSION(6,14,10,5303), OS_WINXP | OS_WINXP_64 },
-    { 0x8086, 0x2A43, D_VERSION(8,15,10,2302), OS_VISTA | OS_WINDOWS7 },
+    { 0x8086, 0x2A42, D_VERSION(6,14,10,5420), OS_WINXP | OS_WINXP_64 },
+    { 0x8086, 0x2A42, D_VERSION(8,15,10,2869), OS_VISTA | OS_WINDOWS7 },
+    { 0x8086, 0x2A43, D_VERSION(6,14,10,5420), OS_WINXP | OS_WINXP_64 },
+    { 0x8086, 0x2A43, D_VERSION(8,15,10,2869), OS_VISTA | OS_WINDOWS7 },
 
     // ATI Mobility Radeon X1600, X1400, X1450, X1300, X1350
     // Reason: workaround for 6613066, 6687166
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/GradientPaint/GradientTransformTest.java	Thu Oct 31 15:45:57 2013 -0700
@@ -0,0 +1,126 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.awt.*;
+import java.awt.MultipleGradientPaint.*;
+import java.awt.geom.*;
+import java.awt.image.*;
+
+/**
+ * @test
+ * @bug 8023483
+ * @summary tests if the transform-parameter is applied correctly when creating
+ *          a gradient.
+ * @author ceisserer
+ */
+public class GradientTransformTest extends Frame {
+    BufferedImage srcImg;
+    Image dstImg;
+
+    public GradientTransformTest() {
+        srcImg = createSrcImage();
+        dstImg = getGraphicsConfiguration().createCompatibleVolatileImage(20,
+                20);
+    }
+
+    protected void renderToVI(BufferedImage src, Image dst) {
+        Graphics2D g = (Graphics2D) dst.getGraphics();
+
+        g.setColor(Color.WHITE);
+        g.fillRect(0, 0, dst.getWidth(null), dst.getHeight(null));
+
+        AffineTransform at = new AffineTransform();
+        at.translate(-100, 0);
+
+        g.setPaint(new LinearGradientPaint(new Point2D.Float(100, 0),
+                new Point2D.Float(120, 0), new float[] { 0.0f, 0.75f, 1.0f },
+                new Color[] { Color.red, Color.green, Color.blue },
+                CycleMethod.NO_CYCLE, ColorSpaceType.SRGB, at));
+
+        g.fillRect(-10, -10, 30, 30);
+    }
+
+    public void paint(Graphics g1) {
+        Graphics2D g = (Graphics2D) g1;
+        renderToVI(createSrcImage(), dstImg);
+        g.drawImage(dstImg, 20, 20, null);
+    }
+
+    public void showFrame() {
+        setSize(500, 500);
+        setVisible(true);
+    }
+
+    public void test() {
+        renderToVI(createSrcImage(), dstImg);
+
+        BufferedImage validationImg = new BufferedImage(20, 20,
+                BufferedImage.TYPE_INT_RGB);
+        Graphics2D valG = (Graphics2D) validationImg.getGraphics();
+        valG.drawImage(dstImg, 0, 0, null);
+
+        // Loop over all pixel, and count the different pixel values
+        // encountered.
+        boolean gradientTranslated = false;
+        for (int x = 0; x < validationImg.getWidth() && !gradientTranslated; x++) {
+            for (int y = 0; y < validationImg.getHeight()
+                    && !gradientTranslated; y++) {
+                int rgb = validationImg.getRGB(x, y);
+                if (rgb != -65279) {
+                    gradientTranslated = true;
+                }
+            }
+        }
+
+        if (gradientTranslated) {
+            System.out.println("Passed!");
+        } else {
+            throw new RuntimeException("Test FAILED!");
+        }
+    }
+
+    protected BufferedImage createSrcImage() {
+        BufferedImage bi = new BufferedImage(10, 10, BufferedImage.TYPE_INT_RGB);
+        Graphics2D g = (Graphics2D) bi.getGraphics();
+        g.setColor(Color.YELLOW);
+        g.fillRect(0, 0, 10, 10);
+        g.setColor(Color.black);
+        g.drawLine(0, 0, 10, 10);
+        return bi;
+    }
+
+    public static void main(String[] args) throws Exception {
+        boolean show = (args.length > 0 && "-show".equals(args[0]));
+        final GradientTransformTest t = new GradientTransformTest();
+
+        if (show) {
+            EventQueue.invokeAndWait(new Runnable() {
+                public void run() {
+                    t.showFrame();
+                }
+            });
+        } else {
+            t.test();
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/GradientPaint/LinearColorSpaceGradientTest.java	Thu Oct 31 15:45:57 2013 -0700
@@ -0,0 +1,113 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.awt.*;
+import java.awt.MultipleGradientPaint.*;
+import java.awt.geom.*;
+import java.awt.image.*;
+
+/**
+ * @test
+ * @bug 8023483
+ * @summary tests wether the colorspace-parameter is applied correctly when
+ *          creating a gradient.
+ * @author ceisserer
+ */
+public class LinearColorSpaceGradientTest extends Frame {
+    BufferedImage srcImg;
+    Image dstImg;
+
+    public LinearColorSpaceGradientTest() {
+        srcImg = createSrcImage();
+        dstImg = getGraphicsConfiguration().createCompatibleVolatileImage(20,
+                20);
+    }
+
+    protected void renderToVI(BufferedImage src, Image dst) {
+        Graphics2D g = (Graphics2D) dst.getGraphics();
+
+        g.setColor(Color.WHITE);
+        g.fillRect(0, 0, dst.getWidth(null), dst.getHeight(null));
+
+        AffineTransform at = new AffineTransform();
+        g.setPaint(new LinearGradientPaint(new Point2D.Float(0, 0),
+                new Point2D.Float(20, 0), new float[] { 0.0f, 1.0f },
+                new Color[] { Color.green, Color.blue }, CycleMethod.NO_CYCLE,
+                ColorSpaceType.LINEAR_RGB, at));
+
+        g.fillRect(-10, -10, 30, 30);
+    }
+
+    public void paint(Graphics g1) {
+        Graphics2D g = (Graphics2D) g1;
+        renderToVI(createSrcImage(), dstImg);
+        g.drawImage(dstImg, 20, 20, null);
+    }
+
+    public void showFrame() {
+        setSize(500, 500);
+        setVisible(true);
+    }
+
+    public void test() {
+        renderToVI(createSrcImage(), dstImg);
+
+        BufferedImage validationImg = new BufferedImage(20, 20,
+                BufferedImage.TYPE_INT_RGB);
+        Graphics2D valG = (Graphics2D) validationImg.getGraphics();
+        valG.drawImage(dstImg, 0, 0, null);
+
+        int b = validationImg.getRGB(10, 10) & 0x000000FF;
+
+        if (b > 150) {
+            System.out.println("Passed!");
+        } else {
+            throw new RuntimeException("Test FAILED!");
+        }
+    }
+
+    protected BufferedImage createSrcImage() {
+        BufferedImage bi = new BufferedImage(10, 10, BufferedImage.TYPE_INT_RGB);
+        Graphics2D g = (Graphics2D) bi.getGraphics();
+        g.setColor(Color.YELLOW);
+        g.fillRect(0, 0, 10, 10);
+        g.setColor(Color.black);
+        g.drawLine(0, 0, 10, 10);
+        return bi;
+    }
+
+    public static void main(String[] args) throws Exception {
+        boolean show = (args.length > 0 && "-show".equals(args[0]));
+
+        final LinearColorSpaceGradientTest t = new LinearColorSpaceGradientTest();
+        if (show) {
+            EventQueue.invokeAndWait(new Runnable() {
+                public void run() {
+                    t.showFrame();
+                }
+            });
+        } else {
+            t.test();
+        }
+    }
+}
--- a/jdk/test/java/awt/PrintJob/SaveDialogTitleTest.java	Thu Oct 31 12:36:25 2013 -0700
+++ b/jdk/test/java/awt/PrintJob/SaveDialogTitleTest.java	Thu Oct 31 15:45:57 2013 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -23,8 +23,8 @@
 
 /*
  * @test
- * @bug 4851363
- * @summary Tests the save to file dialog has a title
+ * @bug 4851363 8025988 8025990
+ * @summary Tests the save to file dialog has a title.
  * @run main/manual=yesno/othervm SaveDialogTitleTest
  */
 
@@ -37,12 +37,21 @@
         System.out.print("Once the dialog appears, press OK and the ");
         System.out.print("Save to File dialog should appear and it ");
         System.out.println("must have a window title else the test fails.");
+        System.out.println("To test 8025988: Range should be selected with pages 3 to 8.");
+        System.out.println("To test 8025990: Paper should be Legal and in Landscape.");
         Toolkit tk = Toolkit.getDefaultToolkit();
         JobAttributes jobAttributes = new JobAttributes();
         jobAttributes.setDestination(JobAttributes.DestinationType.FILE);
+        jobAttributes.setDefaultSelection(JobAttributes.DefaultSelectionType.RANGE);
+        jobAttributes.setPageRanges(new int[][]{new int[]{3,8}});
+        PageAttributes page = new PageAttributes();
+        page.setMedia(PageAttributes.MediaType.LEGAL);
+        page.setOrientationRequested(PageAttributes.
+                                        OrientationRequestedType.LANDSCAPE);
+
         PrintJob printJob =
             tk.getPrintJob(new Frame(), "Save Title Test",
-                           jobAttributes, null);
+                           jobAttributes, page);
         if (printJob != null) { // in case user cancels.
           printJob.end();
         }
--- a/jdk/test/java/awt/print/PrinterJob/PrintLatinCJKTest.java	Thu Oct 31 12:36:25 2013 -0700
+++ b/jdk/test/java/awt/print/PrinterJob/PrintLatinCJKTest.java	Thu Oct 31 15:45:57 2013 -0700
@@ -23,7 +23,7 @@
 
 /**
  * @test
- * @bug 800535
+ * @bug 800535 8022536
  * @summary JDK7 Printing: CJK and Latin Text in string overlap
  * @run main/manual=yesno PrintLatinCJKTest
  */
@@ -49,6 +49,8 @@
     private PageFormat pf;
 
     static String info =
+       "To test 8022536, if a remote printer is the system default,"+
+       "it should show in the dialog as the selected printer.\n"+
        "You need a printer for this test. If you have none, let "+
        "the test pass. If there is a printer, press Print, send "+
        "the output to the printer, and examine it. It should have "+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/print/PrinterJob/PrintToDir.java	Thu Oct 31 15:45:57 2013 -0700
@@ -0,0 +1,144 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/* @test
+   @bug 4973278 8015586
+   @run main PrintToDir
+   @summary Must throw exception when printing to an invalid filename - a dir.
+*/
+import java.io.*;
+import java.net.*;
+import java.awt.*;
+import java.awt.geom.*;
+import java.awt.print.*;
+import javax.print.PrintService;
+import javax.print.attribute.*;
+import javax.print.attribute.standard.*;
+import java.util.PropertyPermission;
+
+public class PrintToDir extends Frame implements Printable {
+
+    boolean firstTime = true;
+    double sx, sy;
+    Shape clip, firstClip;
+
+    TextField tf = new TextField();
+    Label tfLabel = new Label ("File Name");
+    Panel p = new Panel (new GridLayout(2,2));
+    Button b = new Button("Print");
+
+    PrintToDir() {
+        add("South", p);
+        p.add(tfLabel);
+        p.add(tf);
+        p.add(b);
+        setSize(300, 300);
+        setVisible(true);
+    }
+
+    public int print(Graphics g, PageFormat pf, int pageIndex)  {
+        Graphics2D g2 = (Graphics2D)g;
+        if (pageIndex>=1) {
+                return Printable.NO_SUCH_PAGE;
+        }
+        g2.drawString("hello world", 100, 100);
+        return Printable.PAGE_EXISTS;
+    }
+
+    void doPrintJob(String fileStr) {
+        PageAttributes pa = new PageAttributes();
+        JobAttributes ja = new JobAttributes();
+        ja.setDialog(JobAttributes.DialogType.NONE);
+        ja.setDestination(JobAttributes.DestinationType.FILE);
+        ja.setFileName(fileStr);
+        try {
+            PrintJob pjob = Toolkit.getDefaultToolkit().getPrintJob(this,
+                                        "PrintDialog Testing", ja, pa);
+            if (pjob != null) {
+                System.out.println("Printjob successfully created: " + pjob);
+                Graphics g = pjob.getGraphics();
+                this.printAll(g);
+                g.dispose();
+                pjob.end();
+            }
+            System.out.println("Printing completed");
+        } catch (IllegalArgumentException e) {
+            System.out.println("PrintJob passed.");
+            return;
+        }
+        throw new RuntimeException("PrintJob::IllegalArgumentException expected but not thrown. \nTEST FAILED");
+    }
+
+    public static void doPrinterJob(String fileStr, OrientationRequested o) {
+        PrinterJob  pj = PrinterJob.getPrinterJob();
+        PrintService ps = pj.getPrintService();
+        if (ps == null) {
+          System.out.println("No print service found.");
+          return;
+        }
+        pj.setPrintable(new PrintToDir());
+        PrintRequestAttributeSet aset = new HashPrintRequestAttributeSet();
+        aset.add(o);
+        File f = new File(fileStr);
+        //      f.deleteOnExit();
+        URI dest = f.toURI();
+        Destination d = new Destination(dest);
+        if (ps.isAttributeValueSupported(d, null, null)) {
+            aset.add(d);
+            try {
+                pj.print(aset);
+            } catch (PrinterException e) {
+                System.out.println("PrinterJob passed.");
+                return;
+            }
+            throw new RuntimeException("PrinterJob:PrinterException expected but not thrown. \nTEST FAILED");
+        } else {
+            System.out.println("Destination attribute is not a supported value.  PrinterJob passed.");
+        }
+    }
+
+
+    public static void main(String arg[]) {
+        SecurityManager security = System.getSecurityManager();
+        if (security != null) {
+            System.out.println("Security manager detected");
+            try {
+                security.checkPermission(new FilePermission("<<ALL FILES>>", "read,write"));
+                security.checkPermission(new PropertyPermission("user.dir", "read"));
+            } catch (SecurityException se) {
+                System.out.println("Security requirement not obtained.  TEST PASSED");
+                return;
+            }
+        }
+        String[] testStr = {".", ""};
+        for (int i=0; i<testStr.length; i++) {
+            System.out.println("Testing file name = \""+testStr[i]+"\"");
+            doPrinterJob(testStr[i], OrientationRequested.PORTRAIT);
+            PrintToDir ptd = new PrintToDir();
+            ptd.doPrintJob(testStr[i]);
+            ptd.dispose();
+        }
+        System.out.println("TEST PASSED");
+    }
+
+}
--- a/jdk/test/java/lang/Thread/ThreadStateTest.java	Thu Oct 31 12:36:25 2013 -0700
+++ b/jdk/test/java/lang/Thread/ThreadStateTest.java	Thu Oct 31 15:45:57 2013 -0700
@@ -30,7 +30,7 @@
  * @author  Mandy Chung
  *
  * @build ThreadStateTest
- * @run main ThreadStateTest
+ * @run main/othervm -Xmixed ThreadStateTest
  */
 
 import java.util.concurrent.locks.LockSupport;
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/print/TextFlavorTest.java	Thu Oct 31 15:45:57 2013 -0700
@@ -0,0 +1,61 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+  @test
+  @bug 6334074 8022536
+  @summary test supported text flavors reported properly
+  @run main TextFlavorTest
+*/
+
+import javax.print.*;
+import javax.print.attribute.standard.*;
+import javax.print.attribute.*;
+import java.io.*;
+
+public class TextFlavorTest {
+
+    public static void main(String[] args) throws Exception {
+
+        PrintService service[] =
+            PrintServiceLookup.lookupPrintServices(null, null);
+
+        if (service.length == 0) {
+            System.out.println("No print service found.");
+            return;
+        }
+
+        for (int y = 0; y < service.length; y ++) {
+            DocFlavor flavors[] = service[y].getSupportedDocFlavors();
+            if (flavors == null) continue;
+            for (int x = 0; x < flavors.length; x ++) {
+                if (!service[y].isDocFlavorSupported(flavors[x])) {
+                    String msg = "DocFlavor " + flavors[x] +
+                        " is not supported by service "+ service[y];
+                    throw new RuntimeException(msg);
+                }
+            }
+        }
+        System.out.println("Test passed.");
+    }
+}
--- a/jdk/test/sun/java2d/DirectX/TransformedPaintTest/TransformedPaintTest.java	Thu Oct 31 12:36:25 2013 -0700
+++ b/jdk/test/sun/java2d/DirectX/TransformedPaintTest/TransformedPaintTest.java	Thu Oct 31 15:45:57 2013 -0700
@@ -23,7 +23,7 @@
 
 /*
  * @test
- * @bug 6689025
+ * @bug 6689025 8023483
  * @summary Tests that transformed Paints are rendered correctly
  * @author Dmitri.Trembovetski@sun.com: area=Graphics
  * @run main/othervm TransformedPaintTest