Search in sources :

Example 1 with GLXVSyncOffScreenSurfaceData

use of sun.java2d.opengl.GLXSurfaceData.GLXVSyncOffScreenSurfaceData in project jdk8u_jdk by JetBrains.

the class GLXGraphicsConfig method flip.

/**
     * Performs the native GLX flip operation for the given target Component.
     */
@Override
public void flip(X11ComponentPeer peer, Component target, VolatileImage xBackBuffer, int x1, int y1, int x2, int y2, BufferCapabilities.FlipContents flipAction) {
    if (flipAction == BufferCapabilities.FlipContents.COPIED) {
        SurfaceManager vsm = SurfaceManager.getManager(xBackBuffer);
        SurfaceData sd = vsm.getPrimarySurfaceData();
        if (sd instanceof GLXVSyncOffScreenSurfaceData) {
            GLXVSyncOffScreenSurfaceData vsd = (GLXVSyncOffScreenSurfaceData) sd;
            SurfaceData bbsd = vsd.getFlipSurface();
            Graphics2D bbg = new SunGraphics2D(bbsd, Color.black, Color.white, null);
            try {
                bbg.drawImage(xBackBuffer, 0, 0, null);
            } finally {
                bbg.dispose();
            }
        } else {
            Graphics g = peer.getGraphics();
            try {
                g.drawImage(xBackBuffer, x1, y1, x2, y2, x1, y1, x2, y2, null);
            } finally {
                g.dispose();
            }
            return;
        }
    } else if (flipAction == BufferCapabilities.FlipContents.PRIOR) {
        // not supported by GLX...
        return;
    }
    OGLSurfaceData.swapBuffers(peer.getContentWindow());
    if (flipAction == BufferCapabilities.FlipContents.BACKGROUND) {
        Graphics g = xBackBuffer.getGraphics();
        try {
            g.setColor(target.getBackground());
            g.fillRect(0, 0, xBackBuffer.getWidth(), xBackBuffer.getHeight());
        } finally {
            g.dispose();
        }
    }
}
Also used : Graphics(java.awt.Graphics) GLXVSyncOffScreenSurfaceData(sun.java2d.opengl.GLXSurfaceData.GLXVSyncOffScreenSurfaceData) SurfaceData(sun.java2d.SurfaceData) GLXVSyncOffScreenSurfaceData(sun.java2d.opengl.GLXSurfaceData.GLXVSyncOffScreenSurfaceData) OGLSurfaceData(sun.java2d.opengl.OGLSurfaceData) SurfaceManager(sun.awt.image.SurfaceManager) SunGraphics2D(sun.java2d.SunGraphics2D) Graphics2D(java.awt.Graphics2D) SunGraphics2D(sun.java2d.SunGraphics2D)

Aggregations

Graphics (java.awt.Graphics)1 Graphics2D (java.awt.Graphics2D)1 SurfaceManager (sun.awt.image.SurfaceManager)1 SunGraphics2D (sun.java2d.SunGraphics2D)1 SurfaceData (sun.java2d.SurfaceData)1 GLXVSyncOffScreenSurfaceData (sun.java2d.opengl.GLXSurfaceData.GLXVSyncOffScreenSurfaceData)1 OGLSurfaceData (sun.java2d.opengl.OGLSurfaceData)1