< prev index next >
src/demo/share/java2d/J2DBench/src/j2dbench/tests/RenderTests.java
Print this page
*** 1,7 ****
/*
! * Copyright (c) 2002, 2011, 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
* are met:
*
--- 1,7 ----
/*
! * Copyright (c) 2002, 2018, 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
* are met:
*
*** 81,92 ****
static Option sizeList;
static Option strokeList;
static final int NUM_RANDOMCOLORS = 4096;
static final int NUM_RANDOMCOLORMASK = (NUM_RANDOMCOLORS - 1);
! static Color randAlphaColors[];
! static Color randOpaqueColors[];
static {
randOpaqueColors = new Color[NUM_RANDOMCOLORS];
randAlphaColors = new Color[NUM_RANDOMCOLORS];
for (int i = 0; i < NUM_RANDOMCOLORS; i++) {
--- 81,92 ----
static Option sizeList;
static Option strokeList;
static final int NUM_RANDOMCOLORS = 4096;
static final int NUM_RANDOMCOLORMASK = (NUM_RANDOMCOLORS - 1);
! static Color[] randAlphaColors;
! static Color[] randOpaqueColors;
static {
randOpaqueColors = new Color[NUM_RANDOMCOLORS];
randAlphaColors = new Color[NUM_RANDOMCOLORS];
for (int i = 0; i < NUM_RANDOMCOLORS; i++) {
*** 159,189 ****
Option.Toggle.Off);
doAntialias =
new Option.Toggle(renderoptroot, "antialias",
"Render shapes antialiased",
Option.Toggle.Off);
! String strokeStrings[] = {
"width0",
"width1",
"width5",
"width20",
"dash0_5",
"dash1_5",
"dash5_20",
"dash20_50",
};
! String strokeDescriptions[] = {
"Solid Thin lines",
"Solid Width 1 lines",
"Solid Width 5 lines",
"Solid Width 20 lines",
"Dashed Thin lines",
"Dashed Width 1 lines",
"Dashed Width 5 lines",
"Dashed Width 20 lines",
};
! BasicStroke strokeObjects[] = {
new BasicStroke(0f),
new BasicStroke(1f),
new BasicStroke(5f),
new BasicStroke(20f),
new BasicStroke(0f, BasicStroke.CAP_SQUARE,
--- 159,189 ----
Option.Toggle.Off);
doAntialias =
new Option.Toggle(renderoptroot, "antialias",
"Render shapes antialiased",
Option.Toggle.Off);
! String[] strokeStrings = {
"width0",
"width1",
"width5",
"width20",
"dash0_5",
"dash1_5",
"dash5_20",
"dash20_50",
};
! String[] strokeDescriptions = {
"Solid Thin lines",
"Solid Width 1 lines",
"Solid Width 5 lines",
"Solid Width 20 lines",
"Dashed Thin lines",
"Dashed Width 1 lines",
"Dashed Width 5 lines",
"Dashed Width 20 lines",
};
! BasicStroke[] strokeObjects = {
new BasicStroke(0f),
new BasicStroke(1f),
new BasicStroke(5f),
new BasicStroke(20f),
new BasicStroke(0f, BasicStroke.CAP_SQUARE,
*** 270,280 ****
}
}
public static class Context extends GraphicsTests.Context {
int colorindex;
! Color colorlist[];
}
public RenderTests(Group parent, String nodeName, String description) {
super(parent, nodeName, description);
addDependencies(renderoptroot, true);
--- 270,280 ----
}
}
public static class Context extends GraphicsTests.Context {
int colorindex;
! Color[] colorlist;
}
public RenderTests(Group parent, String nodeName, String description) {
super(parent, nodeName, description);
addDependencies(renderoptroot, true);
*** 408,418 ****
int size = rctx.size - 1;
int x = rctx.initX;
int y = rctx.initY;
Graphics g = rctx.graphics;
g.translate(rctx.orgX, rctx.orgY);
! Color rCArray[] = rctx.colorlist;
int ci = rctx.colorindex;
if (rctx.animate) {
do {
if (rCArray != null) {
g.setColor(rCArray[ci++ & NUM_RANDOMCOLORMASK]);
--- 408,418 ----
int size = rctx.size - 1;
int x = rctx.initX;
int y = rctx.initY;
Graphics g = rctx.graphics;
g.translate(rctx.orgX, rctx.orgY);
! Color[] rCArray = rctx.colorlist;
int ci = rctx.colorindex;
if (rctx.animate) {
do {
if (rCArray != null) {
g.setColor(rCArray[ci++ & NUM_RANDOMCOLORMASK]);
*** 453,463 ****
int size = rctx.size - 1;
int x = rctx.initX;
int y = rctx.initY;
Graphics g = rctx.graphics;
g.translate(rctx.orgX, rctx.orgY);
! Color rCArray[] = rctx.colorlist;
int ci = rctx.colorindex;
if (rctx.animate) {
do {
if (rCArray != null) {
g.setColor(rCArray[ci++ & NUM_RANDOMCOLORMASK]);
--- 453,463 ----
int size = rctx.size - 1;
int x = rctx.initX;
int y = rctx.initY;
Graphics g = rctx.graphics;
g.translate(rctx.orgX, rctx.orgY);
! Color[] rCArray = rctx.colorlist;
int ci = rctx.colorindex;
if (rctx.animate) {
do {
if (rCArray != null) {
g.setColor(rCArray[ci++ & NUM_RANDOMCOLORMASK]);
*** 498,508 ****
int size = rctx.size - 1;
int x = rctx.initX;
int y = rctx.initY;
Graphics g = rctx.graphics;
g.translate(rctx.orgX, rctx.orgY);
! Color rCArray[] = rctx.colorlist;
int ci = rctx.colorindex;
if (rctx.animate) {
do {
if (rCArray != null) {
g.setColor(rCArray[ci++ & NUM_RANDOMCOLORMASK]);
--- 498,508 ----
int size = rctx.size - 1;
int x = rctx.initX;
int y = rctx.initY;
Graphics g = rctx.graphics;
g.translate(rctx.orgX, rctx.orgY);
! Color[] rCArray = rctx.colorlist;
int ci = rctx.colorindex;
if (rctx.animate) {
do {
if (rCArray != null) {
g.setColor(rCArray[ci++ & NUM_RANDOMCOLORMASK]);
*** 534,544 ****
int size = rctx.size;
int x = rctx.initX;
int y = rctx.initY;
Graphics g = rctx.graphics;
g.translate(rctx.orgX, rctx.orgY);
! Color rCArray[] = rctx.colorlist;
int ci = rctx.colorindex;
if (rctx.animate) {
do {
if (rCArray != null) {
g.setColor(rCArray[ci++ & NUM_RANDOMCOLORMASK]);
--- 534,544 ----
int size = rctx.size;
int x = rctx.initX;
int y = rctx.initY;
Graphics g = rctx.graphics;
g.translate(rctx.orgX, rctx.orgY);
! Color[] rCArray = rctx.colorlist;
int ci = rctx.colorindex;
if (rctx.animate) {
do {
if (rCArray != null) {
g.setColor(rCArray[ci++ & NUM_RANDOMCOLORMASK]);
*** 581,591 ****
int size = rctx.size - 1;
int x = rctx.initX;
int y = rctx.initY;
Graphics g = rctx.graphics;
g.translate(rctx.orgX, rctx.orgY);
! Color rCArray[] = rctx.colorlist;
int ci = rctx.colorindex;
if (rctx.animate) {
do {
if (rCArray != null) {
g.setColor(rCArray[ci++ & NUM_RANDOMCOLORMASK]);
--- 581,591 ----
int size = rctx.size - 1;
int x = rctx.initX;
int y = rctx.initY;
Graphics g = rctx.graphics;
g.translate(rctx.orgX, rctx.orgY);
! Color[] rCArray = rctx.colorlist;
int ci = rctx.colorindex;
if (rctx.animate) {
do {
if (rCArray != null) {
g.setColor(rCArray[ci++ & NUM_RANDOMCOLORMASK]);
*** 624,634 ****
int size = rctx.size;
int x = rctx.initX;
int y = rctx.initY;
Graphics g = rctx.graphics;
g.translate(rctx.orgX, rctx.orgY);
! Color rCArray[] = rctx.colorlist;
int ci = rctx.colorindex;
if (rctx.animate) {
do {
if (rCArray != null) {
g.setColor(rCArray[ci++ & NUM_RANDOMCOLORMASK]);
--- 624,634 ----
int size = rctx.size;
int x = rctx.initX;
int y = rctx.initY;
Graphics g = rctx.graphics;
g.translate(rctx.orgX, rctx.orgY);
! Color[] rCArray = rctx.colorlist;
int ci = rctx.colorindex;
if (rctx.animate) {
do {
if (rCArray != null) {
g.setColor(rCArray[ci++ & NUM_RANDOMCOLORMASK]);
*** 678,688 ****
int size = rctx.size - 1;
int x = rctx.initX;
int y = rctx.initY;
Graphics g = rctx.graphics;
g.translate(rctx.orgX, rctx.orgY);
! Color rCArray[] = rctx.colorlist;
int ci = rctx.colorindex;
if (rctx.animate) {
do {
if (rCArray != null) {
g.setColor(rCArray[ci++ & NUM_RANDOMCOLORMASK]);
--- 678,688 ----
int size = rctx.size - 1;
int x = rctx.initX;
int y = rctx.initY;
Graphics g = rctx.graphics;
g.translate(rctx.orgX, rctx.orgY);
! Color[] rCArray = rctx.colorlist;
int ci = rctx.colorindex;
if (rctx.animate) {
do {
if (rCArray != null) {
g.setColor(rCArray[ci++ & NUM_RANDOMCOLORMASK]);
*** 731,745 ****
public void runTest(Object ctx, int numReps) {
RenderTests.Context rctx = (RenderTests.Context) ctx;
int size = rctx.size;
int x = rctx.initX;
int y = rctx.initY;
! int hexaX[] = new int[6];
! int hexaY[] = new int[6];
Graphics g = rctx.graphics;
g.translate(rctx.orgX, rctx.orgY);
! Color rCArray[] = rctx.colorlist;
int ci = rctx.colorindex;
do {
hexaX[0] = x;
hexaX[1] = hexaX[5] = x+size/4;
hexaX[2] = hexaX[4] = x+size-size/4;
--- 731,745 ----
public void runTest(Object ctx, int numReps) {
RenderTests.Context rctx = (RenderTests.Context) ctx;
int size = rctx.size;
int x = rctx.initX;
int y = rctx.initY;
! int[] hexaX = new int[6];
! int[] hexaY = new int[6];
Graphics g = rctx.graphics;
g.translate(rctx.orgX, rctx.orgY);
! Color[] rCArray = rctx.colorlist;
int ci = rctx.colorindex;
do {
hexaX[0] = x;
hexaX[1] = hexaX[5] = x+size/4;
hexaX[2] = hexaX[4] = x+size-size/4;
*** 796,810 ****
// subtract 1 to account for the fact that lines are drawn to
// and including the final coordinate...
int size = rctx.size - 1;
int x = rctx.initX;
int y = rctx.initY;
! int hexaX[] = new int[6];
! int hexaY[] = new int[6];
Graphics g = rctx.graphics;
g.translate(rctx.orgX, rctx.orgY);
! Color rCArray[] = rctx.colorlist;
int ci = rctx.colorindex;
do {
hexaX[0] = x;
hexaX[1] = hexaX[5] = x+size/4;
hexaX[2] = hexaX[4] = x+size-size/4;
--- 796,810 ----
// subtract 1 to account for the fact that lines are drawn to
// and including the final coordinate...
int size = rctx.size - 1;
int x = rctx.initX;
int y = rctx.initY;
! int[] hexaX = new int[6];
! int[] hexaY = new int[6];
Graphics g = rctx.graphics;
g.translate(rctx.orgX, rctx.orgY);
! Color[] rCArray = rctx.colorlist;
int ci = rctx.colorindex;
do {
hexaX[0] = x;
hexaX[1] = hexaX[5] = x+size/4;
hexaX[2] = hexaX[4] = x+size-size/4;
*** 866,876 ****
int y = cctx.initY;
int cpoffset = (int) (size/relYmax/2);
CubicCurve2D curve = cctx.curve;
Graphics2D g2d = (Graphics2D) cctx.graphics;
g2d.translate(cctx.orgX, cctx.orgY);
! Color rCArray[] = cctx.colorlist;
int ci = cctx.colorindex;
do {
curve.setCurve(x, y+size/2.0,
x+size/2.0, y+size/2.0-cpoffset,
x+size/2.0, y+size/2.0+cpoffset,
--- 866,876 ----
int y = cctx.initY;
int cpoffset = (int) (size/relYmax/2);
CubicCurve2D curve = cctx.curve;
Graphics2D g2d = (Graphics2D) cctx.graphics;
g2d.translate(cctx.orgX, cctx.orgY);
! Color[] rCArray = cctx.colorlist;
int ci = cctx.colorindex;
do {
curve.setCurve(x, y+size/2.0,
x+size/2.0, y+size/2.0-cpoffset,
x+size/2.0, y+size/2.0+cpoffset,
*** 920,930 ****
int y = cctx.initY;
int cpoffset = (int) (size/relYmax/2);
CubicCurve2D curve = cctx.curve;
Graphics2D g2d = (Graphics2D) cctx.graphics;
g2d.translate(cctx.orgX, cctx.orgY);
! Color rCArray[] = cctx.colorlist;
int ci = cctx.colorindex;
do {
curve.setCurve(x, y+size/2.0,
x+size/2.0, y+size/2.0-cpoffset,
x+size/2.0, y+size/2.0+cpoffset,
--- 920,930 ----
int y = cctx.initY;
int cpoffset = (int) (size/relYmax/2);
CubicCurve2D curve = cctx.curve;
Graphics2D g2d = (Graphics2D) cctx.graphics;
g2d.translate(cctx.orgX, cctx.orgY);
! Color[] rCArray = cctx.colorlist;
int ci = cctx.colorindex;
do {
curve.setCurve(x, y+size/2.0,
x+size/2.0, y+size/2.0-cpoffset,
x+size/2.0, y+size/2.0+cpoffset,
*** 968,978 ****
int x = cctx.initX;
int y = cctx.initY;
Ellipse2D ellipse = cctx.ellipse;
Graphics2D g2d = (Graphics2D) cctx.graphics;
g2d.translate(cctx.orgX, cctx.orgY);
! Color rCArray[] = cctx.colorlist;
int ci = cctx.colorindex;
do {
if (rCArray != null) {
g2d.setColor(rCArray[ci++ & NUM_RANDOMCOLORMASK]);
}
--- 968,978 ----
int x = cctx.initX;
int y = cctx.initY;
Ellipse2D ellipse = cctx.ellipse;
Graphics2D g2d = (Graphics2D) cctx.graphics;
g2d.translate(cctx.orgX, cctx.orgY);
! Color[] rCArray = cctx.colorlist;
int ci = cctx.colorindex;
do {
if (rCArray != null) {
g2d.setColor(rCArray[ci++ & NUM_RANDOMCOLORMASK]);
}
*** 1010,1020 ****
int x = cctx.initX;
int y = cctx.initY;
Ellipse2D ellipse = cctx.ellipse;
Graphics2D g2d = (Graphics2D) cctx.graphics;
g2d.translate(cctx.orgX, cctx.orgY);
! Color rCArray[] = cctx.colorlist;
int ci = cctx.colorindex;
do {
if (rCArray != null) {
g2d.setColor(rCArray[ci++ & NUM_RANDOMCOLORMASK]);
}
--- 1010,1020 ----
int x = cctx.initX;
int y = cctx.initY;
Ellipse2D ellipse = cctx.ellipse;
Graphics2D g2d = (Graphics2D) cctx.graphics;
g2d.translate(cctx.orgX, cctx.orgY);
! Color[] rCArray = cctx.colorlist;
int ci = cctx.colorindex;
do {
if (rCArray != null) {
g2d.setColor(rCArray[ci++ & NUM_RANDOMCOLORMASK]);
}
< prev index next >