Java Code Examples for java.awt.BufferCapabilities#getFlipContents()

The following examples show how to use java.awt.BufferCapabilities#getFlipContents() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: WGLGraphicsConfig.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Checks that the requested configuration is natively supported; if not,
 * an AWTException is thrown.
 */
@Override
public void assertOperationSupported(Component target,
                                     int numBuffers,
                                     BufferCapabilities caps)
    throws AWTException
{
    if (numBuffers > 2) {
        throw new AWTException(
            "Only double or single buffering is supported");
    }
    BufferCapabilities configCaps = getBufferCapabilities();
    if (!configCaps.isPageFlipping()) {
        throw new AWTException("Page flipping is not supported");
    }
    if (caps.getFlipContents() == BufferCapabilities.FlipContents.PRIOR) {
        throw new AWTException("FlipContents.PRIOR is not supported");
    }
}
 
Example 2
Source File: CGLGraphicsConfig.java    From dragonwell8_jdk with GNU General Public License v2.0 6 votes vote down vote up
@Override
public void assertOperationSupported(final int numBuffers,
                                     final BufferCapabilities caps)
        throws AWTException {
    // Assume this method is never called with numBuffers != 2, as 0 is
    // unsupported, and 1 corresponds to a SingleBufferStrategy which
    // doesn't depend on the peer. Screen is considered as a separate
    // "buffer".
    if (numBuffers != 2) {
        throw new AWTException("Only double buffering is supported");
    }
    final BufferCapabilities configCaps = getBufferCapabilities();
    if (!configCaps.isPageFlipping()) {
        throw new AWTException("Page flipping is not supported");
    }
    if (caps.getFlipContents() == BufferCapabilities.FlipContents.PRIOR) {
        throw new AWTException("FlipContents.PRIOR is not supported");
    }
}
 
Example 3
Source File: GLXGraphicsConfig.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Attempts to create a GLX-based backbuffer for the given peer.  If
 * the requested configuration is not natively supported, an AWTException
 * is thrown.  Otherwise, if the backbuffer creation is successful, a
 * value of 1 is returned.
 */
@Override
public long createBackBuffer(X11ComponentPeer peer,
                             int numBuffers, BufferCapabilities caps)
    throws AWTException
{
    if (numBuffers > 2) {
        throw new AWTException(
            "Only double or single buffering is supported");
    }
    BufferCapabilities configCaps = getBufferCapabilities();
    if (!configCaps.isPageFlipping()) {
        throw new AWTException("Page flipping is not supported");
    }
    if (caps.getFlipContents() == BufferCapabilities.FlipContents.PRIOR) {
        throw new AWTException("FlipContents.PRIOR is not supported");
    }

    // non-zero return value means backbuffer creation was successful
    // (checked in X11ComponentPeer.flip(), etc.)
    return 1;
}
 
Example 4
Source File: GLXGraphicsConfig.java    From jdk8u_jdk with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Attempts to create a GLX-based backbuffer for the given peer.  If
 * the requested configuration is not natively supported, an AWTException
 * is thrown.  Otherwise, if the backbuffer creation is successful, a
 * value of 1 is returned.
 */
@Override
public long createBackBuffer(X11ComponentPeer peer,
                             int numBuffers, BufferCapabilities caps)
    throws AWTException
{
    if (numBuffers > 2) {
        throw new AWTException(
            "Only double or single buffering is supported");
    }
    BufferCapabilities configCaps = getBufferCapabilities();
    if (!configCaps.isPageFlipping()) {
        throw new AWTException("Page flipping is not supported");
    }
    if (caps.getFlipContents() == BufferCapabilities.FlipContents.PRIOR) {
        throw new AWTException("FlipContents.PRIOR is not supported");
    }

    // non-zero return value means backbuffer creation was successful
    // (checked in X11ComponentPeer.flip(), etc.)
    return 1;
}
 
