author | lana |
Fri, 17 May 2013 10:04:12 -0700 | |
changeset 17409 | 9bc2ffbb42d1 |
parent 17403 | 038d29f71bbf (current diff) |
parent 17408 | bb1047aa94aa (diff) |
child 17419 | 19e9480ad872 |
--- a/jdk/src/macosx/classes/sun/lwawt/macosx/CPrinterJob.java Thu May 16 12:15:19 2013 -0700 +++ b/jdk/src/macosx/classes/sun/lwawt/macosx/CPrinterJob.java Fri May 17 10:04:12 2013 -0700 @@ -35,6 +35,7 @@ import javax.print.*; import javax.print.attribute.PrintRequestAttributeSet; +import javax.print.attribute.HashPrintRequestAttributeSet; import sun.java2d.*; import sun.print.*; @@ -96,6 +97,14 @@ return false; } + if (attributes == null) { + attributes = new HashPrintRequestAttributeSet(); + } + + if (getPrintService() instanceof StreamPrintService) { + return super.printDialog(attributes); + } + return jobSetup(getPageable(), checkAllowedToPrintToFile()); } @@ -130,6 +139,10 @@ return page; } + if (getPrintService() instanceof StreamPrintService) { + return super.pageDialog(page); + } + PageFormat pageClone = (PageFormat) page.clone(); boolean doIt = pageSetup(pageClone, null); return doIt ? pageClone : page;
--- a/jdk/src/share/classes/com/sun/imageio/plugins/gif/GIFImageReader.java Thu May 16 12:15:19 2013 -0700 +++ b/jdk/src/share/classes/com/sun/imageio/plugins/gif/GIFImageReader.java Fri May 17 10:04:12 2013 -0700 @@ -790,16 +790,12 @@ } private void startPass(int pass) { - if (updateListeners == null) { + if (updateListeners == null || !imageMetadata.interlaceFlag) { return; } - int y = 0; - int yStep = 1; - if (imageMetadata.interlaceFlag) { - y = interlaceOffset[interlacePass]; - yStep = interlaceIncrement[interlacePass]; - } + int y = interlaceOffset[interlacePass]; + int yStep = interlaceIncrement[interlacePass]; int[] vals = ReaderUtil. computeUpdatedPixels(sourceRegion,
--- a/jdk/src/share/classes/sun/font/FileFontStrike.java Thu May 16 12:15:19 2013 -0700 +++ b/jdk/src/share/classes/sun/font/FileFontStrike.java Fri May 17 10:04:12 2013 -0700 @@ -747,14 +747,9 @@ return origMinX; } - long pixelData; - if (StrikeCache.nativeAddressSize == 4) { - pixelData = 0xffffffff & - StrikeCache.unsafe.getInt(ptr + StrikeCache.pixelDataOffset); - } else { - pixelData = - StrikeCache.unsafe.getLong(ptr + StrikeCache.pixelDataOffset); - } + long pixelData = + StrikeCache.unsafe.getAddress(ptr + StrikeCache.pixelDataOffset); + if (pixelData == 0L) { return origMinX; }
--- a/jdk/src/share/classes/sun/font/GlyphList.java Thu May 16 12:15:19 2013 -0700 +++ b/jdk/src/share/classes/sun/font/GlyphList.java Fri May 17 10:04:12 2013 -0700 @@ -361,16 +361,10 @@ graybits = new byte[len]; } } - long pixelDataAddress; - if (StrikeCache.nativeAddressSize == 4) { - pixelDataAddress = 0xffffffff & - StrikeCache.unsafe.getInt(images[glyphindex] + + long pixelDataAddress = + StrikeCache.unsafe.getAddress(images[glyphindex] + StrikeCache.pixelDataOffset); - } else { - pixelDataAddress = - StrikeCache.unsafe.getLong(images[glyphindex] + - StrikeCache.pixelDataOffset); - } + if (pixelDataAddress == 0L) { return graybits; }
--- a/jdk/src/share/classes/sun/print/RasterPrinterJob.java Thu May 16 12:15:19 2013 -0700 +++ b/jdk/src/share/classes/sun/print/RasterPrinterJob.java Fri May 17 10:04:12 2013 -0700 @@ -607,13 +607,17 @@ protected void updatePageAttributes(PrintService service, PageFormat page) { + if (this.attributes == null) { + this.attributes = new HashPrintRequestAttributeSet(); + } + updateAttributesWithPageFormat(service, page, this.attributes); } protected void updateAttributesWithPageFormat(PrintService service, PageFormat page, - PrintRequestAttributeSet attributes) { - if (service == null || page == null) { + PrintRequestAttributeSet pageAttributes) { + if (service == null || page == null || pageAttributes == null) { return; } @@ -653,13 +657,10 @@ orient = OrientationRequested.PORTRAIT; } - if (attributes == null) { - attributes = new HashPrintRequestAttributeSet(); + if (media != null) { + pageAttributes.add(media); } - if (media != null) { - attributes.add(media); - } - attributes.add(orient); + pageAttributes.add(orient); float ix = (float)(page.getPaper().getImageableX()/DPI); float iw = (float)(page.getPaper().getImageableWidth()/DPI); @@ -667,7 +668,7 @@ float ih = (float)(page.getPaper().getImageableHeight()/DPI); if (ix < 0) ix = 0f; if (iy < 0) iy = 0f; try { - attributes.add(new MediaPrintableArea(ix, iy, iw, ih, + pageAttributes.add(new MediaPrintableArea(ix, iy, iw, ih, MediaPrintableArea.INCH)); } catch (IllegalArgumentException iae) { }
--- a/jdk/src/solaris/classes/sun/font/XRGlyphCacheEntry.java Thu May 16 12:15:19 2013 -0700 +++ b/jdk/src/solaris/classes/sun/font/XRGlyphCacheEntry.java Fri May 17 10:04:12 2013 -0700 @@ -69,11 +69,28 @@ } public static int getGlyphID(long glyphInfoPtr) { - return (int) StrikeCache.unsafe.getInt(glyphInfoPtr + StrikeCache.cacheCellOffset); + // We need to access the GlyphID with Unsafe.getAddress() because the + // corresponding field in the underlying C data-structure is of type + // 'void*' (see field 'cellInfo' of struct 'GlyphInfo' + // in src/share/native/sun/font/fontscalerdefs.h). + // On 64-bit Big-endian architectures it would be wrong to access this + // field with Unsafe.getInt(). + return (int) StrikeCache.unsafe.getAddress(glyphInfoPtr + + StrikeCache.cacheCellOffset); } public static void setGlyphID(long glyphInfoPtr, int id) { - StrikeCache.unsafe.putInt(glyphInfoPtr + StrikeCache.cacheCellOffset, id); + // We need to access the GlyphID with Unsafe.putAddress() because the + // corresponding field in the underlying C data-structure is of type + // 'void*' (see field 'cellInfo' of struct 'GlyphInfo' in + // src/share/native/sun/font/fontscalerdefs.h). + // On 64-bit Big-endian architectures it would be wrong to write this + // field with Unsafe.putInt() because it is also accessed from native + // code as a 'long'. + // See Java_sun_java2d_xr_XRBackendNative_XRAddGlyphsNative() + // in src/solaris/native/sun/java2d/x11/XRBackendNative.c + StrikeCache.unsafe.putAddress(glyphInfoPtr + + StrikeCache.cacheCellOffset, (long)id); } public int getGlyphID() { @@ -105,12 +122,9 @@ } public void writePixelData(ByteArrayOutputStream os, boolean uploadAsLCD) { - long pixelDataAddress; - if (StrikeCache.nativeAddressSize == 4) { - pixelDataAddress = 0xffffffff & StrikeCache.unsafe.getInt(glyphInfoPtr + StrikeCache.pixelDataOffset); - } else { - pixelDataAddress = StrikeCache.unsafe.getLong(glyphInfoPtr + StrikeCache.pixelDataOffset); - } + long pixelDataAddress = + StrikeCache.unsafe.getAddress(glyphInfoPtr + + StrikeCache.pixelDataOffset); if (pixelDataAddress == 0L) { return; }
--- a/jdk/src/solaris/native/sun/java2d/x11/XRBackendNative.c Thu May 16 12:15:19 2013 -0700 +++ b/jdk/src/solaris/native/sun/java2d/x11/XRBackendNative.c Fri May 17 10:04:12 2013 -0700 @@ -742,7 +742,12 @@ for (i=0; i < glyphCnt; i++) { GlyphInfo *jginfo = (GlyphInfo *) jlong_to_ptr(glyphInfoPtrs[i]); - gid[i] = (Glyph) (0x0ffffffffL & ((unsigned long)(jginfo->cellInfo))); + // 'jginfo->cellInfo' is of type 'void*' + // (see definition of 'GlyphInfo' in fontscalerdefs.h) + // 'Glyph' is typedefed to 'unsigned long' + // (see http://www.x.org/releases/X11R7.7/doc/libXrender/libXrender.txt) + // Maybe we should assert that (sizeof(void*) == sizeof(Glyph)) ? + gid[i] = (Glyph) (jginfo->cellInfo); xginfo[i].x = (-jginfo->topLeftX); xginfo[i].y = (-jginfo->topLeftY); xginfo[i].width = jginfo->width;
--- a/jdk/src/windows/native/sun/java2d/d3d/D3DBadHardware.h Thu May 16 12:15:19 2013 -0700 +++ b/jdk/src/windows/native/sun/java2d/d3d/D3DBadHardware.h Fri May 17 10:04:12 2013 -0700 @@ -51,9 +51,105 @@ static const ADAPTER_INFO badHardware[] = { - // any Intel chip - // Reason: workaround for 6620073, 6612195, 6620073 - { 0x8086, ALL_DEVICEIDS, NO_VERSION, OS_ALL }, + // 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 }, + // 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 }, + + // Reason: workaround for 6620073, 6612195 + // Intel 740 + { 0x8086, 0x7800, NO_VERSION, OS_ALL }, + { 0x8086, 0x1240, NO_VERSION, OS_ALL }, + { 0x8086, 0x7121, NO_VERSION, OS_ALL }, + { 0x8086, 0x7123, NO_VERSION, OS_ALL }, + { 0x8086, 0x7125, NO_VERSION, OS_ALL }, + { 0x8086, 0x1132, NO_VERSION, OS_ALL }, + // IEG + { 0x8086, 0x2562, NO_VERSION, OS_ALL }, + { 0x8086, 0x3577, NO_VERSION, OS_ALL }, + { 0x8086, 0x2572, NO_VERSION, OS_ALL }, + { 0x8086, 0x3582, NO_VERSION, OS_ALL }, + { 0x8086, 0x358E, NO_VERSION, OS_ALL }, + // GMA + { 0x8086, 0x2582, NO_VERSION, OS_ALL }, + { 0x8086, 0x2782, NO_VERSION, OS_ALL }, + { 0x8086, 0x2592, NO_VERSION, OS_ALL }, + { 0x8086, 0x2792, NO_VERSION, OS_ALL }, + { 0x8086, 0x2772, NO_VERSION, OS_ALL }, + { 0x8086, 0x2776, NO_VERSION, OS_ALL }, + { 0x8086, 0x27A2, NO_VERSION, OS_ALL }, + { 0x8086, 0x27A6, NO_VERSION, OS_ALL }, + { 0x8086, 0x27AE, NO_VERSION, OS_ALL }, + { 0x8086, 0x29D2, NO_VERSION, OS_ALL }, + { 0x8086, 0x29D3, NO_VERSION, OS_ALL }, + { 0x8086, 0x29B2, NO_VERSION, OS_ALL }, + { 0x8086, 0x29B3, NO_VERSION, OS_ALL }, + { 0x8086, 0x29C2, NO_VERSION, OS_ALL }, + { 0x8086, 0x29C3, NO_VERSION, OS_ALL }, + { 0x8086, 0xA001, NO_VERSION, OS_ALL }, + { 0x8086, 0xA002, NO_VERSION, OS_ALL }, + { 0x8086, 0xA011, NO_VERSION, OS_ALL }, + { 0x8086, 0xA012, NO_VERSION, OS_ALL }, + // GMA + { 0x8086, 0x2972, NO_VERSION, OS_ALL }, + { 0x8086, 0x2973, NO_VERSION, OS_ALL }, + { 0x8086, 0x2992, NO_VERSION, OS_ALL }, + { 0x8086, 0x2993, NO_VERSION, OS_ALL }, + { 0x8086, 0x29A2, NO_VERSION, OS_ALL }, + { 0x8086, 0x29A3, NO_VERSION, OS_ALL }, + { 0x8086, 0x2982, NO_VERSION, OS_ALL }, + { 0x8086, 0x2983, NO_VERSION, OS_ALL }, + { 0x8086, 0x2A02, NO_VERSION, OS_ALL }, + { 0x8086, 0x2A03, NO_VERSION, OS_ALL }, + { 0x8086, 0x2A12, NO_VERSION, OS_ALL }, + { 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 }, + // 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 }, + // 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 }, + // 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 }, // 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/javax/imageio/plugins/gif/GIFPassListenerTest.java Fri May 17 10:04:12 2013 -0700 @@ -0,0 +1,127 @@ +/* + * Copyright (c) 2012, 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 4892259 + * + * @summary Verify that calls to IIOReadUpdateListener passStarted and + * passComplete are consistent. + * + * @run main GIFPassListenerTest + */ + +import java.awt.image.*; +import java.io.*; +import java.util.*; +import javax.imageio.*; +import javax.imageio.event.*; +import javax.imageio.stream.*; + +public class GIFPassListenerTest { + + private static ImageInputStream createTestImageStream(boolean progressive) throws IOException { + ByteArrayOutputStream output = new ByteArrayOutputStream(); + Iterator<ImageWriter> writers = ImageIO.getImageWritersByFormatName("gif"); + if (!writers.hasNext()) { + return null; + } + ImageWriter writer = writers.next(); + ImageWriteParam param = writer.getDefaultWriteParam(); + param.setProgressiveMode(progressive ? + ImageWriteParam.MODE_DEFAULT : ImageWriteParam.MODE_DISABLED); + ImageOutputStream imageOutput = ImageIO.createImageOutputStream(output); + writer.setOutput(imageOutput); + BufferedImage image = new BufferedImage(100, 100, BufferedImage.TYPE_INT_ARGB); + writer.write(null, new IIOImage(image, null, null), param); + imageOutput.flush(); + ByteArrayInputStream input = new ByteArrayInputStream(output.toByteArray()); + return ImageIO.createImageInputStream(input); + } + + private static void checkImage(boolean progressive) throws Exception { + ImageInputStream iis = createTestImageStream(progressive); + ImageReader reader = ImageIO.getImageReaders(iis).next(); + reader.setInput(iis); + ReadUpdateHandler handler = new ReadUpdateHandler(); + reader.addIIOReadUpdateListener(handler); + reader.readAll(null); + if (handler.isPassStarted) { + throw new RuntimeException("passStarted without passComplete."); + } + if (progressive && (handler.numPasses == 0)) { + throw new RuntimeException("passStarted wasn't called for progressive image"); + } + if (!progressive && (handler.numPasses != 0)) { + throw new RuntimeException("passStarted was called for non-progressive image"); + } + iis.close(); + } + + public static void main(String args[]) throws Exception { + checkImage(true); + checkImage(false); + } + + private static class ReadUpdateHandler implements IIOReadUpdateListener { + public boolean isPassStarted = false; + public int numPasses = 0; + + @Override + public void imageUpdate(ImageReader source, BufferedImage theImage, int minX, int minY, + int width, int height, int periodX, int periodY, int[] bands) { + } + + @Override + public void passStarted(ImageReader source, BufferedImage theImage, int pass, int minPass, + int maxPass, int minX, int minY, int periodX, int periodY, int[] bands) { + if (isPassStarted) { + throw new RuntimeException("reentered passStarted!"); + } + isPassStarted = true; + numPasses++; + } + + @Override + public void passComplete(ImageReader source, BufferedImage theImage) { + if (!isPassStarted) { + throw new RuntimeException("passComplete without passStarted!"); + } + isPassStarted = false; + } + + @Override + public void thumbnailPassStarted(ImageReader source, BufferedImage theThumbnail, int pass, + int minPass, int maxPass, int minX, int minY, int periodX, int periodY, int[] bands) { + } + + @Override + public void thumbnailPassComplete(ImageReader source, BufferedImage theThumbnail) { + } + + @Override + public void thumbnailUpdate(ImageReader source, BufferedImage theThumbnail, int minX, int minY, + int width, int height, int periodX, int periodY, int[] bands) { + } + } +}