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

The following examples show how to use sun.awt.windows.WComponentPeer#getTarget() . 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: D3DGraphicsConfig.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Creates a D3D-based backbuffer for the given peer and returns the
 * image wrapper.
 */
@Override
public VolatileImage createBackBuffer(WComponentPeer peer) {
    Component target = (Component)peer.getTarget();
    // it is possible for the component to have size 0x0, adjust it to
    // be at least 1x1 to avoid IAE
    int w = Math.max(1, target.getWidth());
    int h = Math.max(1, target.getHeight());
    return new SunVolatileImage(target, w, h, Boolean.TRUE);
}
 
Example 2
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 3
Source File: WGLGraphicsConfig.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Creates a WGL-based backbuffer for the given peer and returns the
 * image wrapper.
 */
@Override
public VolatileImage createBackBuffer(WComponentPeer peer) {
    Component target = (Component)peer.getTarget();
    // it is possible for the component to have size 0x0, adjust it to
    // be at least 1x1 to avoid IAE
    int w = Math.max(1, target.getWidth());
    int h = Math.max(1, target.getHeight());
    return new SunVolatileImage(target,
                                w, h,
                                Boolean.TRUE);
}
 
Example 4
Source File: D3DScreenUpdateManager.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Posts a repaint event for the peer's target to the EDT
 * @param peer for which target's the repaint should be issued
 */
private void repaintPeerTarget(WComponentPeer peer) {
    Component target = (Component)peer.getTarget();
    Rectangle bounds = AWTAccessor.getComponentAccessor().getBounds(target);
    // the system-level painting operations should call the handlePaint()
    // method of the WComponentPeer class to repaint the component;
    // calling repaint() forces AWT to make call to update()
    peer.handlePaint(0, 0, bounds.width, bounds.height);
}
 
Example 5
Source File: WGLGraphicsConfig.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Creates a WGL-based backbuffer for the given peer and returns the
 * image wrapper.
 */
@Override
public VolatileImage createBackBuffer(WComponentPeer peer) {
    Component target = (Component)peer.getTarget();
    return new SunVolatileImage(target,
                                target.getWidth(), target.getHeight(),
                                Boolean.TRUE);
}
 
Example 6
Source File: D3DScreenUpdateManager.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Posts a repaint event for the peer's target to the EDT
 * @param peer for which target's the repaint should be issued
 */
private void repaintPeerTarget(WComponentPeer peer) {
    Component target = (Component)peer.getTarget();
    Rectangle bounds = AWTAccessor.getComponentAccessor().getBounds(target);
    // the system-level painting operations should call the handlePaint()
    // method of the WComponentPeer class to repaint the component;
    // calling repaint() forces AWT to make call to update()
    peer.handlePaint(0, 0, bounds.width, bounds.height);
}
 
Example 7
Source File: D3DScreenUpdateManager.java    From jdk8u60 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 8
Source File: D3DGraphicsConfig.java    From dragonwell8_jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Creates a D3D-based backbuffer for the given peer and returns the
 * image wrapper.
 */
@Override
public VolatileImage createBackBuffer(WComponentPeer peer) {
    Component target = (Component)peer.getTarget();
    // it is possible for the component to have size 0x0, adjust it to
    // be at least 1x1 to avoid IAE
    int w = Math.max(1, target.getWidth());
    int h = Math.max(1, target.getHeight());
    return new SunVolatileImage(target, w, h, Boolean.TRUE);
}
 
Example 9
Source File: D3DScreenUpdateManager.java    From openjdk-jdk9 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
 *
 * @return 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 10
Source File: D3DScreenUpdateManager.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Posts a repaint event for the peer's target to the EDT
 * @param peer for which target's the repaint should be issued
 */
private void repaintPeerTarget(WComponentPeer peer) {
    Component target = (Component)peer.getTarget();
    Rectangle bounds = AWTAccessor.getComponentAccessor().getBounds(target);
    // the system-level painting operations should call the handlePaint()
    // method of the WComponentPeer class to repaint the component;
    // calling repaint() forces AWT to make call to update()
    peer.handlePaint(0, 0, bounds.width, bounds.height);
}
 
Example 11
Source File: WGLGraphicsConfig.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Creates a WGL-based backbuffer for the given peer and returns the
 * image wrapper.
 */
