sun.java2d.windows.WindowsFlags Java Examples

The following examples show how to use sun.java2d.windows.WindowsFlags. 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: D3DGraphicsDevice.java    From dragonwell8_jdk with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Used to construct a Direct3D-enabled GraphicsDevice.
 *
 * @return a D3DGraphicsDevice if it could be created
 * successfully, null otherwise.
 */
public static D3DGraphicsDevice createDevice(int screen) {
    if (!d3dAvailable) {
        return null;
    }

    ContextCapabilities d3dCaps = getDeviceCaps(screen);
    // could not initialize the device successfully
    if ((d3dCaps.getCaps() & CAPS_DEVICE_OK) == 0) {
        if (WindowsFlags.isD3DVerbose()) {
            System.out.println("Could not enable Direct3D pipeline on " +
                               "screen " + screen);
        }
        return null;
    }
    if (WindowsFlags.isD3DVerbose()) {
        System.out.println("Direct3D pipeline enabled on screen " + screen);
    }

    D3DGraphicsDevice gd = new D3DGraphicsDevice(screen, d3dCaps);
    return gd;
}
 
Example #2
Source File: D3DGraphicsDevice.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Used to construct a Direct3D-enabled GraphicsDevice.
 *
 * @return a D3DGraphicsDevice if it could be created
 * successfully, null otherwise.
 */
public static D3DGraphicsDevice createDevice(int screen) {
    if (!d3dAvailable) {
        return null;
    }

    ContextCapabilities d3dCaps = getDeviceCaps(screen);
    // could not initialize the device successfully
    if ((d3dCaps.getCaps() & CAPS_DEVICE_OK) == 0) {
        if (WindowsFlags.isD3DVerbose()) {
            System.out.println("Could not enable Direct3D pipeline on " +
                               "screen " + screen);
        }
        return null;
    }
    if (WindowsFlags.isD3DVerbose()) {
        System.out.println("Direct3D pipeline enabled on screen " + screen);
    }

    D3DGraphicsDevice gd = new D3DGraphicsDevice(screen, d3dCaps);
    return gd;
}
 
Example #3
Source File: D3DGraphicsDevice.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Used to construct a Direct3D-enabled GraphicsDevice.
 *
 * @return a D3DGraphicsDevice if it could be created
 * successfully, null otherwise.
 */
public static D3DGraphicsDevice createDevice(int screen) {
    if (!d3dAvailable) {
        return null;
    }

    ContextCapabilities d3dCaps = getDeviceCaps(screen);
    // could not initialize the device successfully
    if ((d3dCaps.getCaps() & CAPS_DEVICE_OK) == 0) {
        if (WindowsFlags.isD3DVerbose()) {
            System.out.println("Could not enable Direct3D pipeline on " +
                               "screen " + screen);
        }
        return null;
    }
    if (WindowsFlags.isD3DVerbose()) {
        System.out.println("Direct3D pipeline enabled on screen " + screen);
    }

    D3DGraphicsDevice gd = new D3DGraphicsDevice(screen, d3dCaps);
    return gd;
}
 
Example #4
Source File: D3DGraphicsDevice.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Used to construct a Direct3D-enabled GraphicsDevice.
 *
 * @return a D3DGraphicsDevice if it could be created
 * successfully, null otherwise.
 */
public static D3DGraphicsDevice createDevice(int screen) {
    if (!d3dAvailable) {
        return null;
    }

    ContextCapabilities d3dCaps = getDeviceCaps(screen);
    // could not initialize the device successfully
    if ((d3dCaps.getCaps() & CAPS_DEVICE_OK) == 0) {
        if (WindowsFlags.isD3DVerbose()) {
            System.out.println("Could not enable Direct3D pipeline on " +
                               "screen " + screen);
        }
        return null;
    }
    if (WindowsFlags.isD3DVerbose()) {
        System.out.println("Direct3D pipeline enabled on screen " + screen);
    }

    D3DGraphicsDevice gd = new D3DGraphicsDevice(screen, d3dCaps);
    return gd;
}
 
Example #5
Source File: D3DGraphicsDevice.java    From jdk8u_jdk with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Used to construct a Direct3D-enabled GraphicsDevice.
 *
 * @return a D3DGraphicsDevice if it could be created
 * successfully, null otherwise.
 */
