Merge
This commit is contained in:
commit
be32b11e5b
@ -233,6 +233,10 @@ public class CPrinterJob extends RasterPrinterJob {
|
|||||||
|
|
||||||
|
|
||||||
setAttributes(attributes);
|
setAttributes(attributes);
|
||||||
|
// throw exception for invalid destination
|
||||||
|
if (destinationAttr != null) {
|
||||||
|
validateDestination(destinationAttr);
|
||||||
|
}
|
||||||
|
|
||||||
/* Get the range of pages we are to print. If the
|
/* Get the range of pages we are to print. If the
|
||||||
* last page to print is unknown, then we print to
|
* last page to print is unknown, then we print to
|
||||||
|
@ -359,7 +359,11 @@ static void javaPrinterJobToNSPrintInfo(JNIEnv* env, jobject srcPrinterJob, jobj
|
|||||||
static JNF_CLASS_CACHE(jc_Pageable, "java/awt/print/Pageable");
|
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_getCopies, sjc_CPrinterJob, "getCopiesInt", "()I");
|
||||||
static JNF_MEMBER_CACHE(jm_isCollated, sjc_CPrinterJob, "isCollated", "()Z");
|
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_getNumberOfPages, jc_Pageable, "getNumberOfPages", "()I");
|
||||||
|
static JNF_MEMBER_CACHE(jm_getPageFormat, sjc_CPrinterJob, "getPageFormatFromAttributes", "()Ljava/awt/print/PageFormat;");
|
||||||
|
|
||||||
NSMutableDictionary* printingDictionary = [dst dictionary];
|
NSMutableDictionary* printingDictionary = [dst dictionary];
|
||||||
|
|
||||||
@ -368,19 +372,35 @@ static void javaPrinterJobToNSPrintInfo(JNIEnv* env, jobject srcPrinterJob, jobj
|
|||||||
|
|
||||||
jboolean collated = JNFCallBooleanMethod(env, srcPrinterJob, jm_isCollated); // AWT_THREADING Safe (known object)
|
jboolean collated = JNFCallBooleanMethod(env, srcPrinterJob, jm_isCollated); // AWT_THREADING Safe (known object)
|
||||||
[printingDictionary setObject:[NSNumber numberWithBool:collated ? YES : NO] forKey:NSPrintMustCollate];
|
[printingDictionary setObject:[NSNumber numberWithBool:collated ? YES : NO] forKey:NSPrintMustCollate];
|
||||||
|
|
||||||
jint jNumPages = JNFCallIntMethod(env, srcPageable, jm_getNumberOfPages); // AWT_THREADING Safe (!appKit)
|
jint jNumPages = JNFCallIntMethod(env, srcPageable, jm_getNumberOfPages); // AWT_THREADING Safe (!appKit)
|
||||||
if (jNumPages != java_awt_print_Pageable_UNKNOWN_NUMBER_OF_PAGES)
|
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];
|
jint fromPage = JNFCallIntMethod(env, srcPrinterJob, jm_getFromPage);
|
||||||
[printingDictionary setObject:[NSNumber numberWithInteger:jNumPages] forKey:NSPrintLastPage];
|
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
|
else
|
||||||
{
|
{
|
||||||
[printingDictionary setObject:[NSNumber numberWithBool:YES] forKey:NSPrintAllPages];
|
[printingDictionary setObject:[NSNumber numberWithBool:YES] forKey:NSPrintAllPages];
|
||||||
}
|
}
|
||||||
|
jobject page = JNFCallObjectMethod(env, srcPrinterJob, jm_getPageFormat);
|
||||||
|
if (page != NULL) {
|
||||||
|
javaPageFormatToNSPrintInfo(env, NULL, page, dst);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -187,15 +187,24 @@ public class BMPImageReader extends ImageReader implements BMPConstants {
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public int getWidth(int imageIndex) throws IOException {
|
public int getWidth(int imageIndex) throws IOException {
|
||||||
checkIndex(imageIndex);
|
checkIndex(imageIndex);
|
||||||
readHeader();
|
try {
|
||||||
|
readHeader();
|
||||||
|
} catch (IllegalArgumentException e) {
|
||||||
|
throw new IIOException(I18N.getString("BMPImageReader6"), e);
|
||||||
|
}
|
||||||
return width;
|
return width;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getHeight(int imageIndex) throws IOException {
|
public int getHeight(int imageIndex) throws IOException {
|
||||||
checkIndex(imageIndex);
|
checkIndex(imageIndex);
|
||||||
readHeader();
|
try {
|
||||||
|
readHeader();
|
||||||
|
} catch (IllegalArgumentException e) {
|
||||||
|
throw new IIOException(I18N.getString("BMPImageReader6"), e);
|
||||||
|
}
|
||||||
return height;
|
return height;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -205,7 +214,18 @@ public class BMPImageReader extends ImageReader implements BMPConstants {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
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)
|
if (gotHeader)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -307,6 +327,9 @@ public class BMPImageReader extends ImageReader implements BMPConstants {
|
|||||||
case BI_RLE4: // 4-bit RLE compression
|
case BI_RLE4: // 4-bit RLE compression
|
||||||
|
|
||||||
// Read in the palette
|
// Read in the palette
|
||||||
|
if (bitmapOffset < (size + 14)) {
|
||||||
|
throw new IIOException(I18N.getString("BMPImageReader7"));
|
||||||
|
}
|
||||||
int numberOfEntries = (int)((bitmapOffset-14-size) / 4);
|
int numberOfEntries = (int)((bitmapOffset-14-size) / 4);
|
||||||
int sizeOfPalette = numberOfEntries * 4;
|
int sizeOfPalette = numberOfEntries * 4;
|
||||||
palette = new byte[sizeOfPalette];
|
palette = new byte[sizeOfPalette];
|
||||||
@ -375,7 +398,7 @@ public class BMPImageReader extends ImageReader implements BMPConstants {
|
|||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
throw new
|
throw new
|
||||||
RuntimeException(I18N.getString("BMPImageReader2"));
|
IIOException(I18N.getString("BMPImageReader2"));
|
||||||
}
|
}
|
||||||
} else if (size == 108 || size == 124) {
|
} else if (size == 108 || size == 124) {
|
||||||
// Windows 4.x BMP
|
// Windows 4.x BMP
|
||||||
@ -478,7 +501,7 @@ public class BMPImageReader extends ImageReader implements BMPConstants {
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
throw new
|
throw new
|
||||||
RuntimeException(I18N.getString("BMPImageReader3"));
|
IIOException(I18N.getString("BMPImageReader3"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -660,7 +683,11 @@ public class BMPImageReader extends ImageReader implements BMPConstants {
|
|||||||
public Iterator getImageTypes(int imageIndex)
|
public Iterator getImageTypes(int imageIndex)
|
||||||
throws IOException {
|
throws IOException {
|
||||||
checkIndex(imageIndex);
|
checkIndex(imageIndex);
|
||||||
readHeader();
|
try {
|
||||||
|
readHeader();
|
||||||
|
} catch (IllegalArgumentException e) {
|
||||||
|
throw new IIOException(I18N.getString("BMPImageReader6"), e);
|
||||||
|
}
|
||||||
ArrayList list = new ArrayList(1);
|
ArrayList list = new ArrayList(1);
|
||||||
list.add(new ImageTypeSpecifier(originalColorModel,
|
list.add(new ImageTypeSpecifier(originalColorModel,
|
||||||
originalSampleModel));
|
originalSampleModel));
|
||||||
@ -675,7 +702,11 @@ public class BMPImageReader extends ImageReader implements BMPConstants {
|
|||||||
throws IOException {
|
throws IOException {
|
||||||
checkIndex(imageIndex);
|
checkIndex(imageIndex);
|
||||||
if (metadata == null) {
|
if (metadata == null) {
|
||||||
readHeader();
|
try {
|
||||||
|
readHeader();
|
||||||
|
} catch (IllegalArgumentException e) {
|
||||||
|
throw new IIOException(I18N.getString("BMPImageReader6"), e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return metadata;
|
return metadata;
|
||||||
}
|
}
|
||||||
@ -686,7 +717,11 @@ public class BMPImageReader extends ImageReader implements BMPConstants {
|
|||||||
|
|
||||||
public boolean isRandomAccessEasy(int imageIndex) throws IOException {
|
public boolean isRandomAccessEasy(int imageIndex) throws IOException {
|
||||||
checkIndex(imageIndex);
|
checkIndex(imageIndex);
|
||||||
readHeader();
|
try {
|
||||||
|
readHeader();
|
||||||
|
} catch (IllegalArgumentException e) {
|
||||||
|
throw new IIOException(I18N.getString("BMPImageReader6"), e);
|
||||||
|
}
|
||||||
return metadata.compression == BI_RGB;
|
return metadata.compression == BI_RGB;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -705,7 +740,11 @@ public class BMPImageReader extends ImageReader implements BMPConstants {
|
|||||||
param = getDefaultReadParam();
|
param = getDefaultReadParam();
|
||||||
|
|
||||||
//read header
|
//read header
|
||||||
readHeader();
|
try {
|
||||||
|
readHeader();
|
||||||
|
} catch (IllegalArgumentException e) {
|
||||||
|
throw new IIOException(I18N.getString("BMPImageReader6"), e);
|
||||||
|
}
|
||||||
|
|
||||||
sourceRegion = new Rectangle(0, 0, 0, 0);
|
sourceRegion = new Rectangle(0, 0, 0, 0);
|
||||||
destinationRegion = new Rectangle(0, 0, 0, 0);
|
destinationRegion = new Rectangle(0, 0, 0, 0);
|
||||||
@ -817,7 +856,7 @@ public class BMPImageReader extends ImageReader implements BMPConstants {
|
|||||||
|
|
||||||
default:
|
default:
|
||||||
throw new
|
throw new
|
||||||
RuntimeException(I18N.getString("BMPImageReader1"));
|
IIOException(I18N.getString("BMPImageReader1"));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -833,7 +872,7 @@ public class BMPImageReader extends ImageReader implements BMPConstants {
|
|||||||
|
|
||||||
default:
|
default:
|
||||||
throw new
|
throw new
|
||||||
RuntimeException(I18N.getString("BMPImageReader1"));
|
IIOException(I18N.getString("BMPImageReader1"));
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
@ -874,7 +913,7 @@ public class BMPImageReader extends ImageReader implements BMPConstants {
|
|||||||
|
|
||||||
default:
|
default:
|
||||||
throw new
|
throw new
|
||||||
RuntimeException(I18N.getString("BMPImageReader1"));
|
IIOException(I18N.getString("BMPImageReader1"));
|
||||||
}
|
}
|
||||||
|
|
||||||
case VERSION_4_8_BIT:
|
case VERSION_4_8_BIT:
|
||||||
@ -890,7 +929,7 @@ public class BMPImageReader extends ImageReader implements BMPConstants {
|
|||||||
|
|
||||||
default:
|
default:
|
||||||
throw new
|
throw new
|
||||||
RuntimeException(I18N.getString("BMPImageReader1"));
|
IIOException(I18N.getString("BMPImageReader1"));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -21,6 +21,8 @@ BMPImageReader2=Invalid compression specified in BMP stream.
|
|||||||
BMPImageReader3=New BMP version not implemented yet.
|
BMPImageReader3=New BMP version not implemented yet.
|
||||||
BMPImageReader4=No ImageIO-style reader is found for
|
BMPImageReader4=No ImageIO-style reader is found for
|
||||||
BMPImageReader5=Input has not been set.
|
BMPImageReader5=Input has not been set.
|
||||||
|
BMPImageReader6=Unable to read the image header.
|
||||||
|
BMPImageReader7=Invalid bitmap offset.
|
||||||
BMPImageWriter0=Output is not an ImageOutputStream.
|
BMPImageWriter0=Output is not an ImageOutputStream.
|
||||||
BMPImageWriter1=The image region to be encoded is empty.
|
BMPImageWriter1=The image region to be encoded is empty.
|
||||||
BMPImageWriter2=Only 1 or 3 band image is encoded.
|
BMPImageWriter2=Only 1 or 3 band image is encoded.
|
||||||
@ -34,7 +36,7 @@ BMPMetadata0=The provided metadata format isn't recognized.
|
|||||||
BMPMetadata1=Metadata is read-only.
|
BMPMetadata1=Metadata is read-only.
|
||||||
|
|
||||||
|
|
||||||
# WBMP plugin properties
|
# WBMP plugin properties
|
||||||
WBMPImageReader0=Only one image exists in the stream.
|
WBMPImageReader0=Only one image exists in the stream.
|
||||||
WBMPImageReader1=Input has not been set.
|
WBMPImageReader1=Input has not been set.
|
||||||
WBMPImageReader2=Bad WBMP header.
|
WBMPImageReader2=Bad WBMP header.
|
||||||
|
@ -115,6 +115,8 @@ public class GIFImageReader extends ImageReader {
|
|||||||
// The current interlace pass, starting with 0.
|
// The current interlace pass, starting with 0.
|
||||||
int interlacePass = 0;
|
int interlacePass = 0;
|
||||||
|
|
||||||
|
private byte[] fallbackColorTable = null;
|
||||||
|
|
||||||
// End per-stream settings
|
// End per-stream settings
|
||||||
|
|
||||||
// Constants used to control interlacing.
|
// Constants used to control interlacing.
|
||||||
@ -239,10 +241,22 @@ public class GIFImageReader extends ImageReader {
|
|||||||
byte[] colorTable;
|
byte[] colorTable;
|
||||||
if (imageMetadata.localColorTable != null) {
|
if (imageMetadata.localColorTable != null) {
|
||||||
colorTable = imageMetadata.localColorTable;
|
colorTable = imageMetadata.localColorTable;
|
||||||
|
fallbackColorTable = imageMetadata.localColorTable;
|
||||||
} else {
|
} else {
|
||||||
colorTable = streamMetadata.globalColorTable;
|
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
|
// Normalize color table length to 2^1, 2^2, 2^4, or 2^8
|
||||||
int length = colorTable.length/3;
|
int length = colorTable.length/3;
|
||||||
int bits;
|
int bits;
|
||||||
@ -1036,5 +1050,34 @@ public class GIFImageReader extends ImageReader {
|
|||||||
streamY = -1;
|
streamY = -1;
|
||||||
rowsDone = 0;
|
rowsDone = 0;
|
||||||
interlacePass = 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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -28,6 +28,7 @@ package com.sun.imageio.plugins.jpeg;
|
|||||||
import javax.imageio.metadata.IIOInvalidTreeException;
|
import javax.imageio.metadata.IIOInvalidTreeException;
|
||||||
import javax.imageio.metadata.IIOMetadataNode;
|
import javax.imageio.metadata.IIOMetadataNode;
|
||||||
import javax.imageio.stream.ImageOutputStream;
|
import javax.imageio.stream.ImageOutputStream;
|
||||||
|
import javax.imageio.IIOException;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
@ -60,6 +61,10 @@ class MarkerSegment implements Cloneable {
|
|||||||
length = (buffer.buf[buffer.bufPtr++] & 0xff) << 8;
|
length = (buffer.buf[buffer.bufPtr++] & 0xff) << 8;
|
||||||
length |= buffer.buf[buffer.bufPtr++] & 0xff;
|
length |= buffer.buf[buffer.bufPtr++] & 0xff;
|
||||||
length -= 2; // JPEG length includes itself, we don't
|
length -= 2; // JPEG length includes itself, we don't
|
||||||
|
|
||||||
|
if (length < 0) {
|
||||||
|
throw new IIOException("Invalid segment length: " + length);
|
||||||
|
}
|
||||||
buffer.bufAvail -= 3;
|
buffer.bufAvail -= 3;
|
||||||
// Now that we know the true length, ensure that we've got it,
|
// Now that we know the true length, ensure that we've got it,
|
||||||
// or at least a bufferful if length is too big.
|
// or at least a bufferful if length is too big.
|
||||||
|
@ -78,7 +78,7 @@ class SOFMarkerSegment extends MarkerSegment {
|
|||||||
numLines |= buffer.buf[buffer.bufPtr++] & 0xff;
|
numLines |= buffer.buf[buffer.bufPtr++] & 0xff;
|
||||||
samplesPerLine = (buffer.buf[buffer.bufPtr++] & 0xff) << 8;
|
samplesPerLine = (buffer.buf[buffer.bufPtr++] & 0xff) << 8;
|
||||||
samplesPerLine |= buffer.buf[buffer.bufPtr++] & 0xff;
|
samplesPerLine |= buffer.buf[buffer.bufPtr++] & 0xff;
|
||||||
int numComponents = buffer.buf[buffer.bufPtr++];
|
int numComponents = buffer.buf[buffer.bufPtr++] & 0xff;
|
||||||
componentSpecs = new ComponentSpec [numComponents];
|
componentSpecs = new ComponentSpec [numComponents];
|
||||||
for (int i = 0; i < numComponents; i++) {
|
for (int i = 0; i < numComponents; i++) {
|
||||||
componentSpecs[i] = new ComponentSpec(buffer);
|
componentSpecs[i] = new ComponentSpec(buffer);
|
||||||
|
@ -688,6 +688,21 @@ public class PNGImageReader extends ImageReader {
|
|||||||
loop: while (true) {
|
loop: while (true) {
|
||||||
int chunkLength = stream.readInt();
|
int chunkLength = stream.readInt();
|
||||||
int chunkType = 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) {
|
switch (chunkType) {
|
||||||
case IDAT_TYPE:
|
case IDAT_TYPE:
|
||||||
@ -762,7 +777,11 @@ public class PNGImageReader extends ImageReader {
|
|||||||
break;
|
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());
|
stream.flushBefore(stream.getStreamPosition());
|
||||||
}
|
}
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
@ -1277,6 +1296,16 @@ public class PNGImageReader extends ImageReader {
|
|||||||
is = new BufferedInputStream(is);
|
is = new BufferedInputStream(is);
|
||||||
this.pixelStream = new DataInputStream(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,
|
theImage = getDestination(param,
|
||||||
getImageTypes(0),
|
getImageTypes(0),
|
||||||
width,
|
width,
|
||||||
|
@ -167,6 +167,7 @@ public class ComponentSampleModel extends SampleModel
|
|||||||
for (int i=0; i<numBands; i++) {
|
for (int i=0; i<numBands; i++) {
|
||||||
bankIndices[i] = 0;
|
bankIndices[i] = 0;
|
||||||
}
|
}
|
||||||
|
verify();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -244,24 +245,53 @@ public class ComponentSampleModel extends SampleModel
|
|||||||
throw new IllegalArgumentException("Length of bandOffsets must "+
|
throw new IllegalArgumentException("Length of bandOffsets must "+
|
||||||
"equal length of bankIndices.");
|
"equal length of bankIndices.");
|
||||||
}
|
}
|
||||||
|
verify();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void verify() {
|
||||||
|
int requiredSize = getBufferSize();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the size of the data buffer (in data elements) needed
|
* Returns the size of the data buffer (in data elements) needed
|
||||||
* for a data buffer that matches this ComponentSampleModel.
|
* for a data buffer that matches this ComponentSampleModel.
|
||||||
*/
|
*/
|
||||||
private long getBufferSize() {
|
private int getBufferSize() {
|
||||||
int maxBandOff=bandOffsets[0];
|
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]);
|
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");
|
||||||
|
}
|
||||||
|
|
||||||
|
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;
|
||||||
|
|
||||||
long size = 0;
|
|
||||||
if (maxBandOff >= 0)
|
|
||||||
size += maxBandOff+1;
|
|
||||||
if (pixelStride > 0)
|
|
||||||
size += pixelStride * (width-1);
|
|
||||||
if (scanlineStride > 0)
|
|
||||||
size += scanlineStride*(height-1);
|
|
||||||
return size;
|
return size;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -409,7 +439,7 @@ public class ComponentSampleModel extends SampleModel
|
|||||||
public DataBuffer createDataBuffer() {
|
public DataBuffer createDataBuffer() {
|
||||||
DataBuffer dataBuffer = null;
|
DataBuffer dataBuffer = null;
|
||||||
|
|
||||||
int size = (int)getBufferSize();
|
int size = getBufferSize();
|
||||||
switch (dataType) {
|
switch (dataType) {
|
||||||
case DataBuffer.TYPE_BYTE:
|
case DataBuffer.TYPE_BYTE:
|
||||||
dataBuffer = new DataBufferByte(size, numBanks);
|
dataBuffer = new DataBufferByte(size, numBanks);
|
||||||
|
@ -97,7 +97,7 @@ public class StandardTextSource extends TextSource {
|
|||||||
throw new IllegalArgumentException("bad frc: null");
|
throw new IllegalArgumentException("bad frc: null");
|
||||||
}
|
}
|
||||||
|
|
||||||
this.chars = chars;
|
this.chars = chars.clone();
|
||||||
this.start = start;
|
this.start = start;
|
||||||
this.len = len;
|
this.len = len;
|
||||||
this.cstart = cstart;
|
this.cstart = cstart;
|
||||||
@ -148,7 +148,7 @@ public class StandardTextSource extends TextSource {
|
|||||||
// TextSource API
|
// TextSource API
|
||||||
|
|
||||||
public char[] getChars() {
|
public char[] getChars() {
|
||||||
return chars;
|
return chars.clone();
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getStart() {
|
public int getStart() {
|
||||||
|
@ -32,7 +32,6 @@ package sun.font;
|
|||||||
import java.awt.Font;
|
import java.awt.Font;
|
||||||
|
|
||||||
import java.awt.font.FontRenderContext;
|
import java.awt.font.FontRenderContext;
|
||||||
import java.awt.font.LineMetrics;
|
|
||||||
import java.text.Bidi;
|
import java.text.Bidi;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -70,7 +69,7 @@ public class TextLabelFactory {
|
|||||||
Bidi bidi,
|
Bidi bidi,
|
||||||
int flags) {
|
int flags) {
|
||||||
this.frc = frc;
|
this.frc = frc;
|
||||||
this.text = text;
|
this.text = text.clone();
|
||||||
this.bidi = bidi;
|
this.bidi = bidi;
|
||||||
this.flags = flags;
|
this.flags = flags;
|
||||||
this.lineBidi = bidi;
|
this.lineBidi = bidi;
|
||||||
@ -82,30 +81,10 @@ public class TextLabelFactory {
|
|||||||
return frc;
|
return frc;
|
||||||
}
|
}
|
||||||
|
|
||||||
public char[] getText() {
|
|
||||||
return text;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Bidi getParagraphBidi() {
|
|
||||||
return bidi;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Bidi getLineBidi() {
|
public Bidi getLineBidi() {
|
||||||
return lineBidi;
|
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.
|
* Set a line context for the factory. Shaping only occurs on this line.
|
||||||
* Characters are ordered as they would appear on this line.
|
* Characters are ordered as they would appear on this line.
|
||||||
|
@ -117,6 +117,16 @@ public abstract class RasterPrinterJob extends PrinterJob {
|
|||||||
/* Stream destination type. */
|
/* Stream destination type. */
|
||||||
protected static final int STREAM = 2;
|
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
|
* Maximum amount of memory in bytes to use for the
|
||||||
* buffered image "band". 4Mb is a compromise between
|
* buffered image "band". 4Mb is a compromise between
|
||||||
@ -800,6 +810,14 @@ public abstract class RasterPrinterJob extends PrinterJob {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected PageFormat getPageFormatFromAttributes() {
|
||||||
|
if (attributes == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return attributeToPageFormat(getPrintService(), this.attributes);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Presents the user a dialog for changing properties of the
|
* Presents the user a dialog for changing properties of the
|
||||||
* print job interactively.
|
* print job interactively.
|
||||||
@ -1359,34 +1377,7 @@ public abstract class RasterPrinterJob extends PrinterJob {
|
|||||||
setAttributes(attributes);
|
setAttributes(attributes);
|
||||||
// throw exception for invalid destination
|
// throw exception for invalid destination
|
||||||
if (destinationAttr != null) {
|
if (destinationAttr != null) {
|
||||||
// destinationAttr is null for Destination(new URI(""))
|
validateDestination(destinationAttr);
|
||||||
// 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);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
spoolToService(psvc, attributes);
|
spoolToService(psvc, attributes);
|
||||||
@ -1509,6 +1500,40 @@ public abstract class RasterPrinterJob extends PrinterJob {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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
|
* updates a Paper object to reflect the current printer's selected
|
||||||
* paper size and imageable area for that paper size.
|
* paper size and imageable area for that paper size.
|
||||||
@ -1755,6 +1780,78 @@ public abstract class RasterPrinterJob extends PrinterJob {
|
|||||||
return mCollate;
|
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
|
* Called by the print() method at the start of
|
||||||
* a print job.
|
* a print job.
|
||||||
|
@ -31,6 +31,7 @@
|
|||||||
#include "Trace.h"
|
#include "Trace.h"
|
||||||
#include "Disposer.h"
|
#include "Disposer.h"
|
||||||
#include "lcms2.h"
|
#include "lcms2.h"
|
||||||
|
#include "jlong.h"
|
||||||
|
|
||||||
|
|
||||||
#define ALIGNLONG(x) (((x)+3) & ~(3)) // Aligns to DWORD boundary
|
#define ALIGNLONG(x) (((x)+3) & ~(3)) // Aligns to DWORD boundary
|
||||||
@ -98,13 +99,6 @@ typedef struct lcmsProfile_s {
|
|||||||
cmsHPROFILE pf;
|
cmsHPROFILE pf;
|
||||||
} lcmsProfile_t, *lcmsProfile_p;
|
} 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 {
|
typedef union {
|
||||||
cmsTagSignature cms;
|
cmsTagSignature cms;
|
||||||
jint j;
|
jint j;
|
||||||
@ -148,23 +142,21 @@ JNIEXPORT jint JNICALL JNI_OnLoad(JavaVM *jvm, void *reserved) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void LCMS_freeProfile(JNIEnv *env, jlong ptr) {
|
void LCMS_freeProfile(JNIEnv *env, jlong ptr) {
|
||||||
storeID_t sProfile;
|
lcmsProfile_p p = (lcmsProfile_p)jlong_to_ptr(ptr);
|
||||||
sProfile.j = ptr;
|
|
||||||
|
|
||||||
if (sProfile.lcmsPf != NULL) {
|
if (p != NULL) {
|
||||||
if (sProfile.lcmsPf->pf != NULL) {
|
if (p->pf != NULL) {
|
||||||
cmsCloseProfile(sProfile.lcmsPf->pf);
|
cmsCloseProfile(p->pf);
|
||||||
}
|
}
|
||||||
free(sProfile.lcmsPf);
|
free(p);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void LCMS_freeTransform(JNIEnv *env, jlong ID)
|
void LCMS_freeTransform(JNIEnv *env, jlong ID)
|
||||||
{
|
{
|
||||||
storeID_t sTrans;
|
cmsHTRANSFORM sTrans = jlong_to_ptr(ID);
|
||||||
sTrans.j = ID;
|
|
||||||
/* Passed ID is always valid native ref so there is no check for zero */
|
/* Passed ID is always valid native ref so there is no check for zero */
|
||||||
cmsDeleteTransform(sTrans.xf);
|
cmsDeleteTransform(sTrans);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -179,12 +171,16 @@ JNIEXPORT jlong JNICALL Java_sun_java2d_cmm_lcms_LCMS_createNativeTransform
|
|||||||
{
|
{
|
||||||
cmsHPROFILE _iccArray[DF_ICC_BUF_SIZE];
|
cmsHPROFILE _iccArray[DF_ICC_BUF_SIZE];
|
||||||
cmsHPROFILE *iccArray = &_iccArray[0];
|
cmsHPROFILE *iccArray = &_iccArray[0];
|
||||||
storeID_t sTrans;
|
cmsHTRANSFORM sTrans = NULL;
|
||||||
int i, j, size;
|
int i, j, size;
|
||||||
jlong* ids;
|
jlong* ids;
|
||||||
|
|
||||||
size = (*env)->GetArrayLength (env, profileIDs);
|
size = (*env)->GetArrayLength (env, profileIDs);
|
||||||
ids = (*env)->GetLongArrayElements(env, profileIDs, 0);
|
ids = (*env)->GetLongArrayElements(env, profileIDs, 0);
|
||||||
|
if (ids == NULL) {
|
||||||
|
// An exception should have already been thrown.
|
||||||
|
return 0L;
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef _LITTLE_ENDIAN
|
#ifdef _LITTLE_ENDIAN
|
||||||
/* Reversing data packed into int for LE archs */
|
/* Reversing data packed into int for LE archs */
|
||||||
@ -209,11 +205,10 @@ JNIEXPORT jlong JNICALL Java_sun_java2d_cmm_lcms_LCMS_createNativeTransform
|
|||||||
|
|
||||||
j = 0;
|
j = 0;
|
||||||
for (i = 0; i < size; i++) {
|
for (i = 0; i < size; i++) {
|
||||||
cmsHPROFILE icc;
|
|
||||||
cmsColorSpaceSignature cs;
|
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;
|
iccArray[j++] = icc;
|
||||||
|
|
||||||
/* Middle non-abstract profiles should be doubled before passing to
|
/* Middle non-abstract profiles should be doubled before passing to
|
||||||
@ -228,26 +223,26 @@ JNIEXPORT jlong JNICALL Java_sun_java2d_cmm_lcms_LCMS_createNativeTransform
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
sTrans.xf = cmsCreateMultiprofileTransform(iccArray, j,
|
sTrans = cmsCreateMultiprofileTransform(iccArray, j,
|
||||||
inFormatter, outFormatter, renderType, 0);
|
inFormatter, outFormatter, renderType, 0);
|
||||||
|
|
||||||
(*env)->ReleaseLongArrayElements(env, profileIDs, ids, 0);
|
(*env)->ReleaseLongArrayElements(env, profileIDs, ids, 0);
|
||||||
|
|
||||||
if (sTrans.xf == NULL) {
|
if (sTrans == NULL) {
|
||||||
J2dRlsTraceLn(J2D_TRACE_ERROR, "LCMS_createNativeTransform: "
|
J2dRlsTraceLn(J2D_TRACE_ERROR, "LCMS_createNativeTransform: "
|
||||||
"sTrans.xf == NULL");
|
"sTrans == NULL");
|
||||||
if ((*env)->ExceptionOccurred(env) == NULL) {
|
if ((*env)->ExceptionOccurred(env) == NULL) {
|
||||||
JNU_ThrowByName(env, "java/awt/color/CMMException",
|
JNU_ThrowByName(env, "java/awt/color/CMMException",
|
||||||
"Cannot get color transform");
|
"Cannot get color transform");
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
Disposer_AddRecord(env, disposerRef, LCMS_freeTransform, sTrans.j);
|
Disposer_AddRecord(env, disposerRef, LCMS_freeTransform, ptr_to_jlong(sTrans));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (iccArray != &_iccArray[0]) {
|
if (iccArray != &_iccArray[0]) {
|
||||||
free(iccArray);
|
free(iccArray);
|
||||||
}
|
}
|
||||||
return sTrans.j;
|
return ptr_to_jlong(sTrans);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -261,7 +256,7 @@ JNIEXPORT jlong JNICALL Java_sun_java2d_cmm_lcms_LCMS_loadProfileNative
|
|||||||
{
|
{
|
||||||
jbyte* dataArray;
|
jbyte* dataArray;
|
||||||
jint dataSize;
|
jint dataSize;
|
||||||
storeID_t sProf;
|
lcmsProfile_p sProf = NULL;
|
||||||
cmsHPROFILE pf;
|
cmsHPROFILE pf;
|
||||||
|
|
||||||
if (JNU_IsNull(env, data)) {
|
if (JNU_IsNull(env, data)) {
|
||||||
@ -269,16 +264,14 @@ JNIEXPORT jlong JNICALL Java_sun_java2d_cmm_lcms_LCMS_loadProfileNative
|
|||||||
return 0L;
|
return 0L;
|
||||||
}
|
}
|
||||||
|
|
||||||
sProf.j = 0L;
|
|
||||||
|
|
||||||
dataArray = (*env)->GetByteArrayElements (env, data, 0);
|
dataArray = (*env)->GetByteArrayElements (env, data, 0);
|
||||||
dataSize = (*env)->GetArrayLength (env, data);
|
|
||||||
|
|
||||||
if (dataArray == NULL) {
|
if (dataArray == NULL) {
|
||||||
JNU_ThrowIllegalArgumentException(env, "Invalid profile data");
|
// An exception should have already been thrown.
|
||||||
return 0L;
|
return 0L;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
dataSize = (*env)->GetArrayLength (env, data);
|
||||||
|
|
||||||
pf = cmsOpenProfileFromMem((const void *)dataArray,
|
pf = cmsOpenProfileFromMem((const void *)dataArray,
|
||||||
(cmsUInt32Number) dataSize);
|
(cmsUInt32Number) dataSize);
|
||||||
|
|
||||||
@ -303,17 +296,17 @@ JNIEXPORT jlong JNICALL Java_sun_java2d_cmm_lcms_LCMS_loadProfileNative
|
|||||||
|
|
||||||
if (pf != NULL) {
|
if (pf != NULL) {
|
||||||
// create profile holder
|
// create profile holder
|
||||||
sProf.lcmsPf = (lcmsProfile_p)malloc(sizeof(lcmsProfile_t));
|
sProf = (lcmsProfile_p)malloc(sizeof(lcmsProfile_t));
|
||||||
if (sProf.lcmsPf != NULL) {
|
if (sProf != NULL) {
|
||||||
// register the disposer record
|
// register the disposer record
|
||||||
sProf.lcmsPf->pf = pf;
|
sProf->pf = pf;
|
||||||
Disposer_AddRecord(env, disposerRef, LCMS_freeProfile, sProf.j);
|
Disposer_AddRecord(env, disposerRef, LCMS_freeProfile, ptr_to_jlong(sProf));
|
||||||
} else {
|
} else {
|
||||||
cmsCloseProfile(pf);
|
cmsCloseProfile(pf);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return sProf.j;
|
return ptr_to_jlong(sProf);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -324,11 +317,10 @@ JNIEXPORT jlong JNICALL Java_sun_java2d_cmm_lcms_LCMS_loadProfileNative
|
|||||||
JNIEXPORT jint JNICALL Java_sun_java2d_cmm_lcms_LCMS_getProfileSizeNative
|
JNIEXPORT jint JNICALL Java_sun_java2d_cmm_lcms_LCMS_getProfileSizeNative
|
||||||
(JNIEnv *env, jobject obj, jlong id)
|
(JNIEnv *env, jobject obj, jlong id)
|
||||||
{
|
{
|
||||||
storeID_t sProf;
|
lcmsProfile_p sProf = (lcmsProfile_p)jlong_to_ptr(id);
|
||||||
cmsUInt32Number pfSize = 0;
|
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;
|
return (jint)pfSize;
|
||||||
} else {
|
} else {
|
||||||
JNU_ThrowByName(env, "java/awt/color/CMMException",
|
JNU_ThrowByName(env, "java/awt/color/CMMException",
|
||||||
@ -345,16 +337,14 @@ JNIEXPORT jint JNICALL Java_sun_java2d_cmm_lcms_LCMS_getProfileSizeNative
|
|||||||
JNIEXPORT void JNICALL Java_sun_java2d_cmm_lcms_LCMS_getProfileDataNative
|
JNIEXPORT void JNICALL Java_sun_java2d_cmm_lcms_LCMS_getProfileDataNative
|
||||||
(JNIEnv *env, jobject obj, jlong id, jbyteArray data)
|
(JNIEnv *env, jobject obj, jlong id, jbyteArray data)
|
||||||
{
|
{
|
||||||
storeID_t sProf;
|
lcmsProfile_p sProf = (lcmsProfile_p)jlong_to_ptr(id);
|
||||||
jint size;
|
jint size;
|
||||||
jbyte* dataArray;
|
jbyte* dataArray;
|
||||||
cmsUInt32Number pfSize = 0;
|
cmsUInt32Number pfSize = 0;
|
||||||
cmsBool status;
|
cmsBool status;
|
||||||
|
|
||||||
sProf.j = id;
|
|
||||||
|
|
||||||
// determine actual profile size
|
// determine actual profile size
|
||||||
if (!cmsSaveProfileToMem(sProf.lcmsPf->pf, NULL, &pfSize)) {
|
if (!cmsSaveProfileToMem(sProf->pf, NULL, &pfSize)) {
|
||||||
JNU_ThrowByName(env, "java/awt/color/CMMException",
|
JNU_ThrowByName(env, "java/awt/color/CMMException",
|
||||||
"Can not access specified profile.");
|
"Can not access specified profile.");
|
||||||
return;
|
return;
|
||||||
@ -369,8 +359,12 @@ JNIEXPORT void JNICALL Java_sun_java2d_cmm_lcms_LCMS_getProfileDataNative
|
|||||||
}
|
}
|
||||||
|
|
||||||
dataArray = (*env)->GetByteArrayElements (env, data, 0);
|
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);
|
(*env)->ReleaseByteArrayElements (env, data, dataArray, 0);
|
||||||
|
|
||||||
@ -395,7 +389,7 @@ static cmsHPROFILE _writeCookedTag(cmsHPROFILE pfTarget, cmsTagSignature sig, jb
|
|||||||
JNIEXPORT jbyteArray JNICALL Java_sun_java2d_cmm_lcms_LCMS_getTagNative
|
JNIEXPORT jbyteArray JNICALL Java_sun_java2d_cmm_lcms_LCMS_getTagNative
|
||||||
(JNIEnv *env, jobject obj, jlong id, jint tagSig)
|
(JNIEnv *env, jobject obj, jlong id, jint tagSig)
|
||||||
{
|
{
|
||||||
storeID_t sProf;
|
lcmsProfile_p sProf = (lcmsProfile_p)jlong_to_ptr(id);
|
||||||
TagSignature_t sig;
|
TagSignature_t sig;
|
||||||
cmsInt32Number tagSize;
|
cmsInt32Number tagSize;
|
||||||
|
|
||||||
@ -404,7 +398,6 @@ JNIEXPORT jbyteArray JNICALL Java_sun_java2d_cmm_lcms_LCMS_getTagNative
|
|||||||
|
|
||||||
jint bufSize;
|
jint bufSize;
|
||||||
|
|
||||||
sProf.j = id;
|
|
||||||
sig.j = tagSig;
|
sig.j = tagSig;
|
||||||
|
|
||||||
if (tagSig == SigHead) {
|
if (tagSig == SigHead) {
|
||||||
@ -415,20 +408,18 @@ JNIEXPORT jbyteArray JNICALL Java_sun_java2d_cmm_lcms_LCMS_getTagNative
|
|||||||
data = (*env)->NewByteArray(env, bufSize);
|
data = (*env)->NewByteArray(env, bufSize);
|
||||||
|
|
||||||
if (data == NULL) {
|
if (data == NULL) {
|
||||||
JNU_ThrowByName(env, "java/awt/color/CMMException",
|
// An exception should have already been thrown.
|
||||||
"Unable to allocate buffer");
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
dataArray = (*env)->GetByteArrayElements (env, data, 0);
|
dataArray = (*env)->GetByteArrayElements (env, data, 0);
|
||||||
|
|
||||||
if (dataArray == NULL) {
|
if (dataArray == NULL) {
|
||||||
JNU_ThrowByName(env, "java/awt/color/CMMException",
|
// An exception should have already been thrown.
|
||||||
"Unable to get buffer");
|
return NULL;
|
||||||
return NULL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
status = _getHeaderInfo(sProf.lcmsPf->pf, dataArray, bufSize);
|
status = _getHeaderInfo(sProf->pf, dataArray, bufSize);
|
||||||
|
|
||||||
(*env)->ReleaseByteArrayElements (env, data, dataArray, 0);
|
(*env)->ReleaseByteArrayElements (env, data, dataArray, 0);
|
||||||
|
|
||||||
@ -441,8 +432,8 @@ JNIEXPORT jbyteArray JNICALL Java_sun_java2d_cmm_lcms_LCMS_getTagNative
|
|||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cmsIsTag(sProf.lcmsPf->pf, sig.cms)) {
|
if (cmsIsTag(sProf->pf, sig.cms)) {
|
||||||
tagSize = cmsReadRawTag(sProf.lcmsPf->pf, sig.cms, NULL, 0);
|
tagSize = cmsReadRawTag(sProf->pf, sig.cms, NULL, 0);
|
||||||
} else {
|
} else {
|
||||||
JNU_ThrowByName(env, "java/awt/color/CMMException",
|
JNU_ThrowByName(env, "java/awt/color/CMMException",
|
||||||
"ICC profile tag not found");
|
"ICC profile tag not found");
|
||||||
@ -452,20 +443,18 @@ JNIEXPORT jbyteArray JNICALL Java_sun_java2d_cmm_lcms_LCMS_getTagNative
|
|||||||
// allocate java array
|
// allocate java array
|
||||||
data = (*env)->NewByteArray(env, tagSize);
|
data = (*env)->NewByteArray(env, tagSize);
|
||||||
if (data == NULL) {
|
if (data == NULL) {
|
||||||
JNU_ThrowByName(env, "java/awt/color/CMMException",
|
// An exception should have already been thrown.
|
||||||
"Unable to allocate buffer");
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
dataArray = (*env)->GetByteArrayElements (env, data, 0);
|
dataArray = (*env)->GetByteArrayElements (env, data, 0);
|
||||||
|
|
||||||
if (dataArray == NULL) {
|
if (dataArray == NULL) {
|
||||||
JNU_ThrowByName(env, "java/awt/color/CMMException",
|
// An exception should have already been thrown.
|
||||||
"Unable to get buffer");
|
|
||||||
return NULL;
|
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);
|
(*env)->ReleaseByteArrayElements (env, data, dataArray, 0);
|
||||||
|
|
||||||
@ -485,7 +474,7 @@ JNIEXPORT jbyteArray JNICALL Java_sun_java2d_cmm_lcms_LCMS_getTagNative
|
|||||||
JNIEXPORT void JNICALL Java_sun_java2d_cmm_lcms_LCMS_setTagDataNative
|
JNIEXPORT void JNICALL Java_sun_java2d_cmm_lcms_LCMS_setTagDataNative
|
||||||
(JNIEnv *env, jobject obj, jlong id, jint tagSig, jbyteArray data)
|
(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;
|
cmsHPROFILE pfReplace = NULL;
|
||||||
|
|
||||||
TagSignature_t sig;
|
TagSignature_t sig;
|
||||||
@ -493,7 +482,6 @@ JNIEXPORT void JNICALL Java_sun_java2d_cmm_lcms_LCMS_setTagDataNative
|
|||||||
jbyte* dataArray;
|
jbyte* dataArray;
|
||||||
int tagSize;
|
int tagSize;
|
||||||
|
|
||||||
sProf.j = id;
|
|
||||||
sig.j = tagSig;
|
sig.j = tagSig;
|
||||||
|
|
||||||
if (JNU_IsNull(env, data)) {
|
if (JNU_IsNull(env, data)) {
|
||||||
@ -506,19 +494,19 @@ JNIEXPORT void JNICALL Java_sun_java2d_cmm_lcms_LCMS_setTagDataNative
|
|||||||
dataArray = (*env)->GetByteArrayElements(env, data, 0);
|
dataArray = (*env)->GetByteArrayElements(env, data, 0);
|
||||||
|
|
||||||
if (dataArray == NULL) {
|
if (dataArray == NULL) {
|
||||||
JNU_ThrowIllegalArgumentException(env, "Can not write tag data.");
|
// An exception should have already been thrown.
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tagSig == SigHead) {
|
if (tagSig == SigHead) {
|
||||||
status = _setHeaderInfo(sProf.lcmsPf->pf, dataArray, tagSize);
|
status = _setHeaderInfo(sProf->pf, dataArray, tagSize);
|
||||||
} else {
|
} else {
|
||||||
/*
|
/*
|
||||||
* New strategy for generic tags: create a place holder,
|
* New strategy for generic tags: create a place holder,
|
||||||
* dump all existing tags there, dump externally supplied
|
* dump all existing tags there, dump externally supplied
|
||||||
* tag, and return the new profile to the java.
|
* 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);
|
status = (pfReplace != NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -527,8 +515,8 @@ JNIEXPORT void JNICALL Java_sun_java2d_cmm_lcms_LCMS_setTagDataNative
|
|||||||
if (!status) {
|
if (!status) {
|
||||||
JNU_ThrowIllegalArgumentException(env, "Can not write tag data.");
|
JNU_ThrowIllegalArgumentException(env, "Can not write tag data.");
|
||||||
} else if (pfReplace != NULL) {
|
} else if (pfReplace != NULL) {
|
||||||
cmsCloseProfile(sProf.lcmsPf->pf);
|
cmsCloseProfile(sProf->pf);
|
||||||
sProf.lcmsPf->pf = pfReplace;
|
sProf->pf = pfReplace;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -582,7 +570,7 @@ void releaseILData (JNIEnv *env, void* pData, jint dataType,
|
|||||||
JNIEXPORT void JNICALL Java_sun_java2d_cmm_lcms_LCMS_colorConvert
|
JNIEXPORT void JNICALL Java_sun_java2d_cmm_lcms_LCMS_colorConvert
|
||||||
(JNIEnv *env, jclass obj, jobject trans, jobject src, jobject dst)
|
(JNIEnv *env, jclass obj, jobject trans, jobject src, jobject dst)
|
||||||
{
|
{
|
||||||
storeID_t sTrans;
|
cmsHTRANSFORM sTrans = NULL;
|
||||||
int srcDType, dstDType;
|
int srcDType, dstDType;
|
||||||
int srcOffset, srcNextRowOffset, dstOffset, dstNextRowOffset;
|
int srcOffset, srcNextRowOffset, dstOffset, dstNextRowOffset;
|
||||||
int width, height, i;
|
int width, height, i;
|
||||||
@ -603,9 +591,9 @@ JNIEXPORT void JNICALL Java_sun_java2d_cmm_lcms_LCMS_colorConvert
|
|||||||
srcAtOnce = (*env)->GetBooleanField(env, src, IL_imageAtOnce_fID);
|
srcAtOnce = (*env)->GetBooleanField(env, src, IL_imageAtOnce_fID);
|
||||||
dstAtOnce = (*env)->GetBooleanField(env, dst, 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");
|
J2dRlsTraceLn(J2D_TRACE_ERROR, "LCMS_colorConvert: transform == NULL");
|
||||||
JNU_ThrowByName(env, "java/awt/color/CMMException",
|
JNU_ThrowByName(env, "java/awt/color/CMMException",
|
||||||
"Cannot get color transform");
|
"Cannot get color transform");
|
||||||
@ -617,8 +605,7 @@ JNIEXPORT void JNICALL Java_sun_java2d_cmm_lcms_LCMS_colorConvert
|
|||||||
|
|
||||||
if (inputBuffer == NULL) {
|
if (inputBuffer == NULL) {
|
||||||
J2dRlsTraceLn(J2D_TRACE_ERROR, "");
|
J2dRlsTraceLn(J2D_TRACE_ERROR, "");
|
||||||
JNU_ThrowByName(env, "java/awt/color/CMMException",
|
// An exception should have already been thrown.
|
||||||
"Cannot get input data");
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -626,8 +613,7 @@ JNIEXPORT void JNICALL Java_sun_java2d_cmm_lcms_LCMS_colorConvert
|
|||||||
|
|
||||||
if (outputBuffer == NULL) {
|
if (outputBuffer == NULL) {
|
||||||
releaseILData(env, inputBuffer, srcDType, srcData);
|
releaseILData(env, inputBuffer, srcDType, srcData);
|
||||||
JNU_ThrowByName(env, "java/awt/color/CMMException",
|
// An exception should have already been thrown.
|
||||||
"Cannot get output data");
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -635,10 +621,10 @@ JNIEXPORT void JNICALL Java_sun_java2d_cmm_lcms_LCMS_colorConvert
|
|||||||
outputRow = (char*)outputBuffer + dstOffset;
|
outputRow = (char*)outputBuffer + dstOffset;
|
||||||
|
|
||||||
if (srcAtOnce && dstAtOnce) {
|
if (srcAtOnce && dstAtOnce) {
|
||||||
cmsDoTransform(sTrans.xf, inputRow, outputRow, width * height);
|
cmsDoTransform(sTrans, inputRow, outputRow, width * height);
|
||||||
} else {
|
} else {
|
||||||
for (i = 0; i < height; i++) {
|
for (i = 0; i < height; i++) {
|
||||||
cmsDoTransform(sTrans.xf, inputRow, outputRow, width);
|
cmsDoTransform(sTrans, inputRow, outputRow, width);
|
||||||
inputRow += srcNextRowOffset;
|
inputRow += srcNextRowOffset;
|
||||||
outputRow += dstNextRowOffset;
|
outputRow += dstNextRowOffset;
|
||||||
}
|
}
|
||||||
@ -656,14 +642,22 @@ JNIEXPORT void JNICALL Java_sun_java2d_cmm_lcms_LCMS_colorConvert
|
|||||||
JNIEXPORT jobject JNICALL Java_sun_java2d_cmm_lcms_LCMS_getProfileID
|
JNIEXPORT jobject JNICALL Java_sun_java2d_cmm_lcms_LCMS_getProfileID
|
||||||
(JNIEnv *env, jclass cls, jobject pf)
|
(JNIEnv *env, jclass cls, jobject pf)
|
||||||
{
|
{
|
||||||
|
jclass clsLcmsProfile;
|
||||||
|
jobject cmmProfile;
|
||||||
jfieldID fid = (*env)->GetFieldID (env,
|
jfieldID fid = (*env)->GetFieldID (env,
|
||||||
(*env)->GetObjectClass(env, pf),
|
(*env)->GetObjectClass(env, pf),
|
||||||
"cmmProfile", "Lsun/java2d/cmm/Profile;");
|
"cmmProfile", "Lsun/java2d/cmm/Profile;");
|
||||||
|
if (fid == NULL) {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
jclass clsLcmsProfile = (*env)->FindClass(env,
|
clsLcmsProfile = (*env)->FindClass(env,
|
||||||
"sun/java2d/cmm/lcms/LCMSProfile");
|
"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)) {
|
if (JNU_IsNull(env, cmmProfile)) {
|
||||||
return NULL;
|
return NULL;
|
||||||
@ -687,18 +681,51 @@ JNIEXPORT void JNICALL Java_sun_java2d_cmm_lcms_LCMS_initLCMS
|
|||||||
* unloading
|
* unloading
|
||||||
*/
|
*/
|
||||||
Trans_renderType_fID = (*env)->GetFieldID (env, Trans, "renderType", "I");
|
Trans_renderType_fID = (*env)->GetFieldID (env, Trans, "renderType", "I");
|
||||||
|
if (Trans_renderType_fID == NULL) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
Trans_ID_fID = (*env)->GetFieldID (env, Trans, "ID", "J");
|
Trans_ID_fID = (*env)->GetFieldID (env, Trans, "ID", "J");
|
||||||
|
if (Trans_ID_fID == NULL) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
IL_isIntPacked_fID = (*env)->GetFieldID (env, IL, "isIntPacked", "Z");
|
IL_isIntPacked_fID = (*env)->GetFieldID (env, IL, "isIntPacked", "Z");
|
||||||
|
if (IL_isIntPacked_fID == NULL) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
IL_dataType_fID = (*env)->GetFieldID (env, IL, "dataType", "I");
|
IL_dataType_fID = (*env)->GetFieldID (env, IL, "dataType", "I");
|
||||||
|
if (IL_dataType_fID == NULL) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
IL_pixelType_fID = (*env)->GetFieldID (env, IL, "pixelType", "I");
|
IL_pixelType_fID = (*env)->GetFieldID (env, IL, "pixelType", "I");
|
||||||
|
if (IL_pixelType_fID == NULL) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
IL_dataArray_fID = (*env)->GetFieldID(env, IL, "dataArray",
|
IL_dataArray_fID = (*env)->GetFieldID(env, IL, "dataArray",
|
||||||
"Ljava/lang/Object;");
|
"Ljava/lang/Object;");
|
||||||
|
if (IL_dataArray_fID == NULL) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
IL_width_fID = (*env)->GetFieldID (env, IL, "width", "I");
|
IL_width_fID = (*env)->GetFieldID (env, IL, "width", "I");
|
||||||
|
if (IL_width_fID == NULL) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
IL_height_fID = (*env)->GetFieldID (env, IL, "height", "I");
|
IL_height_fID = (*env)->GetFieldID (env, IL, "height", "I");
|
||||||
|
if (IL_height_fID == NULL) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
IL_offset_fID = (*env)->GetFieldID (env, IL, "offset", "I");
|
IL_offset_fID = (*env)->GetFieldID (env, IL, "offset", "I");
|
||||||
|
if (IL_offset_fID == NULL) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
IL_imageAtOnce_fID = (*env)->GetFieldID (env, IL, "imageAtOnce", "Z");
|
IL_imageAtOnce_fID = (*env)->GetFieldID (env, IL, "imageAtOnce", "Z");
|
||||||
|
if (IL_imageAtOnce_fID == NULL) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
IL_nextRowOffset_fID = (*env)->GetFieldID (env, IL, "nextRowOffset", "I");
|
IL_nextRowOffset_fID = (*env)->GetFieldID (env, IL, "nextRowOffset", "I");
|
||||||
|
if (IL_nextRowOffset_fID == NULL) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static cmsBool _getHeaderInfo(cmsHPROFILE pf, jbyte* pBuffer, jint bufferSize)
|
static cmsBool _getHeaderInfo(cmsHPROFILE pf, jbyte* pBuffer, jint bufferSize)
|
||||||
@ -709,7 +736,7 @@ static cmsBool _getHeaderInfo(cmsHPROFILE pf, jbyte* pBuffer, jint bufferSize)
|
|||||||
|
|
||||||
if (!cmsSaveProfileToMem(pf, NULL, &pfSize) ||
|
if (!cmsSaveProfileToMem(pf, NULL, &pfSize) ||
|
||||||
pfSize < sizeof(cmsICCHeader) ||
|
pfSize < sizeof(cmsICCHeader) ||
|
||||||
bufferSize < sizeof(cmsICCHeader))
|
bufferSize < (jint)sizeof(cmsICCHeader))
|
||||||
{
|
{
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
@ -730,9 +757,9 @@ static cmsBool _getHeaderInfo(cmsHPROFILE pf, jbyte* pBuffer, jint bufferSize)
|
|||||||
|
|
||||||
static cmsBool _setHeaderInfo(cmsHPROFILE pf, jbyte* pBuffer, jint bufferSize)
|
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;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -765,13 +792,14 @@ static cmsHPROFILE _writeCookedTag(const cmsHPROFILE pfTarget,
|
|||||||
cmsInt32Number i;
|
cmsInt32Number i;
|
||||||
cmsHPROFILE pfSanity = NULL;
|
cmsHPROFILE pfSanity = NULL;
|
||||||
|
|
||||||
cmsICCHeader hdr = { 0 };
|
cmsICCHeader hdr;
|
||||||
|
|
||||||
cmsHPROFILE p = cmsCreateProfilePlaceholder(NULL);
|
cmsHPROFILE p = cmsCreateProfilePlaceholder(NULL);
|
||||||
|
|
||||||
if (NULL == p) {
|
if (NULL == p) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
memset(&hdr, 0, sizeof(cmsICCHeader));
|
||||||
|
|
||||||
// Populate the placeholder's header according to target profile
|
// Populate the placeholder's header according to target profile
|
||||||
hdr.flags = cmsGetHeaderFlags(pfTarget);
|
hdr.flags = cmsGetHeaderFlags(pfTarget);
|
||||||
|
@ -661,7 +661,12 @@ OGLBlitLoops_Blit(JNIEnv *env,
|
|||||||
(sy2-sy1) != (jint)(dy2-dy1) ||
|
(sy2-sy1) != (jint)(dy2-dy1) ||
|
||||||
oglc->extraAlpha != 1.0f;
|
oglc->extraAlpha != 1.0f;
|
||||||
break;
|
break;
|
||||||
|
#ifdef MACOSX
|
||||||
|
case OGLC_VENDOR_ATI:
|
||||||
|
// see 8024461
|
||||||
|
viaTexture = JNI_TRUE;
|
||||||
|
break;
|
||||||
|
#endif
|
||||||
default:
|
default:
|
||||||
// just use the glDrawPixels() codepath
|
// just use the glDrawPixels() codepath
|
||||||
viaTexture = JNI_FALSE;
|
viaTexture = JNI_FALSE;
|
||||||
|
@ -108,10 +108,6 @@ public class FontConfigManager {
|
|||||||
public FontConfigManager() {
|
public FontConfigManager() {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String[] getFontConfigNames() {
|
|
||||||
return fontConfigNames;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Called from code that needs to know what are the AA settings
|
/* Called from code that needs to know what are the AA settings
|
||||||
* that apps using FC would pick up for the default desktop font.
|
* that apps using FC would pick up for the default desktop font.
|
||||||
* Note apps can change the default desktop font. etc, so this
|
* Note apps can change the default desktop font. etc, so this
|
||||||
@ -182,7 +178,6 @@ public class FontConfigManager {
|
|||||||
t0 = System.nanoTime();
|
t0 = System.nanoTime();
|
||||||
}
|
}
|
||||||
|
|
||||||
String[] fontConfigNames = FontConfigManager.getFontConfigNames();
|
|
||||||
FcCompFont[] fontArr = new FcCompFont[fontConfigNames.length];
|
FcCompFont[] fontArr = new FcCompFont[fontConfigNames.length];
|
||||||
|
|
||||||
for (int i = 0; i< fontArr.length; i++) {
|
for (int i = 0; i< fontArr.length; i++) {
|
||||||
|
@ -76,8 +76,9 @@ public class MaskTileManager {
|
|||||||
public void fillMask(XRSurfaceData dst) {
|
public void fillMask(XRSurfaceData dst) {
|
||||||
|
|
||||||
boolean maskRequired = xrMgr.maskRequired();
|
boolean maskRequired = xrMgr.maskRequired();
|
||||||
|
boolean maskEvaluated = XRUtils.isMaskEvaluated(xrMgr.compRule);
|
||||||
|
|
||||||
if (maskRequired) {
|
if (maskRequired && maskEvaluated) {
|
||||||
mainTile.calculateDirtyAreas();
|
mainTile.calculateDirtyAreas();
|
||||||
DirtyRegion dirtyArea = mainTile.getDirtyArea().cloneRegion();
|
DirtyRegion dirtyArea = mainTile.getDirtyArea().cloneRegion();
|
||||||
mainTile.translate(-dirtyArea.x, -dirtyArea.y);
|
mainTile.translate(-dirtyArea.x, -dirtyArea.y);
|
||||||
@ -106,7 +107,15 @@ public class MaskTileManager {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} 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();
|
mainTile.reset();
|
||||||
|
@ -100,14 +100,13 @@ public interface XRBackend {
|
|||||||
int xSrc, int ySrc, int xDst, int yDst,
|
int xSrc, int ySrc, int xDst, int yDst,
|
||||||
int glyphset, GrowableEltArray elts);
|
int glyphset, GrowableEltArray elts);
|
||||||
|
|
||||||
public int createRadialGradient(Point2D inner, Point2D outer,
|
public int createRadialGradient(float centerX, float centerY,
|
||||||
float innerRadius, float outerRadius,
|
float innerRadius, float outerRadius,
|
||||||
float[] fractions, int[] pixels,
|
float[] fractions, int[] pixels,
|
||||||
int repeat, AffineTransform transform);
|
int repeat);
|
||||||
|
|
||||||
public int createLinearGradient(Point2D p1, Point2D p2, float[] fractions,
|
public int createLinearGradient(Point2D p1, Point2D p2, float[] fractions,
|
||||||
int[] pixels, int repeat,
|
int[] pixels, int repeat);
|
||||||
AffineTransform transform);
|
|
||||||
|
|
||||||
public void setGCMode(long gc, boolean copy);
|
public void setGCMode(long gc, boolean copy);
|
||||||
|
|
||||||
|
@ -105,17 +105,14 @@ public class XRBackendNative implements XRBackend {
|
|||||||
XRCreateLinearGradientPaintNative(float[] fractionsArray,
|
XRCreateLinearGradientPaintNative(float[] fractionsArray,
|
||||||
short[] pixelsArray,
|
short[] pixelsArray,
|
||||||
int x1, int y1, int x2, int y2,
|
int x1, int y1, int x2, int y2,
|
||||||
int numStops, int repeat,
|
int numStops, int repeat);
|
||||||
int m00, int m01, int m02,
|
|
||||||
int m10, int m11, int m12);
|
|
||||||
|
|
||||||
private native static int
|
private native static int
|
||||||
XRCreateRadialGradientPaintNative(float[] fractionsArray,
|
XRCreateRadialGradientPaintNative(float[] fractionsArray,
|
||||||
short[] pixelsArray, int numStops,
|
short[] pixelsArray, int numStops,
|
||||||
|
int centerX, int centerY,
|
||||||
int innerRadius, int outerRadius,
|
int innerRadius, int outerRadius,
|
||||||
int repeat,
|
int repeat);
|
||||||
int m00, int m01, int m02,
|
|
||||||
int m10, int m11, int m12);
|
|
||||||
|
|
||||||
public native void setFilter(int picture, int filter);
|
public native void setFilter(int picture, int filter);
|
||||||
|
|
||||||
@ -175,40 +172,29 @@ public class XRBackendNative implements XRBackend {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public int createLinearGradient(Point2D p1, Point2D p2, float[] fractions,
|
public int createLinearGradient(Point2D p1, Point2D p2, float[] fractions,
|
||||||
int[] pixels, int repeat, AffineTransform trx) {
|
int[] pixels, int repeat) {
|
||||||
|
|
||||||
short[] colorValues = getRenderColors(pixels);
|
short[] colorValues = getRenderColors(pixels);
|
||||||
int gradient =
|
int gradient =
|
||||||
XRCreateLinearGradientPaintNative(fractions, colorValues,
|
XRCreateLinearGradientPaintNative(fractions, colorValues,
|
||||||
XDoubleToFixed(p1.getX()), XDoubleToFixed(p1.getY()),
|
XDoubleToFixed(p1.getX()), XDoubleToFixed(p1.getY()),
|
||||||
XDoubleToFixed(p2.getX()), XDoubleToFixed(p2.getY()),
|
XDoubleToFixed(p2.getX()), XDoubleToFixed(p2.getY()),
|
||||||
fractions.length, repeat,
|
fractions.length, repeat);
|
||||||
XDoubleToFixed(trx.getScaleX()),
|
|
||||||
XDoubleToFixed(trx.getShearX()),
|
|
||||||
XDoubleToFixed(trx.getTranslateX()),
|
|
||||||
XDoubleToFixed(trx.getShearY()),
|
|
||||||
XDoubleToFixed(trx.getScaleY()),
|
|
||||||
XDoubleToFixed(trx.getTranslateY()));
|
|
||||||
return gradient;
|
return gradient;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int createRadialGradient(Point2D inner, Point2D outer,
|
public int createRadialGradient(float centerX, float centerY,
|
||||||
float innerRadius, float outerRadius,
|
float innerRadius, float outerRadius,
|
||||||
float[] fractions, int[] pixels, int repeat,
|
float[] fractions, int[] pixels, int repeat) {
|
||||||
AffineTransform trx) {
|
|
||||||
|
|
||||||
short[] colorValues = getRenderColors(pixels);
|
short[] colorValues = getRenderColors(pixels);
|
||||||
return XRCreateRadialGradientPaintNative
|
return XRCreateRadialGradientPaintNative
|
||||||
(fractions, colorValues, fractions.length,
|
(fractions, colorValues, fractions.length,
|
||||||
|
XDoubleToFixed(centerX),
|
||||||
|
XDoubleToFixed(centerY),
|
||||||
XDoubleToFixed(innerRadius),
|
XDoubleToFixed(innerRadius),
|
||||||
XDoubleToFixed(outerRadius),
|
XDoubleToFixed(outerRadius),
|
||||||
repeat,
|
repeat);
|
||||||
XDoubleToFixed(trx.getScaleX()),
|
|
||||||
XDoubleToFixed(trx.getShearX()),
|
|
||||||
XDoubleToFixed(trx.getTranslateX()),
|
|
||||||
XDoubleToFixed(trx.getShearY()),
|
|
||||||
XDoubleToFixed(trx.getScaleY()),
|
|
||||||
XDoubleToFixed(trx.getTranslateY()));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setGCClipRectangles(long gc, Region clip) {
|
public void setGCClipRectangles(long gc, Region clip) {
|
||||||
|
@ -54,6 +54,7 @@ public class XRColor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public XRColor(Color color) {
|
public XRColor(Color color) {
|
||||||
|
setColorValues(color);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setColorValues(Color color) {
|
public void setColorValues(Color color) {
|
||||||
|
@ -48,7 +48,12 @@ public class XRCompositeManager {
|
|||||||
private static boolean enableGradCache = true;
|
private static boolean enableGradCache = true;
|
||||||
private static XRCompositeManager instance;
|
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 texture;
|
||||||
XRSurfaceData gradient;
|
XRSurfaceData gradient;
|
||||||
int alphaMask = XRUtils.None;
|
int alphaMask = XRUtils.None;
|
||||||
@ -84,7 +89,6 @@ public class XRCompositeManager {
|
|||||||
|
|
||||||
private XRCompositeManager(XRSurfaceData surface) {
|
private XRCompositeManager(XRSurfaceData surface) {
|
||||||
con = new XRBackendNative();
|
con = new XRBackendNative();
|
||||||
// con = XRBackendJava.getInstance();
|
|
||||||
|
|
||||||
String gradProp =
|
String gradProp =
|
||||||
AccessController.doPrivileged(new PrivilegedAction<String>() {
|
AccessController.doPrivileged(new PrivilegedAction<String>() {
|
||||||
@ -109,14 +113,7 @@ public class XRCompositeManager {
|
|||||||
public void initResources(XRSurfaceData surface) {
|
public void initResources(XRSurfaceData surface) {
|
||||||
int parentXid = surface.getXid();
|
int parentXid = surface.getXid();
|
||||||
|
|
||||||
int solidPixmap = con.createPixmap(parentXid, 32, 1, 1);
|
solidSrc32 = new XRSolidSrcPict(con, parentXid);
|
||||||
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);
|
|
||||||
setForeground(0);
|
setForeground(0);
|
||||||
|
|
||||||
int extraAlphaMask = con.createPixmap(parentXid, 8, 1, 1);
|
int extraAlphaMask = con.createPixmap(parentXid, 8, 1, 1);
|
||||||
@ -135,9 +132,7 @@ public class XRCompositeManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void setForeground(int pixel) {
|
public void setForeground(int pixel) {
|
||||||
solidColor.setColorValues(pixel, false);
|
solidColor.setColorValues(pixel, true);
|
||||||
con.renderRectangle(solidSrcPict.picture, XRUtils.PictOpSrc,
|
|
||||||
solidColor, 0, 0, 1, 1);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setGradientPaint(XRSurfaceData gradient) {
|
public void setGradientPaint(XRSurfaceData gradient) {
|
||||||
@ -145,16 +140,16 @@ public class XRCompositeManager {
|
|||||||
con.freePicture(this.gradient.picture);
|
con.freePicture(this.gradient.picture);
|
||||||
}
|
}
|
||||||
this.gradient = gradient;
|
this.gradient = gradient;
|
||||||
src = gradient;
|
srcType = GRADIENT;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setTexturePaint(XRSurfaceData texture) {
|
public void setTexturePaint(XRSurfaceData texture) {
|
||||||
this.texture = texture;
|
this.texture = texture;
|
||||||
src = texture;
|
this.srcType = TEXTURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void XRResetPaint() {
|
public void XRResetPaint() {
|
||||||
src = solidSrcPict;
|
srcType = SOLID;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void validateCompositeState(Composite comp, AffineTransform xform,
|
public void validateCompositeState(Composite comp, AffineTransform xform,
|
||||||
@ -175,7 +170,7 @@ public class XRCompositeManager {
|
|||||||
validatedComp = comp;
|
validatedComp = comp;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (sg2d != null && validatedPixel != sg2d.pixel) {
|
if (sg2d != null && (validatedPixel != sg2d.pixel || updatePaint)) {
|
||||||
validatedPixel = sg2d.pixel;
|
validatedPixel = sg2d.pixel;
|
||||||
setForeground(validatedPixel);
|
setForeground(validatedPixel);
|
||||||
}
|
}
|
||||||
@ -191,14 +186,14 @@ public class XRCompositeManager {
|
|||||||
validatedPaint = paint;
|
validatedPaint = paint;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (src != solidSrcPict) {
|
if (srcType != SOLID) {
|
||||||
AffineTransform at = (AffineTransform) xform.clone();
|
AffineTransform at = (AffineTransform) xform.clone();
|
||||||
try {
|
try {
|
||||||
at.invert();
|
at.invert();
|
||||||
} catch (NoninvertibleTransformException e) {
|
} catch (NoninvertibleTransformException e) {
|
||||||
at.setToIdentity();
|
at.setToIdentity();
|
||||||
}
|
}
|
||||||
src.validateAsSource(at, -1, -1);
|
getCurrentSource().validateAsSource(at, -1, XRUtils.ATransOpToXRQuality(sg2d.interpolationType));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -234,13 +229,13 @@ public class XRCompositeManager {
|
|||||||
|
|
||||||
public boolean maskRequired() {
|
public boolean maskRequired() {
|
||||||
return (!xorEnabled)
|
return (!xorEnabled)
|
||||||
&& ((src != solidSrcPict)
|
&& ((srcType != SOLID)
|
||||||
|| (src == solidSrcPict && solidColor.alpha != 0xffff) || (extraAlpha != 1.0f));
|
|| (srcType == SOLID && (solidColor.alpha != 0xffff) || (extraAlpha != 1.0f)));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void XRComposite(int src, int mask, int dst, int srcX, int srcY,
|
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 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 cachedX = srcX;
|
||||||
int cachedY = srcY;
|
int cachedY = srcY;
|
||||||
|
|
||||||
@ -276,7 +271,7 @@ public class XRCompositeManager {
|
|||||||
renderReferenceY = (int) Math.floor(XRUtils
|
renderReferenceY = (int) Math.floor(XRUtils
|
||||||
.XFixedToDouble(renderReferenceY));
|
.XFixedToDouble(renderReferenceY));
|
||||||
|
|
||||||
con.renderCompositeTrapezoids(compRule, src.picture,
|
con.renderCompositeTrapezoids(compRule, getCurrentSource().picture,
|
||||||
XRUtils.PictStandardA8, dst, renderReferenceX,
|
XRUtils.PictStandardA8, dst, renderReferenceX,
|
||||||
renderReferenceY, trapList);
|
renderReferenceY, trapList);
|
||||||
}
|
}
|
||||||
@ -294,15 +289,46 @@ public class XRCompositeManager {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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,
|
public void compositeBlit(XRSurfaceData src, XRSurfaceData dst, int sx,
|
||||||
int sy, int dx, int dy, int w, int h) {
|
int sy, int dx, int dy, int w, int h) {
|
||||||
con.renderComposite(compRule, src.picture, alphaMask, dst.picture, sx,
|
con.renderComposite(compRule, src.picture, alphaMask, dst.picture, sx,
|
||||||
sy, 0, 0, dx, dy, w, h);
|
sy, 0, 0, dx, dy, w, h);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void compositeText(XRSurfaceData dst, int sx, int sy,
|
public void compositeText(XRSurfaceData dst, int sx, int sy, int glyphSet,
|
||||||
int glyphSet, int maskFormat, GrowableEltArray elts) {
|
int maskFormat, GrowableEltArray elts) {
|
||||||
con.XRenderCompositeText(compRule, src.picture, dst.picture,
|
/*
|
||||||
|
* 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);
|
maskFormat, sx, sy, 0, 0, glyphSet, elts);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -315,7 +341,11 @@ public class XRCompositeManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public boolean isTexturePaintActive() {
|
public boolean isTexturePaintActive() {
|
||||||
return src == texture;
|
return srcType == TEXTURE;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isSolidPaintActive() {
|
||||||
|
return srcType == SOLID;
|
||||||
}
|
}
|
||||||
|
|
||||||
public XRColor getAlphaColor() {
|
public XRColor getAlphaColor() {
|
||||||
|
@ -38,6 +38,7 @@ import sun.java2d.pipe.*;
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
public class XRDrawImage extends DrawImage {
|
public class XRDrawImage extends DrawImage {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void renderImageXform(SunGraphics2D sg, Image img,
|
protected void renderImageXform(SunGraphics2D sg, Image img,
|
||||||
AffineTransform tx, int interpType, int sx1, int sy1, int sx2,
|
AffineTransform tx, int interpType, int sx1, int sy1, int sx2,
|
||||||
@ -45,20 +46,24 @@ public class XRDrawImage extends DrawImage {
|
|||||||
SurfaceData dstData = sg.surfaceData;
|
SurfaceData dstData = sg.surfaceData;
|
||||||
SurfaceData srcData = dstData.getSourceSurfaceData(img,
|
SurfaceData srcData = dstData.getSourceSurfaceData(img,
|
||||||
SunGraphics2D.TRANSFORM_GENERIC, sg.imageComp, bgColor);
|
SunGraphics2D.TRANSFORM_GENERIC, sg.imageComp, bgColor);
|
||||||
|
int compRule = ((AlphaComposite) sg.composite).getRule();
|
||||||
|
float extraAlpha = ((AlphaComposite) sg.composite).getAlpha();
|
||||||
|
|
||||||
if (srcData != null && !isBgOperation(srcData, bgColor)
|
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 srcType = srcData.getSurfaceType();
|
||||||
SurfaceType dstType = dstData.getSurfaceType();
|
SurfaceType dstType = dstData.getSurfaceType();
|
||||||
|
|
||||||
TransformBlit blit = TransformBlit.getFromCache(srcType,
|
TransformBlit blit = TransformBlit.getFromCache(srcType,
|
||||||
sg.imageComp, dstType);
|
sg.imageComp, dstType);
|
||||||
|
|
||||||
if (blit != null) {
|
if (blit != null) {
|
||||||
blit.Transform(srcData, dstData, sg.composite,
|
blit.Transform(srcData, dstData, sg.composite,
|
||||||
sg.getCompClip(), tx, interpType, sx1, sy1, 0, 0, sx2
|
sg.getCompClip(), tx, interpType, sx1, sy1, 0, 0, sx2
|
||||||
- sx1, sy2 - sy1);
|
- sx1, sy2 - sy1);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -84,7 +84,7 @@ public class XRMaskBlit extends MaskBlit {
|
|||||||
|
|
||||||
int maskPict = maskBuffer.getMaskBuffer().
|
int maskPict = maskBuffer.getMaskBuffer().
|
||||||
uploadMask(width, height, maskscan, maskoff, mask);
|
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);
|
srcx, srcy, 0, 0, dstx, dsty, width, height);
|
||||||
maskBuffer.getMaskBuffer().clearUploadMask(maskPict, width, height);
|
maskBuffer.getMaskBuffer().clearUploadMask(maskPict, width, height);
|
||||||
} finally {
|
} finally {
|
||||||
|
@ -178,9 +178,6 @@ class XRPMScaledBlit extends ScaledBlit {
|
|||||||
super(srcType, CompositeType.AnyAlpha, dstType);
|
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,
|
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) {
|
double dx2, double dy2) {
|
||||||
try {
|
try {
|
||||||
@ -199,19 +196,14 @@ class XRPMScaledBlit extends ScaledBlit {
|
|||||||
sy1 *= yScale;
|
sy1 *= yScale;
|
||||||
sy2 *= 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);
|
AffineTransform xForm = AffineTransform.getScaleInstance(1 / xScale, 1 / yScale);
|
||||||
|
|
||||||
x11sdSrc.validateAsSource(xForm, XRUtils.RepeatNone, XRUtils.FAST); /*
|
x11sdSrc.validateAsSource(xForm, XRUtils.RepeatNone, XRUtils.FAST);
|
||||||
* TODO:
|
|
||||||
* padded
|
|
||||||
* blit
|
|
||||||
* required
|
|
||||||
* :
|
|
||||||
* -
|
|
||||||
* /
|
|
||||||
* ?
|
|
||||||
* ?
|
|
||||||
*/
|
|
||||||
x11sdDst.maskBuffer.compositeBlit(x11sdSrc, x11sdDst, (int) sx1, (int) sy1, (int) dx1, (int) dy1, (int) (dx2 - dx1), (int) (dy2 - dy1));
|
x11sdDst.maskBuffer.compositeBlit(x11sdSrc, x11sdDst, (int) sx1, (int) sy1, (int) dx1, (int) dy1, (int) (dx2 - dx1), (int) (dy2 - dy1));
|
||||||
} finally {
|
} finally {
|
||||||
SunToolkit.awtUnlock();
|
SunToolkit.awtUnlock();
|
||||||
@ -234,43 +226,55 @@ class XRPMTransformedBlit extends TransformBlit {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Calculates the composite-rectangle required for transformed blits. This
|
* Calculates the composition-rectangle required for transformed blits.
|
||||||
* method is functionally equal to: Shape shp =
|
* For composite operations where the composition-rectangle defines
|
||||||
* xform.createTransformedShape(rect); Rectangle bounds = shp.getBounds();
|
* the modified destination area, coordinates are rounded.
|
||||||
* but performs significantly better.
|
* Otherwise the composition window rectangle is sized large enough
|
||||||
* Returns true if the destination shape is parallel to x/y axis
|
* 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[0] = dstx;
|
||||||
srcCoords[1] = dsty;
|
srcCoords[1] = dsty;
|
||||||
srcCoords[2] = dstx + width;
|
srcCoords[2] = dstx + width;
|
||||||
srcCoords[3] = dsty;
|
srcCoords[3] = dsty + height;
|
||||||
srcCoords[4] = dstx + width;
|
|
||||||
srcCoords[5] = dsty + height;
|
|
||||||
srcCoords[6] = dstx;
|
|
||||||
srcCoords[7] = dsty + height;
|
|
||||||
|
|
||||||
tr.transform(srcCoords, 0, dstCoords, 0, 4);
|
double minX, minY, maxX, maxY;
|
||||||
|
if (isQuadrantRotated) {
|
||||||
|
tr.transform(srcCoords, 0, dstCoords, 0, 2);
|
||||||
|
|
||||||
double minX = Math.min(dstCoords[0], Math.min(dstCoords[2], Math.min(dstCoords[4], dstCoords[6])));
|
minX = Math.min(dstCoords[0], dstCoords[2]);
|
||||||
double minY = Math.min(dstCoords[1], Math.min(dstCoords[3], Math.min(dstCoords[5], dstCoords[7])));
|
minY = Math.min(dstCoords[1], dstCoords[3]);
|
||||||
double maxX = Math.max(dstCoords[0], Math.max(dstCoords[2], Math.max(dstCoords[4], dstCoords[6])));
|
maxX = Math.max(dstCoords[0], dstCoords[2]);
|
||||||
double maxY = Math.max(dstCoords[1], Math.max(dstCoords[3], Math.max(dstCoords[5], dstCoords[7])));
|
maxY = Math.max(dstCoords[1], dstCoords[3]);
|
||||||
|
|
||||||
minX = Math.round(minX);
|
minX = Math.ceil(minX - 0.5);
|
||||||
minY = Math.round(minY);
|
minY = Math.ceil(minY - 0.5);
|
||||||
maxX = Math.round(maxX);
|
maxX = Math.ceil(maxX - 0.5);
|
||||||
maxY = Math.round(maxY);
|
maxY = Math.ceil(maxY - 0.5);
|
||||||
|
} else {
|
||||||
|
srcCoords[4] = dstx;
|
||||||
|
srcCoords[5] = dsty + height;
|
||||||
|
srcCoords[6] = dstx + width;
|
||||||
|
srcCoords[7] = dsty;
|
||||||
|
|
||||||
|
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.x = (int) minX;
|
||||||
compositeBounds.y = (int) minY;
|
compositeBounds.y = (int) minY;
|
||||||
compositeBounds.width = (int) (maxX - minX);
|
compositeBounds.width = (int) (maxX - minX);
|
||||||
compositeBounds.height = (int) (maxY - minY);
|
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,
|
public void Transform(SurfaceData src, SurfaceData dst, Composite comp, Region clip, AffineTransform xform,
|
||||||
@ -280,9 +284,13 @@ class XRPMTransformedBlit extends TransformBlit {
|
|||||||
|
|
||||||
XRSurfaceData x11sdDst = (XRSurfaceData) dst;
|
XRSurfaceData x11sdDst = (XRSurfaceData) dst;
|
||||||
XRSurfaceData x11sdSrc = (XRSurfaceData) src;
|
XRSurfaceData x11sdSrc = (XRSurfaceData) src;
|
||||||
|
XRCompositeManager xrMgr = XRCompositeManager.getInstance(x11sdSrc);
|
||||||
|
|
||||||
|
float extraAlpha = ((AlphaComposite) comp).getAlpha();
|
||||||
int filter = XRUtils.ATransOpToXRQuality(hint);
|
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.validateAsDestination(null, clip);
|
||||||
x11sdDst.maskBuffer.validateCompositeState(comp, null, null, null);
|
x11sdDst.maskBuffer.validateCompositeState(comp, null, null, null);
|
||||||
@ -298,21 +306,26 @@ class XRPMTransformedBlit extends TransformBlit {
|
|||||||
trx.setToIdentity();
|
trx.setToIdentity();
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean omitMask = (filter == XRUtils.FAST)
|
if (filter != XRUtils.FAST && (!isQuadrantRotated || extraAlpha != 1.0f)) {
|
||||||
|| (isAxisAligned && ((AlphaComposite) comp).getAlpha() == 1.0f);
|
|
||||||
|
|
||||||
if (!omitMask) {
|
|
||||||
XRMaskImage mask = x11sdSrc.maskBuffer.getMaskImage();
|
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);
|
x11sdSrc.validateAsSource(trx, XRUtils.RepeatPad, filter);
|
||||||
int maskPicture = mask.prepareBlitMask(x11sdDst, maskTX, width, height);
|
x11sdDst.maskBuffer.con.renderComposite(xrMgr.getCompRule(), x11sdSrc.picture,
|
||||||
x11sdDst.maskBuffer.con.renderComposite(XRCompositeManager.getInstance(x11sdSrc).getCompRule(), x11sdSrc.picture, maskPicture, x11sdDst.picture,
|
maskPicture, x11sdDst.picture, 0, 0, 0, 0, compositeBounds.x, compositeBounds.y,
|
||||||
0, 0, 0, 0, compositeBounds.x, compositeBounds.y, compositeBounds.width, compositeBounds.height);
|
compositeBounds.width, compositeBounds.height);
|
||||||
} else {
|
} else {
|
||||||
int repeat = filter == XRUtils.FAST ? XRUtils.RepeatNone : XRUtils.RepeatPad;
|
int repeat = filter == XRUtils.FAST ? XRUtils.RepeatNone : XRUtils.RepeatPad;
|
||||||
|
|
||||||
x11sdSrc.validateAsSource(trx, repeat, filter);
|
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 {
|
} finally {
|
||||||
SunToolkit.awtUnlock();
|
SunToolkit.awtUnlock();
|
||||||
@ -329,9 +342,7 @@ class XrSwToPMBlit extends Blit {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void Blit(SurfaceData src, SurfaceData dst, Composite comp, Region clip, int sx, int sy, int dx, int dy, int w, int h) {
|
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)) {
|
if (CompositeType.SrcOverNoEa.equals(comp) && (src.getTransparency() == Transparency.OPAQUE)) {
|
||||||
Blit opaqueSwToSurfaceBlit = Blit.getFromCache(src.getSurfaceType(), CompositeType.SrcNoEa, dst.getSurfaceType());
|
Blit opaqueSwToSurfaceBlit = Blit.getFromCache(src.getSurfaceType(), CompositeType.SrcNoEa, dst.getSurfaceType());
|
||||||
opaqueSwToSurfaceBlit.Blit(src, dst, comp, clip, sx, sy, dx, dy, w, h);
|
opaqueSwToSurfaceBlit.Blit(src, dst, comp, clip, sx, sy, dx, dy, w, h);
|
||||||
|
@ -29,10 +29,9 @@ import java.awt.*;
|
|||||||
import java.awt.MultipleGradientPaint.*;
|
import java.awt.MultipleGradientPaint.*;
|
||||||
import java.awt.geom.*;
|
import java.awt.geom.*;
|
||||||
import java.awt.image.*;
|
import java.awt.image.*;
|
||||||
|
|
||||||
import sun.java2d.*;
|
import sun.java2d.*;
|
||||||
import sun.java2d.loops.*;
|
import sun.java2d.loops.*;
|
||||||
import sun.java2d.pipe.*;
|
import sun.java2d.xr.XRSurfaceData.XRInternalSurfaceData;
|
||||||
|
|
||||||
abstract class XRPaints {
|
abstract class XRPaints {
|
||||||
static XRCompositeManager xrCompMan;
|
static XRCompositeManager xrCompMan;
|
||||||
@ -108,27 +107,16 @@ abstract class XRPaints {
|
|||||||
void setXRPaint(SunGraphics2D sg2d, Paint pt) {
|
void setXRPaint(SunGraphics2D sg2d, Paint pt) {
|
||||||
GradientPaint paint = (GradientPaint) pt;
|
GradientPaint paint = (GradientPaint) pt;
|
||||||
|
|
||||||
int[] pixels = convertToIntArgbPixels(new Color[] { paint.getColor1(), paint.getColor2() }, false);
|
int repeat = paint.isCyclic() ? XRUtils.RepeatReflect : XRUtils.RepeatPad;
|
||||||
|
float fractions[] = {0, 1};
|
||||||
float fractions[] = new float[2];
|
int[] pixels = convertToIntArgbPixels(new Color[] { paint.getColor1(), paint.getColor2() });
|
||||||
fractions[0] = 0;
|
|
||||||
fractions[1] = 1;
|
|
||||||
|
|
||||||
Point2D pt1 = paint.getPoint1();
|
Point2D pt1 = paint.getPoint1();
|
||||||
Point2D pt2 = paint.getPoint2();
|
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();
|
XRBackend con = xrCompMan.getBackend();
|
||||||
int gradient = con.createLinearGradient(pt1, pt2, fractions, pixels, repeat, at);
|
int gradient = con.createLinearGradient(pt1, pt2, fractions, pixels, repeat);
|
||||||
xrCompMan.setGradientPaint(new XRSurfaceData.XRInternalSurfaceData(con, gradient, at));
|
xrCompMan.setGradientPaint(new XRSurfaceData.XRInternalSurfaceData(con, gradient));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -142,26 +130,22 @@ abstract class XRPaints {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
boolean isPaintValid(SunGraphics2D sg2d) {
|
boolean isPaintValid(SunGraphics2D sg2d) {
|
||||||
return true;
|
return ((LinearGradientPaint) sg2d.getPaint()).getColorSpace() == ColorSpaceType.SRGB;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
void setXRPaint(SunGraphics2D sg2d, Paint pt) {
|
void setXRPaint(SunGraphics2D sg2d, Paint pt) {
|
||||||
LinearGradientPaint paint = (LinearGradientPaint) pt;
|
LinearGradientPaint paint = (LinearGradientPaint) pt;
|
||||||
boolean linear = (paint.getColorSpace() == ColorSpaceType.LINEAR_RGB);
|
|
||||||
|
|
||||||
Color[] colors = paint.getColors();
|
Color[] colors = paint.getColors();
|
||||||
Point2D pt1 = paint.getStartPoint();
|
Point2D pt1 = paint.getStartPoint();
|
||||||
Point2D pt2 = paint.getEndPoint();
|
Point2D pt2 = paint.getEndPoint();
|
||||||
|
|
||||||
|
|
||||||
AffineTransform at = paint.getTransform();
|
|
||||||
at.preConcatenate(sg2d.transform);
|
|
||||||
|
|
||||||
int repeat = XRUtils.getRepeatForCycleMethod(paint.getCycleMethod());
|
int repeat = XRUtils.getRepeatForCycleMethod(paint.getCycleMethod());
|
||||||
float[] fractions = paint.getFractions();
|
float[] fractions = paint.getFractions();
|
||||||
int[] pixels = convertToIntArgbPixels(colors, linear);
|
int[] pixels = convertToIntArgbPixels(colors);
|
||||||
|
|
||||||
|
AffineTransform at = paint.getTransform();
|
||||||
try {
|
try {
|
||||||
at.invert();
|
at.invert();
|
||||||
} catch (NoninvertibleTransformException ex) {
|
} catch (NoninvertibleTransformException ex) {
|
||||||
@ -169,8 +153,10 @@ abstract class XRPaints {
|
|||||||
}
|
}
|
||||||
|
|
||||||
XRBackend con = xrCompMan.getBackend();
|
XRBackend con = xrCompMan.getBackend();
|
||||||
int gradient = con.createLinearGradient(pt1, pt2, fractions, pixels, repeat, at);
|
int gradient = con.createLinearGradient(pt1, pt2, fractions, pixels, repeat);
|
||||||
xrCompMan.setGradientPaint(new XRSurfaceData.XRInternalSurfaceData(con, gradient, at));
|
XRInternalSurfaceData x11sd = new XRSurfaceData.XRInternalSurfaceData(con, gradient);
|
||||||
|
x11sd.setStaticSrcTx(at);
|
||||||
|
xrCompMan.setGradientPaint(x11sd);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -179,136 +165,101 @@ abstract class XRPaints {
|
|||||||
@Override
|
@Override
|
||||||
boolean isPaintValid(SunGraphics2D sg2d) {
|
boolean isPaintValid(SunGraphics2D sg2d) {
|
||||||
RadialGradientPaint grad = (RadialGradientPaint) sg2d.paint;
|
RadialGradientPaint grad = (RadialGradientPaint) sg2d.paint;
|
||||||
return grad.getFocusPoint().equals(grad.getCenterPoint());
|
return grad.getFocusPoint().equals(grad.getCenterPoint())
|
||||||
|
&& grad.getColorSpace() == ColorSpaceType.SRGB;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
void setXRPaint(SunGraphics2D sg2d, Paint pt) {
|
void setXRPaint(SunGraphics2D sg2d, Paint pt) {
|
||||||
RadialGradientPaint paint = (RadialGradientPaint) pt;
|
RadialGradientPaint paint = (RadialGradientPaint) pt;
|
||||||
boolean linear = (paint.getColorSpace() == ColorSpaceType.LINEAR_RGB);
|
|
||||||
Color[] colors = paint.getColors();
|
Color[] colors = paint.getColors();
|
||||||
Point2D center = paint.getCenterPoint();
|
Point2D center = paint.getCenterPoint();
|
||||||
Point2D focus = paint.getFocusPoint();
|
|
||||||
|
|
||||||
int repeat = XRUtils.getRepeatForCycleMethod(paint.getCycleMethod());
|
int repeat = XRUtils.getRepeatForCycleMethod(paint.getCycleMethod());
|
||||||
float[] fractions = paint.getFractions();
|
float[] fractions = paint.getFractions();
|
||||||
int[] pixels = convertToIntArgbPixels(colors, linear);
|
int[] pixels = convertToIntArgbPixels(colors);
|
||||||
float radius = paint.getRadius();
|
float radius = paint.getRadius();
|
||||||
|
|
||||||
// save original (untransformed) center and focus points
|
float cx = (float) center.getX();
|
||||||
double cx = center.getX();
|
float cy = (float) center.getY();
|
||||||
double cy = center.getY();
|
|
||||||
double fx = focus.getX();
|
|
||||||
double fy = focus.getY();
|
|
||||||
|
|
||||||
AffineTransform at = paint.getTransform();
|
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 {
|
try {
|
||||||
at.invert();
|
at.invert();
|
||||||
} catch (Exception e) {
|
} catch (NoninvertibleTransformException ex) {
|
||||||
at.setToScale(0.0, 0.0);
|
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();
|
XRBackend con = xrCompMan.getBackend();
|
||||||
int gradient = con.createRadialGradient(new Point2D.Float(0, 0), new Point2D.Float(0, 0), 0, radius, fractions, pixels, repeat, at);
|
int gradient = con.createRadialGradient(cx, cy, 0, radius, fractions, pixels, repeat);
|
||||||
xrCompMan.setGradientPaint(new XRSurfaceData.XRInternalSurfaceData(con, gradient, at));
|
XRInternalSurfaceData x11sd = new XRSurfaceData.XRInternalSurfaceData(con, gradient);
|
||||||
|
x11sd.setStaticSrcTx(at);
|
||||||
|
xrCompMan.setGradientPaint(x11sd);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static class XRTexture extends XRPaints {
|
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
|
@Override
|
||||||
boolean isPaintValid(SunGraphics2D sg2d) {
|
boolean isPaintValid(SunGraphics2D sg2d) {
|
||||||
TexturePaint paint = (TexturePaint) sg2d.paint;
|
TexturePaint paint = (TexturePaint) sg2d.paint;
|
||||||
BufferedImage bi = paint.getImage();
|
BufferedImage bi = paint.getImage();
|
||||||
XRSurfaceData dstData = (XRSurfaceData) sg2d.getDestSurface();
|
XRSurfaceData dstData = (XRSurfaceData) sg2d.getDestSurface();
|
||||||
|
|
||||||
SurfaceData srcData = dstData.getSourceSurfaceData(bi, SunGraphics2D.TRANSFORM_ISIDENT, CompositeType.SrcOver, null);
|
return getAccSrcSurface(dstData, bi) != 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;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
void setXRPaint(SunGraphics2D sg2d, Paint pt) {
|
void setXRPaint(SunGraphics2D sg2d, Paint pt) {
|
||||||
TexturePaint paint = (TexturePaint) pt;
|
TexturePaint paint = (TexturePaint) pt;
|
||||||
|
|
||||||
BufferedImage bi = paint.getImage();
|
BufferedImage bi = paint.getImage();
|
||||||
SurfaceData dstData = sg2d.surfaceData;
|
|
||||||
SurfaceData srcData = dstData.getSourceSurfaceData(bi, SunGraphics2D.TRANSFORM_ISIDENT, CompositeType.SrcOver, null);
|
|
||||||
|
|
||||||
// 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 x11SrcData = (XRSurfaceData) srcData;
|
|
||||||
|
|
||||||
AffineTransform at = (AffineTransform) sg2d.transform.clone();
|
|
||||||
Rectangle2D anchor = paint.getAnchorRect();
|
Rectangle2D anchor = paint.getAnchorRect();
|
||||||
|
|
||||||
|
XRSurfaceData dstData = (XRSurfaceData) sg2d.surfaceData;
|
||||||
|
XRSurfaceData srcData = (XRSurfaceData) getAccSrcSurface(dstData, bi);
|
||||||
|
|
||||||
|
AffineTransform at = new AffineTransform();
|
||||||
at.translate(anchor.getX(), anchor.getY());
|
at.translate(anchor.getX(), anchor.getY());
|
||||||
at.scale(anchor.getWidth() / ((double) bi.getWidth()), anchor.getHeight() / ((double) bi.getHeight()));
|
at.scale(anchor.getWidth() / ((double) bi.getWidth()), anchor.getHeight() / ((double) bi.getHeight()));
|
||||||
|
|
||||||
try {
|
try {
|
||||||
at.invert();
|
at.invert();
|
||||||
} catch (NoninvertibleTransformException ex) {
|
} 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));
|
srcData.validateAsSource(at, XRUtils.RepeatNormal, XRUtils.ATransOpToXRQuality(sg2d.interpolationType));
|
||||||
xrCompMan.setTexturePaint(((XRSurfaceData) srcData));
|
xrCompMan.setTexturePaint(srcData);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public int[] convertToIntArgbPixels(Color[] colors, boolean linear) {
|
public int[] convertToIntArgbPixels(Color[] colors) {
|
||||||
int[] pixels = new int[colors.length];
|
int[] pixels = new int[colors.length];
|
||||||
for (int i = 0; i < colors.length; i++) {
|
for (int i = 0; i < colors.length; i++) {
|
||||||
pixels[i] = colorToIntArgbPixel(colors[i], linear);
|
pixels[i] = colorToIntArgbPixel(colors[i]);
|
||||||
}
|
}
|
||||||
return pixels;
|
return pixels;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int colorToIntArgbPixel(Color c, boolean linear) {
|
public int colorToIntArgbPixel(Color c) {
|
||||||
int rgb = c.getRGB();
|
int rgb = c.getRGB();
|
||||||
|
int a = (int) Math.round(xrCompMan.getExtraAlpha() * (rgb >>> 24));
|
||||||
int a = rgb >>> 24;
|
return ((a << 24) | (rgb & 0x00FFFFFF));
|
||||||
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));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
57
jdk/src/solaris/classes/sun/java2d/xr/XRSolidSrcPict.java
Normal file
57
jdk/src/solaris/classes/sun/java2d/xr/XRSolidSrcPict.java
Normal file
@ -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;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -109,6 +109,7 @@ public abstract class XRSurfaceData extends XSurfaceData {
|
|||||||
return XRSurfaceDataProxy.createProxy(srcData, graphicsConfig);
|
return XRSurfaceDataProxy.createProxy(srcData, graphicsConfig);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void validatePipe(SunGraphics2D sg2d) {
|
public void validatePipe(SunGraphics2D sg2d) {
|
||||||
TextPipe textpipe;
|
TextPipe textpipe;
|
||||||
boolean validated = false;
|
boolean validated = false;
|
||||||
@ -117,14 +118,8 @@ public abstract class XRSurfaceData extends XSurfaceData {
|
|||||||
* The textpipe for now can't handle TexturePaint when extra-alpha is
|
* The textpipe for now can't handle TexturePaint when extra-alpha is
|
||||||
* specified nore XOR mode
|
* specified nore XOR mode
|
||||||
*/
|
*/
|
||||||
if (sg2d.compositeState < SunGraphics2D.COMP_XOR &&
|
if ((textpipe = getTextPipe(sg2d)) == null)
|
||||||
(sg2d.paintState < SunGraphics2D.PAINT_TEXTURE ||
|
|
||||||
sg2d.composite == null ||
|
|
||||||
!(sg2d.composite instanceof AlphaComposite) ||
|
|
||||||
((AlphaComposite) sg2d.composite).getAlpha() == 1.0f))
|
|
||||||
{
|
{
|
||||||
textpipe = xrtextpipe;
|
|
||||||
} else {
|
|
||||||
super.validatePipe(sg2d);
|
super.validatePipe(sg2d);
|
||||||
textpipe = sg2d.textpipe;
|
textpipe = sg2d.textpipe;
|
||||||
validated = true;
|
validated = true;
|
||||||
@ -184,13 +179,38 @@ public abstract class XRSurfaceData extends XSurfaceData {
|
|||||||
sg2d.imagepipe = xrDrawImage;
|
sg2d.imagepipe = xrDrawImage;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected MaskFill getMaskFill(SunGraphics2D sg2d) {
|
protected TextPipe getTextPipe(SunGraphics2D sg2d) {
|
||||||
if (sg2d.paintState > SunGraphics2D.PAINT_ALPHACOLOR &&
|
boolean supportedPaint = sg2d.compositeState <= SunGraphics2D.COMP_ALPHA
|
||||||
!XRPaints.isValid(sg2d))
|
&& (sg2d.paintState <= SunGraphics2D.PAINT_ALPHACOLOR || sg2d.composite == null);
|
||||||
{
|
|
||||||
return 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 super.getMaskFill(sg2d);
|
|
||||||
|
return (supportedPaint && supportedCompOp) ? xrtextpipe : null;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected MaskFill getMaskFill(SunGraphics2D sg2d) {
|
||||||
|
AlphaComposite aComp = null;
|
||||||
|
if(sg2d.composite != null
|
||||||
|
&& sg2d.composite instanceof AlphaComposite) {
|
||||||
|
aComp = (AlphaComposite) sg2d.composite;
|
||||||
|
}
|
||||||
|
|
||||||
|
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) {
|
public RenderLoops getRenderLoops(SunGraphics2D sg2d) {
|
||||||
@ -395,6 +415,7 @@ public abstract class XRSurfaceData extends XSurfaceData {
|
|||||||
|
|
||||||
boolean transformInUse = false;
|
boolean transformInUse = false;
|
||||||
AffineTransform validatedSourceTransform = new AffineTransform();
|
AffineTransform validatedSourceTransform = new AffineTransform();
|
||||||
|
AffineTransform staticSrcTx = null;
|
||||||
int validatedRepeat = XRUtils.RepeatNone;
|
int validatedRepeat = XRUtils.RepeatNone;
|
||||||
int validatedFilter = XRUtils.FAST;
|
int validatedFilter = XRUtils.FAST;
|
||||||
|
|
||||||
@ -423,13 +444,24 @@ public abstract class XRSurfaceData extends XSurfaceData {
|
|||||||
}
|
}
|
||||||
} else if (!transformInUse ||
|
} else if (!transformInUse ||
|
||||||
(transformInUse && !sxForm.equals(validatedSourceTransform))) {
|
(transformInUse && !sxForm.equals(validatedSourceTransform))) {
|
||||||
|
|
||||||
validatedSourceTransform.setTransform(sxForm.getScaleX(),
|
validatedSourceTransform.setTransform(sxForm.getScaleX(),
|
||||||
sxForm.getShearY(),
|
sxForm.getShearY(),
|
||||||
sxForm.getShearX(),
|
sxForm.getShearX(),
|
||||||
sxForm.getScaleY(),
|
sxForm.getScaleY(),
|
||||||
sxForm.getTranslateX(),
|
sxForm.getTranslateX(),
|
||||||
sxForm.getTranslateY());
|
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;
|
transformInUse = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -547,15 +579,10 @@ public abstract class XRSurfaceData extends XSurfaceData {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static class XRInternalSurfaceData extends XRSurfaceData {
|
public static class XRInternalSurfaceData extends XRSurfaceData {
|
||||||
public XRInternalSurfaceData(XRBackend renderQueue, int pictXid,
|
public XRInternalSurfaceData(XRBackend renderQueue, int pictXid) {
|
||||||
AffineTransform transform) {
|
|
||||||
super(renderQueue);
|
super(renderQueue);
|
||||||
this.picture = pictXid;
|
this.picture = pictXid;
|
||||||
this.validatedSourceTransform = transform;
|
this.transformInUse = false;
|
||||||
|
|
||||||
if (validatedSourceTransform != null) {
|
|
||||||
transformInUse = true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean canSourceSendExposures(int x, int y, int w, int h) {
|
public boolean canSourceSendExposures(int x, int y, int w, int h) {
|
||||||
@ -677,4 +704,8 @@ public abstract class XRSurfaceData extends XSurfaceData {
|
|||||||
public XRGraphicsConfig getGraphicsConfig() {
|
public XRGraphicsConfig getGraphicsConfig() {
|
||||||
return graphicsConfig;
|
return graphicsConfig;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setStaticSrcTx(AffineTransform staticSrcTx) {
|
||||||
|
this.staticSrcTx = staticSrcTx;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -27,6 +27,7 @@ package sun.java2d.xr;
|
|||||||
|
|
||||||
import java.awt.*;
|
import java.awt.*;
|
||||||
import java.awt.MultipleGradientPaint.*;
|
import java.awt.MultipleGradientPaint.*;
|
||||||
|
import java.awt.geom.AffineTransform;
|
||||||
import java.awt.image.*;
|
import java.awt.image.*;
|
||||||
import sun.java2d.loops.*;
|
import sun.java2d.loops.*;
|
||||||
import static java.awt.AlphaComposite.*;
|
import static java.awt.AlphaComposite.*;
|
||||||
@ -258,4 +259,21 @@ public class XRUtils {
|
|||||||
public static int clampToUShort(int x) {
|
public static int clampToUShort(int x) {
|
||||||
return (x > 65535 ? 65535 : (x < 0) ? 0 : 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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -237,8 +237,9 @@ public class CUPSPrinter {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Get CUPS default printer using IPP.
|
* 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 {
|
try {
|
||||||
URL url = new URL("http", getServer(), getPort(), "");
|
URL url = new URL("http", getServer(), getPort(), "");
|
||||||
final HttpURLConnection urlConnection =
|
final HttpURLConnection urlConnection =
|
||||||
@ -264,8 +265,8 @@ public class CUPSPrinter {
|
|||||||
AttributeClass.ATTRIBUTES_CHARSET,
|
AttributeClass.ATTRIBUTES_CHARSET,
|
||||||
AttributeClass.ATTRIBUTES_NATURAL_LANGUAGE,
|
AttributeClass.ATTRIBUTES_NATURAL_LANGUAGE,
|
||||||
new AttributeClass("requested-attributes",
|
new AttributeClass("requested-attributes",
|
||||||
AttributeClass.TAG_KEYWORD,
|
AttributeClass.TAG_URI,
|
||||||
"printer-name")
|
"printer-uri")
|
||||||
};
|
};
|
||||||
|
|
||||||
if (IPPPrintService.writeIPPRequest(os,
|
if (IPPPrintService.writeIPPRequest(os,
|
||||||
@ -273,6 +274,7 @@ public class CUPSPrinter {
|
|||||||
attCl)) {
|
attCl)) {
|
||||||
|
|
||||||
HashMap defaultMap = null;
|
HashMap defaultMap = null;
|
||||||
|
String[] printerInfo = new String[2];
|
||||||
InputStream is = urlConnection.getInputStream();
|
InputStream is = urlConnection.getInputStream();
|
||||||
HashMap[] responseMap = IPPPrintService.readIPPResponse(
|
HashMap[] responseMap = IPPPrintService.readIPPResponse(
|
||||||
is);
|
is);
|
||||||
@ -293,21 +295,30 @@ public class CUPSPrinter {
|
|||||||
* special behaviour for this built in.
|
* special behaviour for this built in.
|
||||||
*/
|
*/
|
||||||
if (UnixPrintServiceLookup.isMac()) {
|
if (UnixPrintServiceLookup.isMac()) {
|
||||||
return UnixPrintServiceLookup.
|
printerInfo[0] = UnixPrintServiceLookup.
|
||||||
getDefaultPrinterNameSysV();
|
getDefaultPrinterNameSysV();
|
||||||
|
printerInfo[1] = null;
|
||||||
|
return (String[])printerInfo.clone();
|
||||||
} else {
|
} else {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
AttributeClass attribClass = (AttributeClass)
|
AttributeClass attribClass = (AttributeClass)
|
||||||
defaultMap.get("printer-name");
|
defaultMap.get("printer-name");
|
||||||
|
|
||||||
if (attribClass != null) {
|
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();
|
os.close();
|
||||||
urlConnection.disconnect();
|
urlConnection.disconnect();
|
||||||
return nameStr;
|
return (String [])printerInfo.clone();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
os.close();
|
os.close();
|
||||||
@ -322,7 +333,7 @@ public class CUPSPrinter {
|
|||||||
/**
|
/**
|
||||||
* Get list of all CUPS printers using IPP.
|
* Get list of all CUPS printers using IPP.
|
||||||
*/
|
*/
|
||||||
public static String[] getAllPrinters() {
|
static String[] getAllPrinters() {
|
||||||
try {
|
try {
|
||||||
URL url = new URL("http", getServer(), getPort(), "");
|
URL url = new URL("http", getServer(), getPort(), "");
|
||||||
|
|
||||||
|
@ -366,6 +366,7 @@ public class IPPPrintService implements PrintService, SunPrinterJobService {
|
|||||||
" IPPPrintService, myURL="+
|
" IPPPrintService, myURL="+
|
||||||
myURL+" Exception= "+
|
myURL+" Exception= "+
|
||||||
e);
|
e);
|
||||||
|
throw new IllegalArgumentException("invalid url");
|
||||||
}
|
}
|
||||||
|
|
||||||
isCupsPrinter = isCups;
|
isCupsPrinter = isCups;
|
||||||
@ -1145,6 +1146,8 @@ public class IPPPrintService implements PrintService, SunPrinterJobService {
|
|||||||
// REMIND: check attribute values
|
// REMIND: check attribute values
|
||||||
return (T)PDLOverrideSupported.NOT_ATTEMPTED;
|
return (T)PDLOverrideSupported.NOT_ATTEMPTED;
|
||||||
}
|
}
|
||||||
|
} else if (category == PrinterURI.class) {
|
||||||
|
return (T)(new PrinterURI(myURI));
|
||||||
} else {
|
} else {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -48,6 +48,7 @@ import javax.print.attribute.PrintRequestAttributeSet;
|
|||||||
import javax.print.attribute.PrintServiceAttribute;
|
import javax.print.attribute.PrintServiceAttribute;
|
||||||
import javax.print.attribute.PrintServiceAttributeSet;
|
import javax.print.attribute.PrintServiceAttributeSet;
|
||||||
import javax.print.attribute.standard.PrinterName;
|
import javax.print.attribute.standard.PrinterName;
|
||||||
|
import javax.print.attribute.standard.PrinterURI;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.FileReader;
|
import java.io.FileReader;
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
@ -203,6 +204,33 @@ public class UnixPrintServiceLookup extends PrintServiceLookup
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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"
|
// refreshes "printServices"
|
||||||
public synchronized void refreshServices() {
|
public synchronized void refreshServices() {
|
||||||
@ -246,8 +274,7 @@ public class UnixPrintServiceLookup extends PrintServiceLookup
|
|||||||
}
|
}
|
||||||
if ((defaultPrintService != null)
|
if ((defaultPrintService != null)
|
||||||
&& printers[p].equals(getPrinterDestName(defaultPrintService))) {
|
&& printers[p].equals(getPrinterDestName(defaultPrintService))) {
|
||||||
printerList.add(defaultPrintService);
|
defaultIndex = addPrintServiceToList(printerList, defaultPrintService);
|
||||||
defaultIndex = printerList.size() - 1;
|
|
||||||
} else {
|
} else {
|
||||||
if (printServices == null) {
|
if (printServices == null) {
|
||||||
IPPPrintService.debug_println(debugPrefix+
|
IPPPrintService.debug_println(debugPrefix+
|
||||||
@ -255,9 +282,10 @@ public class UnixPrintServiceLookup extends PrintServiceLookup
|
|||||||
|
|
||||||
if (CUPSPrinter.isCupsRunning()) {
|
if (CUPSPrinter.isCupsRunning()) {
|
||||||
try {
|
try {
|
||||||
printerList.add(new IPPPrintService(printers[p],
|
addPrintServiceToList(printerList,
|
||||||
printerURIs[p],
|
new IPPPrintService(printers[p],
|
||||||
true));
|
printerURIs[p],
|
||||||
|
true));
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
IPPPrintService.debug_println(debugPrefix+
|
IPPPrintService.debug_println(debugPrefix+
|
||||||
" getAllPrinters Exception "+
|
" getAllPrinters Exception "+
|
||||||
@ -282,10 +310,10 @@ public class UnixPrintServiceLookup extends PrintServiceLookup
|
|||||||
if (j == printServices.length) { // not found?
|
if (j == printServices.length) { // not found?
|
||||||
if (CUPSPrinter.isCupsRunning()) {
|
if (CUPSPrinter.isCupsRunning()) {
|
||||||
try {
|
try {
|
||||||
printerList.add(new IPPPrintService(
|
addPrintServiceToList(printerList,
|
||||||
printers[p],
|
new IPPPrintService(printers[p],
|
||||||
printerURIs[p],
|
printerURIs[p],
|
||||||
true));
|
true));
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
IPPPrintService.debug_println(debugPrefix+
|
IPPPrintService.debug_println(debugPrefix+
|
||||||
" getAllPrinters Exception "+
|
" getAllPrinters Exception "+
|
||||||
@ -312,9 +340,7 @@ public class UnixPrintServiceLookup extends PrintServiceLookup
|
|||||||
|
|
||||||
//if defaultService is not found in printerList
|
//if defaultService is not found in printerList
|
||||||
if (defaultIndex == -1 && defaultPrintService != null) {
|
if (defaultIndex == -1 && defaultPrintService != null) {
|
||||||
//add default to the list
|
defaultIndex = addPrintServiceToList(printerList, defaultPrintService);
|
||||||
printerList.add(defaultPrintService);
|
|
||||||
defaultIndex = printerList.size() - 1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
printServices = (PrintService[])printerList.toArray(
|
printServices = (PrintService[])printerList.toArray(
|
||||||
@ -563,11 +589,14 @@ public class UnixPrintServiceLookup extends PrintServiceLookup
|
|||||||
|
|
||||||
// clear defaultPrintService
|
// clear defaultPrintService
|
||||||
defaultPrintService = null;
|
defaultPrintService = null;
|
||||||
|
String psuri = null;
|
||||||
|
|
||||||
IPPPrintService.debug_println("isRunning ? "+
|
IPPPrintService.debug_println("isRunning ? "+
|
||||||
(CUPSPrinter.isCupsRunning()));
|
(CUPSPrinter.isCupsRunning()));
|
||||||
if (CUPSPrinter.isCupsRunning()) {
|
if (CUPSPrinter.isCupsRunning()) {
|
||||||
defaultPrinter = CUPSPrinter.getDefaultPrinter();
|
String[] printerInfo = CUPSPrinter.getDefaultPrinter();
|
||||||
|
defaultPrinter = printerInfo[0];
|
||||||
|
psuri = printerInfo[1];
|
||||||
} else {
|
} else {
|
||||||
if (isMac() || isSysV()) {
|
if (isMac() || isSysV()) {
|
||||||
defaultPrinter = getDefaultPrinterNameSysV();
|
defaultPrinter = getDefaultPrinterNameSysV();
|
||||||
@ -590,12 +619,17 @@ public class UnixPrintServiceLookup extends PrintServiceLookup
|
|||||||
if (defaultPrintService == null) {
|
if (defaultPrintService == null) {
|
||||||
if (CUPSPrinter.isCupsRunning()) {
|
if (CUPSPrinter.isCupsRunning()) {
|
||||||
try {
|
try {
|
||||||
PrintService defaultPS =
|
PrintService defaultPS;
|
||||||
new IPPPrintService(defaultPrinter,
|
if (psuri != null) {
|
||||||
|
defaultPS = new IPPPrintService(defaultPrinter,
|
||||||
|
psuri, true);
|
||||||
|
} else {
|
||||||
|
defaultPS = new IPPPrintService(defaultPrinter,
|
||||||
new URL("http://"+
|
new URL("http://"+
|
||||||
CUPSPrinter.getServer()+":"+
|
CUPSPrinter.getServer()+":"+
|
||||||
CUPSPrinter.getPort()+"/"+
|
CUPSPrinter.getPort()+"/"+
|
||||||
defaultPrinter));
|
defaultPrinter));
|
||||||
|
}
|
||||||
defaultPrintService = defaultPS;
|
defaultPrintService = defaultPS;
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
}
|
}
|
||||||
|
@ -523,12 +523,10 @@ JNIEXPORT jint JNICALL
|
|||||||
Java_sun_java2d_xr_XRBackendNative_XRCreateLinearGradientPaintNative
|
Java_sun_java2d_xr_XRBackendNative_XRCreateLinearGradientPaintNative
|
||||||
(JNIEnv *env, jclass xsd, jfloatArray fractionsArray,
|
(JNIEnv *env, jclass xsd, jfloatArray fractionsArray,
|
||||||
jshortArray pixelsArray, jint x1, jint y1, jint x2, jint y2,
|
jshortArray pixelsArray, jint x1, jint y1, jint x2, jint y2,
|
||||||
jint numStops, jint repeat,
|
jint numStops, jint repeat) {
|
||||||
jint m00, jint m01, jint m02, jint m10, jint m11, jint m12) {
|
|
||||||
jint i;
|
jint i;
|
||||||
jshort* pixels;
|
jshort* pixels;
|
||||||
jfloat* fractions;
|
jfloat* fractions;
|
||||||
XTransform tr;
|
|
||||||
XRenderPictureAttributes pict_attr;
|
XRenderPictureAttributes pict_attr;
|
||||||
Picture gradient = 0;
|
Picture gradient = 0;
|
||||||
XRenderColor *colors;
|
XRenderColor *colors;
|
||||||
@ -594,8 +592,6 @@ Java_sun_java2d_xr_XRBackendNative_XRCreateLinearGradientPaintNative
|
|||||||
(*env)->ReleasePrimitiveArrayCritical(env, fractionsArray, fractions, JNI_ABORT);
|
(*env)->ReleasePrimitiveArrayCritical(env, fractionsArray, fractions, JNI_ABORT);
|
||||||
|
|
||||||
if (gradient != 0) {
|
if (gradient != 0) {
|
||||||
BUILD_TRANSFORM_MATRIX(tr, m00, m01, m02, m10, m11, m12);
|
|
||||||
XRenderSetPictureTransform (awt_display, gradient, &tr);
|
|
||||||
pict_attr.repeat = repeat;
|
pict_attr.repeat = repeat;
|
||||||
XRenderChangePicture (awt_display, gradient, CPRepeat, &pict_attr);
|
XRenderChangePicture (awt_display, gradient, CPRepeat, &pict_attr);
|
||||||
}
|
}
|
||||||
@ -608,12 +604,11 @@ JNIEXPORT jint JNICALL
|
|||||||
Java_sun_java2d_xr_XRBackendNative_XRCreateRadialGradientPaintNative
|
Java_sun_java2d_xr_XRBackendNative_XRCreateRadialGradientPaintNative
|
||||||
(JNIEnv *env, jclass xsd, jfloatArray fractionsArray,
|
(JNIEnv *env, jclass xsd, jfloatArray fractionsArray,
|
||||||
jshortArray pixelsArray, jint numStops,
|
jshortArray pixelsArray, jint numStops,
|
||||||
jint innerRadius, jint outerRadius, jint repeat,
|
jint centerX, jint centerY,
|
||||||
jint m00, jint m01, jint m02, jint m10, jint m11, jint m12) {
|
jint innerRadius, jint outerRadius, jint repeat) {
|
||||||
jint i;
|
jint i;
|
||||||
jshort* pixels;
|
jshort* pixels;
|
||||||
jfloat* fractions;
|
jfloat* fractions;
|
||||||
XTransform tr;
|
|
||||||
XRenderPictureAttributes pict_attr;
|
XRenderPictureAttributes pict_attr;
|
||||||
Picture gradient = 0;
|
Picture gradient = 0;
|
||||||
XRenderColor *colors;
|
XRenderColor *colors;
|
||||||
@ -637,11 +632,11 @@ Java_sun_java2d_xr_XRBackendNative_XRCreateRadialGradientPaintNative
|
|||||||
return -1; //TODO release pixels first
|
return -1; //TODO release pixels first
|
||||||
}
|
}
|
||||||
|
|
||||||
grad.inner.x = 0;
|
grad.inner.x = centerX;
|
||||||
grad.inner.y = 0;
|
grad.inner.y = centerY;
|
||||||
grad.inner.radius = innerRadius;
|
grad.inner.radius = innerRadius;
|
||||||
grad.outer.x = 0;
|
grad.outer.x = centerX;
|
||||||
grad.outer.y = 0;
|
grad.outer.y = centerY;
|
||||||
grad.outer.radius = outerRadius;
|
grad.outer.radius = outerRadius;
|
||||||
|
|
||||||
/*TODO optimized & malloc check*/
|
/*TODO optimized & malloc check*/
|
||||||
@ -682,8 +677,6 @@ Java_sun_java2d_xr_XRBackendNative_XRCreateRadialGradientPaintNative
|
|||||||
|
|
||||||
|
|
||||||
if (gradient != 0) {
|
if (gradient != 0) {
|
||||||
BUILD_TRANSFORM_MATRIX(tr, m00, m01, m02, m10, m11, m12);
|
|
||||||
XRenderSetPictureTransform (awt_display, gradient, &tr);
|
|
||||||
pict_attr.repeat = repeat;
|
pict_attr.repeat = repeat;
|
||||||
XRenderChangePicture (awt_display, gradient, CPRepeat, &pict_attr);
|
XRenderChangePicture (awt_display, gradient, CPRepeat, &pict_attr);
|
||||||
}
|
}
|
||||||
|
@ -183,10 +183,6 @@ public class WPrinterJob extends RasterPrinterJob implements DisposerTarget {
|
|||||||
/**
|
/**
|
||||||
* Values must match those defined in wingdi.h & commdlg.h
|
* 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_COLLATE = 0x00000010;
|
||||||
private static final int PD_PRINTTOFILE = 0x00000020;
|
private static final int PD_PRINTTOFILE = 0x00000020;
|
||||||
private static final int DM_ORIENTATION = 0x00000001;
|
private static final int DM_ORIENTATION = 0x00000001;
|
||||||
@ -1639,63 +1635,7 @@ public class WPrinterJob extends RasterPrinterJob implements DisposerTarget {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//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() {
|
private final boolean getDestAttrib() {
|
||||||
return (mDestination != null);
|
return (mDestination != null);
|
||||||
@ -1847,20 +1787,7 @@ public class WPrinterJob extends RasterPrinterJob implements DisposerTarget {
|
|||||||
return mAttMediaTray;
|
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() {
|
private final boolean getPrintToFileEnabled() {
|
||||||
SecurityManager security = System.getSecurityManager();
|
SecurityManager security = System.getSecurityManager();
|
||||||
|
@ -53,26 +53,73 @@ static const ADAPTER_INFO badHardware[] = {
|
|||||||
|
|
||||||
// Intel HD
|
// Intel HD
|
||||||
// Clarkdale (Desktop) GMA HD Lines
|
// Clarkdale (Desktop) GMA HD Lines
|
||||||
{ 0x8086, 0x0042, D_VERSION(6,14,10,5337), OS_WINXP | OS_WINXP_64 },
|
{ 0x8086, 0x0042, D_VERSION(6,14,10,5394), OS_WINXP | OS_WINXP_64 },
|
||||||
{ 0x8086, 0x0042, D_VERSION(8,15,10,2302), OS_VISTA | OS_WINDOWS7 },
|
{ 0x8086, 0x0042, D_VERSION(8,15,10,2993), OS_VISTA | OS_WINDOWS7 },
|
||||||
// Arrandale (Mobile) GMA HD Lines
|
// Arrandale (Mobile) GMA HD Lines
|
||||||
{ 0x8086, 0x0046, D_VERSION(6,14,10,5337), OS_WINXP | OS_WINXP_64 },
|
{ 0x8086, 0x0046, D_VERSION(6,14,10,5394), OS_WINXP | OS_WINXP_64 },
|
||||||
{ 0x8086, 0x0046, D_VERSION(8,15,10,2302), OS_VISTA | OS_WINDOWS7 },
|
{ 0x8086, 0x0046, D_VERSION(8,15,10,2993), OS_VISTA | OS_WINDOWS7 },
|
||||||
// Sandy Bridge GMA HD Lines
|
|
||||||
{ 0x8086, 0x0102, D_VERSION(6,14,10,5337), OS_WINXP | OS_WINXP_64 },
|
// Sandy Bridge HD Graphics 3000/2000
|
||||||
{ 0x8086, 0x0102, D_VERSION(8,15,10,2302), OS_VISTA | OS_WINDOWS7 },
|
{ 0x8086, 0x0102, D_VERSION(6,14,10,5437), OS_WINXP | OS_WINXP_64 },
|
||||||
{ 0x8086, 0x0106, D_VERSION(6,14,10,5337), OS_WINXP | OS_WINXP_64 },
|
{ 0x8086, 0x0102, D_VERSION(9,17,10,3223), OS_VISTA | OS_WINDOWS7 },
|
||||||
{ 0x8086, 0x0106, D_VERSION(8,15,10,2302), OS_VISTA | OS_WINDOWS7 },
|
{ 0x8086, 0x0106, D_VERSION(6,14,10,5437), OS_WINXP | OS_WINXP_64 },
|
||||||
{ 0x8086, 0x0112, D_VERSION(6,14,10,5337), OS_WINXP | OS_WINXP_64 },
|
{ 0x8086, 0x0106, D_VERSION(9,17,10,3223), OS_VISTA | OS_WINDOWS7 },
|
||||||
{ 0x8086, 0x0112, D_VERSION(8,15,10,2302), OS_VISTA | OS_WINDOWS7 },
|
{ 0x8086, 0x0112, D_VERSION(6,14,10,5437), OS_WINXP | OS_WINXP_64 },
|
||||||
{ 0x8086, 0x0116, D_VERSION(6,14,10,5337), OS_WINXP | OS_WINXP_64 },
|
{ 0x8086, 0x0112, D_VERSION(9,17,10,3223), OS_VISTA | OS_WINDOWS7 },
|
||||||
{ 0x8086, 0x0116, D_VERSION(8,15,10,2302), OS_VISTA | OS_WINDOWS7 },
|
{ 0x8086, 0x0116, D_VERSION(6,14,10,5437), OS_WINXP | OS_WINXP_64 },
|
||||||
{ 0x8086, 0x0122, D_VERSION(6,14,10,5337), OS_WINXP | OS_WINXP_64 },
|
{ 0x8086, 0x0116, D_VERSION(9,17,10,3223), OS_VISTA | OS_WINDOWS7 },
|
||||||
{ 0x8086, 0x0122, D_VERSION(8,15,10,2302), OS_VISTA | OS_WINDOWS7 },
|
{ 0x8086, 0x0122, D_VERSION(6,14,10,5437), OS_WINXP | OS_WINXP_64 },
|
||||||
{ 0x8086, 0x0126, D_VERSION(6,14,10,5337), OS_WINXP | OS_WINXP_64 },
|
{ 0x8086, 0x0122, D_VERSION(9,17,10,3223), OS_VISTA | OS_WINDOWS7 },
|
||||||
{ 0x8086, 0x0126, D_VERSION(8,15,10,2302), OS_VISTA | OS_WINDOWS7 },
|
{ 0x8086, 0x0126, D_VERSION(6,14,10,5437), OS_WINXP | OS_WINXP_64 },
|
||||||
{ 0x8086, 0x010A, D_VERSION(6,14,10,5337), OS_WINXP | OS_WINXP_64 },
|
{ 0x8086, 0x0126, D_VERSION(9,17,10,3223), OS_VISTA | OS_WINDOWS7 },
|
||||||
{ 0x8086, 0x010A, D_VERSION(8,15,10,2302), 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
|
// Reason: workaround for 6620073, 6612195
|
||||||
// Intel 740
|
// Intel 740
|
||||||
@ -123,33 +170,33 @@ static const ADAPTER_INFO badHardware[] = {
|
|||||||
{ 0x8086, 0x2A13, NO_VERSION, OS_ALL },
|
{ 0x8086, 0x2A13, NO_VERSION, OS_ALL },
|
||||||
|
|
||||||
// Eaglelake (Desktop) GMA 4500 Lines
|
// Eaglelake (Desktop) GMA 4500 Lines
|
||||||
{ 0x8086, 0x2E42, D_VERSION(6,14,10,5303), OS_WINXP | OS_WINXP_64 },
|
{ 0x8086, 0x2E42, D_VERSION(6,14,10,5420), OS_WINXP | OS_WINXP_64 },
|
||||||
{ 0x8086, 0x2E42, D_VERSION(8,15,10,2302), OS_VISTA | OS_WINDOWS7 },
|
{ 0x8086, 0x2E42, D_VERSION(8,15,10,2869), OS_VISTA | OS_WINDOWS7 },
|
||||||
{ 0x8086, 0x2E43, D_VERSION(6,14,10,5303), OS_WINXP | OS_WINXP_64 },
|
{ 0x8086, 0x2E43, D_VERSION(6,14,10,5420), OS_WINXP | OS_WINXP_64 },
|
||||||
{ 0x8086, 0x2E43, D_VERSION(8,15,10,2302), OS_VISTA | OS_WINDOWS7 },
|
{ 0x8086, 0x2E43, D_VERSION(8,15,10,2869), OS_VISTA | OS_WINDOWS7 },
|
||||||
{ 0x8086, 0x2E92, D_VERSION(6,14,10,5303), OS_WINXP | OS_WINXP_64 },
|
{ 0x8086, 0x2E92, D_VERSION(6,14,10,5420), OS_WINXP | OS_WINXP_64 },
|
||||||
{ 0x8086, 0x2E92, D_VERSION(8,15,10,2302), OS_VISTA | OS_WINDOWS7 },
|
{ 0x8086, 0x2E92, D_VERSION(8,15,10,2869), OS_VISTA | OS_WINDOWS7 },
|
||||||
{ 0x8086, 0x2E93, D_VERSION(6,14,10,5303), OS_WINXP | OS_WINXP_64 },
|
{ 0x8086, 0x2E93, D_VERSION(6,14,10,5420), OS_WINXP | OS_WINXP_64 },
|
||||||
{ 0x8086, 0x2E93, D_VERSION(8,15,10,2302), OS_VISTA | OS_WINDOWS7 },
|
{ 0x8086, 0x2E93, D_VERSION(8,15,10,2869), OS_VISTA | OS_WINDOWS7 },
|
||||||
{ 0x8086, 0x2E12, D_VERSION(6,14,10,5303), OS_WINXP | OS_WINXP_64 },
|
{ 0x8086, 0x2E12, D_VERSION(6,14,10,5420), OS_WINXP | OS_WINXP_64 },
|
||||||
{ 0x8086, 0x2E12, D_VERSION(8,15,10,2302), OS_VISTA | OS_WINDOWS7 },
|
{ 0x8086, 0x2E12, D_VERSION(8,15,10,2869), OS_VISTA | OS_WINDOWS7 },
|
||||||
{ 0x8086, 0x2E13, D_VERSION(6,14,10,5303), OS_WINXP | OS_WINXP_64 },
|
{ 0x8086, 0x2E13, D_VERSION(6,14,10,5420), OS_WINXP | OS_WINXP_64 },
|
||||||
{ 0x8086, 0x2E13, D_VERSION(8,15,10,2302), OS_VISTA | OS_WINDOWS7 },
|
{ 0x8086, 0x2E13, D_VERSION(8,15,10,2869), OS_VISTA | OS_WINDOWS7 },
|
||||||
// Eaglelake (Desktop) GMA X4500 Lines
|
// Eaglelake (Desktop) GMA X4500 Lines
|
||||||
{ 0x8086, 0x2E32, D_VERSION(6,14,10,5303), OS_WINXP | OS_WINXP_64 },
|
{ 0x8086, 0x2E32, D_VERSION(6,14,10,5420), OS_WINXP | OS_WINXP_64 },
|
||||||
{ 0x8086, 0x2E32, D_VERSION(8,15,10,2302), OS_VISTA | OS_WINDOWS7 },
|
{ 0x8086, 0x2E32, D_VERSION(8,15,10,2869), OS_VISTA | OS_WINDOWS7 },
|
||||||
{ 0x8086, 0x2E33, D_VERSION(6,14,10,5303), OS_WINXP | OS_WINXP_64 },
|
{ 0x8086, 0x2E33, D_VERSION(6,14,10,5420), OS_WINXP | OS_WINXP_64 },
|
||||||
{ 0x8086, 0x2E33, D_VERSION(8,15,10,2302), OS_VISTA | OS_WINDOWS7 },
|
{ 0x8086, 0x2E33, D_VERSION(8,15,10,2869), OS_VISTA | OS_WINDOWS7 },
|
||||||
{ 0x8086, 0x2E22, D_VERSION(6,14,10,5303), OS_WINXP | OS_WINXP_64 },
|
{ 0x8086, 0x2E22, D_VERSION(6,14,10,5420), OS_WINXP | OS_WINXP_64 },
|
||||||
{ 0x8086, 0x2E22, D_VERSION(8,15,10,2302), OS_VISTA | OS_WINDOWS7 },
|
{ 0x8086, 0x2E22, D_VERSION(8,15,10,2869), OS_VISTA | OS_WINDOWS7 },
|
||||||
// Eaglelake (Desktop) GMA X4500HD Lines
|
// Eaglelake (Desktop) GMA X4500HD Lines
|
||||||
{ 0x8086, 0x2E23, D_VERSION(6,14,10,5303), OS_WINXP | OS_WINXP_64 },
|
{ 0x8086, 0x2E23, D_VERSION(6,14,10,5420), OS_WINXP | OS_WINXP_64 },
|
||||||
{ 0x8086, 0x2E23, D_VERSION(8,15,10,2302), OS_VISTA | OS_WINDOWS7 },
|
{ 0x8086, 0x2E23, D_VERSION(8,15,10,2869), OS_VISTA | OS_WINDOWS7 },
|
||||||
// Cantiga (Mobile) GMA 4500MHD Lines
|
// Cantiga (Mobile) GMA 4500MHD Lines
|
||||||
{ 0x8086, 0x2A42, D_VERSION(6,14,10,5303), OS_WINXP | OS_WINXP_64 },
|
{ 0x8086, 0x2A42, D_VERSION(6,14,10,5420), OS_WINXP | OS_WINXP_64 },
|
||||||
{ 0x8086, 0x2A42, D_VERSION(8,15,10,2302), OS_VISTA | OS_WINDOWS7 },
|
{ 0x8086, 0x2A42, D_VERSION(8,15,10,2869), OS_VISTA | OS_WINDOWS7 },
|
||||||
{ 0x8086, 0x2A43, D_VERSION(6,14,10,5303), OS_WINXP | OS_WINXP_64 },
|
{ 0x8086, 0x2A43, D_VERSION(6,14,10,5420), OS_WINXP | OS_WINXP_64 },
|
||||||
{ 0x8086, 0x2A43, D_VERSION(8,15,10,2302), OS_VISTA | OS_WINDOWS7 },
|
{ 0x8086, 0x2A43, D_VERSION(8,15,10,2869), OS_VISTA | OS_WINDOWS7 },
|
||||||
|
|
||||||
// ATI Mobility Radeon X1600, X1400, X1450, X1300, X1350
|
// ATI Mobility Radeon X1600, X1400, X1450, X1300, X1350
|
||||||
// Reason: workaround for 6613066, 6687166
|
// Reason: workaround for 6613066, 6687166
|
||||||
|
126
jdk/test/java/awt/GradientPaint/GradientTransformTest.java
Normal file
126
jdk/test/java/awt/GradientPaint/GradientTransformTest.java
Normal file
@ -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();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -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();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -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.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -23,8 +23,8 @@
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* @test
|
* @test
|
||||||
* @bug 4851363
|
* @bug 4851363 8025988 8025990
|
||||||
* @summary Tests the save to file dialog has a title
|
* @summary Tests the save to file dialog has a title.
|
||||||
* @run main/manual=yesno/othervm SaveDialogTitleTest
|
* @run main/manual=yesno/othervm SaveDialogTitleTest
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@ -37,12 +37,21 @@ public class SaveDialogTitleTest {
|
|||||||
System.out.print("Once the dialog appears, press OK and the ");
|
System.out.print("Once the dialog appears, press OK and the ");
|
||||||
System.out.print("Save to File dialog should appear and it ");
|
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("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();
|
Toolkit tk = Toolkit.getDefaultToolkit();
|
||||||
JobAttributes jobAttributes = new JobAttributes();
|
JobAttributes jobAttributes = new JobAttributes();
|
||||||
jobAttributes.setDestination(JobAttributes.DestinationType.FILE);
|
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 =
|
PrintJob printJob =
|
||||||
tk.getPrintJob(new Frame(), "Save Title Test",
|
tk.getPrintJob(new Frame(), "Save Title Test",
|
||||||
jobAttributes, null);
|
jobAttributes, page);
|
||||||
if (printJob != null) { // in case user cancels.
|
if (printJob != null) { // in case user cancels.
|
||||||
printJob.end();
|
printJob.end();
|
||||||
}
|
}
|
||||||
|
@ -23,7 +23,7 @@
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @test
|
* @test
|
||||||
* @bug 800535
|
* @bug 800535 8022536
|
||||||
* @summary JDK7 Printing: CJK and Latin Text in string overlap
|
* @summary JDK7 Printing: CJK and Latin Text in string overlap
|
||||||
* @run main/manual=yesno PrintLatinCJKTest
|
* @run main/manual=yesno PrintLatinCJKTest
|
||||||
*/
|
*/
|
||||||
@ -49,6 +49,8 @@ public class PrintLatinCJKTest implements Printable, ActionListener {
|
|||||||
private PageFormat pf;
|
private PageFormat pf;
|
||||||
|
|
||||||
static String info =
|
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 "+
|
"You need a printer for this test. If you have none, let "+
|
||||||
"the test pass. If there is a printer, press Print, send "+
|
"the test pass. If there is a printer, press Print, send "+
|
||||||
"the output to the printer, and examine it. It should have "+
|
"the output to the printer, and examine it. It should have "+
|
||||||
|
144
jdk/test/java/awt/print/PrinterJob/PrintToDir.java
Normal file
144
jdk/test/java/awt/print/PrinterJob/PrintToDir.java
Normal file
@ -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");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -30,7 +30,7 @@
|
|||||||
* @author Mandy Chung
|
* @author Mandy Chung
|
||||||
*
|
*
|
||||||
* @build ThreadStateTest
|
* @build ThreadStateTest
|
||||||
* @run main ThreadStateTest
|
* @run main/othervm -Xmixed ThreadStateTest
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import java.util.concurrent.locks.LockSupport;
|
import java.util.concurrent.locks.LockSupport;
|
||||||
|
61
jdk/test/javax/print/TextFlavorTest.java
Normal file
61
jdk/test/javax/print/TextFlavorTest.java
Normal file
@ -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.");
|
||||||
|
}
|
||||||
|
}
|
@ -23,7 +23,7 @@
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* @test
|
* @test
|
||||||
* @bug 6689025
|
* @bug 6689025 8023483
|
||||||
* @summary Tests that transformed Paints are rendered correctly
|
* @summary Tests that transformed Paints are rendered correctly
|
||||||
* @author Dmitri.Trembovetski@sun.com: area=Graphics
|
* @author Dmitri.Trembovetski@sun.com: area=Graphics
|
||||||
* @run main/othervm TransformedPaintTest
|
* @run main/othervm TransformedPaintTest
|
||||||
|
Loading…
Reference in New Issue
Block a user