Java Code Examples for sun.awt.windows.WComponentPeer#getBounds()

The following examples show how to use sun.awt.windows.WComponentPeer#getBounds() . 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: 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 2
Source File: WGLSurfaceData.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 WGLOffScreenSurfaceData createData(WComponentPeer peer,
                                                 Image image,
                                                 int type)
{
    // the OGL pipeline can render directly to the screen and interfere
    // with layered windows, which is why we don't allow accelerated
    // surfaces in this case
    if (!peer.isAccelCapable() ||
        !SunToolkit.isContainingTopLevelOpaque((Component)peer.getTarget()))
    {
        return null;
    }
    WGLGraphicsConfig gc = getGC(peer);
    Rectangle r = peer.getBounds();
    if (type == FLIP_BACKBUFFER) {
        return new WGLOffScreenSurfaceData(peer, gc, r.width, r.height,
                                           image, peer.getColorModel(),
                                           type);
    } else {
        return new WGLVSyncOffScreenSurfaceData(peer, gc, r.width, r.height,
                                                image, peer.getColorModel(),
                                                type);
    }
}
 
Example 3
Source File: WGLSurfaceData.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 WGLOffScreenSurfaceData createData(WComponentPeer peer,
                                                 Image image,
                                                 int type)
{
    // the OGL pipeline can render directly to the screen and interfere
    // with layered windows, which is why we don't allow accelerated
    // surfaces in this case
    if (!peer.isAccelCapable() ||
        !SunToolkit.isContainingTopLevelOpaque((Component)peer.getTarget()))
    {
        return null;
    }
    WGLGraphicsConfig gc = getGC(peer);
    Rectangle r = peer.getBounds();
    if (type == FLIP_BACKBUFFER) {
        return new WGLOffScreenSurfaceData(peer, gc, r.width, r.height,
                                           image, peer.getColorModel(),
                                           type);
    } else {
        return new WGLVSyncOffScreenSurfaceData(peer, gc, r.width, r.height,
                                                image, peer.getColorModel(),
                                                type);
    }
}
 
Example 4
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 5
Source File: WGLSurfaceData.java    From jdk8u-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 WGLOffScreenSurfaceData createData(WComponentPeer peer,
                                                 Image image,
                                                 int type)
{
    // the OGL pipeline can render directly to the screen and interfere
    // with layered windows, which is why we don't allow accelerated
    // surfaces in this case
    if (!peer.isAccelCapable() ||
        !SunToolkit.isContainingTopLevelOpaque((Component)peer.getTarget()))
    {
        return null;
    }
    WGLGraphicsConfig gc = getGC(peer);
    Rectangle r = peer.getBounds();
    if (type == FLIP_BACKBUFFER) {
        return new WGLOffScreenSurfaceData(peer, gc, r.width, r.height,
                                           image, peer.getColorModel(),
                                           type);
    } else {
        return new WGLVSyncOffScreenSurfaceData(peer, gc, r.width, r.height,
                                                image, peer.getColorModel(),
                                                type);
    }
}
 
Example 6
Source File: WGLSurfaceData.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 WGLOffScreenSurfaceData createData(WComponentPeer peer,
                                                 Image image,
                                                 int type)
{
    // the OGL pipeline can render directly to the screen and interfere
    // with layered windows, which is why we don't allow accelerated
    // surfaces in this case
    if (!peer.isAccelCapable() ||
        !SunToolkit.isContainingTopLevelOpaque((Component)peer.getTarget()))
    {
        return null;
    }
    WGLGraphicsConfig gc = getGC(peer);
    Rectangle r = peer.getBounds();
    if (type == FLIP_BACKBUFFER) {
        return new WGLOffScreenSurfaceData(peer, gc, r.width, r.height,
                                           image, peer.getColorModel(),
                                           type);
    } else {
        return new WGLVSyncOffScreenSurfaceData(peer, gc, r.width, r.height,
                                                image, peer.getColorModel(),
                                                type);
    }
}
 
