Search in sources :

Example 1 with AccelGraphicsConfig

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);
}
Also used : AccelGraphicsConfig(sun.java2d.pipe.hw.AccelGraphicsConfig) GraphicsConfiguration(java.awt.GraphicsConfiguration)

Example 2 with AccelGraphicsConfig

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);
}
Also used : Graphics(java.awt.Graphics) AccelSurface(sun.java2d.pipe.hw.AccelSurface) VolatileImage(java.awt.image.VolatileImage) AccelGraphicsConfig(sun.java2d.pipe.hw.AccelGraphicsConfig) DestSurfaceProvider(sun.java2d.DestSurfaceProvider) Surface(sun.java2d.Surface) AccelSurface(sun.java2d.pipe.hw.AccelSurface)

Example 3 with AccelGraphicsConfig

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);
    }
}
Also used : AccelGraphicsConfig(sun.java2d.pipe.hw.AccelGraphicsConfig) RenderQueue(sun.java2d.pipe.RenderQueue) GraphicsEnvironment(java.awt.GraphicsEnvironment) GraphicsConfiguration(java.awt.GraphicsConfiguration) BufferedContext(sun.java2d.pipe.BufferedContext)

Aggregations

AccelGraphicsConfig (sun.java2d.pipe.hw.AccelGraphicsConfig)3 GraphicsConfiguration (java.awt.GraphicsConfiguration)2 Graphics (java.awt.Graphics)1 GraphicsEnvironment (java.awt.GraphicsEnvironment)1 VolatileImage (java.awt.image.VolatileImage)1 DestSurfaceProvider (sun.java2d.DestSurfaceProvider)1 Surface (sun.java2d.Surface)1 BufferedContext (sun.java2d.pipe.BufferedContext)1 RenderQueue (sun.java2d.pipe.RenderQueue)1 AccelSurface (sun.java2d.pipe.hw.AccelSurface)1