Example 5
Source File: WGLGraphicsConfig.java    From dragonwell8_jdk with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Checks that the requested configuration is natively supported; if not,
 * an AWTException is thrown.
 */
@Override
public void assertOperationSupported(Component target,
                                     int numBuffers,
                                     BufferCapabilities caps)
    throws AWTException
{
    if (numBuffers > 2) {
        throw new AWTException(
            "Only double or single buffering is supported");
    }
    BufferCapabilities configCaps = getBufferCapabilities();
    if (!configCaps.isPageFlipping()) {
        throw new AWTException("Page flipping is not supported");
    }
    if (caps.getFlipContents() == BufferCapabilities.FlipContents.PRIOR) {
        throw new AWTException("FlipContents.PRIOR is not supported");
    }
}
 
Example 6
Source File: D3DSurfaceData.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Creates a SurfaceData object representing the back buffer of a
 * double-buffered on-screen Window.
 */
public static D3DSurfaceData createData(WComponentPeer peer, Image image) {
    D3DGraphicsConfig gc = getGC(peer);
    if (gc == null || !peer.isAccelCapable()) {
        return null;
    }
    BufferCapabilities caps = peer.getBackBufferCaps();
    VSyncType vSyncType = VSYNC_DEFAULT;
    if (caps instanceof ExtendedBufferCapabilities) {
        vSyncType = ((ExtendedBufferCapabilities)caps).getVSync();
    }
    Rectangle r = peer.getBounds();
    BufferCapabilities.FlipContents flip = caps.getFlipContents();
    int swapEffect;
    if (flip == FlipContents.COPIED) {
        swapEffect = SWAP_COPY;
    } else if (flip == FlipContents.PRIOR) {
        swapEffect = SWAP_FLIP;
    } else { // flip == FlipContents.UNDEFINED || .BACKGROUND
        swapEffect = SWAP_DISCARD;
    }
    return new D3DSurfaceData(peer, gc, r.width, r.height,
                              image, peer.getColorModel(),
                              peer.getBackBuffersNum(),
                              swapEffect, vSyncType, FLIP_BACKBUFFER);
}
 
Example 7
Source File: D3DGraphicsConfig.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Checks that the requested configuration is natively supported; if not,
 * an AWTException is thrown.
 */
@Override
public void assertOperationSupported(Component target,
                                     int numBuffers,
                                     BufferCapabilities caps)
    throws AWTException
{
    if (numBuffers < 2 || numBuffers > 4) {
        throw new AWTException("Only 2-4 buffers supported");
    }
    if (caps.getFlipContents() == BufferCapabilities.FlipContents.COPIED &&
        numBuffers != 2)
    {
        throw new AWTException("FlipContents.COPIED is only" +
                               "supported for 2 buffers");
    }
}
 
Example 8
Source File: CGLGraphicsConfig.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
@Override
public void assertOperationSupported(final int numBuffers,
                                     final BufferCapabilities caps)
        throws AWTException {
    // Assume this method is never called with numBuffers != 2, as 0 is
    // unsupported, and 1 corresponds to a SingleBufferStrategy which
    // doesn't depend on the peer. Screen is considered as a separate
    // "buffer".
    if (numBuffers != 2) {
        throw new AWTException("Only double buffering is supported");
    }
    final BufferCapabilities configCaps = getBufferCapabilities();
    if (!configCaps.isPageFlipping()) {
        throw new AWTException("Page flipping is not supported");
    }
    if (caps.getFlipContents() == BufferCapabilities.FlipContents.PRIOR) {
        throw new AWTException("FlipContents.PRIOR is not supported");
    }
}
 