public static D3DGraphicsDevice createDevice(int screen) {
    if (!d3dAvailable) {
        return null;
    }

    ContextCapabilities d3dCaps = getDeviceCaps(screen);
    // could not initialize the device successfully
    if ((d3dCaps.getCaps() & CAPS_DEVICE_OK) == 0) {
        if (WindowsFlags.isD3DVerbose()) {
            System.out.println("Could not enable Direct3D pipeline on " +
                               "screen " + screen);
        }
        return null;
    }
    if (WindowsFlags.isD3DVerbose()) {
        System.out.println("Direct3D pipeline enabled on screen " + screen);
    }

    D3DGraphicsDevice gd = new D3DGraphicsDevice(screen, d3dCaps);
    return gd;
}
 
Example #6
Source File: D3DGraphicsDevice.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Used to construct a Direct3D-enabled GraphicsDevice.
 *
 * @return a D3DGraphicsDevice if it could be created
 * successfully, null otherwise.
 */
public static D3DGraphicsDevice createDevice(int screen) {
    if (!d3dAvailable) {
        return null;
    }

    ContextCapabilities d3dCaps = getDeviceCaps(screen);
    // could not initialize the device successfully
    if ((d3dCaps.getCaps() & CAPS_DEVICE_OK) == 0) {
        if (WindowsFlags.isD3DVerbose()) {
            System.out.println("Could not enable Direct3D pipeline on " +
                               "screen " + screen);
        }
        return null;
    }
    if (WindowsFlags.isD3DVerbose()) {
        System.out.println("Direct3D pipeline enabled on screen " + screen);
    }

    D3DGraphicsDevice gd = new D3DGraphicsDevice(screen, d3dCaps);
    return gd;
}
 
Example #7
Source File: D3DGraphicsDevice.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Used to construct a Direct3D-enabled GraphicsDevice.
 *
 * @return a D3DGraphicsDevice if it could be created
 * successfully, null otherwise.
 */
public static D3DGraphicsDevice createDevice(int screen) {
    if (!d3dAvailable) {
        return null;
    }

    ContextCapabilities d3dCaps = getDeviceCaps(screen);
    // could not initialize the device successfully
    if ((d3dCaps.getCaps() & CAPS_DEVICE_OK) == 0) {
        if (WindowsFlags.isD3DVerbose()) {
            System.out.println("Could not enable Direct3D pipeline on " +
                               "screen " + screen);
        }
        return null;
    }
    if (WindowsFlags.isD3DVerbose()) {
        System.out.println("Direct3D pipeline enabled on screen " + screen);
    }

    D3DGraphicsDevice gd = new D3DGraphicsDevice(screen, d3dCaps);
    return gd;
}
 
Example #8
Source File: D3DGraphicsDevice.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Used to construct a Direct3D-enabled GraphicsDevice.
 *
 * @return a D3DGraphicsDevice if it could be created
 * successfully, null otherwise.
 */
public static D3DGraphicsDevice createDevice(int screen) {
    if (!d3dAvailable) {
        return null;
    }

    ContextCapabilities d3dCaps = getDeviceCaps(screen);
    // could not initialize the device successfully
    if ((d3dCaps.getCaps() & CAPS_DEVICE_OK) == 0) {
        if (WindowsFlags.isD3DVerbose()) {
            System.out.println("Could not enable Direct3D pipeline on " +
                               "screen " + screen);
        }
        return null;
    }
    if (WindowsFlags.isD3DVerbose()) {
        System.out.println("Direct3D pipeline enabled on screen " + screen);
    }

    D3DGraphicsDevice gd = new D3DGraphicsDevice(screen, d3dCaps);
    return gd;
}
 
Example #9
Source File: D3DGraphicsDevice.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Used to construct a Direct3D-enabled GraphicsDevice.
 *
 * @return a D3DGraphicsDevice if it could be created
 * successfully, null otherwise.
 */
public static D3DGraphicsDevice createDevice(int screen) {
    if (!d3dAvailable) {
        return null;
    }

    ContextCapabilities d3dCaps = getDeviceCaps(screen);
    // could not initialize the device successfully
    if ((d3dCaps.getCaps() & CAPS_DEVICE_OK) == 0) {
        if (WindowsFlags.isD3DVerbose()) {
            System.out.println("Could not enable Direct3D pipeline on " +
                               "screen " + screen);
        }
        return null;
    }
    if (WindowsFlags.isD3DVerbose()) {
        System.out.println("Direct3D pipeline enabled on screen " + screen);
    }

    D3DGraphicsDevice gd = new D3DGraphicsDevice(screen, d3dCaps);
    return gd;
}
 
