Skip to content
This repository has been archived by the owner. It is now read-only.
Permalink
Browse files
Automatic merge of client:master into master
  • Loading branch information
duke committed Aug 23, 2020
2 parents 64ae0bb + 87e1ab5 commit 84215334c8bd8677b98040331d812d22ba5bfb5d
@@ -1,5 +1,5 @@
#
# Copyright (c) 2002, 2007, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2002, 2020, 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
@@ -120,7 +120,7 @@ $(CLASSES):
mkdirs: $(DIST) $(CLASSES)

$(CLASSES)/j2dbench/%.class: $(SOURCEPATH)/j2dbench/%.java
javac -g:none -source 1.6 -target 1.6 -d $(CLASSES) -sourcepath $(SOURCEPATH) $<
javac -g:none -source 1.7 -target 1.7 -d $(CLASSES) -sourcepath $(SOURCEPATH) $<

clean:
rm -rf $(CLASSES)
@@ -20,8 +20,9 @@ Minimum requirements
-----------------------------------------------------------------------

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.
source/target is set to 1.7 in the makefile and build.xml, because of
support in jdk 14 compiler. To check compatibility with jdk1.4 you can
use "-source 1.4 -target 1.4" options and jdk1.7.

-----------------------------------------------------------------------
How To Compile
@@ -1,5 +1,5 @@
<!--
Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
Copyright (c) 2005, 2020, 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
@@ -49,7 +49,7 @@
<target name="compile" depends="init"
description="compile the source " >
<!-- Compile the java code from ${src} into ${build} -->
<javac debug="off" source="1.6" target="1.6" srcdir="${src}" destdir="${build}"/>
<javac debug="off" source="1.7" target="1.7" srcdir="${src}" destdir="${build}"/>
</target>

<target name="run" depends="dist"
@@ -8,8 +8,11 @@ global.env.testtime=2500
global.results.workunits=units
global.results.timeunits=sec
global.results.ratio=unitspersec
global.dest.screen=disabled
global.dest.offscreen=disabled
global.dest.frame.defaultframe=disabled
global.dest.frame.transframe=disabled
global.dest.frame.shapedframe=disabled
global.dest.frame.shapedtransframe=disabled
global.dest.compatimg.compatimg=disabled
global.dest.compatimg.opqcompatimg=disabled
global.dest.compatimg.bmcompatimg=disabled
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2002, 2018, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2002, 2020, 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
@@ -40,21 +40,26 @@

package j2dbench;

import java.awt.Image;
import java.awt.Component;
import java.awt.Frame;
import java.awt.GraphicsConfiguration;
import java.awt.Image;
import java.awt.Polygon;
import java.awt.Transparency;
import java.awt.color.ColorSpace;
import java.awt.image.BufferedImage;
import java.awt.image.ComponentColorModel;
import java.awt.image.DataBuffer;
import java.awt.image.WritableRaster;

import javax.swing.SwingUtilities;

import j2dbench.tests.GraphicsTests;
import j2dbench.tests.ImageTests;