Example 7
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 8
Source File: WGLSurfaceData.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 WGLOffScreenSurfaceData createData(WComponentPeer peer,
                                                 Image image,
                                                 int type)
{
    // the OGL pipeline can render directly to the screen and interfere
    // with layered windows, which is why we don't allow accelerated
    // surfaces in this case
    if (!peer.isAccelCapable() ||
        !SunToolkit.isContainingTopLevelOpaque((Component)peer.getTarget()))
    {
        return null;
    }
    WGLGraphicsConfig gc = getGC(peer);
    Rectangle r = peer.getBounds();
    if (type == FLIP_BACKBUFFER) {
        return new WGLOffScreenSurfaceData(peer, gc, r.width, r.height,
                                           image, peer.getColorModel(),
                                           type);
    } else {
        return new WGLVSyncOffScreenSurfaceData(peer, gc, r.width, r.height,
                                                image, peer.getColorModel(),
                                                type);
    }
}
 
Example 9
Source File: D3DSurfaceData.java    From TencentKona-8 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 10
Source File: WGLSurfaceData.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 WGLOffScreenSurfaceData createData(WComponentPeer peer,
                                                 Image image,
                                                 int type)
{
    // the OGL pipeline can render directly to the screen and interfere
    // with layered windows, which is why we don't allow accelerated
    // surfaces in this case
    if (!peer.isAccelCapable() ||
        !SunToolkit.isContainingTopLevelOpaque((Component)peer.getTarget()))
    {
        return null;
    }
    WGLGraphicsConfig gc = getGC(peer);
    Rectangle r = peer.getBounds();
    if (type == FLIP_BACKBUFFER) {
        return new WGLOffScreenSurfaceData(peer, gc, r.width, r.height,
                                           image, peer.getColorModel(),
                                           type);
    } else {
        return new WGLVSyncOffScreenSurfaceData(peer, gc, r.width, r.height,
                                                image, peer.getColorModel(),
                                                type);
    }
}
 