Example #10
Source File: D3DGraphicsDevice.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Used to construct a Direct3D-enabled GraphicsDevice.
 *
 * @return a D3DGraphicsDevice if it could be created
 * successfully, null otherwise.
 */
public static D3DGraphicsDevice createDevice(int screen) {
    if (!d3dAvailable) {
        return null;
    }

    ContextCapabilities d3dCaps = getDeviceCaps(screen);
    // could not initialize the device successfully
    if ((d3dCaps.getCaps() & CAPS_DEVICE_OK) == 0) {
        if (WindowsFlags.isD3DVerbose()) {
            System.out.println("Could not enable Direct3D pipeline on " +
                               "screen " + screen);
        }
        return null;
    }
    if (WindowsFlags.isD3DVerbose()) {
        System.out.println("Direct3D pipeline enabled on screen " + screen);
    }

    D3DGraphicsDevice gd = new D3DGraphicsDevice(screen, d3dCaps);
    return gd;
}
 
Example #11
Source File: D3DGraphicsDevice.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Used to construct a Direct3D-enabled GraphicsDevice.
 *
 * @return a D3DGraphicsDevice if it could be created
 * successfully, null otherwise.
 */
public static D3DGraphicsDevice createDevice(int screen) {
    if (!d3dAvailable) {
        return null;
    }

    ContextCapabilities d3dCaps = getDeviceCaps(screen);
    // could not initialize the device successfully
    if ((d3dCaps.getCaps() & CAPS_DEVICE_OK) == 0) {
        if (WindowsFlags.isD3DVerbose()) {
            System.out.println("Could not enable Direct3D pipeline on " +
                               "screen " + screen);
        }
        return null;
    }
    if (WindowsFlags.isD3DVerbose()) {
        System.out.println("Direct3D pipeline enabled on screen " + screen);
    }

    D3DGraphicsDevice gd = new D3DGraphicsDevice(screen, d3dCaps);
    return gd;
}
 
Example #12
Source File: D3DGraphicsDevice.java    From jdk8u-dev-jdk with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Used to construct a Direct3D-enabled GraphicsDevice.
 *
 * @return a D3DGraphicsDevice if it could be created
 * successfully, null otherwise.
 */
public static D3DGraphicsDevice createDevice(int screen) {
    if (!d3dAvailable) {
        return null;
    }

    ContextCapabilities d3dCaps = getDeviceCaps(screen);
    // could not initialize the device successfully
    if ((d3dCaps.getCaps() & CAPS_DEVICE_OK) == 0) {
        if (WindowsFlags.isD3DVerbose()) {
            System.out.println("Could not enable Direct3D pipeline on " +
                               "screen " + screen);
        }
        return null;
    }
    if (WindowsFlags.isD3DVerbose()) {
        System.out.println("Direct3D pipeline enabled on screen " + screen);
    }

    D3DGraphicsDevice gd = new D3DGraphicsDevice(screen, d3dCaps);
    return gd;
}
 
Example #13
Source File: D3DGraphicsDevice.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Used to construct a Direct3D-enabled GraphicsDevice.
 *
 * @return a D3DGraphicsDevice if it could be created
 * successfully, null otherwise.
 */
public static D3DGraphicsDevice createDevice(int screen) {
    if (!d3dAvailable) {
        return null;
    }

    ContextCapabilities d3dCaps = getDeviceCaps(screen);
    // could not initialize the device successfully
    if ((d3dCaps.getCaps() & CAPS_DEVICE_OK) == 0) {
        if (WindowsFlags.isD3DVerbose()) {
            System.out.println("Could not enable Direct3D pipeline on " +
                               "screen " + screen);
        }
        return null;
    }
    if (WindowsFlags.isD3DVerbose()) {
        System.out.println("Direct3D pipeline enabled on screen " + screen);
    }

    D3DGraphicsDevice gd = new D3DGraphicsDevice(screen, d3dCaps);
    return gd;
}
 
Example #14
Source File: Win32GraphicsDevice.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Returns the default graphics configuration
 * associated with this graphics device.
 */