public abstract class Destinations extends Option.Enable {
public static Group.EnableSet destroot;
public static Group frameroot;
public static Group bufimgdestroot;
public static Group compatimgdestroot;
public static Group volimgdestroot;
@@ -63,9 +68,22 @@ public static void init() {
destroot = new Group.EnableSet(TestEnvironment.globaloptroot,
"dest", "Output Destination Options");

new Screen();
new OffScreen();

frameroot = new Group.EnableSet(destroot, "frame", "Output to Frame");
frameroot.setHorizontal();

new Screen(false, false);
if (ImageTests.hasOpacityWindow) {
new Screen(true, false);
}
if (ImageTests.hasShapedWindow) {
new Screen(false, true);
}
if (ImageTests.hasShapedWindow && ImageTests.hasOpacityWindow) {
new Screen(true, true);
}

if (GraphicsTests.hasGraphics2D) {
if (ImageTests.hasCompatImage) {
compatimgdestroot =
@@ -129,17 +147,95 @@ public String getAbbreviatedModifierDescription(Object val) {
public abstract void setDestination(TestEnvironment env);

public static class Screen extends Destinations {
public Screen() {
super(destroot, "screen", "Output to Screen", false);

private boolean opacity;
private boolean shaped;

public Screen(boolean opacity, boolean shaped) {
super(frameroot, getDescription(opacity,shaped),
getLongDescription(opacity,shaped), false);
this.opacity = opacity;
this.shaped = shaped;
}

private static String getDescription(boolean opacity, boolean shaped){
if (opacity && shaped) {
return "shapedtransframe";
}
if (shaped) {
return "shapedframe";
}
if (opacity) {
return "transframe";
}
return "defaultframe";
}

private static String getLongDescription(boolean opacity, boolean shaped){
if (opacity && shaped) {
return "Translucent and Shaped";
}
if (shaped) {
return "Shaped";
}
if (opacity) {
return "Translucent";
}
return "Default";
}

public String getModifierValueName(Object val) {
return "Screen";
if (opacity && shaped) {
return "Translucent and Shaped Frame";
}
if (shaped) {
return "Shaped Frame";
}
if (opacity) {
return "Translucent Frame";
}
return "Default Frame";
}

public void setDestination(TestEnvironment env) {
env.setTestImage(null);
}

public void modifyTest(TestEnvironment env) {
setDestination(env);
Frame frame = (Frame) SwingUtilities.getWindowAncestor(env.comp);
if (frame != null && (opacity || shaped)) {
frame.dispose();
frame.setUndecorated(true);
int w = frame.getWidth();
int h = frame.getHeight();
if (shaped) {
Polygon p = new Polygon();
p.addPoint(0, 0);
p.addPoint(w, 0);
p.addPoint(0, h);
p.addPoint(w, h);
p.addPoint(0, 0);
frame.setShape(p);
}
if (opacity) {
frame.setOpacity(0.5f);
}
frame.setVisible(true);
}
}

public void restoreTest(TestEnvironment env) {
env.setTestImage(null);
Frame frame = (Frame) SwingUtilities.getWindowAncestor(env.comp);
if (frame != null && (opacity || shaped)) {
frame.dispose();
frame.setShape(null);
frame.setOpacity(1);
frame.setUndecorated(false);
frame.setVisible(true);
}
}
}

public static class OffScreen extends Destinations {
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2002, 2018, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2002, 2020, 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
@@ -40,6 +40,8 @@

package j2dbench;

import java.awt.GraphicsEnvironment;
import java.awt.Rectangle;
import java.io.PrintWriter;
import java.io.FileReader;
import java.io.FileWriter;
@@ -780,7 +782,10 @@ public void actionPerformed(ActionEvent e) {
f.getContentPane().add(p, BorderLayout.SOUTH);
f.pack();
f.setLocationRelativeTo(null);
f.show();
Rectangle usable = GraphicsEnvironment.getLocalGraphicsEnvironment()
.getMaximumWindowBounds().intersection(f.getBounds());
f.setBounds(usable);
f.setVisible(true);
}

public static void runTests(boolean showresults) {
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2002, 2018, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2002, 2020, 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
@@ -53,7 +53,9 @@
import java.awt.AlphaComposite;
import java.awt.Dimension;
import java.awt.GraphicsConfiguration;
import java.awt.Rectangle;
import java.awt.RenderingHints;
import java.awt.Window;
import java.awt.image.BufferedImage;
import java.awt.image.BufferedImageOp;
import java.awt.image.ByteLookupTable;
@@ -79,6 +81,8 @@
public abstract class ImageTests extends GraphicsTests {
public static boolean hasVolatileImage;
public static boolean hasTransparentVolatileImage;
public static boolean hasShapedWindow;
public static boolean hasOpacityWindow;
public static boolean hasCompatImage;

static {
@@ -96,6 +100,16 @@ public abstract class ImageTests extends GraphicsTests {
hasTransparentVolatileImage = true;
} catch (NoSuchMethodError e) {
}
try {
new Window(null).setShape(new Rectangle());
hasShapedWindow = true;
} catch (Exception e) {
}
try {
new Window(null).setOpacity(0.5f);
hasOpacityWindow = true;
} catch (Exception e) {
}
}

static Group imageroot;
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2006, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2006, 2020, 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
@@ -184,7 +184,7 @@ private static void initIIOReadFormats() {
String klass = spi.getClass().getName();
String format = spi.getFormatNames()[0].toLowerCase();
String suffix = spi.getFileSuffixes()[0].toLowerCase();
if (suffix == null || suffix.isEmpty()) {
if (suffix == null || suffix.equals("")) {
suffix = format;
}
String shortName;
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2006, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2006, 2020, 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
@@ -143,7 +143,7 @@ private static void initIIOWriteFormats() {
String klass = spi.getClass().getName();
String format = spi.getFormatNames()[0].toLowerCase();
String suffix = spi.getFileSuffixes()[0].toLowerCase();
if (suffix == null || suffix.isEmpty()) {
if (suffix == null || suffix.equals("")) {
suffix = format;
}
String shortName;

0 comments on commit 8421533

Please sign in to comment.