/*
* 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 6521533 6525997
* @summary Verifies that the OGL-accelerated codepaths for GradientPaint,
* LinearGradientPaint, and RadialGradientPaint produce results that are
* sufficiently close to those produced by the software codepaths.
* @author campbelc
*/
/*
* We expect slight differences in rendering between the OpenGL and
* software pipelines due to algorithmic and rounding differences.
* The purpose of this test is just to make sure that the OGL pipeline
* is producing results that are "reasonably" consistent with those
* produced in software, so we will allow +/-TOLERANCE differences
* in each component. When comparing the test and reference images,
* we add up the number of pixels that fall outside this tolerance
* range and if the sum is larger than some percentage of the total
* number of pixels.
*
* REMIND: Note that we have separate thresholds for linear and radial
* gradients because the visible differences between OGL and software
* are more apparent in the radial cases. In the future we should try
* to reduce the number of mismatches between the two approaches, but
* for now the visible differences are slight enough to not cause worry.
*/
private static final int ALLOWED_MISMATCHES_LINEAR =
private static final int ALLOWED_MISMATCHES_RADIAL =
private static boolean done;
private static boolean verbose;
};
};
synchronized (this) {
if (!done) {
done = true;
notifyAll();
}
}
}
}
{
for (int numStops : numStopsArray) {
"type=" + paintType +
" cycleMethod=" + cycleMethod +
" colorSpace=" + colorSpace +
" xformType=" + xform +
" numStops=" + numStops +
" aa=" + aahint;
int allowedMismatches =
msg);
}
}
}
}
}
}
}
{
float radius = 100.0f;
}
switch (xformType) {
default:
case IDENTITY:
transform = new AffineTransform();
break;
case TRANSLATE:
break;
case SCALE:
break;
case SHEAR:
break;
case ROTATE:
getWidth()/2,
getHeight()/2);
break;
}
switch (paintType) {
case BASIC:
paint =
break;
default:
case LINEAR:
paint =
break;
case RADIAL:
paint =
break;
}
return paint;
}
}
}
int tolerance, int allowedMismatches,
{
int numMismatches = 0;
int x1 = 0;
int y1 = 0;
}
}
}
if (verbose) {
}
if (numMismatches > allowedMismatches) {
try {
new File("GradientPaints.ref.png"));
new File("GradientPaints.cap.png"));
} catch (Exception e) {
}
if (!verbose) {
}
throw new RuntimeException("Test failed: Number of mismatches (" +
") exceeds limit (" +
") with tolerance=" +
}
}
{
return true;
}
return false;
}
verbose = true;
}
frame.setVisible(true);
// Wait until the component's been painted
synchronized (test) {
while (!done) {
try {
} catch (InterruptedException e) {
throw new RuntimeException("Failed: Interrupted");
}
}
}
"test considered PASSED");
return;
}
try {
} finally {
}
}
}