public GraphicsConfiguration getDefaultConfiguration() {
    if (defaultConfig == null) {
        // first try to create a WGLGraphicsConfig if OGL is enabled
        // REMIND: the WGL code does not yet work properly in multimon
        // situations, so we will fallback on GDI if we are not on the
        // default device...
        if (WindowsFlags.isOGLEnabled() && isDefaultDevice()) {
            int defPixID = WGLGraphicsConfig.getDefaultPixFmt(screen);
            defaultConfig = WGLGraphicsConfig.getConfig(this, defPixID);
            if (WindowsFlags.isOGLVerbose()) {
                if (defaultConfig != null) {
                    System.out.print("OpenGL pipeline enabled");
                } else {
                    System.out.print("Could not enable OpenGL pipeline");
                }
                System.out.println(" for default config on screen " +
                                   screen);
            }
        }

        // Fix for 4669614.  Most apps are not concerned with PixelFormats,
        // yet we ALWAYS used them for determining ColorModels and such.
        // By passing in 0 as the PixelFormatID here, we signal that
        // PixelFormats should not be used, thus avoid loading the opengl
        // library.  Apps concerned with PixelFormats can still use
        // GraphicsConfiguration.getConfigurations().
        // Note that calling native pixel format functions tends to cause
        // problems between those functions (which are OpenGL-related)
        // and our use of DirectX.  For example, some Matrox boards will
        // crash or hang calling these functions when any app is running
        // in DirectX fullscreen mode.  So avoiding these calls unless
        // absolutely necessary is preferable.
        if (defaultConfig == null) {
            defaultConfig = Win32GraphicsConfig.getConfig(this, 0);
        }
    }
    return defaultConfig;
}
 
Example #15
Source File: Win32GraphicsEnvironment.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
protected GraphicsDevice makeScreenDevice(int screennum) {
    GraphicsDevice device = null;
    if (WindowsFlags.isD3DEnabled()) {
        device = D3DGraphicsDevice.createDevice(screennum);
    }
    if (device == null) {
        device = new Win32GraphicsDevice(screennum);
    }
    return device;
}
 
Example #16
Source File: Win32GraphicsEnvironment.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
protected GraphicsDevice makeScreenDevice(int screennum) {
    GraphicsDevice device = null;
    if (WindowsFlags.isD3DEnabled()) {
        device = D3DGraphicsDevice.createDevice(screennum);
    }
    if (device == null) {
        device = new Win32GraphicsDevice(screennum);
    }
    return device;
}
 
Example #17
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 #18
Source File: Win32GraphicsEnvironment.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
protected GraphicsDevice makeScreenDevice(int screennum) {
    GraphicsDevice device = null;
    if (WindowsFlags.isD3DEnabled()) {
        device = D3DGraphicsDevice.createDevice(screennum);
    }
    if (device == null) {
        device = new Win32GraphicsDevice(screennum);
    }
    return device;
}
 
Example #19
Source File: Win32GraphicsDevice.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Returns the default graphics configuration
 * associated with this graphics device.
 */
public GraphicsConfiguration getDefaultConfiguration() {
    if (defaultConfig == null) {
        // first try to create a WGLGraphicsConfig if OGL is enabled
        // REMIND: the WGL code does not yet work properly in multimon
        // situations, so we will fallback on GDI if we are not on the
        // default device...
        if (WindowsFlags.isOGLEnabled() && isDefaultDevice()) {
            int defPixID = WGLGraphicsConfig.getDefaultPixFmt(screen);
            defaultConfig = WGLGraphicsConfig.getConfig(this, defPixID);
            if (WindowsFlags.isOGLVerbose()) {
                if (defaultConfig != null) {
                    System.out.print("OpenGL pipeline enabled");
                } else {
                    System.out.print("Could not enable OpenGL pipeline");
                }
                System.out.println(" for default config on screen " +
                                   screen);
            }
        }

        // Fix for 4669614.  Most apps are not concerned with PixelFormats,
        // yet we ALWAYS used them for determining ColorModels and such.
        // By passing in 0 as the PixelFormatID here, we signal that
        // PixelFormats should not be used, thus avoid loading the opengl
        // library.  Apps concerned with PixelFormats can still use
        // GraphicsConfiguration.getConfigurations().
        // Note that calling native pixel format functions tends to cause
        // problems between those functions (which are OpenGL-related)
        // and our use of DirectX.  For example, some Matrox boards will
        // crash or hang calling these functions when any app is running
        // in DirectX fullscreen mode.  So avoiding these calls unless
        // absolutely necessary is preferable.
        if (defaultConfig == null) {
            defaultConfig = Win32GraphicsConfig.getConfig(this, 0);
        }
    }
    return defaultConfig;
}
 