Example 9
Source File: CGLGraphicsConfig.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
@Override
public void assertOperationSupported(final int numBuffers,
                                     final BufferCapabilities caps)
        throws AWTException {
    // Assume this method is never called with numBuffers != 2, as 0 is
    // unsupported, and 1 corresponds to a SingleBufferStrategy which
    // doesn't depend on the peer. Screen is considered as a separate
    // "buffer".
    if (numBuffers != 2) {
        throw new AWTException("Only double buffering is supported");
    }
    final BufferCapabilities configCaps = getBufferCapabilities();
    if (!configCaps.isPageFlipping()) {
        throw new AWTException("Page flipping is not supported");
    }
    if (caps.getFlipContents() == BufferCapabilities.FlipContents.PRIOR) {
        throw new AWTException("FlipContents.PRIOR is not supported");
    }
}
 
Example 10
Source File: WGLGraphicsConfig.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Checks that the requested configuration is natively supported; if not,
 * an AWTException is thrown.
 */
@Override
public void assertOperationSupported(Component target,
                                     int numBuffers,
                                     BufferCapabilities caps)
    throws AWTException
{
    if (numBuffers > 2) {
        throw new AWTException(
            "Only double or single buffering is supported");
    }
    BufferCapabilities configCaps = getBufferCapabilities();
    if (!configCaps.isPageFlipping()) {
        throw new AWTException("Page flipping is not supported");
    }
    if (caps.getFlipContents() == BufferCapabilities.FlipContents.PRIOR) {
        throw new AWTException("FlipContents.PRIOR is not supported");
    }
}
 
Example 11
Source File: D3DGraphicsConfig.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Checks that the requested configuration is natively supported; if not,
 * an AWTException is thrown.
 */
@Override
public void assertOperationSupported(Component target,
                                     int numBuffers,
                                     BufferCapabilities caps)
    throws AWTException
{
    if (numBuffers < 2 || numBuffers > 4) {
        throw new AWTException("Only 2-4 buffers supported");
    }
    if (caps.getFlipContents() == BufferCapabilities.FlipContents.COPIED &&
        numBuffers != 2)
    {
        throw new AWTException("FlipContents.COPIED is only" +
                               "supported for 2 buffers");
    }
}
 
Example 12
Source File: GLXGraphicsConfig.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Attempts to create a GLX-based backbuffer for the given peer.  If
 * the requested configuration is not natively supported, an AWTException
 * is thrown.  Otherwise, if the backbuffer creation is successful, a
 * value of 1 is returned.
 */
@Override
public long createBackBuffer(X11ComponentPeer peer,
                             int numBuffers, BufferCapabilities caps)
    throws AWTException
{
    if (numBuffers > 2) {
        throw new AWTException(
            "Only double or single buffering is supported");
    }
    BufferCapabilities configCaps = getBufferCapabilities();
    if (!configCaps.isPageFlipping()) {
        throw new AWTException("Page flipping is not supported");
    }
    if (caps.getFlipContents() == BufferCapabilities.FlipContents.PRIOR) {
        throw new AWTException("FlipContents.PRIOR is not supported");
    }

    // non-zero return value means backbuffer creation was successful
    // (checked in X11ComponentPeer.flip(), etc.)
    return 1;
}
 
Example 13
Source File: D3DGraphicsConfig.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Checks that the requested configuration is natively supported; if not,
 * an AWTException is thrown.
 */
@Override
public void assertOperationSupported(Component target,
                                     int numBuffers,
                                     BufferCapabilities caps)
    throws AWTException
{
    if (numBuffers < 2 || numBuffers > 4) {
        throw new AWTException("Only 2-4 buffers supported");
    }
    if (caps.getFlipContents() == BufferCapabilities.FlipContents.COPIED &&
        numBuffers != 2)
    {
        throw new AWTException("FlipContents.COPIED is only" +
                               "supported for 2 buffers");
    }
}
 
Example 14
Source File: D3DSurfaceData.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Creates a SurfaceData object representing the back buffer of a
 * double-buffered on-screen Window.
 */
