--- a/jdk/src/share/classes/java/awt/Shape.java Mon Apr 04 23:01:24 2011 +0400
+++ b/jdk/src/share/classes/java/awt/Shape.java Mon Apr 04 17:18:35 2011 -0700
@@ -43,7 +43,7 @@
* object that describes the trajectory path of the <code>Shape</code>
* outline.
* <p>
- * <b>Definition of insideness:</b>
+ * <a name="def_insideness"><b>Definition of insideness:</b></a>
* A point is considered to lie inside a
* <code>Shape</code> if and only if:
* <ul>
@@ -88,6 +88,32 @@
* <code>getBounds2D</code> method generally returns a
* tighter bounding box due to its greater flexibility in
* representation.
+ *
+ * <p>
+ * Note that the <a href="{@docRoot}/java/awt/Shape.html#def_insideness">
+ * definition of insideness</a> can lead to situations where points
+ * on the defining outline of the {@code shape} may not be considered
+ * contained in the returned {@code bounds} object, but only in cases
+ * where those points are also not considered contained in the original
+ * {@code shape}.
+ * </p>
+ * <p>
+ * If a {@code point} is inside the {@code shape} according to the
+ * {@link #contains(double x, double y) contains(point)} method, then
+ * it must be inside the returned {@code Rectangle} bounds object
+ * according to the {@link #contains(double x, double y) contains(point)}
+ * method of the {@code bounds}. Specifically:
+ * </p>
+ * <p>
+ * {@code shape.contains(x,y)} requires {@code bounds.contains(x,y)}
+ * </p>
+ * <p>
+ * If a {@code point} is not inside the {@code shape}, then it might
+ * still be contained in the {@code bounds} object:
+ * </p>
+ * <p>
+ * {@code bounds.contains(x,y)} does not imply {@code shape.contains(x,y)}
+ * </p>
* @return an integer <code>Rectangle</code> that completely encloses
* the <code>Shape</code>.
* @see #getBounds2D
@@ -107,6 +133,32 @@
* to overflow problems since the return value can be an instance of
* the <code>Rectangle2D</code> that uses double precision values to
* store the dimensions.
+ *
+ * <p>
+ * Note that the <a href="{@docRoot}/java/awt/Shape.html#def_insideness">
+ * definition of insideness</a> can lead to situations where points
+ * on the defining outline of the {@code shape} may not be considered
+ * contained in the returned {@code bounds} object, but only in cases
+ * where those points are also not considered contained in the original
+ * {@code shape}.
+ * </p>
+ * <p>
+ * If a {@code point} is inside the {@code shape} according to the
+ * {@link #contains(Point2D p) contains(point)} method, then it must
+ * be inside the returned {@code Rectangle2D} bounds object according
+ * to the {@link #contains(Point2D p) contains(point)} method of the
+ * {@code bounds}. Specifically:
+ * </p>
+ * <p>
+ * {@code shape.contains(p)} requires {@code bounds.contains(p)}
+ * </p>
+ * <p>
+ * If a {@code point} is not inside the {@code shape}, then it might
+ * still be contained in the {@code bounds} object:
+ * </p>
+ * <p>
+ * {@code bounds.contains(p)} does not imply {@code shape.contains(p)}
+ * </p>
* @return an instance of <code>Rectangle2D</code> that is a
* high-precision bounding box of the <code>Shape</code>.
* @see #getBounds
@@ -116,7 +168,9 @@
/**
* Tests if the specified coordinates are inside the boundary of the
- * <code>Shape</code>.
+ * <code>Shape</code>, as described by the
+ * <a href="{@docRoot}/java/awt/Shape.html#def_insideness">
+ * definition of insideness</a>.
* @param x the specified X coordinate to be tested
* @param y the specified Y coordinate to be tested
* @return <code>true</code> if the specified coordinates are inside
@@ -128,7 +182,9 @@
/**
* Tests if a specified {@link Point2D} is inside the boundary
- * of the <code>Shape</code>.
+ * of the <code>Shape</code>, as described by the
+ * <a href="{@docRoot}/java/awt/Shape.html#def_insideness">
+ * definition of insideness</a>.
* @param p the specified <code>Point2D</code> to be tested
* @return <code>true</code> if the specified <code>Point2D</code> is
* inside the boundary of the <code>Shape</code>;
--- a/jdk/src/share/classes/java/awt/image/BandedSampleModel.java Mon Apr 04 23:01:24 2011 +0400
+++ b/jdk/src/share/classes/java/awt/image/BandedSampleModel.java Mon Apr 04 17:18:35 2011 -0700
@@ -408,7 +408,12 @@
*/
public int[] getPixels(int x, int y, int w, int h,
int iArray[], DataBuffer data) {
- if ((x < 0) || (y < 0) || (x + w > width) || (y + h > height)) {
+ int x1 = x + w;
+ int y1 = y + h;
+
+ if (x < 0 || x >= width || w > width || x1 < 0 || x1 > width ||
+ y < 0 || y >= height || h > height || y1 < 0 || y1 > height)
+ {
throw new ArrayIndexOutOfBoundsException
("Coordinate out of bounds!");
}
@@ -690,7 +695,12 @@
*/
public void setPixels(int x, int y, int w, int h,
int iArray[], DataBuffer data) {
- if ((x < 0) || (y < 0) || (x + w > width) || (y + h > height)) {
+ int x1 = x + w;
+ int y1 = y + h;
+
+ if (x < 0 || x >= width || w > width || x1 < 0 || x1 > width ||
+ y < 0 || y >= height || h > height || y1 < 0 || y1 > height)
+ {
throw new ArrayIndexOutOfBoundsException
("Coordinate out of bounds!");
}
--- a/jdk/src/share/classes/java/awt/image/ComponentSampleModel.java Mon Apr 04 23:01:24 2011 +0400
+++ b/jdk/src/share/classes/java/awt/image/ComponentSampleModel.java Mon Apr 04 17:18:35 2011 -0700
@@ -739,7 +739,12 @@
*/
public int[] getPixels(int x, int y, int w, int h,
int iArray[], DataBuffer data) {
- if ((x < 0) || (y < 0) || (x + w > width) || (y + h > height)) {
+ int x1 = x + w;
+ int y1 = y + h;
+
+ if (x < 0 || x >= width || w > width || x1 < 0 || x1 > width ||
+ y < 0 || y >= height || y > height || y1 < 0 || y1 > height)
+ {
throw new ArrayIndexOutOfBoundsException
("Coordinate out of bounds!");
}
@@ -1025,7 +1030,12 @@
*/
public void setPixels(int x, int y, int w, int h,
int iArray[], DataBuffer data) {
- if ((x < 0) || (y < 0) || (x + w > width) || (y + h > height)) {
+ int x1 = x + w;
+ int y1 = y + h;
+
+ if (x < 0 || x >= width || w > width || x1 < 0 || x1 > width ||
+ y < 0 || y >= height || h > height || y1 < 0 || y1 > height)
+ {
throw new ArrayIndexOutOfBoundsException
("Coordinate out of bounds!");
}
--- a/jdk/src/share/classes/java/awt/image/SampleModel.java Mon Apr 04 23:01:24 2011 +0400
+++ b/jdk/src/share/classes/java/awt/image/SampleModel.java Mon Apr 04 17:18:35 2011 -0700
@@ -361,8 +361,8 @@
int x1 = x + w;
int y1 = y + h;
- if (x < 0 || x1 < x || x1 > width ||
- y < 0 || y1 < y || y1 > height)
+ if (x < 0 || x >= width || w > width || x1 < 0 || x1 > width ||
+ y < 0 || y >= height || h > height || y1 < 0 || y1 > height)
{
throw new ArrayIndexOutOfBoundsException("Invalid coordinates.");
}
@@ -588,6 +588,15 @@
int type = getTransferType();
int numDataElems = getNumDataElements();
+ int x1 = x + w;
+ int y1 = y + h;
+
+ if (x < 0 || x >= width || w > width || x1 < 0 || x1 > width ||
+ y < 0 || y >= height || h > height || y1 < 0 || y1 > height)
+ {
+ throw new ArrayIndexOutOfBoundsException("Invalid coordinates.");
+ }
+
switch(type) {
case DataBuffer.TYPE_BYTE:
@@ -595,8 +604,8 @@
byte[] barray = (byte[])obj;
byte[] btemp = new byte[numDataElems];
- for (int i=y; i<y+h; i++) {
- for (int j=x; j<x+w; j++) {
+ for (int i=y; i<y1; i++) {
+ for (int j=x; j<x1; j++) {
for (int k=0; k<numDataElems; k++) {
btemp[k] = barray[cnt++];
}
@@ -612,8 +621,8 @@
short[] sarray = (short[])obj;
short[] stemp = new short[numDataElems];
- for (int i=y; i<y+h; i++) {
- for (int j=x; j<x+w; j++) {
+ for (int i=y; i<y1; i++) {
+ for (int j=x; j<x1; j++) {
for (int k=0; k<numDataElems; k++) {
stemp[k] = sarray[cnt++];
}
@@ -628,8 +637,8 @@
int[] iArray = (int[])obj;
int[] itemp = new int[numDataElems];
- for (int i=y; i<y+h; i++) {
- for (int j=x; j<x+w; j++) {
+ for (int i=y; i<y1; i++) {
+ for (int j=x; j<x1; j++) {
for (int k=0; k<numDataElems; k++) {
itemp[k] = iArray[cnt++];
}
@@ -644,8 +653,8 @@
float[] fArray = (float[])obj;
float[] ftemp = new float[numDataElems];
- for (int i=y; i<y+h; i++) {
- for (int j=x; j<x+w; j++) {
+ for (int i=y; i<y1; i++) {
+ for (int j=x; j<x1; j++) {
for (int k=0; k<numDataElems; k++) {
ftemp[k] = fArray[cnt++];
}
@@ -660,8 +669,8 @@
double[] dArray = (double[])obj;
double[] dtemp = new double[numDataElems];
- for (int i=y; i<y+h; i++) {
- for (int j=x; j<x+w; j++) {
+ for (int i=y; i<y1; i++) {
+ for (int j=x; j<x1; j++) {
for (int k=0; k<numDataElems; k++) {
dtemp[k] = dArray[cnt++];
}
@@ -759,14 +768,22 @@
int pixels[];
int Offset=0;
+ int x1 = x + w;
+ int y1 = y + h;
+
+ if (x < 0 || x >= width || w > width || x1 < 0 || x1 > width ||
+ y < 0 || y >= height || h > height || y1 < 0 || y1 > height)
+ {
+ throw new ArrayIndexOutOfBoundsException("Invalid coordinates.");
+ }
if (iArray != null)
pixels = iArray;
else
pixels = new int[numBands * w * h];
- for (int i=y; i<(h+y); i++) {
- for (int j=x; j<(w+x); j++) {
+ for (int i=y; i<y1; i++) {
+ for (int j=x; j<x1; j++) {
for(int k=0; k<numBands; k++) {
pixels[Offset++] = getSample(j, i, k, data);
}
@@ -799,14 +816,22 @@
float pixels[];
int Offset = 0;
+ int x1 = x + w;
+ int y1 = y + h;
+
+ if (x < 0 || x >= width || w > width || x1 < 0 || x1 > width ||
+ y < 0 || y >= height || h > height || y1 < 0 || y1 > height)
+ {
+ throw new ArrayIndexOutOfBoundsException("Invalid coordinates.");
+ }
if (fArray != null)
pixels = fArray;
else
pixels = new float[numBands * w * h];
- for (int i=y; i<(h+y); i++) {
- for(int j=x; j<(w+x); j++) {
+ for (int i=y; i<y1; i++) {
+ for(int j=x; j<x1; j++) {
for(int k=0; k<numBands; k++) {
pixels[Offset++] = getSampleFloat(j, i, k, data);
}
@@ -838,6 +863,14 @@
double dArray[], DataBuffer data) {
double pixels[];
int Offset = 0;
+ int x1 = x + w;
+ int y1 = y + h;
+
+ if (x < 0 || x >= width || w > width || x1 < 0 || x1 > width ||
+ y < 0 || y >= height || h > height || y1 < 0 || y1 > height)
+ {
+ throw new ArrayIndexOutOfBoundsException("Invalid coordinates.");
+ }
if (dArray != null)
pixels = dArray;
@@ -845,8 +878,8 @@
pixels = new double[numBands * w * h];
// Fix 4217412
- for (int i=y; i<(h+y); i++) {
- for (int j=x; j<(w+x); j++) {
+ for (int i=y; i<y1; i++) {
+ for (int j=x; j<x1; j++) {
for (int k=0; k<numBands; k++) {
pixels[Offset++] = getSampleDouble(j, i, k, data);
}
@@ -1146,9 +1179,17 @@
public void setPixels(int x, int y, int w, int h,
int iArray[], DataBuffer data) {
int Offset=0;
+ int x1 = x + w;
+ int y1 = y + h;
- for (int i=y; i<(y+h); i++) {
- for (int j=x; j<(x+w); j++) {
+ if (x < 0 || x >= width || w > width || x1 < 0 || x1 > width ||
+ y < 0 || y >= height || h > height || y1 < 0 || y1 > height)
+ {
+ throw new ArrayIndexOutOfBoundsException("Invalid coordinates.");
+ }
+
+ for (int i=y; i<y1; i++) {
+ for (int j=x; j<x1; j++) {
for (int k=0; k<numBands; k++) {
setSample(j, i, k, iArray[Offset++], data);
}
@@ -1176,9 +1217,17 @@
public void setPixels(int x, int y, int w, int h,
float fArray[], DataBuffer data) {
int Offset=0;
+ int x1 = x + w;
+ int y1 = y + h;
- for (int i=y; i<(y+h); i++) {
- for (int j=x; j<(x+w); j++) {
+ if (x < 0 || x >= width || w > width || x1 < 0 || x1 > width||
+ y < 0 || y >= height || h > height || y1 < 0 || y1 > height)
+ {
+ throw new ArrayIndexOutOfBoundsException("Invalid coordinates.");
+ }
+
+ for (int i=y; i<y1; i++) {
+ for (int j=x; j<x1; j++) {
for(int k=0; k<numBands; k++) {
setSample(j, i, k, fArray[Offset++], data);
}
@@ -1206,9 +1255,17 @@
public void setPixels(int x, int y, int w, int h,
double dArray[], DataBuffer data) {
int Offset=0;
+ int x1 = x + w;
+ int y1 = y + h;
- for (int i=y; i<(y+h); i++) {
- for (int j=x; j<(x+w); j++) {
+ if (x < 0 || x >= width || w > width || x1 < 0 || x1 > width ||
+ y < 0 || y >= height || h > height || y1 < 0 || y1 > height)
+ {
+ throw new ArrayIndexOutOfBoundsException("Invalid coordinates.");
+ }
+
+ for (int i=y; i<y1; i++) {
+ for (int j=x; j<x1; j++) {
for (int k=0; k<numBands; k++) {
setSample(j, i, k, dArray[Offset++], data);
}
@@ -1315,9 +1372,16 @@
int iArray[], DataBuffer data) {
int Offset=0;
+ int x1 = x + w;
+ int y1 = y + h;
+ if (x < 0 || x >= width || w > width || x1 < 0 || x1 > width ||
+ y < 0 || y >= height || h > height || y1 < 0 || y1 > height)
+ {
+ throw new ArrayIndexOutOfBoundsException("Invalid coordinates.");
+ }
- for (int i=y; i<(y+h); i++) {
- for (int j=x; j<(x+w); j++) {
+ for (int i=y; i<y1; i++) {
+ for (int j=x; j<x1; j++) {
setSample(j, i, b, iArray[Offset++], data);
}
}
@@ -1345,9 +1409,17 @@
public void setSamples(int x, int y, int w, int h, int b,
float fArray[], DataBuffer data) {
int Offset=0;
+ int x1 = x + w;
+ int y1 = y + h;
- for (int i=y; i<(y+h); i++) {
- for (int j=x; j<(x+w); j++) {
+ if (x < 0 || x >= width || w > width || x1 < 0 || x1 > width ||
+ y < 0 || y >= height || h > height || y1 < 0 || y1 > height)
+ {
+ throw new ArrayIndexOutOfBoundsException("Invalid coordinates.");
+ }
+
+ for (int i=y; i<y1; i++) {
+ for (int j=x; j<x1; j++) {
setSample(j, i, b, fArray[Offset++], data);
}
}
@@ -1375,9 +1447,18 @@
public void setSamples(int x, int y, int w, int h, int b,
double dArray[], DataBuffer data) {
int Offset=0;
+ int x1 = x + w;
+ int y1 = y + h;
- for (int i=y; i<(y+h); i++) {
- for (int j=x; j<(x+w); j++) {
+
+ if (x < 0 || x >= width || w > width || x1 < 0 || x1 > width ||
+ y < 0 || y >= height || h > height || y1 < 0 || y1 > height)
+ {
+ throw new ArrayIndexOutOfBoundsException("Invalid coordinates.");
+ }
+
+ for (int i=y; i<y1; i++) {
+ for (int j=x; j<x1; j++) {
setSample(j, i, b, dArray[Offset++], data);
}
}
--- a/jdk/src/share/classes/java/awt/image/SinglePixelPackedSampleModel.java Mon Apr 04 23:01:24 2011 +0400
+++ b/jdk/src/share/classes/java/awt/image/SinglePixelPackedSampleModel.java Mon Apr 04 17:18:35 2011 -0700
@@ -461,7 +461,12 @@
*/
public int[] getPixels(int x, int y, int w, int h,
int iArray[], DataBuffer data) {
- if ((x < 0) || (y < 0) || (x + w > width) || (y + h > height)) {
+ int x1 = x + w;
+ int y1 = y + h;
+
+ if (x < 0 || x >= width || w > width || x1 < 0 || x1 > width ||
+ y < 0 || y >= height || h > height || y1 < 0 || y1 > height)
+ {
throw new ArrayIndexOutOfBoundsException
("Coordinate out of bounds!");
}
@@ -659,7 +664,12 @@
*/
public void setPixels(int x, int y, int w, int h,
int iArray[], DataBuffer data) {
- if ((x < 0) || (y < 0) || (x + w > width) || (y + h > height)) {
+ int x1 = x + w;
+ int y1 = y + h;
+
+ if (x < 0 || x >= width || w > width || x1 < 0 || x1 > width ||
+ y < 0 || y >= height || h > height || y1 < 0 || y1 > height)
+ {
throw new ArrayIndexOutOfBoundsException
("Coordinate out of bounds!");
}
--- a/jdk/src/share/classes/javax/imageio/metadata/IIOMetadataNode.java Mon Apr 04 23:01:24 2011 +0400
+++ b/jdk/src/share/classes/javax/imageio/metadata/IIOMetadataNode.java Mon Apr 04 17:18:35 2011 -0700
@@ -724,7 +724,7 @@
/**
* Equivalent to <code>getNodeName</code>.
*
- * @return the node name, as a <code>String</code
+ * @return the node name, as a <code>String</code>
*/
public String getTagName() {
return nodeName;
--- a/jdk/src/share/classes/sun/awt/FontConfiguration.java Mon Apr 04 23:01:24 2011 +0400
+++ b/jdk/src/share/classes/sun/awt/FontConfiguration.java Mon Apr 04 17:18:35 2011 -0700
@@ -82,6 +82,10 @@
* one to ensure proper static initialisation takes place.
*/
public FontConfiguration(SunFontManager fm) {
+ if (FontUtilities.debugFonts()) {
+ FontUtilities.getLogger()
+ .info("Creating standard Font Configuration");
+ }
if (FontUtilities.debugFonts() && logger == null) {
logger = PlatformLogger.getLogger("sun.awt.FontConfiguration");
}
@@ -111,6 +115,10 @@
boolean preferLocaleFonts,
boolean preferPropFonts) {
fontManager = fm;
+ if (FontUtilities.debugFonts()) {
+ FontUtilities.getLogger()
+ .info("Creating alternate Font Configuration");
+ }
this.preferLocaleFonts = preferLocaleFonts;
this.preferPropFonts = preferPropFonts;
/* fontConfig should be initialised by default constructor, and
--- a/jdk/src/share/classes/sun/font/FontManagerForSGE.java Mon Apr 04 23:01:24 2011 +0400
+++ b/jdk/src/share/classes/sun/font/FontManagerForSGE.java Mon Apr 04 17:18:35 2011 -0700
@@ -54,4 +54,11 @@
public Font[] getAllInstalledFonts();
public String[] getInstalledFontFamilyNames(Locale requestedLocale);
+
+ /* Modifies the behaviour of a subsequent call to preferLocaleFonts()
+ * to use Mincho instead of Gothic for dialoginput in JA locales
+ * on windows. Not needed on other platforms.
+ */
+ public void useAlternateFontforJALocales();
+
}
--- a/jdk/src/share/classes/sun/font/SunFontManager.java Mon Apr 04 23:01:24 2011 +0400
+++ b/jdk/src/share/classes/sun/font/SunFontManager.java Mon Apr 04 17:18:35 2011 -0700
@@ -2874,7 +2874,10 @@
* on windows. Not needed on other platforms.
*/
public synchronized void useAlternateFontforJALocales() {
-
+ if (FontUtilities.isLogging()) {
+ FontUtilities.getLogger()
+ .info("Entered useAlternateFontforJALocales().");
+ }
if (!FontUtilities.isWindows) {
return;
}
@@ -2897,7 +2900,9 @@
}
public synchronized void preferLocaleFonts() {
-
+ if (FontUtilities.isLogging()) {
+ FontUtilities.getLogger().info("Entered preferLocaleFonts().");
+ }
/* Test if re-ordering will have any effect */
if (!FontConfiguration.willReorderForStartupLocale()) {
return;
@@ -2928,7 +2933,10 @@
}
public synchronized void preferProportionalFonts() {
-
+ if (FontUtilities.isLogging()) {
+ FontUtilities.getLogger()
+ .info("Entered preferProportionalFonts().");
+ }
/* If no proportional fonts are configured, there's no need
* to take any action.
*/
@@ -3456,6 +3464,11 @@
initCompositeFonts(FontConfiguration fontConfig,
ConcurrentHashMap<String, Font2D> altNameCache) {
+ if (FontUtilities.isLogging()) {
+ FontUtilities.getLogger()
+ .info("Initialising composite fonts");
+ }
+
int numCoreFonts = fontConfig.getNumberCoreFonts();
String[] fcFonts = fontConfig.getPlatformFontNames();
for (int f=0; f<fcFonts.length; f++) {
--- a/jdk/src/share/classes/sun/java2d/SunGraphicsEnvironment.java Mon Apr 04 23:01:24 2011 +0400
+++ b/jdk/src/share/classes/sun/java2d/SunGraphicsEnvironment.java Mon Apr 04 17:18:35 2011 -0700
@@ -185,6 +185,18 @@
FontManager fm = FontManagerFactory.getInstance();
return (FontManagerForSGE) fm;
}
+
+ /* Modifies the behaviour of a subsequent call to preferLocaleFonts()
+ * to use Mincho instead of Gothic for dialoginput in JA locales
+ * on windows. Not needed on other platforms.
+ *
+ * DO NOT MOVE OR RENAME OR OTHERWISE ALTER THIS METHOD.
+ * ITS USED BY SOME NON-JRE INTERNAL CODE.
+ */
+ public static void useAlternateFontforJALocales() {
+ getFontManagerForSGE().useAlternateFontforJALocales();
+ }
+
/**
* Returns all fonts available in this environment.
*/
--- a/jdk/src/share/native/sun/awt/medialib/mlib_ImageAffine.c Mon Apr 04 23:01:24 2011 +0400
+++ b/jdk/src/share/native/sun/awt/medialib/mlib_ImageAffine.c Mon Apr 04 17:18:35 2011 -0700
@@ -210,6 +210,8 @@
t_ind = 4;
else if (type == MLIB_DOUBLE)
t_ind = 5;
+ else
+ return MLIB_FAILURE; /* unknown image type */
if (colormap != NULL && filter != MLIB_NEAREST) {
if (t_ind != 0 && t_ind != 1)
@@ -318,6 +320,10 @@
}
break;
+
+ default:
+ /* nothing to do for other edge types. */
+ break;
}
if (param_e->buff_malloc != NULL)
--- a/jdk/src/share/native/sun/awt/medialib/mlib_ImageAffineEdge.c Mon Apr 04 23:01:24 2011 +0400
+++ b/jdk/src/share/native/sun/awt/medialib/mlib_ImageAffineEdge.c Mon Apr 04 17:18:35 2011 -0700
@@ -616,6 +616,9 @@
MLIB_PROCESS_EDGES_ZERO(mlib_d64);
break;
}
+ default:
+ /* Image type MLIB_BIT is not used in java, so we can ignore it. */
+ break;
}
}
@@ -643,6 +646,9 @@
case MLIB_DOUBLE:
MLIB_PROCESS_EDGES(MLIB_EDGE_NEAREST_LINE, mlib_d64);
break;
+ default:
+ /* Image type MLIB_BIT is not used in java, so we can ignore it. */
+ break;
}
}
@@ -673,8 +679,11 @@
if (ltype == MLIB_BYTE) {
buff = mlib_malloc(channels * max_xsize);
}
- else {
+ else if (ltype == MLIB_SHORT) {
buff = mlib_malloc(channels * max_xsize * sizeof(mlib_s16));
+ } else {
+ /* Unsupported type of lookup table. Report a failure */
+ return MLIB_FAILURE;
}
if (buff == NULL)
@@ -691,6 +700,9 @@
srcStride >>= 1;
MLIB_PROCESS_EDGES(MLIB_EDGE_INDEX_u8i, mlib_s16);
break;
+ default:
+ /* Incompatible image type. Ignore it for now. */
+ break;
}
break;
@@ -705,9 +717,18 @@
srcStride >>= 1;
MLIB_PROCESS_EDGES(MLIB_EDGE_INDEX_s16i, mlib_s16);
break;
+ default:
+ /* Incompatible image type. Ignore it for now. */
+ break;
}
break;
+ default:
+ /* Unsupported type of lookup table.
+ * Can not be here due to check on line 685,
+ * so just ignore it.
+ */
+ break;
}
mlib_free(buff);
@@ -744,6 +765,10 @@
srcStride >>= 3;
MLIB_PROCESS_EDGES(MLIB_EDGE_BL, mlib_d64);
break;
+
+ default:
+ /* Image type MLIB_BIT is not supported, ignore it. */
+ break;
}
return MLIB_SUCCESS;
@@ -803,8 +828,11 @@
if (ltype == MLIB_BYTE) {
buff = mlib_malloc(channels * max_xsize);
}
- else {
+ else if (ltype == MLIB_SHORT) {
buff = mlib_malloc(channels * max_xsize * sizeof(mlib_s16));
+ } else {
+ /* Unsupported type of lookup table. */
+ return MLIB_FAILURE;
}
if (buff == NULL)
@@ -821,6 +849,9 @@
srcStride >>= 1;
MLIB_PROCESS_EDGES(MLIB_EDGE_INDEX_u8i, mlib_s16);
break;
+ default:
+ /* Ignore incomatible image type. */
+ break;
}
break;
@@ -835,9 +866,19 @@
srcStride >>= 1;
MLIB_PROCESS_EDGES(MLIB_EDGE_INDEX_s16i, mlib_s16);
break;
+ default:
+ /* Ignore incomatible image type. */
+ break;
}
break;
+
+ default:
+ /* Unsupported type of lookup table.
+ * Can not be here due to check on line 836,
+ * so just ignore it.
+ */
+ break;
}
mlib_free(buff);
@@ -895,6 +936,10 @@
}
break;
+
+ default:
+ /* Ignore unsupported image type MLIB_BIT */
+ break;
}
return MLIB_SUCCESS;
--- a/jdk/src/share/native/sun/awt/medialib/mlib_ImageColorTrue2Index.c Mon Apr 04 23:01:24 2011 +0400
+++ b/jdk/src/share/native/sun/awt/medialib/mlib_ImageColorTrue2Index.c Mon Apr 04 17:18:35 2011 -0700
@@ -2623,9 +2623,10 @@
return MLIB_FAILURE;
}
}
+ default:
+ /* Unsupported type of destination image */
+ return MLIB_FAILURE;
}
-
- break;
}
case MLIB_SHORT:
@@ -2678,18 +2679,15 @@
return MLIB_FAILURE;
}
}
+ default:
+ /* Unsupported type of destination image */
+ return MLIB_FAILURE;
}
-
- break;
}
default:
return MLIB_FAILURE;
}
-
- /* we need to return something to make Microsoft VC happy.
- Return FAILURE because on success we likely to return earlier. */
- return MLIB_FAILURE;
}
/***************************************************************/
--- a/jdk/src/share/native/sun/awt/medialib/mlib_ImageConvMxN.c Mon Apr 04 23:01:24 2011 +0400
+++ b/jdk/src/share/native/sun/awt/medialib/mlib_ImageConvMxN.c Mon Apr 04 17:18:35 2011 -0700
@@ -211,6 +211,13 @@
case MLIB_DOUBLE:
ret = mlib_convMxNnw_d64(dst_i, src_i, kernel, m, n, dm, dn, cmask);
break;
+
+ default:
+ /* For some reasons, there is no convolution routine for type MLIB_BIT.
+ * For now, we silently ignore it (because this image type is not used by java),
+ * but probably we have to report an error.
+ */
+ break;
}
}
@@ -221,6 +228,11 @@
case MLIB_EDGE_DST_COPY_SRC:
mlib_ImageConvCopyEdge(dst_e, src_e, dx_l, dx_r, dy_t, dy_b, cmask);
break;
+ default:
+ /* Other edge conditions do not need additional handling.
+ * Note also that they are not exposed in public Java API
+ */
+ break;
}
}
else { /* MLIB_EDGE_SRC_EXTEND */
@@ -279,6 +291,12 @@
case MLIB_DOUBLE:
mlib_convMxNext_d64(dst_e, src_e, kernel, m, n, dx_l, dx_r, dy_t, dy_b, cmask);
break;
+ default:
+ /* For some reasons, there is no convolution routine for type MLIB_BIT.
+ * For now, we silently ignore it (because this image type is not used by java),
+ * but probably we have to report an error.
+ */
+ break;
}
}
--- a/jdk/src/share/native/sun/awt/medialib/mlib_ImageConv_16ext.c Mon Apr 04 23:01:24 2011 +0400
+++ b/jdk/src/share/native/sun/awt/medialib/mlib_ImageConv_16ext.c Mon Apr 04 17:18:35 2011 -0700
@@ -1869,8 +1869,8 @@
/***************************************************************/
mlib_status CONV_FUNC_MxN
{
- DTYPE *adr_src, *sl, *sp;
- DTYPE *adr_dst, *dl, *dp;
+ DTYPE *adr_src, *sl, *sp = NULL;
+ DTYPE *adr_dst, *dl, *dp = NULL;
FTYPE buff[BUFF_SIZE], *buffs_arr[2*(MAX_N + 1)];
FTYPE **buffs = buffs_arr, *buffd;
FTYPE akernel[256], *k = akernel, fscale = DSCALE;
@@ -2332,8 +2332,8 @@
mlib_status CONV_FUNC_MxN_I
{
- DTYPE *adr_src, *sl, *sp;
- DTYPE *adr_dst, *dl, *dp;
+ DTYPE *adr_src, *sl, *sp = NULL;
+ DTYPE *adr_dst, *dl, *dp = NULL;
mlib_s32 buff[BUFF_SIZE], *buffs_arr[2*(MAX_N + 1)];
mlib_s32 *pbuff = buff;
mlib_s32 **buffs = buffs_arr, *buffd;
--- a/jdk/src/share/native/sun/awt/medialib/mlib_ImageConv_16nw.c Mon Apr 04 23:01:24 2011 +0400
+++ b/jdk/src/share/native/sun/awt/medialib/mlib_ImageConv_16nw.c Mon Apr 04 17:18:35 2011 -0700
@@ -148,8 +148,8 @@
/***************************************************************/
#define DEF_VARS(type) \
- type *adr_src, *sl, *sp; \
- type *adr_dst, *dl, *dp; \
+ type *adr_src, *sl, *sp = NULL; \
+ type *adr_dst, *dl, *dp = NULL; \
FTYPE *pbuff = buff; \
mlib_s32 wid, hgt, sll, dll; \
mlib_s32 nchannel, chan1; \
@@ -2060,8 +2060,8 @@
mlib_s32 d0, d1, shift1, shift2;
mlib_s32 k0, k1, k2, k3, k4, k5, k6;
mlib_s32 p0, p1, p2, p3, p4, p5, p6, p7;
- DTYPE *adr_src, *sl, *sp;
- DTYPE *adr_dst, *dl, *dp;
+ DTYPE *adr_src, *sl, *sp = NULL;
+ DTYPE *adr_dst, *dl, *dp = NULL;
mlib_s32 wid, hgt, sll, dll;
mlib_s32 nchannel, chan1;
mlib_s32 i, j, c;
--- a/jdk/src/share/native/sun/awt/medialib/mlib_ImageConv_32nw.c Mon Apr 04 23:01:24 2011 +0400
+++ b/jdk/src/share/native/sun/awt/medialib/mlib_ImageConv_32nw.c Mon Apr 04 17:18:35 2011 -0700
@@ -78,7 +78,7 @@
/***************************************************************/
#define DEF_VARS_MxN(type) \
GET_SRC_DST_PARAMETERS(type); \
- type *sl, *sp, *dl, *dp; \
+ type *sl, *sp = NULL, *dl, *dp = NULL; \
mlib_d64 *pbuff = buff; \
mlib_s32 i, j, c
--- a/jdk/src/share/native/sun/awt/medialib/mlib_ImageConv_8ext.c Mon Apr 04 23:01:24 2011 +0400
+++ b/jdk/src/share/native/sun/awt/medialib/mlib_ImageConv_8ext.c Mon Apr 04 17:18:35 2011 -0700
@@ -1869,8 +1869,8 @@
/***************************************************************/
mlib_status CONV_FUNC_MxN
{
- DTYPE *adr_src, *sl, *sp;
- DTYPE *adr_dst, *dl, *dp;
+ DTYPE *adr_src, *sl, *sp = NULL;
+ DTYPE *adr_dst, *dl, *dp = NULL;
FTYPE buff[BUFF_SIZE], *buffs_arr[2*(MAX_N + 1)];
FTYPE **buffs = buffs_arr, *buffd;
FTYPE akernel[256], *k = akernel, fscale = DSCALE;
@@ -2332,8 +2332,8 @@
mlib_status CONV_FUNC_MxN_I
{
- DTYPE *adr_src, *sl, *sp;
- DTYPE *adr_dst, *dl, *dp;
+ DTYPE *adr_src, *sl, *sp = NULL;
+ DTYPE *adr_dst, *dl, *dp = NULL;
mlib_s32 buff[BUFF_SIZE], *buffs_arr[2*(MAX_N + 1)];
mlib_s32 *pbuff = buff;
mlib_s32 **buffs = buffs_arr, *buffd;
--- a/jdk/src/share/native/sun/awt/medialib/mlib_ImageConv_8nw.c Mon Apr 04 23:01:24 2011 +0400
+++ b/jdk/src/share/native/sun/awt/medialib/mlib_ImageConv_8nw.c Mon Apr 04 17:18:35 2011 -0700
@@ -149,8 +149,8 @@
/***************************************************************/
#define DEF_VARS(type) \
- type *adr_src, *sl, *sp; \
- type *adr_dst, *dl, *dp; \
+ type *adr_src, *sl, *sp = NULL; \
+ type *adr_dst, *dl, *dp = NULL; \
FTYPE *pbuff = buff; \
mlib_s32 wid, hgt, sll, dll; \
mlib_s32 nchannel, chan1; \
@@ -2061,8 +2061,8 @@
mlib_s32 d0, d1, shift1, shift2;
mlib_s32 k0, k1, k2, k3, k4, k5, k6;
mlib_s32 p0, p1, p2, p3, p4, p5, p6, p7;
- DTYPE *adr_src, *sl, *sp;
- DTYPE *adr_dst, *dl, *dp;
+ DTYPE *adr_src, *sl, *sp = NULL;
+ DTYPE *adr_dst, *dl, *dp = NULL;
mlib_s32 wid, hgt, sll, dll;
mlib_s32 nchannel, chan1;
mlib_s32 i, j, c;
--- a/jdk/src/share/native/sun/awt/medialib/mlib_ImageConv_D64nw.c Mon Apr 04 23:01:24 2011 +0400
+++ b/jdk/src/share/native/sun/awt/medialib/mlib_ImageConv_D64nw.c Mon Apr 04 17:18:35 2011 -0700
@@ -71,8 +71,8 @@
#define DEF_VARS(type) \
GET_SRC_DST_PARAMETERS(type); \
type *sl; \
- type *dl, *dp; \
- mlib_s32 i, j, c
+ type *dl, *dp = NULL; \
+ mlib_s32 i = 0, j, c
/***************************************************************/
#undef KSIZE
--- a/jdk/src/share/native/sun/awt/medialib/mlib_ImageConv_F32nw.c Mon Apr 04 23:01:24 2011 +0400
+++ b/jdk/src/share/native/sun/awt/medialib/mlib_ImageConv_F32nw.c Mon Apr 04 17:18:35 2011 -0700
@@ -71,7 +71,7 @@
#define DEF_VARS(type) \
GET_SRC_DST_PARAMETERS(type); \
type *sl; \
- type *dl, *dp; \
+ type *dl, *dp = NULL; \
mlib_s32 i, j, c
/***************************************************************/
--- a/jdk/src/share/native/sun/awt/medialib/mlib_ImageConv_u16ext.c Mon Apr 04 23:01:24 2011 +0400
+++ b/jdk/src/share/native/sun/awt/medialib/mlib_ImageConv_u16ext.c Mon Apr 04 17:18:35 2011 -0700
@@ -1869,8 +1869,8 @@
/***************************************************************/
mlib_status CONV_FUNC_MxN
{
- DTYPE *adr_src, *sl, *sp;
- DTYPE *adr_dst, *dl, *dp;
+ DTYPE *adr_src, *sl, *sp = NULL;
+ DTYPE *adr_dst, *dl, *dp = NULL;
FTYPE buff[BUFF_SIZE], *buffs_arr[2*(MAX_N + 1)];
FTYPE **buffs = buffs_arr, *buffd;
FTYPE akernel[256], *k = akernel, fscale = DSCALE;
@@ -2332,8 +2332,8 @@
mlib_status CONV_FUNC_MxN_I
{
- DTYPE *adr_src, *sl, *sp;
- DTYPE *adr_dst, *dl, *dp;
+ DTYPE *adr_src, *sl, *sp = NULL;
+ DTYPE *adr_dst, *dl, *dp = NULL;
mlib_s32 buff[BUFF_SIZE], *buffs_arr[2*(MAX_N + 1)];
mlib_s32 *pbuff = buff;
mlib_s32 **buffs = buffs_arr, *buffd;
--- a/jdk/src/share/native/sun/awt/medialib/mlib_ImageConv_u16nw.c Mon Apr 04 23:01:24 2011 +0400
+++ b/jdk/src/share/native/sun/awt/medialib/mlib_ImageConv_u16nw.c Mon Apr 04 17:18:35 2011 -0700
@@ -148,8 +148,8 @@
/***************************************************************/
#define DEF_VARS(type) \
- type *adr_src, *sl, *sp; \
- type *adr_dst, *dl, *dp; \
+ type *adr_src, *sl, *sp = NULL; \
+ type *adr_dst, *dl, *dp = NULL; \
FTYPE *pbuff = buff; \
mlib_s32 wid, hgt, sll, dll; \
mlib_s32 nchannel, chan1; \
@@ -2060,8 +2060,8 @@
mlib_s32 d0, d1, shift1, shift2;
mlib_s32 k0, k1, k2, k3, k4, k5, k6;
mlib_s32 p0, p1, p2, p3, p4, p5, p6, p7;
- DTYPE *adr_src, *sl, *sp;
- DTYPE *adr_dst, *dl, *dp;
+ DTYPE *adr_src, *sl, *sp = NULL;
+ DTYPE *adr_dst, *dl, *dp = NULL;
mlib_s32 wid, hgt, sll, dll;
mlib_s32 nchannel, chan1;
mlib_s32 i, j, c;
--- a/jdk/src/share/native/sun/awt/medialib/mlib_ImageCopy_Bit.c Mon Apr 04 23:01:24 2011 +0400
+++ b/jdk/src/share/native/sun/awt/medialib/mlib_ImageCopy_Bit.c Mon Apr 04 17:18:35 2011 -0700
@@ -204,9 +204,9 @@
mlib_u64 *dp; /* 8-byte aligned start points in dst */
mlib_u64 *sp; /* 8-byte aligned start point in src */
mlib_s32 j; /* offset of address in dst */
- mlib_u64 lmask0 = 0xFFFFFFFFFFFFFFFF;
+ mlib_u64 lmask0 = 0xFFFFFFFFFFFFFFFFULL;
mlib_u64 dmask;
- mlib_u64 lsrc, lsrc0, lsrc1, ldst;
+ mlib_u64 lsrc, lsrc0, lsrc1 = 0ULL, ldst;
mlib_s32 ls_offset, ld_offset, shift;
if (size <= 0) return;
@@ -427,9 +427,9 @@
mlib_u64 *dp; /* 8-byte aligned start points in dst */
mlib_u64 *sp; /* 8-byte aligned start point in src */
mlib_s32 j; /* offset of address in dst */
- mlib_u64 lmask0 = 0xFFFFFFFFFFFFFFFF;
+ mlib_u64 lmask0 = 0xFFFFFFFFFFFFFFFFULL;
mlib_u64 dmask;
- mlib_u64 lsrc, lsrc0, lsrc1, ldst;
+ mlib_u64 lsrc, lsrc0, lsrc1 = 0ULL, ldst;
mlib_s32 ls_offset, ld_offset, shift;
if (size <= 0) return;
--- a/jdk/src/share/native/sun/awt/medialib/mlib_ImageCreate.c Mon Apr 04 23:01:24 2011 +0400
+++ b/jdk/src/share/native/sun/awt/medialib/mlib_ImageCreate.c Mon Apr 04 17:18:35 2011 -0700
@@ -334,7 +334,7 @@
mlib_s32 width; /* for parent image */
mlib_s32 height; /* for parent image */
mlib_s32 stride;
- mlib_s32 bitoffset;
+ mlib_s32 bitoffset = 0;
void *data;
/* sanity check */
@@ -423,7 +423,7 @@
mlib_s32 channels = src -> channels;
mlib_s32 stride = src -> stride;
mlib_u8 *data = src -> data;
- mlib_s32 bitoffset;
+ mlib_s32 bitoffset = 0;
data += y * stride;
--- a/jdk/src/solaris/classes/sun/java2d/xr/XRPMBlitLoops.java Mon Apr 04 23:01:24 2011 +0400
+++ b/jdk/src/solaris/classes/sun/java2d/xr/XRPMBlitLoops.java Mon Apr 04 17:18:35 2011 -0700
@@ -143,7 +143,8 @@
Blit swToSurfaceBlit = Blit.getFromCache(src.getSurfaceType(), CompositeType.SrcNoEa, vImgSurfaceType);
XRSurfaceData vImgSurface = (XRSurfaceData) vImg.getDestSurface();
- swToSurfaceBlit.Blit(src, vImgSurface, null, null, sx, sy, 0, 0, w, h);
+ swToSurfaceBlit.Blit(src, vImgSurface, AlphaComposite.Src, null,
+ sx, sy, 0, 0, w, h);
return vImgSurface;
}
--- a/jdk/src/solaris/native/sun/java2d/x11/XRBackendNative.c Mon Apr 04 23:01:24 2011 +0400
+++ b/jdk/src/solaris/native/sun/java2d/x11/XRBackendNative.c Mon Apr 04 17:18:35 2011 -0700
@@ -644,7 +644,7 @@
for (i=0; i < glyphCnt; i++) {
GlyphInfo *jginfo = (GlyphInfo *) jlong_to_ptr(glyphInfoPtrs[i]);
- gid[i] = (Glyph) (0xffffffff & ((unsigned int) jginfo->cellInfo));
+ gid[i] = (Glyph) (0x0ffffffffL & ((unsigned long)(jginfo->cellInfo)));
xginfo[i].x = (-jginfo->topLeftX);
xginfo[i].y = (-jginfo->topLeftY);
xginfo[i].width = jginfo->width;
@@ -666,16 +666,56 @@
JNIEXPORT void JNICALL
Java_sun_java2d_xr_XRBackendNative_XRFreeGlyphsNative
(JNIEnv *env, jclass cls, jint glyphSet, jintArray gidArray, jint glyphCnt) {
- jint *gids;
- int i;
- if ((gids = (jint *) (*env)->GetPrimitiveArrayCritical(env, gidArray, NULL)) == NULL) {
+ /* The glyph ids are 32 bit but may be stored in a 64 bit long on
+ * a 64 bit architecture. So optimise the 32 bit case to avoid
+ * extra stack or heap allocations by directly referencing the
+ * underlying Java array and only allocate on 64 bit.
+ */
+ if (sizeof(jint) == sizeof(Glyph)) {
+ jint *gids =
+ (*env)->GetPrimitiveArrayCritical(env, gidArray, NULL);
+ if (gids == NULL) {
+ return;
+ } else {
+ XRenderFreeGlyphs(awt_display,
+ (GlyphSet)glyphSet, (Glyph *)gids, glyphCnt);
+ (*env)->ReleasePrimitiveArrayCritical(env, gidArray,
+ gids, JNI_ABORT);
+ }
return;
- }
+ } else {
+ Glyph stack_ids[64];
+ Glyph *gids = NULL;
+ jint* jgids = NULL;
+ int i;
- XRenderFreeGlyphs (awt_display, (GlyphSet) glyphSet, (Glyph *) gids, glyphCnt);
-
- (*env)->ReleasePrimitiveArrayCritical(env, gidArray, gids, JNI_ABORT);
+ if (glyphCnt <= 64) {
+ gids = stack_ids;
+ } else {
+ gids = (Glyph *)malloc(sizeof(Glyph) * glyphCnt);
+ if (gids == NULL) {
+ return;
+ }
+ }
+ jgids = (*env)->GetPrimitiveArrayCritical(env, gidArray, NULL);
+ if (jgids == NULL) {
+ if (gids != stack_ids) {
+ free(gids);
+ }
+ return;
+ }
+ for (i=0; i < glyphCnt; i++) {
+ gids[i] = jgids[i];
+ }
+ XRenderFreeGlyphs(awt_display,
+ (GlyphSet) glyphSet, gids, glyphCnt);
+ (*env)->ReleasePrimitiveArrayCritical(env, gidArray,
+ jgids, JNI_ABORT);
+ if (gids != stack_ids) {
+ free(gids);
+ }
+ }
}
JNIEXPORT jint JNICALL
@@ -692,9 +732,9 @@
jint *ids;
jint *elts;
XGlyphElt32 *xelts;
- Glyph *xids;
+ unsigned int *xids;
XGlyphElt32 selts[24];
- Glyph sids[256];
+ unsigned int sids[256];
int charCnt = 0;
if (eltCnt <= 24) {
@@ -709,7 +749,7 @@
if (glyphCnt <= 256) {
xids = &sids[0];
} else {
- xids = (Glyph *) malloc(sizeof(Glyph) * glyphCnt);
+ xids = (unsigned int*)malloc(sizeof(unsigned int) * glyphCnt);
if (xids == NULL) {
if (xelts != &selts[0]) {
free(xelts);
@@ -742,7 +782,7 @@
}
for (i=0; i < glyphCnt; i++) {
- xids[i] = (Glyph) ids[i];
+ xids[i] = ids[i];
}
for (i=0; i < eltCnt; i++) {
@@ -750,7 +790,7 @@
xelts[i].xOff = elts[i*4 + 1];
xelts[i].yOff = elts[i*4 + 2];
xelts[i].glyphset = (GlyphSet) elts[i*4 + 3];
- xelts[i].chars = (unsigned int *) &xids[charCnt];
+ xelts[i].chars = &xids[charCnt];
charCnt += xelts[i].nchars;
}
--- a/jdk/src/windows/classes/sun/awt/Win32GraphicsEnvironment.java Mon Apr 04 23:01:24 2011 +0400
+++ b/jdk/src/windows/classes/sun/awt/Win32GraphicsEnvironment.java Mon Apr 04 17:18:35 2011 -0700
@@ -39,12 +39,8 @@
import java.util.StringTokenizer;
import sun.awt.DisplayChangedListener;
import sun.awt.SunDisplayChanger;
-import sun.awt.windows.WFontConfiguration;
import sun.awt.windows.WPrinterJob;
import sun.awt.windows.WToolkit;
-import sun.font.FontManager;
-import sun.font.FontManagerFactory;
-import sun.font.SunFontManager;
import sun.java2d.SunGraphicsEnvironment;
import sun.java2d.SurfaceManagerFactory;
import sun.java2d.WindowsSurfaceManagerFactory;
@@ -231,20 +227,6 @@
return device;
}
- // Implements SunGraphicsEnvironment.createFontConfiguration.
- protected FontConfiguration createFontConfiguration() {
- FontConfiguration fc = new WFontConfiguration(SunFontManager.getInstance());
- fc.init();
- return fc;
- }
-
- public FontConfiguration createFontConfiguration(boolean preferLocaleFonts,
- boolean preferPropFonts) {
-
- return new WFontConfiguration(SunFontManager.getInstance(),
- preferLocaleFonts,preferPropFonts);
- }
-
public boolean isDisplayLocal() {
return true;
}
--- a/jdk/test/java/awt/image/GetSamplesTest.java Mon Apr 04 23:01:24 2011 +0400
+++ b/jdk/test/java/awt/image/GetSamplesTest.java Mon Apr 04 17:18:35 2011 -0700
@@ -23,9 +23,9 @@
/*
* @test
- * @bug 6735275
- * @summary Test verifies that SampleModel.getSamples() throws an appropriate
- * exception if coordinates are not in bounds.
+ * @bug 6735275 6993561
+ * @summary Test verifies that SampleModel.getSamples() SampleModel.setSamples()
+ * throw an appropriate exception if coordinates are not in bounds.
*
* @run main GetSamplesTest
*/
@@ -75,6 +75,7 @@
try {
sm.getSamples(Integer.MAX_VALUE, 0, 1, 1, 0, iArray, db);
+ sm.setSamples(Integer.MAX_VALUE, 0, 1, 1, 0, iArray, db);
} catch (ArrayIndexOutOfBoundsException e) {
System.out.println(e.getMessage());
iOk = true;
@@ -82,6 +83,7 @@
try {
sm.getSamples(Integer.MAX_VALUE, 0, 1, 1, 0, fArray, db);
+ sm.setSamples(Integer.MAX_VALUE, 0, 1, 1, 0, fArray, db);
} catch (ArrayIndexOutOfBoundsException e) {
System.out.println(e.getMessage());
fOk = true;
@@ -89,6 +91,7 @@
try {
sm.getSamples(0, Integer.MAX_VALUE, 1, 1, 0, dArray, db);
+ sm.setSamples(0, Integer.MAX_VALUE, 1, 1, 0, dArray, db);
} catch (ArrayIndexOutOfBoundsException e) {
System.out.println(e.getMessage());
dOk = true;
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/sun/java2d/SunGraphicsEnvironment/TestSGEuseAlternateFontforJALocales.java Mon Apr 04 17:18:35 2011 -0700
@@ -0,0 +1,99 @@
+/*
+ * Copyright (c) 2011, 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 7032930
+ *
+ * @summary verify the existence of the method
+ * SunGraphicsEnvironment.useAlternateFontforJALocales
+ *
+ * @run main/othervm TestSGEuseAlternateFontforJALocales
+ * @run main/othervm -Dfile.encoding=windows-31j -Duser.language=ja -Duser.country=JA TestSGEuseAlternateFontforJALocales
+ *
+ */
+
+import java.lang.reflect.Method;
+import java.nio.charset.Charset;
+import java.util.Locale;
+import java.awt.Font;
+import java.awt.FontMetrics;
+import java.awt.Graphics2D;
+import java.awt.GraphicsEnvironment;
+import java.awt.image.BufferedImage;
+
+public class TestSGEuseAlternateFontforJALocales {
+
+ public static void main(String args[]) throws Exception {
+ System.out.println("Default Charset = "
+ + Charset.defaultCharset().name());
+ System.out.println("Locale = " + Locale.getDefault());
+ String os = System.getProperty("os.name");
+ String encoding = System.getProperty("file.encoding");
+ /* Want to test the JA locale uses alternate font for DialogInput. */
+ boolean jaTest = encoding.equalsIgnoreCase("windows-31j");
+ if (!os.startsWith("Win") && jaTest) {
+ System.out.println("Skipping Windows only test");
+ return;
+ }
+
+ String className = "sun.java2d.SunGraphicsEnvironment";
+ String methodName = "useAlternateFontforJALocales";
+ Class sge = Class.forName(className);
+ Method uafMethod = sge.getMethod(methodName, (Class[])null);
+ Object ret = uafMethod.invoke(null);
+ GraphicsEnvironment ge =
+ GraphicsEnvironment.getLocalGraphicsEnvironment();
+ ge.preferLocaleFonts();
+ ge.preferProportionalFonts();
+ if (jaTest) {
+ Font msMincho = new Font("MS Mincho", Font.PLAIN, 12);
+ if (!msMincho.getFamily(Locale.ENGLISH).equals("MS Mincho")) {
+ System.out.println("MS Mincho not installed. Skipping test");
+ return;
+ }
+ Font dialogInput = new Font("DialogInput", Font.PLAIN, 12);
+ Font courierNew = new Font("Courier New", Font.PLAIN, 12);
+ Font msGothic = new Font("MS Gothic", Font.PLAIN, 12);
+ BufferedImage bi = new BufferedImage(1,1,1);
+ Graphics2D g2d = bi.createGraphics();
+ FontMetrics cnMetrics = g2d.getFontMetrics(courierNew);
+ FontMetrics diMetrics = g2d.getFontMetrics(dialogInput);
+ FontMetrics mmMetrics = g2d.getFontMetrics(msMincho);
+ FontMetrics mgMetrics = g2d.getFontMetrics(msGothic);
+ // This tests to make sure we at least have applied
+ // "preferLocaleFonts for Japanese
+ if (cnMetrics.charWidth('A') == diMetrics.charWidth('A')) {
+ throw new RuntimeException
+ ("Courier New should not be used for DialogInput");
+ }
+ // This is supposed to make sure we are using MS Mincho instead
+ // of MS Gothic. However they are metrics identical so its
+ // not definite proof.
+ if (diMetrics.charWidth('A') != mmMetrics.charWidth('A')) {
+ throw new RuntimeException
+ ("MS Mincho should be used for DialogInput");
+ }
+ }
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/sun/java2d/XRenderBlitsTest.java Mon Apr 04 17:18:35 2011 -0700
@@ -0,0 +1,94 @@
+/*
+ * Copyright (c) 2011, 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 6985593
+* @summary Test verifies that rendering standard images to screen does
+* not caiuse a crash in case of XRender.
+* @run main/othervm -Dsun.java2d.xrender=True XRenderBlitsTest
+*/
+
+import java.awt.Color;
+import java.awt.Component;
+import java.awt.Dimension;
+import java.awt.Frame;
+import java.awt.Graphics;
+import java.awt.Graphics2D;
+import java.awt.image.BufferedImage;
+import java.util.ArrayList;
+import java.util.concurrent.CountDownLatch;
+
+public class XRenderBlitsTest {
+
+ private static final int w = 10;
+ private static final int h = 10;
+
+ public static void main(String[] args) {
+ final CountDownLatch done = new CountDownLatch(1);
+
+ final ArrayList<BufferedImage> images = new ArrayList<BufferedImage>();
+
+ int type = BufferedImage.TYPE_INT_RGB;
+ do {
+ BufferedImage img = new BufferedImage(w, h, type++);
+ Graphics2D g2d = img.createGraphics();
+ g2d.setColor(Color.pink);
+ g2d.fillRect(0, 0, w, h);
+ g2d.dispose();
+
+ images.add(img);
+ } while (type <= BufferedImage.TYPE_BYTE_INDEXED);
+
+ Frame f = new Frame("Draw images");
+ Component c = new Component() {
+
+ @Override
+ public Dimension getPreferredSize() {
+ return new Dimension(w * images.size(), h);
+ }
+
+ @Override
+ public void paint(Graphics g) {
+ int x = 0;
+ for (BufferedImage img : images) {
+ System.out.println("Draw image " + img.getType());
+ g.drawImage(img, x, 0, this);
+ x += w;
+ }
+ done.countDown();
+ }
+ };
+ f.add("Center", c);
+ f.pack();
+ f.setVisible(true);
+
+ // now wait for test results
+ try {
+ done.await();
+ } catch (InterruptedException e) {
+ }
+ System.out.println("Test passed");
+ f.dispose();
+ }
+}