8042199: The build of J2DBench via makefile is broken after the JDK-8005402
Reviewed-by: flar, bae
--- a/jdk/src/share/demo/java2d/J2DBench/Makefile Thu Aug 14 14:19:58 2014 +0100
+++ b/jdk/src/share/demo/java2d/J2DBench/Makefile Thu Aug 14 18:43:45 2014 +0400
@@ -72,6 +72,7 @@
J2DBENCH_RESOURCES = \
$(CLASSES)/j2dbench/tests/iio/images \
+ $(CLASSES)/j2dbench/tests/cmm/images \
$(CLASSES)/j2dbench/tests/text/textdata
SCM_DIRs = .hg .svn CVS RCS SCCS Codemgr_wsdata deleted_files
@@ -101,6 +102,10 @@
cp -r $< $@
cd $@ && rm -rf $(SCM_DIRs)
+$(CLASSES)/j2dbench/tests/cmm/images: $(RESOURCES)/cmm_images
+ cp -r $< $@
+ cd $@ && rm -rf $(SCM_DIRs)
+
$(CLASSES)/j2dbench.manifest:
echo "Main-Class: j2dbench.J2DBench" > $@
@@ -115,7 +120,7 @@
mkdirs: $(DIST) $(CLASSES)
$(CLASSES)/j2dbench/%.class: $(SOURCEPATH)/j2dbench/%.java
- javac -source 1.2 -target 1.2 -d $(CLASSES) -sourcepath $(SOURCEPATH) $<
+ javac -g:none -source 1.6 -target 1.6 -d $(CLASSES) -sourcepath $(SOURCEPATH) $<
clean:
rm -rf $(CLASSES)
--- a/jdk/src/share/demo/java2d/J2DBench/README Thu Aug 14 14:19:58 2014 +0100
+++ b/jdk/src/share/demo/java2d/J2DBench/README Thu Aug 14 18:43:45 2014 +0400
@@ -19,10 +19,9 @@
Minimum requirements
-----------------------------------------------------------------------
-The benchmark requires at least jdk1.4 to compile and
-at least jdk1.2** to run.
-
-** Note: the goal is to make the benchmark run on 1.1.x as well.
+The benchmark requires at least jdk1.4 to compile and run. Note that
+source/target is set to 1.6 in the makefile and build.xml, because of
+support in jdk 9 compiler.
-----------------------------------------------------------------------
How To Compile
@@ -125,7 +124,7 @@
After the options file is created, start J2DBench in batch mode to run
the benchmarks for the default pipeline:
-#> java -jar dest/J2DBench.jar -batch -loadopts options/default.opt \
+#> java -jar dist/J2DBench.jar -batch -loadopts options/default.opt \
-saveres default.res -title "Rendering - Default ppl" \
-desc "Rendering tests with the default pipeline"
@@ -136,13 +135,13 @@
"Run Tests" in the J2DBench dialog)
Now run the benchmark with opengl pipeline:
-#> java -Dsun.java2d.opengl=True -jar dest/J2DBench.jar -batch \
+#> java -Dsun.java2d.opengl=True -jar dist/J2DBench.jar -batch \
-loadopts options/default.opt \
-saveres opengl.res -title "Rendering - OpenGL" \
-desc "Rendering tests with OpenGL pipeline"
Now let's analyze the results using J2DAnalyzer:
-#> java -jar dest/J2DAnalyzer.jar default.res opengl.res
+#> java -jar dist/J2DAnalyzer.jar default.res opengl.res
Note that you can compare more than two sets of results, see
J2DAnalyzer's help page.
--- a/jdk/src/share/demo/java2d/J2DBench/build.xml Thu Aug 14 14:19:58 2014 +0100
+++ b/jdk/src/share/demo/java2d/J2DBench/build.xml Thu Aug 14 18:43:45 2014 +0400
@@ -49,7 +49,7 @@
<target name="compile" depends="init"
description="compile the source " >
<!-- Compile the java code from ${src} into ${build} -->
- <javac debug="flase" source="1.5" target="1.5" srcdir="${src}" destdir="${build}"/>
+ <javac debug="off" source="1.6" target="1.6" srcdir="${src}" destdir="${build}"/>
</target>
<target name="run" depends="dist"
--- a/jdk/src/share/demo/java2d/J2DBench/src/j2dbench/tests/cmm/CMMTests.java Thu Aug 14 14:19:58 2014 +0100
+++ b/jdk/src/share/demo/java2d/J2DBench/src/j2dbench/tests/cmm/CMMTests.java Thu Aug 14 18:43:45 2014 +0400
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2014, Oracle and/or its affiliates. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -39,23 +39,24 @@
package j2dbench.tests.cmm;
-import j2dbench.Group;
-import j2dbench.Option;
-import j2dbench.Result;
-import j2dbench.Test;
-import j2dbench.TestEnvironment;
import java.awt.color.ColorSpace;
import java.awt.color.ICC_ColorSpace;
import java.awt.color.ICC_Profile;
import java.io.IOException;
import java.io.InputStream;
+import j2dbench.Group;
+import j2dbench.Option;
+import j2dbench.Result;
+import j2dbench.Test;
+import j2dbench.TestEnvironment;
+
public class CMMTests extends Test {
protected static Group cmmRoot;
protected static Group cmmOptRoot;
protected static Option csList;
- protected static Option usePlatfromProfiles;
+ protected static Option usePlatformProfiles;
public static void init() {
cmmRoot = new Group("cmm", "Color Management Benchmarks");
@@ -64,9 +65,9 @@
cmmOptRoot = new Group(cmmRoot, "opts", "General Options");
/*
- usePlatfromProfiles =
- new Option.Enable(cmmOptRoot, "csPlatfrom",
- "Use Platfrom Profiles", false);
+ usePlatformProfiles =
+ new Option.Enable(cmmOptRoot, "csPlatform",
+ "Use Platform Profiles", false);
*/
int[] colorspaces = new int[] {
ColorSpace.CS_sRGB,
@@ -92,10 +93,10 @@
protected static ColorSpace getColorSpace(TestEnvironment env) {
ColorSpace cs;
- Boolean usePlatfrom = true; //(Boolean)env.getModifier(usePlatfromProfiles);
+ boolean usePlatform = true; //(Boolean)env.getModifier(usePlatformProfiles);
int cs_code = env.getIntValue(csList);
- if (usePlatfrom) {
+ if (usePlatform) {
cs = ColorSpace.getInstance(cs_code);
} else {
String resource = "profiles/";
@@ -136,17 +137,14 @@
addDependencies(cmmOptRoot, true);
}
- @Override
public Object initTest(TestEnvironment te, Result result) {
throw new UnsupportedOperationException("Not supported yet.");
}
- @Override
public void runTest(Object o, int i) {
throw new UnsupportedOperationException("Not supported yet.");
}
- @Override
public void cleanupTest(TestEnvironment te, Object o) {
throw new UnsupportedOperationException("Not supported yet.");
}
--- a/jdk/src/share/demo/java2d/J2DBench/src/j2dbench/tests/cmm/ColorConvertOpTests.java Thu Aug 14 14:19:58 2014 +0100
+++ b/jdk/src/share/demo/java2d/J2DBench/src/j2dbench/tests/cmm/ColorConvertOpTests.java Thu Aug 14 18:43:45 2014 +0400
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2014, Oracle and/or its affiliates. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -39,11 +39,6 @@
package j2dbench.tests.cmm;
-import j2dbench.Group;
-import j2dbench.Option;
-import j2dbench.Result;
-import j2dbench.TestEnvironment;
-import j2dbench.tests.iio.IIOTests;
import java.awt.AlphaComposite;
import java.awt.Color;
import java.awt.Graphics2D;
@@ -53,15 +48,22 @@
import java.awt.image.ColorConvertOp;
import java.awt.image.Raster;
import java.awt.image.WritableRaster;
+
import javax.imageio.ImageIO;
+import j2dbench.Group;
+import j2dbench.Option;
+import j2dbench.Result;
+import j2dbench.TestEnvironment;
+import j2dbench.tests.iio.IIOTests;
+
public class ColorConvertOpTests extends ColorConversionTests {
- private static enum ImageContent {
- BLANK("bank", "Blank (opaque black)"),
- RANDOM("random", "Random"),
- VECTOR("vector", "Vector Art"),
- PHOTO("photo", "Photograph");
+ private static class ImageContent {
+ static ImageContent BLANK = new ImageContent("bank", "Blank (opaque black)");
+ static ImageContent RANDOM = new ImageContent("random", "Random");
+ static ImageContent VECTOR = new ImageContent("vector", "Vector Art");
+ static ImageContent PHOTO= new ImageContent("photo", "Photograph");
public final String name;
public final String descr;
@@ -70,15 +72,19 @@
this.name = name;
this.descr = descr;
}
+
+ public static ImageContent[] values() {
+ return new ImageContent[]{BLANK, RANDOM, VECTOR, PHOTO};
+ }
}
- private static enum ImageType {
- INT_ARGB(BufferedImage.TYPE_INT_ARGB, "INT_ARGB", "TYPE_INT_ARGB"),
- INT_RGB(BufferedImage.TYPE_INT_RGB, "INT_RGB", "TYPE_INT_RGB"),
- INT_BGR(BufferedImage.TYPE_INT_BGR, "INT_BGR", "TYPE_INT_BGR"),
- BYTE_3BYTE_BGR(BufferedImage.TYPE_3BYTE_BGR, "3BYTE_BGR", "TYPE_3BYTE_BGR"),
- BYTE_4BYTE_ABGR(BufferedImage.TYPE_4BYTE_ABGR, "4BYTE_BGR", "TYPE_4BYTE_BGR"),
- COMPATIBLE_DST(0, "Compatible", "Compatible destination");
+ private static class ImageType {
+ static ImageType INT_ARGB = new ImageType(BufferedImage.TYPE_INT_ARGB, "INT_ARGB", "TYPE_INT_ARGB");
+ static ImageType INT_RGB = new ImageType(BufferedImage.TYPE_INT_RGB, "INT_RGB", "TYPE_INT_RGB");
+ static ImageType INT_BGR = new ImageType(BufferedImage.TYPE_INT_BGR, "INT_BGR", "TYPE_INT_BGR");
+ static ImageType BYTE_3BYTE_BGR = new ImageType(BufferedImage.TYPE_3BYTE_BGR, "3BYTE_BGR", "TYPE_3BYTE_BGR");
+ static ImageType BYTE_4BYTE_ABGR = new ImageType(BufferedImage.TYPE_4BYTE_ABGR, "4BYTE_BGR", "TYPE_4BYTE_BGR");
+ static ImageType COMPATIBLE_DST = new ImageType(0, "Compatible", "Compatible destination");
private ImageType(int type, String abbr, String descr) {
this.type = type;
@@ -89,11 +95,16 @@
public final int type;
public final String abbrev;
public final String descr;
+
+ public static ImageType[] values() {
+ return new ImageType[]{INT_ARGB, INT_RGB, INT_BGR,
+ BYTE_3BYTE_BGR, BYTE_4BYTE_ABGR, COMPATIBLE_DST};
+ }
}
- private static enum ListType {
- SRC("srcType", "Source Images"),
- DST("dstType", "Destination Images");
+ private static class ListType {
+ static ListType SRC = new ListType("srcType", "Source Images");
+ static ListType DST = new ListType("dstType", "Destination Images");
private ListType(String name, String description) {
this.name = name;
@@ -320,64 +331,55 @@
BufferedImage image;
image = new BufferedImage(width, height, type);
boolean hasAlpha = image.getColorModel().hasAlpha();
- switch (contentType) {
- case RANDOM:
- for (int y = 0; y < height; y++) {
- for (int x = 0; x < width; x++) {
- int rgb = (int)(Math.random() * 0xffffff);
- if (hasAlpha) {
- rgb |= 0x7f000000;
- }
- image.setRGB(x, y, rgb);
- }
- }
- break;
- case VECTOR:
- {
- Graphics2D g = image.createGraphics();
+ if (contentType == ImageContent.RANDOM) {
+ for (int y = 0; y < height; y++) {
+ for (int x = 0; x < width; x++) {
+ int rgb = (int) (Math.random() * 0xffffff);
if (hasAlpha) {
- // fill background with a translucent color
- g.setComposite(AlphaComposite.getInstance(
- AlphaComposite.SRC, 0.5f));
+ rgb |= 0x7f000000;
}
- g.setColor(Color.blue);
- g.fillRect(0, 0, width, height);
- g.setComposite(AlphaComposite.Src);
- g.setColor(Color.yellow);
- g.fillOval(2, 2, width-4, height-4);
- g.setColor(Color.red);
- g.fillOval(4, 4, width-8, height-8);
- g.setColor(Color.green);
- g.fillRect(8, 8, width-16, height-16);
- g.setColor(Color.white);
- g.drawLine(0, 0, width, height);
- g.drawLine(0, height, width, 0);
- g.dispose();
- break;
+ image.setRGB(x, y, rgb);
}
- case PHOTO:
- {
- Image photo = null;
- try {
- photo = ImageIO.read(
- IIOTests.class.getResourceAsStream("images/photo.jpg"));
- } catch (Exception e) {
- System.err.println("error loading photo");
- e.printStackTrace();
- }
- Graphics2D g = image.createGraphics();
- if (hasAlpha) {
- g.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC,
- 0.5f));
- }
- g.drawImage(photo, 0, 0, width, height, null);
- g.dispose();
- break;
- }
- default:
- break;
+ }
}
-
+ if (contentType == ImageContent.VECTOR) {
+ Graphics2D g = image.createGraphics();
+ if (hasAlpha) {
+ // fill background with a translucent color
+ g.setComposite(AlphaComposite.getInstance(
+ AlphaComposite.SRC, 0.5f));
+ }
+ g.setColor(Color.blue);
+ g.fillRect(0, 0, width, height);
+ g.setComposite(AlphaComposite.Src);
+ g.setColor(Color.yellow);
+ g.fillOval(2, 2, width-4, height-4);
+ g.setColor(Color.red);
+ g.fillOval(4, 4, width-8, height-8);
+ g.setColor(Color.green);
+ g.fillRect(8, 8, width-16, height-16);
+ g.setColor(Color.white);
+ g.drawLine(0, 0, width, height);
+ g.drawLine(0, height, width, 0);
+ g.dispose();
+ }
+ if (contentType == ImageContent.PHOTO) {
+ Image photo = null;
+ try {
+ photo = ImageIO.read(
+ IIOTests.class.getResourceAsStream("images/photo.jpg"));
+ } catch (Exception e) {
+ System.err.println("error loading photo");
+ e.printStackTrace();
+ }
+ Graphics2D g = image.createGraphics();
+ if (hasAlpha) {
+ g.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC,
+ 0.5f));
+ }
+ g.drawImage(photo, 0, 0, width, height, null);
+ g.dispose();
+ }
return image;
}
}
--- a/jdk/src/share/demo/java2d/J2DBench/src/j2dbench/tests/cmm/DataConversionTests.java Thu Aug 14 14:19:58 2014 +0100
+++ b/jdk/src/share/demo/java2d/J2DBench/src/j2dbench/tests/cmm/DataConversionTests.java Thu Aug 14 18:43:45 2014 +0400
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2014, Oracle and/or its affiliates. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -39,10 +39,11 @@
package j2dbench.tests.cmm;
+import java.awt.color.ColorSpace;
+
import j2dbench.Group;
import j2dbench.Result;
import j2dbench.TestEnvironment;
-import java.awt.color.ColorSpace;
public class DataConversionTests extends ColorConversionTests {
@@ -92,13 +93,11 @@
}
}
- @Override
public Object initTest(TestEnvironment env, Result result) {
ColorSpace cs = getColorSpace(env);
return new Context(env, result, cs);
}
- @Override
public void cleanupTest(TestEnvironment te, Object o) {
}
--- a/jdk/src/share/demo/java2d/J2DBench/src/j2dbench/tests/cmm/EmbeddedProfileTests.java Thu Aug 14 14:19:58 2014 +0100
+++ b/jdk/src/share/demo/java2d/J2DBench/src/j2dbench/tests/cmm/EmbeddedProfileTests.java Thu Aug 14 18:43:45 2014 +0400
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -39,16 +39,18 @@
package j2dbench.tests.cmm;
+import java.awt.image.BufferedImage;
+import java.io.IOException;
+import java.net.URL;
+
+import javax.imageio.ImageIO;
+import javax.imageio.ImageReader;
+import javax.imageio.stream.ImageInputStream;
+
import j2dbench.Group;
import j2dbench.Option;
import j2dbench.Result;
import j2dbench.TestEnvironment;
-import java.awt.image.BufferedImage;
-import java.io.IOException;
-import java.net.URL;
-import javax.imageio.ImageIO;
-import javax.imageio.ImageReader;
-import javax.imageio.stream.ImageInputStream;
/* This benchmark verifies how changes in cmm library affects image decoding */
public class EmbeddedProfileTests extends ColorConversionTests {
@@ -68,10 +70,10 @@
new ReadImageTest();
}
- private static enum IccImageResource {
- SMALL("images/img_icc_small.jpg", "512x512", "Small: 512x512"),
- MEDIUM("images/img_icc_medium.jpg", "2048x2048", "Medium: 2048x2048"),
- LARGE("images/img_icc_large.jpg", "4096x4096", "Large: 4096x4096");
+ private static class IccImageResource {
+ static IccImageResource SMALL = new IccImageResource("images/img_icc_small.jpg", "512x512", "Small: 512x512");
+ static IccImageResource MEDIUM = new IccImageResource("images/img_icc_medium.jpg", "2048x2048", "Medium: 2048x2048");
+ static IccImageResource LARGE = new IccImageResource("images/img_icc_large.jpg", "4096x4096", "Large: 4096x4096");
private IccImageResource(String file, String name, String description) {
this.url = CMMTests.class.getResource(file);
@@ -82,6 +84,10 @@
public final URL url;
public final String abbrev;
public final String description;
+
+ public static IccImageResource[] values() {
+ return new IccImageResource[]{SMALL, MEDIUM, LARGE};
+ }
}
private static Option createImageList() {
@@ -145,7 +151,7 @@
try {
iis = ImageIO.createImageInputStream(url.openStream());
- reader = ImageIO.getImageReaders(iis).next();
+ reader = (ImageReader) ImageIO.getImageReaders(iis).next();
} catch (IOException e) {
throw new RuntimeException("Unable to run the becnhmark", e);
}
--- a/jdk/src/share/demo/java2d/J2DBench/src/j2dbench/tests/cmm/ProfileTests.java Thu Aug 14 14:19:58 2014 +0100
+++ b/jdk/src/share/demo/java2d/J2DBench/src/j2dbench/tests/cmm/ProfileTests.java Thu Aug 14 18:43:45 2014 +0400
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2014, Oracle and/or its affiliates. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -38,12 +38,12 @@
*/
package j2dbench.tests.cmm;
+import java.awt.color.ICC_ColorSpace;
+import java.awt.color.ICC_Profile;
+
import j2dbench.Group;
import j2dbench.Result;
import j2dbench.TestEnvironment;
-import java.awt.color.ColorSpace;
-import java.awt.color.ICC_ColorSpace;
-import java.awt.color.ICC_Profile;
public class ProfileTests extends CMMTests {
@@ -73,13 +73,11 @@
}
}
- @Override
public Object initTest(TestEnvironment env, Result res) {
ICC_ColorSpace cs = (ICC_ColorSpace) getColorSpace(env);
return new Context(cs.getProfile(), env, res);
}
- @Override
public void cleanupTest(TestEnvironment env, Object o) {
}
@@ -91,7 +89,6 @@
"getData(icSigHead)");
}
- @Override
public void runTest(Object ctx, int numReps) {
final Context ictx = (Context) ctx;
final ICC_Profile profile = ictx.profile;
@@ -115,7 +112,6 @@
"getNumComponents");
}
- @Override
public void runTest(Object ctx, int numReps) {
final Context ictx = (Context) ctx;
final ICC_Profile profile = ictx.profile;