/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* 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 6766342
* @summary Tests clipping invariance for AA rectangle and line primitives
* @run main RenderClipTest -strict -readfile 6766342.tests
* @run main RenderClipTest -rectsuite -count 10
*/
public class RenderClipTest {
public static double randDblCoord() {
}
public static float randFltCoord() {
return (float) randDblCoord();
}
public static int randIntCoord() {
}
public static int randInt(int n) {
}
static int numtests;
static int numerrors;
static int numfillfailures;
static int numstrokefailures;
static int maxerr;
static boolean useAA;
static boolean strokePure;
static boolean testFill;
static boolean testDraw;
static boolean silent;
static boolean verbose;
static boolean strict;
static boolean showErrors;
static float lw;
static double rot;
public static abstract class AnnotatedRenderOp {
{
return ar;
}
return null;
}
public abstract void randomize();
}
}
}
}
}
"[-read[file F]] [-rectsuite] [-fill] [-draw]");
"[-aa] [-pure] [-lw N] [-rot N]");
"[-rectmethod] [-linemethod] [-rect] [-line]");
"[-cubic] [-quad] [-poly] [-path]");
"[-silent] [-verbose] [-showerr] [-count N]");
"[-strict] [-usage]");
"(default 1.0)");
"(default 0.0)");
"(default 1000)");
}
boolean readTests = false;
boolean rectsuite = false;
int count = 1000;
lw = 1.0f;
rot = 0.0;
useAA = true;
strokePure = true;
testFill = true;
testDraw = true;
}
}
verbose = true;
strict = true;
silent = true;
showErrors = true;
}
readTests = true;
readTests = true;
rectsuite = true;
}
} else {
}
}
if (readTests) {
useAA || strokePure ||
{
usage("Should not specify test types with -read options");
}
} else if (rectsuite) {
useAA || strokePure ||
{
usage("Should not specify test types with -rectsuite option");
}
} else {
usage("No work: Must specify one or both of "+
"-fill or -draw");
}
usage("No work: Must specify one or more of "+
"-rect[method], -line[method], "+
"-cubic, -quad, -poly, or -path");
}
}
initImages();
if (readTests) {
try {
} else {
File f =
readFile);
is = new FileInputStream(f);
}
} catch (IOException e) {
throw new RuntimeException(e);
}
} else if (rectsuite) {
} else {
initGCs();
}
disposeGCs();
}
}
public static int reportStatistics() {
if (numfillfailures > 0) {
connector = "and ";
}
if (numstrokefailures > 0) {
}
if (totalfailures == 0) {
}
if (strict) {
}
if (critical > 0) {
}
return (numerrors+totalfailures);
}
AnnotatedRenderOp ops[] = {
new Rect(),
new RectMethod(),
new Line(),
new LineMethod(),
};
// Sometimes different fill algorithms are chosen for
// thin and wide line modes, make sure we test both...
2.0f, 2.5f,
5.0f, 5.3f };
135.0, 180.0,
200.0, 270.0,
300.0};
for (double r: rotations) {
rot = r;
for (int i = 0; i < 8; i++) {
float linewidths[];
if ((i & 1) == 0) {
(ar instanceof LineMethod))
{
continue;
}
testFill = true;
testDraw = false;
} else {
testFill = false;
testDraw = true;
}
for (float w : linewidths) {
lw = w;
}
}
}
}
}
if (verbose) {
if (useAA) {
}
if (strokePure) {
}
if (lw != 1.0f) {
}
if (rot != 0.0f) {
}
}
initGCs();
disposeGCs();
}
if (leftparen >= 0) {
}
return s;
}
for (int i = 0; i < count; i++) {
if (testDraw) {
}
if (testFill) {
}
}
}
public static void initImages() {
}
public static void initGCs() {
if (lw != 1.0f) {
}
if (rot != 0.0) {
}
if (strokePure) {
}
if (useAA) {
maxerr = 1;
}
}
public static void disposeGCs() {
}
continue;
}
continue;
}
continue;
}
{
continue;
}
continue;
}
}
}
boolean isfill = false;
useAA = strokePure = false;
lw = 1.0f;
rot = 0.0;
isfill = false;
isfill = true;
} else {
}
useAA = true;
}
strokePure = true;
}
if (index > 0) {
}
}
if (index > 0) {
}
}
initGCs();
disposeGCs();
} else {
}
}
if (isfill) {
} else {
}
}
}
return sppsm.getScanlineStride();
}
-r.getSampleModelTranslateY());
}
int maxd = 0;
for (int i = 0; i < 32; i += 8) {
if (maxd < d) {
maxd = d;
}
}
return maxd;
}
{
numtests++;
// We want to check for errors outside the clip at a higher
// priority than errors involving different pixels touched
// inside the clip.
// Check above clip
0, 0, 40, 10))
{
return;
}
// Check below clip
0, 30, 40, 40))
{
return;
}
// Check left of clip
0, 10, 10, 30))
{
return;
}
// Check right of clip
30, 10, 40, 30))
{
return;
}
// Check inside clip
10, 10, 30, 30);
}
{
boolean failed;
int rgbref;
int rgbtst;
/* Outside of clip, must be white, no error tolerance */
reason = "stray pixel rendered outside of clip";
} else {
/* Inside of clip, check for maxerr delta in components */
reason = "different pixel rendered inside clip";
}
if (failed) {
numerrors++;
}
if (wasfill) {
} else {
}
if (!silent) {
"]");
}
if (showErrors) {
}
return true;
}
}
}
return false;
}
errw.setVisible(true);
errw.waitForHide();
}
return null;
}
double coords[] = new double[8];
boolean foundparen = false;
if (index < 0) {
return null;
}
if (index < 0) {
return null;
}
foundparen = true;
}
try {
} catch (NumberFormatException nfe) {
return null;
}
}
return null;
}
return c;
}
public void randomize() {
randDblCoord(), randDblCoord(),
randDblCoord(), randDblCoord(),
randDblCoord(), randDblCoord());
}
return cubic;
}
return ("Cubic("+
+")");
}
}
return null;
}
double coords[] = new double[6];
boolean foundparen = false;
if (index < 0) {
return null;
}
if (index < 0) {
return null;
}
foundparen = true;
}
try {
} catch (NumberFormatException nfe) {
return null;
}
}
return null;
}
return c;
}
public void randomize() {
randDblCoord(), randDblCoord(),
randDblCoord(), randDblCoord());
}
return quad;
}
return ("Quad("+
+")");
}
}
return null;
}
while (true) {
int x, y;
break;
}
if (p.npoints > 0) {
} else {
return null;
}
}
} else {
return null;
}
if (index < 0) {
return null;
}
try {
} catch (NumberFormatException nfe) {
return null;
}
if (index < 0) {
return null;
}
try {
} catch (NumberFormatException nfe) {
return null;
}
p.addPoint(x, y);
}
return null;
}
if (p.npoints < 3) {
return null;
}
return new Poly(p);
}
public Poly() {
}
this.poly = p;
}
public void randomize() {
}
return poly;
}
if (i != 0) {
}
}
}
}
return null;
}
float coords[] = new float[6];
int numsegs = 0;
while (true) {
int type;
int n;
break;
}
n = 2;
n = 2;
n = 4;
n = 6;
n = 0;
} else {
return null;
}
if (n == 0) {
} else {
return null;
}
}
for (int i = 0; i < n; i++) {
int index;
if (i < n-1) {
} else {
}
if (index < 0) {
return null;
}
try {
} catch (NumberFormatException nfe) {
return null;
}
}
switch (type) {
case PathIterator.SEG_MOVETO:
break;
case PathIterator.SEG_LINETO:
break;
case PathIterator.SEG_QUADTO:
break;
case PathIterator.SEG_CUBICTO:
break;
case PathIterator.SEG_CLOSE:
break;
}
numsegs++;
}
return null;
}
if (numsegs < 2) {
return null;
}
}
public Path() {
this.path = new GeneralPath();
}
}
public void randomize() {
switch(randInt(5)) {
case 0:
break;
case 1:
break;
case 2:
randFltCoord(), randFltCoord());
break;
case 3:
randFltCoord(), randFltCoord(),
randFltCoord(), randFltCoord());
break;
case 4:
break;
}
}
}
return path;
}
float coords[] = new float[6];
boolean first = true;
int n;
char c;
case PathIterator.SEG_MOVETO:
c = 'M';
n = 2;
break;
case PathIterator.SEG_LINETO:
c = 'L';
n = 2;
break;
case PathIterator.SEG_QUADTO:
c = 'Q';
n = 4;
break;
case PathIterator.SEG_CUBICTO:
c = 'C';
n = 6;
break;
case PathIterator.SEG_CLOSE:
c = 'E';
n = 0;
break;
default:
throw new InternalError("Unknown segment!");
}
for (int i = 0; i < n; i++) {
if (i != 0) {
}
}
}
}
}
return null;
}
double coords[] = new double[4];
boolean foundparen = false;
if (index < 0) {
return null;
}
if (index < 0) {
return null;
}
foundparen = true;
}
try {
} catch (NumberFormatException nfe) {
return null;
}
}
return null;
}
return r;
}
public void randomize() {
randDblCoord(), randDblCoord());
}
return rect;
}
return ("Rect("+
+")");
}
}
return null;
}
double coords[] = new double[4];
boolean foundparen = false;
if (index < 0) {
return null;
}
if (index < 0) {
return null;
}
foundparen = true;
}
try {
} catch (NumberFormatException nfe) {
return null;
}
}
return null;
}
return l;
}
public void randomize() {
randDblCoord(), randDblCoord());
}
return line;
}
return ("Line("+
+")");
}
}
return null;
}
int coords[] = new int[4];
boolean foundparen = false;
if (index < 0) {
return null;
}
if (index < 0) {
return null;
}
foundparen = true;
}
try {
} catch (NumberFormatException nfe) {
return null;
}
}
return null;
}
return rm;
}
public void randomize() {
randIntCoord(), randIntCoord());
}
}
}
return ("RectMethod("+
rect.x+", "+
rect.y+", "+
+")");
}
}
return null;
}
int coords[] = new int[4];
boolean foundparen = false;
if (index < 0) {
return null;
}
if (index < 0) {
return null;
}
foundparen = true;
}
try {
} catch (NumberFormatException nfe) {
return null;
}
}
return null;
}
return lm;
}
public void randomize() {
}
}
}
return ("LineMethod("+
line[3]
+")");
}
}
public ErrorWindow() {
super("Error Comparison Window");
unclipped = new ImageCanvas();
reference = new ImageCanvas();
actual = new ImageCanvas();
diff = new ImageCanvas();
addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent e) {
setVisible(false);
}
});
}
}
invalidate();
pack();
repaint();
}
super.setVisible(vis);
synchronized (this) {
notifyAll();
}
}
public synchronized void waitForHide() {
while (isShowing()) {
try {
wait();
} catch (InterruptedException e) {
}
}
}
}
int rows;
int cols;
int hgap;
int vgap;
public SmartGridLayout(int r, int c, int h, int v) {
this.rows = r;
this.cols = c;
this.hgap = h;
this.vgap = v;
}
}
}
if (nrows > 0) {
} else {
}
int x = 0;
int y = 0;
for (int i = 0 ; i < ncomponents ; i++) {
? comp.getMinimumSize()
: comp.getPreferredSize());
}
}
x++;
if (x >= ncols) {
x = 0;
y++;
}
}
for (int i = 0; i < ncols; i++) {
}
for (int i = 0; i < nrows; i++) {
}
}
}
}
}
int r = 0;
int c = 0;
for (int i = 0; i < ncomponents; i++) {
if (c >= ncols) {
c = 0;
if (r >= nrows) {
// just in case
break;
}
}
}
}
{
return minsizes;
}
return prefsizes;
}
int prevhappy = 0;
int nhappy = 0;
int happysize = 0;
do {
happysize = 0;
for (int i = 0; i < num; i++) {
{
nhappy++;
} else {
}
}
return sizes;
}
}
}
return image;
}
public void checkImage(int w, int h) {
{
}
}
g.dispose();
}
checkImage(w, h);
g.setPaintMode();
g.dispose();
}
return new Dimension();
} else {
}
}
}
}
}