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();
}
}
}
Aggregations