/*
* 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 7124347
* @summary Verifies that rendering with XOR composite, and arbitraty
* custom composite doesn not cause internal errors.
*
*/
public class CustomCompositeTest {
paintError = null;
public void run() {
initGUI();
}
});
try {
paintLatch.await();
} catch (InterruptedException e) {
};
if (paintError != null) {
}
// now resise the frame in order to cause re-paint with accelerated
// source images.
paintError = null;
public void run() {
}
});
try {
paintLatch.await();
} catch (InterruptedException e) {
};
if (paintError != null) {
}
// test rendering to accelerated volatile image
testVolatileImage(cfg, true);
// test rendering to unaccelerated volatile image
testVolatileImage(cfg, false);
}
boolean accelerated)
{
try {
new ImageCapabilities(accelerated));
} catch (AWTException e) {
return;
}
}
do {
try {
} catch (Throwable e) {
throw new RuntimeException("Test FAILED.", e);
}
} while (dst.contentsLost());
}
private static void initGUI() {
frame.setVisible(true);
}
public MyComp() {
}
}
return theImage;
}
}
try {
} catch (Throwable e) {
paintError = e;
}
if (paintLatch != null) {
}
}
// draw original image
// draw image with custom composite
// draw image with XOR
}
}
// A silly custom Composite to demonstrate the problem - just inverts the RGB
public CompositeContext createContext(ColorModel srcColorModel, ColorModel dstColorModel, RenderingHints hints) {
return new TestCompositeContext();
}
}
public void dispose() {
}
int dstOutScanStride = ((SinglePixelPackedSampleModel) dstOut.getSampleModel()).getScanlineStride();
int srcAdjust = srcScanStride - w;
int dstOutAdjust = dstOutScanStride - w;
int doi = dstOutOffset;
for (int i = 0; i < h; i++) {
for (int j = 0; j < w; j++) {
si++;
doi++;
}
doi += dstOutAdjust;
}
}
}
}