public static D3DSurfaceData createData(WComponentPeer peer, Image image) {
    D3DGraphicsConfig gc = getGC(peer);
    if (gc == null || !peer.isAccelCapable()) {
        return null;
    }
    BufferCapabilities caps = peer.getBackBufferCaps();
    VSyncType vSyncType = VSYNC_DEFAULT;
    if (caps instanceof ExtendedBufferCapabilities) {
        vSyncType = ((ExtendedBufferCapabilities)caps).getVSync();
    }
    Rectangle r = peer.getBounds();
    BufferCapabilities.FlipContents flip = caps.getFlipContents();
    int swapEffect;
    if (flip == FlipContents.COPIED) {
        swapEffect = SWAP_COPY;
    } else if (flip == FlipContents.PRIOR) {
        swapEffect = SWAP_FLIP;
    } else { // flip == FlipContents.UNDEFINED || .BACKGROUND
        swapEffect = SWAP_DISCARD;
    }
    return new D3DSurfaceData(peer, gc, r.width, r.height,
                              image, peer.getColorModel(),
                              peer.getBackBuffersNum(),
                              swapEffect, vSyncType, FLIP_BACKBUFFER);
}
 
Example 15
Source File: ExtendedBufferCapabilities.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Creates an ExtendedBufferCapabilities instance with front/back/flip caps
 * from the passed cap, and the passed v-sync mode.
 */
public ExtendedBufferCapabilities(BufferCapabilities caps, VSyncType t) {
    super(caps.getFrontBufferCapabilities(),
          caps.getBackBufferCapabilities(),
          caps.getFlipContents());

    this.vsync = t;
}
 
Example 16
Source File: ExtendedBufferCapabilities.java    From Bytecoder with Apache License 2.0 5 votes vote down vote up
/**
 * Creates an ExtendedBufferCapabilities object with front/back/flip caps
 * from the passed cap, and VSYNC_DEFAULT v-sync mode.
 */
public ExtendedBufferCapabilities(BufferCapabilities caps) {
    super(caps.getFrontBufferCapabilities(),
          caps.getBackBufferCapabilities(),
          caps.getFlipContents());

    this.vsync = VSyncType.VSYNC_DEFAULT;
}
 
Example 17
Source File: ExtendedBufferCapabilities.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Creates an ExtendedBufferCapabilities object with front/back/flip caps
 * from the passed cap, and VSYNC_DEFAULT v-sync mode.
 */
public ExtendedBufferCapabilities(BufferCapabilities caps) {
    super(caps.getFrontBufferCapabilities(),
          caps.getBackBufferCapabilities(),
          caps.getFlipContents());

    this.vsync = VSyncType.VSYNC_DEFAULT;
}
 
Example 18
Source File: ExtendedBufferCapabilities.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Creates an ExtendedBufferCapabilities object with front/back/flip caps
 * from the passed cap, and VSYNC_DEFAULT v-sync mode.
 */
public ExtendedBufferCapabilities(BufferCapabilities caps) {
    super(caps.getFrontBufferCapabilities(),
          caps.getBackBufferCapabilities(),
          caps.getFlipContents());

    this.vsync = VSyncType.VSYNC_DEFAULT;
}
 
Example 19
Source File: ExtendedBufferCapabilities.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Creates an ExtendedBufferCapabilities instance with front/back/flip caps
 * from the passed cap, and the passed v-sync mode.
 */
public ExtendedBufferCapabilities(BufferCapabilities caps, VSyncType t) {
    super(caps.getFrontBufferCapabilities(),
          caps.getBackBufferCapabilities(),
          caps.getFlipContents());

    this.vsync = t;
}
 
Example 20
Source File: ExtendedBufferCapabilities.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Creates an ExtendedBufferCapabilities instance with front/back/flip caps
 * from the passed cap, and the passed v-sync mode.
 */
public ExtendedBufferCapabilities(BufferCapabilities caps, VSyncType t) {
    super(caps.getFrontBufferCapabilities(),
          caps.getBackBufferCapabilities(),
          caps.getFlipContents());

    this.vsync = t;
}