Example #20
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 #21
Source File: Win32GraphicsEnvironment.java    From jdk8u-dev-jdk with GNU General Public License v2.0 5 votes vote down vote up
protected GraphicsDevice makeScreenDevice(int screennum) {
    GraphicsDevice device = null;
    if (WindowsFlags.isD3DEnabled()) {
        device = D3DGraphicsDevice.createDevice(screennum);
    }
    if (device == null) {
        device = new Win32GraphicsDevice(screennum);
    }
    return device;
}
 
Example #22
Source File: Win32GraphicsDevice.java    From jdk8u-dev-jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Returns the default graphics configuration
 * associated with this graphics device.
 */
public GraphicsConfiguration getDefaultConfiguration() {
    if (defaultConfig == null) {
        // first try to create a WGLGraphicsConfig if OGL is enabled
        // REMIND: the WGL code does not yet work properly in multimon
        // situations, so we will fallback on GDI if we are not on the
        // default device...
        if (WindowsFlags.isOGLEnabled() && isDefaultDevice()) {
            int defPixID = WGLGraphicsConfig.getDefaultPixFmt(screen);
            defaultConfig = WGLGraphicsConfig.getConfig(this, defPixID);
            if (WindowsFlags.isOGLVerbose()) {
                if (defaultConfig != null) {
                    System.out.print("OpenGL pipeline enabled");
                } else {
                    System.out.print("Could not enable OpenGL pipeline");
                }
                System.out.println(" for default config on screen " +
                                   screen);
            }
        }

        // Fix for 4669614.  Most apps are not concerned with PixelFormats,
        // yet we ALWAYS used them for determining ColorModels and such.
        // By passing in 0 as the PixelFormatID here, we signal that
        // PixelFormats should not be used, thus avoid loading the opengl
        // library.  Apps concerned with PixelFormats can still use
        // GraphicsConfiguration.getConfigurations().
        // Note that calling native pixel format functions tends to cause
        // problems between those functions (which are OpenGL-related)
        // and our use of DirectX.  For example, some Matrox boards will
        // crash or hang calling these functions when any app is running
        // in DirectX fullscreen mode.  So avoiding these calls unless
        // absolutely necessary is preferable.
        if (defaultConfig == null) {
            defaultConfig = Win32GraphicsConfig.getConfig(this, 0);
        }
    }
    return defaultConfig;
}
 
Example #23
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 #24
Source File: Win32GraphicsDevice.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Returns the default graphics configuration
 * associated with this graphics device.
 */
public GraphicsConfiguration getDefaultConfiguration() {
    if (defaultConfig == null) {
        // first try to create a WGLGraphicsConfig if OGL is enabled
        // REMIND: the WGL code does not yet work properly in multimon
        // situations, so we will fallback on GDI if we are not on the
        // default device...
        if (WindowsFlags.isOGLEnabled() && isDefaultDevice()) {
            int defPixID = WGLGraphicsConfig.getDefaultPixFmt(screen);
            defaultConfig = WGLGraphicsConfig.getConfig(this, defPixID);
            if (WindowsFlags.isOGLVerbose()) {
                if (defaultConfig != null) {
                    System.out.print("OpenGL pipeline enabled");
                } else {
                    System.out.print("Could not enable OpenGL pipeline");
                }
                System.out.println(" for default config on screen " +
                                   screen);
            }
        }

        // Fix for 4669614.  Most apps are not concerned with PixelFormats,
        // yet we ALWAYS used them for determining ColorModels and such.
        // By passing in 0 as the PixelFormatID here, we signal that
        // PixelFormats should not be used, thus avoid loading the opengl
        // library.  Apps concerned with PixelFormats can still use
        // GraphicsConfiguration.getConfigurations().
        // Note that calling native pixel format functions tends to cause
        // problems between those functions (which are OpenGL-related)
        // and our use of DirectX.  For example, some Matrox boards will
        // crash or hang calling these functions when any app is running
        // in DirectX fullscreen mode.  So avoiding these calls unless
        // absolutely necessary is preferable.
        if (defaultConfig == null) {
            defaultConfig = Win32GraphicsConfig.getConfig(this, 0);
        }
    }
    return defaultConfig;
}
 
