use of sun.java2d.pipe.hw.AccelGraphicsConfig in project jdk8u_jdk by JetBrains.
the class TranslucentWindowPainter method createInstance.
/**
* Creates an instance of the painter for particular peer.
*/
public static TranslucentWindowPainter createInstance(WWindowPeer peer) {
GraphicsConfiguration gc = peer.getGraphicsConfiguration();
if (!forceSW && gc instanceof AccelGraphicsConfig) {
String gcName = gc.getClass().getSimpleName();
AccelGraphicsConfig agc = (AccelGraphicsConfig) gc;
// (those have higher transfer rate from gpu to cpu)
if ((agc.getContextCapabilities().getCaps() & CAPS_PS30) != 0 || forceOpt) {
// a pipeline isn't enabled
if (gcName.startsWith("D3D")) {
return new VIOptD3DWindowPainter(peer);
} else if (forceOpt && gcName.startsWith("WGL")) {
// unless forced
return new VIOptWGLWindowPainter(peer);
}
}
}
return new BIWindowPainter(peer);
}
use of sun.java2d.pipe.hw.AccelGraphicsConfig in project jdk8u_jdk by JetBrains.
the class RSLAPITest method testGC.
private static void testGC(GraphicsConfiguration gc) {
if (!(gc instanceof AccelGraphicsConfig)) {
System.out.println("Test passed: no hw accelerated configs found.");
return;
}
System.out.println("AccelGraphicsConfig exists, testing.");
AccelGraphicsConfig agc = (AccelGraphicsConfig) gc;
printAGC(agc);
testContext(agc);
VolatileImage vi = gc.createCompatibleVolatileImage(10, 10);
vi.validate(gc);
if (vi instanceof DestSurfaceProvider) {
System.out.println("Passed: VI is DestSurfaceProvider");
Surface s = ((DestSurfaceProvider) vi).getDestSurface();
if (s instanceof AccelSurface) {
System.out.println("Passed: Obtained Accel Surface");
printSurface((AccelSurface) s);
}
Graphics g = vi.getGraphics();
if (g instanceof DestSurfaceProvider) {
System.out.println("Passed: VI graphics is " + "DestSurfaceProvider");
printSurface(((DestSurfaceProvider) g).getDestSurface());
}
} else {
System.out.println("VI is not DestSurfaceProvider");
}
testVICreation(agc, CAPS_RT_TEXTURE_ALPHA, TRANSLUCENT, RT_TEXTURE);
testVICreation(agc, CAPS_RT_TEXTURE_OPAQUE, OPAQUE, RT_TEXTURE);
testVICreation(agc, CAPS_RT_PLAIN_ALPHA, TRANSLUCENT, RT_PLAIN);
testVICreation(agc, agc.getContextCapabilities().getCaps(), OPAQUE, TEXTURE);
testForNPEDuringCreation(agc);
}
use of sun.java2d.pipe.hw.AccelGraphicsConfig in project jdk8u_jdk by JetBrains.
the class StrikeCache method disposeStrike.
static void disposeStrike(final FontStrikeDisposer disposer) {
if (Disposer.pollingQueue) {
doDispose(disposer);
return;
}
RenderQueue rq = null;
GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
if (!ge.isHeadless()) {
GraphicsConfiguration gc = ge.getDefaultScreenDevice().getDefaultConfiguration();
if (gc instanceof AccelGraphicsConfig) {
AccelGraphicsConfig agc = (AccelGraphicsConfig) gc;
BufferedContext bc = agc.getContext();
if (bc != null) {
rq = bc.getRenderQueue();
}
}
}
if (rq != null) {
rq.lock();
try {
rq.flushAndInvokeNow(new Runnable() {
public void run() {
doDispose(disposer);
Disposer.pollRemove();
}
});
} finally {
rq.unlock();
}
} else {
doDispose(disposer);
}
}
Aggregations