java.awt.BufferCapabilities.FlipContents Java Examples

The following examples show how to use java.awt.BufferCapabilities.FlipContents. 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 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) {
        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: GLXGraphicsConfig.java    From openjdk-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 #3
Source File: D3DGraphicsConfig.java    From jdk8u-dev-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 || 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 #4
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 #5
Source File: D3DGraphicsConfig.java    From TencentKona-8 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 #6
Source File: D3DSurfaceData.java    From dragonwell8_jdk 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 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 #8
Source File: D3DSurfaceData.java    From jdk8u60 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 #9
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 #10
Source File: GLXGraphicsConfig.java    From jdk8u60 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 #11
Source File: D3DGraphicsConfig.java    From openjdk-jdk8u 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 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 #13
Source File: WGLGraphicsConfig.java    From openjdk-8 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 #14
Source File: D3DGraphicsConfig.java    From openjdk-jdk8u-backup 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 #15
Source File: WGLGraphicsConfig.java    From jdk8u-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 #16
Source File: D3DSurfaceData.java    From openjdk-jdk8u-backup 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 #17
Source File: WGLGraphicsConfig.java    From openjdk-jdk8u-backup 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 #18
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 #19
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 #20
Source File: GLXGraphicsConfig.java    From hottub 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 #21
Source File: D3DGraphicsConfig.java    From jdk8u-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 || 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 #22
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 #23
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 #24
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 #25
Source File: D3DSurfaceData.java    From openjdk-8-source 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 #26
Source File: WGLGraphicsConfig.java    From jdk8u_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 #27
Source File: D3DSurfaceData.java    From hottub 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 #28
Source File: D3DGraphicsConfig.java    From jdk8u-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 || 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 #29
Source File: VSyncedBufferStrategyTest.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
private void createBS(boolean requestVSync) {
    if (bs != null && requestVSync == currentBSVSynced) {
        return;
    }

    BufferCapabilities bc = defaultBC;
    if (requestVSync) {
        bc = new sun.java2d.pipe.hw.ExtendedBufferCapabilities(
                new ImageCapabilities(true),
                new ImageCapabilities(true),
                FlipContents.COPIED,
                sun.java2d.pipe.hw.ExtendedBufferCapabilities.VSyncType.VSYNC_ON);
    }
    try {
        createBufferStrategy(2, bc);
    } catch (AWTException e) {
        System.err.println("Warning: cap is not supported: "+bc);
        e.printStackTrace();
        createBufferStrategy(2);
    }
    currentBSVSynced = requestVSync;
    bs = getBufferStrategy();
    String s =
        getParent() instanceof Frame ?
            ((Frame)getParent()).getTitle() : "parent";
    System.out.println("Created BS for \"" + s + "\" frame, bs="+bs);
}
 
Example #30
Source File: VSyncedBufferStrategyTest.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
private void createBS(boolean requestVSync) {
    if (bs != null && requestVSync == currentBSVSynced) {
        return;
    }

    BufferCapabilities bc = defaultBC;
    if (requestVSync) {
        bc = new sun.java2d.pipe.hw.ExtendedBufferCapabilities(
                new ImageCapabilities(true),
                new ImageCapabilities(true),
                FlipContents.COPIED,
                sun.java2d.pipe.hw.ExtendedBufferCapabilities.VSyncType.VSYNC_ON);
    }
    try {
        createBufferStrategy(2, bc);
    } catch (AWTException e) {
        System.err.println("Warning: cap is not supported: "+bc);
        e.printStackTrace();
        createBufferStrategy(2);
    }
    currentBSVSynced = requestVSync;
    bs = getBufferStrategy();
    String s =
        getParent() instanceof Frame ?
            ((Frame)getParent()).getTitle() : "parent";
    System.out.println("Created BS for \"" + s + "\" frame, bs="+bs);
}