Search in sources :

Example 1 with BufferedContext

use of sun.java2d.pipe.BufferedContext in project jdk8u_jdk by JetBrains.

the class RSLAPITest method testContext.

private static void testContext(final AccelGraphicsConfig agc) {
    BufferedContext c = agc.getContext();
    final AccelDeviceEventListener l = new AccelDeviceEventListener() {

        public void onDeviceDispose() {
            System.out.println("onDeviceDispose invoked");
            agc.removeDeviceEventListener(this);
        }

        public void onDeviceReset() {
            System.out.println("onDeviceReset invoked");
        }
    };
    agc.addDeviceEventListener(l);
    RenderQueue rq = c.getRenderQueue();
    rq.lock();
    try {
        c.saveState();
        rq.flushNow();
        c.restoreState();
        rq.flushNow();
        System.out.println("Passed: Save/Restore");
    } finally {
        rq.unlock();
    }
}
Also used : RenderQueue(sun.java2d.pipe.RenderQueue) AccelDeviceEventListener(sun.java2d.pipe.hw.AccelDeviceEventListener) BufferedContext(sun.java2d.pipe.BufferedContext)

Example 2 with BufferedContext

use of sun.java2d.pipe.BufferedContext 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

BufferedContext (sun.java2d.pipe.BufferedContext)2 RenderQueue (sun.java2d.pipe.RenderQueue)2 GraphicsConfiguration (java.awt.GraphicsConfiguration)1 GraphicsEnvironment (java.awt.GraphicsEnvironment)1 AccelDeviceEventListener (sun.java2d.pipe.hw.AccelDeviceEventListener)1 AccelGraphicsConfig (sun.java2d.pipe.hw.AccelGraphicsConfig)1