Example 11
Source File: D3DScreenUpdateManager.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Determines if we can use a d3d surface for onscreen rendering for this
 * peer.
 * We only create onscreen d3d surfaces if the following conditions are met:
 *  - d3d is enabled on this device and onscreen emulation is enabled
 *  - window is big enough to bother (either dimension > MIN_WIN_SIZE)
 *  - this heavyweight doesn't have a BufferStrategy
 *  - if we are in full-screen mode then it must be the peer of the
 *    full-screen window (since there could be only one SwapChain in fs)
 *    and it must not have any heavyweight children
 *    (as Present() doesn't respect component clipping in fullscreen mode)
 *  - it's one of the classes likely to have custom rendering worth
 *    accelerating
 *
 * @returns true if we can use a d3d surface for this peer's onscreen
 *          rendering
 */
public static boolean canUseD3DOnScreen(final WComponentPeer peer,
                                        final Win32GraphicsConfig gc,
                                        final int bbNum)
{
    if (!(gc instanceof D3DGraphicsConfig)) {
        return false;
    }
    D3DGraphicsConfig d3dgc = (D3DGraphicsConfig)gc;
    D3DGraphicsDevice d3dgd = d3dgc.getD3DDevice();
    String peerName = peer.getClass().getName();
    Rectangle r = peer.getBounds();
    Component target = (Component)peer.getTarget();
    Window fsw = d3dgd.getFullScreenWindow();

    return
        WindowsFlags.isD3DOnScreenEnabled() &&
        d3dgd.isD3DEnabledOnDevice() &&
        peer.isAccelCapable() &&
        (r.width > MIN_WIN_SIZE || r.height > MIN_WIN_SIZE) &&
        bbNum == 0 &&
        (fsw == null || (fsw == target && !hasHWChildren(target))) &&
        (peerName.equals("sun.awt.windows.WCanvasPeer") ||
         peerName.equals("sun.awt.windows.WDialogPeer") ||
         peerName.equals("sun.awt.windows.WPanelPeer")  ||
         peerName.equals("sun.awt.windows.WWindowPeer") ||
         peerName.equals("sun.awt.windows.WFramePeer")  ||
         peerName.equals("sun.awt.windows.WEmbeddedFramePeer"));
}
 
Example 12
Source File: D3DSurfaceData.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
public D3DWindowSurfaceData(WComponentPeer peer,
                            D3DGraphicsConfig gc)
{
    super(peer, gc,
          peer.getBounds().width, peer.getBounds().height,
          null, peer.getColorModel(), 1, SWAP_COPY, VSYNC_DEFAULT,
          WINDOW);
    dirtyTracker = getStateTracker();
}
 
Example 13
Source File: D3DSurfaceData.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
public D3DWindowSurfaceData(WComponentPeer peer,
                            D3DGraphicsConfig gc)
{
    super(peer, gc,
          peer.getBounds().width, peer.getBounds().height,
          null, peer.getColorModel(), 1, SWAP_COPY, VSYNC_DEFAULT,
          WINDOW);
    dirtyTracker = getStateTracker();
}
 
Example 14
Source File: D3DSurfaceData.java    From jdk8u_jdk with GNU General Public License v2.0 5 votes vote down vote up
public D3DWindowSurfaceData(WComponentPeer peer,
                            D3DGraphicsConfig gc)
{
    super(peer, gc,
          peer.getBounds().width, peer.getBounds().height,
          null, peer.getColorModel(), 1, SWAP_COPY, VSYNC_DEFAULT,
          WINDOW);
    dirtyTracker = getStateTracker();
}
 
Example 15
Source File: D3DScreenUpdateManager.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Determines if we can use a d3d surface for onscreen rendering for this
 * peer.
 * We only create onscreen d3d surfaces if the following conditions are met:
 *  - d3d is enabled on this device and onscreen emulation is enabled
 *  - window is big enough to bother (either dimension > MIN_WIN_SIZE)
 *  - this heavyweight doesn't have a BufferStrategy
 *  - if we are in full-screen mode then it must be the peer of the
 *    full-screen window (since there could be only one SwapChain in fs)
 *    and it must not have any heavyweight children
 *    (as Present() doesn't respect component clipping in fullscreen mode)
 *  - it's one of the classes likely to have custom rendering worth
 *    accelerating
 *
 * @returns true if we can use a d3d surface for this peer's onscreen
 *          rendering
 */
public static boolean canUseD3DOnScreen(final WComponentPeer peer,
                                        final Win32GraphicsConfig gc,
                                        final int bbNum)
{
    if (!(gc instanceof D3DGraphicsConfig)) {
        return false;
    }
    D3DGraphicsConfig d3dgc = (D3DGraphicsConfig)gc;
    D3DGraphicsDevice d3dgd = d3dgc.getD3DDevice();
    String peerName = peer.getClass().getName();
    Rectangle r = peer.getBounds();
    Component target = (Component)peer.getTarget();
    Window fsw = d3dgd.getFullScreenWindow();

    return
        WindowsFlags.isD3DOnScreenEnabled() &&
        d3dgd.isD3DEnabledOnDevice() &&
        peer.isAccelCapable() &&
        (r.width > MIN_WIN_SIZE || r.height > MIN_WIN_SIZE) &&
        bbNum == 0 &&
        (fsw == null || (fsw == target && !hasHWChildren(target))) &&
        (peerName.equals("sun.awt.windows.WCanvasPeer") ||
         peerName.equals("sun.awt.windows.WDialogPeer") ||
         peerName.equals("sun.awt.windows.WPanelPeer")  ||
         peerName.equals("sun.awt.windows.WWindowPeer") ||
         peerName.equals("sun.awt.windows.WFramePeer")  ||
         peerName.equals("sun.awt.windows.WEmbeddedFramePeer"));
}
 
Example 16
Source File: D3DScreenUpdateManager.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Determines if we can use a d3d surface for onscreen rendering for this
 * peer.
 * We only create onscreen d3d surfaces if the following conditions are met:
 *  - d3d is enabled on this device and onscreen emulation is enabled
 *  - window is big enough to bother (either dimension > MIN_WIN_SIZE)
 *  - this heavyweight doesn't have a BufferStrategy
 *  - if we are in full-screen mode then it must be the peer of the
 *    full-screen window (since there could be only one SwapChain in fs)
 *    and it must not have any heavyweight children
 *    (as Present() doesn't respect component clipping in fullscreen mode)
 *  - it's one of the classes likely to have custom rendering worth
 *    accelerating
 *
 * @returns true if we can use a d3d surface for this peer's onscreen
 *          rendering
 */
public static boolean canUseD3DOnScreen(final WComponentPeer peer,
                                        final Win32GraphicsConfig gc,
                                        final int bbNum)
{
    if (!(gc instanceof D3DGraphicsConfig)) {
        return false;
    }
    D3DGraphicsConfig d3dgc = (D3DGraphicsConfig)gc;
    D3DGraphicsDevice d3dgd = d3dgc.getD3DDevice();
    String peerName = peer.getClass().getName();
    Rectangle r = peer.getBounds();
    Component target = (Component)peer.getTarget();
    Window fsw = d3dgd.getFullScreenWindow();

    return
        WindowsFlags.isD3DOnScreenEnabled() &&
        d3dgd.isD3DEnabledOnDevice() &&
        peer.isAccelCapable() &&
        (r.width > MIN_WIN_SIZE || r.height > MIN_WIN_SIZE) &&
        bbNum == 0 &&
        (fsw == null || (fsw == target && !hasHWChildren(target))) &&
        (peerName.equals("sun.awt.windows.WCanvasPeer") ||
         peerName.equals("sun.awt.windows.WDialogPeer") ||
         peerName.equals("sun.awt.windows.WPanelPeer")  ||
         peerName.equals("sun.awt.windows.WWindowPeer") ||
         peerName.equals("sun.awt.windows.WFramePeer")  ||
         peerName.equals("sun.awt.windows.WEmbeddedFramePeer"));
}
 
Example 17
Source File: D3DSurfaceData.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
public D3DWindowSurfaceData(WComponentPeer peer,
                            D3DGraphicsConfig gc)
{
    super(peer, gc,
          peer.getBounds().width, peer.getBounds().height,
          null, peer.getColorModel(), 1, SWAP_COPY, VSYNC_DEFAULT,
          WINDOW);
    dirtyTracker = getStateTracker();
}
 
Example 18
Source File: D3DSurfaceData.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
public D3DWindowSurfaceData(WComponentPeer peer,
                            D3DGraphicsConfig gc)
{
    super(peer, gc,
          peer.getBounds().width, peer.getBounds().height,
          null, peer.getColorModel(), 1, SWAP_COPY, VSYNC_DEFAULT,
          WINDOW);
    dirtyTracker = getStateTracker();
}
 
Example 19
Source File: D3DSurfaceData.java    From dragonwell8_jdk with GNU General Public License v2.0 5 votes vote down vote up
public D3DWindowSurfaceData(WComponentPeer peer,
                            D3DGraphicsConfig gc)
{
    super(peer, gc,
          peer.getBounds().width, peer.getBounds().height,
          null, peer.getColorModel(), 1, SWAP_COPY, VSYNC_DEFAULT,
          WINDOW);
    dirtyTracker = getStateTracker();
}
 
Example 20
Source File: D3DScreenUpdateManager.java    From dragonwell8_jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Determines if we can use a d3d surface for onscreen rendering for this
 * peer.
 * We only create onscreen d3d surfaces if the following conditions are met:
 *  - d3d is enabled on this device and onscreen emulation is enabled
 *  - window is big enough to bother (either dimension > MIN_WIN_SIZE)
 *  - this heavyweight doesn't have a BufferStrategy
 *  - if we are in full-screen mode then it must be the peer of the
 *    full-screen window (since there could be only one SwapChain in fs)
 *    and it must not have any heavyweight children
 *    (as Present() doesn't respect component clipping in fullscreen mode)
 *  - it's one of the classes likely to have custom rendering worth
 *    accelerating
 *
 * @returns true if we can use a d3d surface for this peer's onscreen
 *          rendering
 */
public static boolean canUseD3DOnScreen(final WComponentPeer peer,
                                        final Win32GraphicsConfig gc,
                                        final int bbNum)
{
    if (!(gc instanceof D3DGraphicsConfig)) {
        return false;
    }
    D3DGraphicsConfig d3dgc = (D3DGraphicsConfig)gc;
    D3DGraphicsDevice d3dgd = d3dgc.getD3DDevice();
    String peerName = peer.getClass().getName();
    Rectangle r = peer.getBounds();
    Component target = (Component)peer.getTarget();
    Window fsw = d3dgd.getFullScreenWindow();

    return
        WindowsFlags.isD3DOnScreenEnabled() &&
        d3dgd.isD3DEnabledOnDevice() &&
        peer.isAccelCapable() &&
        (r.width > MIN_WIN_SIZE || r.height > MIN_WIN_SIZE) &&
        bbNum == 0 &&
        (fsw == null || (fsw == target && !hasHWChildren(target))) &&
        (peerName.equals("sun.awt.windows.WCanvasPeer") ||
         peerName.equals("sun.awt.windows.WDialogPeer") ||
         peerName.equals("sun.awt.windows.WPanelPeer")  ||
         peerName.equals("sun.awt.windows.WWindowPeer") ||
         peerName.equals("sun.awt.windows.WFramePeer")  ||
         peerName.equals("sun.awt.windows.WEmbeddedFramePeer"));
}