Example #25
Source File: Win32GraphicsEnvironment.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
protected GraphicsDevice makeScreenDevice(int screennum) {
    GraphicsDevice device = null;
    if (WindowsFlags.isD3DEnabled()) {
        device = D3DGraphicsDevice.createDevice(screennum);
    }
    if (device == null) {
        device = new Win32GraphicsDevice(screennum);
    }
    return device;
}
 
Example #26
Source File: Win32GraphicsDevice.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Returns the default graphics configuration
 * associated with this graphics device.
 */
public GraphicsConfiguration getDefaultConfiguration() {
    if (defaultConfig == null) {
        // first try to create a WGLGraphicsConfig if OGL is enabled
        // REMIND: the WGL code does not yet work properly in multimon
        // situations, so we will fallback on GDI if we are not on the
        // default device...
        if (WindowsFlags.isOGLEnabled() && isDefaultDevice()) {
            int defPixID = WGLGraphicsConfig.getDefaultPixFmt(screen);
            defaultConfig = WGLGraphicsConfig.getConfig(this, defPixID);
            if (WindowsFlags.isOGLVerbose()) {
                if (defaultConfig != null) {
                    System.out.print("OpenGL pipeline enabled");
                } else {
                    System.out.print("Could not enable OpenGL pipeline");
                }
                System.out.println(" for default config on screen " +
                                   screen);
            }
        }

        // Fix for 4669614.  Most apps are not concerned with PixelFormats,
        // yet we ALWAYS used them for determining ColorModels and such.
        // By passing in 0 as the PixelFormatID here, we signal that
        // PixelFormats should not be used, thus avoid loading the opengl
        // library.  Apps concerned with PixelFormats can still use
        // GraphicsConfiguration.getConfigurations().
        // Note that calling native pixel format functions tends to cause
        // problems between those functions (which are OpenGL-related)
        // and our use of DirectX.  For example, some Matrox boards will
        // crash or hang calling these functions when any app is running
        // in DirectX fullscreen mode.  So avoiding these calls unless
        // absolutely necessary is preferable.
        if (defaultConfig == null) {
            defaultConfig = Win32GraphicsConfig.getConfig(this, 0);
        }
    }
    return defaultConfig;
}
 
Example #27
Source File: Win32GraphicsEnvironment.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
protected GraphicsDevice makeScreenDevice(int screennum) {
    GraphicsDevice device = null;
    if (WindowsFlags.isD3DEnabled()) {
        device = D3DGraphicsDevice.createDevice(screennum);
    }
    if (device == null) {
        device = new Win32GraphicsDevice(screennum);
    }
    return device;
}
 
Example #28
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 #29
Source File: Win32GraphicsDevice.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Returns the default graphics configuration
 * associated with this graphics device.
 */
public GraphicsConfiguration getDefaultConfiguration() {
    if (defaultConfig == null) {
        // first try to create a WGLGraphicsConfig if OGL is enabled
        // REMIND: the WGL code does not yet work properly in multimon
        // situations, so we will fallback on GDI if we are not on the
        // default device...
        if (WindowsFlags.isOGLEnabled() && isDefaultDevice()) {
            int defPixID = WGLGraphicsConfig.getDefaultPixFmt(screen);
            defaultConfig = WGLGraphicsConfig.getConfig(this, defPixID);
            if (WindowsFlags.isOGLVerbose()) {
                if (defaultConfig != null) {
                    System.out.print("OpenGL pipeline enabled");
                } else {
                    System.out.print("Could not enable OpenGL pipeline");
                }
                System.out.println(" for default config on screen " +
                                   screen);
            }
        }

        // Fix for 4669614.  Most apps are not concerned with PixelFormats,
        // yet we ALWAYS used them for determining ColorModels and such.
        // By passing in 0 as the PixelFormatID here, we signal that
        // PixelFormats should not be used, thus avoid loading the opengl
        // library.  Apps concerned with PixelFormats can still use
        // GraphicsConfiguration.getConfigurations().
        // Note that calling native pixel format functions tends to cause
        // problems between those functions (which are OpenGL-related)
        // and our use of DirectX.  For example, some Matrox boards will
        // crash or hang calling these functions when any app is running
        // in DirectX fullscreen mode.  So avoiding these calls unless
        // absolutely necessary is preferable.
        if (defaultConfig == null) {
            defaultConfig = Win32GraphicsConfig.getConfig(this, 0);
        }
    }
    return defaultConfig;
}
 
Example #30
Source File: D3DScreenUpdateManager.java    From hottub 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"));
}