@Override
public VolatileImage createBackBuffer(WComponentPeer peer) {
    Component target = (Component)peer.getTarget();
    // it is possible for the component to have size 0x0, adjust it to
    // be at least 1x1 to avoid IAE
    int w = Math.max(1, target.getWidth());
    int h = Math.max(1, target.getHeight());
    return new SunVolatileImage(target,
                                w, h,
                                Boolean.TRUE);
}
 
Example 12
Source File: D3DGraphicsConfig.java    From jdk8u-dev-jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Creates a D3D-based backbuffer for the given peer and returns the
 * image wrapper.
 */
@Override
public VolatileImage createBackBuffer(WComponentPeer peer) {
    Component target = (Component)peer.getTarget();
    // it is possible for the component to have size 0x0, adjust it to
    // be at least 1x1 to avoid IAE
    int w = Math.max(1, target.getWidth());
    int h = Math.max(1, target.getHeight());
    return new SunVolatileImage(target, w, h, Boolean.TRUE);
}
 
Example 13
Source File: D3DScreenUpdateManager.java    From openjdk-8 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 14
Source File: WGLGraphicsConfig.java    From dragonwell8_jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Creates a WGL-based backbuffer for the given peer and returns the
 * image wrapper.
 */
@Override
public VolatileImage createBackBuffer(WComponentPeer peer) {
    Component target = (Component)peer.getTarget();
    // it is possible for the component to have size 0x0, adjust it to
    // be at least 1x1 to avoid IAE
    int w = Math.max(1, target.getWidth());
    int h = Math.max(1, target.getHeight());
    return new SunVolatileImage(target,
                                w, h,
                                Boolean.TRUE);
}
 
Example 15
Source File: D3DScreenUpdateManager.java    From jdk8u-dev-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 16
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"));
}
 
Example 17
Source File: Win32GraphicsConfig.java    From hottub with GNU General Public License v2.0 3 votes vote down vote up
/**
 * This method is called from WComponentPeer when a surface data is replaced
 * REMIND: while the default pipeline doesn't support flipping, it may
 * happen that the accelerated device may have this graphics config
 * (like if the device restoration failed when one device exits fs mode
 * while others remain).
 */
public VolatileImage createBackBuffer(WComponentPeer peer) {
    Component target = (Component)peer.getTarget();
    return new SunVolatileImage(target,
                                target.getWidth(), target.getHeight(),
                                Boolean.TRUE);
}
 
Example 18
Source File: Win32GraphicsConfig.java    From jdk8u60 with GNU General Public License v2.0 3 votes vote down vote up
/**
 * This method is called from WComponentPeer when a surface data is replaced
 * REMIND: while the default pipeline doesn't support flipping, it may
 * happen that the accelerated device may have this graphics config
 * (like if the device restoration failed when one device exits fs mode
 * while others remain).
 */
public VolatileImage createBackBuffer(WComponentPeer peer) {
    Component target = (Component)peer.getTarget();
    return new SunVolatileImage(target,
                                target.getWidth(), target.getHeight(),
                                Boolean.TRUE);
}
 
Example 19
Source File: Win32GraphicsConfig.java    From jdk8u_jdk with GNU General Public License v2.0 3 votes vote down vote up
/**
 * This method is called from WComponentPeer when a surface data is replaced
 * REMIND: while the default pipeline doesn't support flipping, it may
 * happen that the accelerated device may have this graphics config
 * (like if the device restoration failed when one device exits fs mode
 * while others remain).
 */
public VolatileImage createBackBuffer(WComponentPeer peer) {
    Component target = (Component)peer.getTarget();
    return new SunVolatileImage(target,
                                target.getWidth(), target.getHeight(),
                                Boolean.TRUE);
}
 
Example 20
Source File: Win32GraphicsConfig.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 3 votes vote down vote up
/**
 * This method is called from WComponentPeer when a surface data is replaced
 * REMIND: while the default pipeline doesn't support flipping, it may
 * happen that the accelerated device may have this graphics config
 * (like if the device restoration failed when one device exits fs mode
 * while others remain).
 */
public VolatileImage createBackBuffer(WComponentPeer peer) {
    Component target = (Component)peer.getTarget();
    return new SunVolatileImage(target,
                                target.getWidth(), target.getHeight(),
                                Boolean.TRUE);
}