sun.awt.Win32GraphicsConfig Java Examples

The following examples show how to use sun.awt.Win32GraphicsConfig. 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: WComponentPeer.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
/**
 * The following multibuffering-related methods delegate to our
 * associated GraphicsConfig (Win or WGL) to handle the appropriate
 * native windowing system specific actions.
 */

@Override
public void createBuffers(int numBuffers, BufferCapabilities caps)
    throws AWTException
{
    Win32GraphicsConfig gc =
        (Win32GraphicsConfig)getGraphicsConfiguration();
    gc.assertOperationSupported((Component)target, numBuffers, caps);

    // Re-create the primary surface with the new number of back buffers
    try {
        replaceSurfaceData(numBuffers - 1, caps);
    } catch (InvalidPipeException e) {
        throw new AWTException(e.getMessage());
    }
}
 
Example #2
Source File: WComponentPeer.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
/**
 * The following multibuffering-related methods delegate to our
 * associated GraphicsConfig (Win or WGL) to handle the appropriate
 * native windowing system specific actions.
 */

@Override
public void createBuffers(int numBuffers, BufferCapabilities caps)
    throws AWTException
{
    Win32GraphicsConfig gc =
        (Win32GraphicsConfig)getGraphicsConfiguration();
    gc.assertOperationSupported((Component)target, numBuffers, caps);

    // Re-create the primary surface with the new number of back buffers
    try {
        replaceSurfaceData(numBuffers - 1, caps);
    } catch (InvalidPipeException e) {
        throw new AWTException(e.getMessage());
    }
}
 
Example #3
Source File: WComponentPeer.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * The following multibuffering-related methods delegate to our
 * associated GraphicsConfig (Win or WGL) to handle the appropriate
 * native windowing system specific actions.
 */

@Override
public void createBuffers(int numBuffers, BufferCapabilities caps)
    throws AWTException
{
    Win32GraphicsConfig gc =
        (Win32GraphicsConfig)getGraphicsConfiguration();
    gc.assertOperationSupported((Component)target, numBuffers, caps);

    // Re-create the primary surface with the new number of back buffers
    try {
        replaceSurfaceData(numBuffers - 1, caps);
    } catch (InvalidPipeException e) {
        throw new AWTException(e.getMessage());
    }
}
 
Example #4
Source File: WComponentPeer.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * The following multibuffering-related methods delegate to our
 * associated GraphicsConfig (Win or WGL) to handle the appropriate
 * native windowing system specific actions.
 */

@Override
public void createBuffers(int numBuffers, BufferCapabilities caps)
    throws AWTException
{
    Win32GraphicsConfig gc =
        (Win32GraphicsConfig)getGraphicsConfiguration();
    gc.assertOperationSupported((Component)target, numBuffers, caps);

    // Re-create the primary surface with the new number of back buffers
    try {
        replaceSurfaceData(numBuffers - 1, caps);
    } catch (InvalidPipeException e) {
        throw new AWTException(e.getMessage());
    }
}
 
Example #5
Source File: WComponentPeer.java    From jdk8u_jdk with GNU General Public License v2.0 6 votes vote down vote up
/**
 * The following multibuffering-related methods delegate to our
 * associated GraphicsConfig (Win or WGL) to handle the appropriate
 * native windowing system specific actions.
 */

@Override
public void createBuffers(int numBuffers, BufferCapabilities caps)
    throws AWTException
{
    Win32GraphicsConfig gc =
        (Win32GraphicsConfig)getGraphicsConfiguration();
    gc.assertOperationSupported((Component)target, numBuffers, caps);

    // Re-create the primary surface with the new number of back buffers
    try {
        replaceSurfaceData(numBuffers - 1, caps);
    } catch (InvalidPipeException e) {
        throw new AWTException(e.getMessage());
    }
}
 
Example #6
Source File: WComponentPeer.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * The following multibuffering-related methods delegate to our
 * associated GraphicsConfig (Win or WGL) to handle the appropriate
 * native windowing system specific actions.
 */

@Override
public void createBuffers(int numBuffers, BufferCapabilities caps)
    throws AWTException
{
    Win32GraphicsConfig gc =
        (Win32GraphicsConfig)getGraphicsConfiguration();
    gc.assertOperationSupported((Component)target, numBuffers, caps);

    // Re-create the primary surface with the new number of back buffers
    try {
        replaceSurfaceData(numBuffers - 1, caps);
    } catch (InvalidPipeException e) {
        throw new AWTException(e.getMessage());
    }
}
 
Example #7
Source File: WComponentPeer.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
/**
 * The following multibuffering-related methods delegate to our
 * associated GraphicsConfig (Win or WGL) to handle the appropriate
 * native windowing system specific actions.
 */

@Override
public void createBuffers(int numBuffers, BufferCapabilities caps)
    throws AWTException
{
    Win32GraphicsConfig gc =
        (Win32GraphicsConfig)getGraphicsConfiguration();
    gc.assertOperationSupported((Component)target, numBuffers, caps);

    // Re-create the primary surface with the new number of back buffers
    try {
        replaceSurfaceData(numBuffers - 1, caps);
    } catch (InvalidPipeException e) {
        throw new AWTException(e.getMessage());
    }
}
 
Example #8
Source File: WComponentPeer.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
/**
 * The following multibuffering-related methods delegate to our
 * associated GraphicsConfig (Win or WGL) to handle the appropriate
 * native windowing system specific actions.
 */

@Override
public void createBuffers(int numBuffers, BufferCapabilities caps)
    throws AWTException
{
    Win32GraphicsConfig gc =
        (Win32GraphicsConfig)getGraphicsConfiguration();
    gc.assertOperationSupported((Component)target, numBuffers, caps);

    // Re-create the primary surface with the new number of back buffers
    try {
        replaceSurfaceData(numBuffers - 1, caps);
    } catch (InvalidPipeException e) {
        throw new AWTException(e.getMessage());
    }
}
 
Example #9
Source File: WComponentPeer.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
/**
 * The following multibuffering-related methods delegate to our
 * associated GraphicsConfig (Win or WGL) to handle the appropriate
 * native windowing system specific actions.
 */

@Override
public void createBuffers(int numBuffers, BufferCapabilities caps)
    throws AWTException
{
    Win32GraphicsConfig gc =
        (Win32GraphicsConfig)getGraphicsConfiguration();
    gc.assertOperationSupported((Component)target, numBuffers, caps);

    // Re-create the primary surface with the new number of back buffers
    try {
        replaceSurfaceData(numBuffers - 1, caps);
    } catch (InvalidPipeException e) {
        throw new AWTException(e.getMessage());
    }
}
 
Example #10
Source File: WComponentPeer.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void flip(int x1, int y1, int x2, int y2,
                              BufferCapabilities.FlipContents flipAction)
{
    VolatileImage backBuffer = this.backBuffer;
    if (backBuffer == null) {
        throw new IllegalStateException("Buffers have not been created");
    }
    Win32GraphicsConfig gc =
        (Win32GraphicsConfig)getGraphicsConfiguration();
    gc.flip(this, (Component)target, backBuffer, x1, y1, x2, y2, flipAction);
}
 
Example #11
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 #12
Source File: D3DVolatileSurfaceManager.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
/**
 * If the destination surface's peer can potentially handle accelerated
 * on-screen rendering then it is likely that the condition which resulted
 * in VI to Screen operation is temporary, so this method sets the
 * restore countdown in hope that the on-screen accelerated rendering will
 * resume. In the meantime the backup surface of the VISM will be used.
 *
 * The countdown is needed because otherwise we may never break out
 * of "do { vi.validate()..} while(vi.lost)" loop since validate() could
 * restore the source surface every time and it will get lost again on the
 * next copy attempt, and we would never get a chance to use the backup
 * surface. By using the countdown we allow the backup surface to be used
 * while the screen surface gets sorted out, or if it for some reason can
 * never be restored.
 *
 * If the destination surface's peer could never do accelerated onscreen
 * rendering then the acceleration for the SurfaceManager associated with
 * the source surface is disabled forever.
 */
static void handleVItoScreenOp(SurfaceData src, SurfaceData dst) {
    if (src instanceof D3DSurfaceData &&
        dst instanceof GDIWindowSurfaceData)
    {
        D3DSurfaceData d3dsd = (D3DSurfaceData)src;
        SurfaceManager mgr =
            SurfaceManager.getManager((Image)d3dsd.getDestination());
        if (mgr instanceof D3DVolatileSurfaceManager) {
            D3DVolatileSurfaceManager vsm = (D3DVolatileSurfaceManager)mgr;
            if (vsm != null) {
                d3dsd.setSurfaceLost(true);

                GDIWindowSurfaceData wsd = (GDIWindowSurfaceData)dst;
                WComponentPeer p = wsd.getPeer();
                if (D3DScreenUpdateManager.canUseD3DOnScreen(p,
                        (Win32GraphicsConfig)p.getGraphicsConfiguration(),
                        p.getBackBuffersNum()))
                {
                    // 10 is only chosen to be greater than the number of
                    // times a sane person would call validate() inside
                    // a validation loop, and to reduce thrashing between
                    // accelerated and backup surfaces
                    vsm.setRestoreCountdown(10);
                } else {
                    vsm.setAccelerationEnabled(false);
                }
            }
        }
    }
}
 
Example #13
Source File: GDIWindowSurfaceData.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
private GDIWindowSurfaceData(WComponentPeer peer, SurfaceType sType) {
    super(sType, peer.getDeviceColorModel());
    ColorModel cm = peer.getDeviceColorModel();
    this.peer = peer;
    int rMask = 0, gMask = 0, bMask = 0;
    int depth;
    switch (cm.getPixelSize()) {
    case 32:
    case 24:
        if (cm instanceof DirectColorModel) {
            depth = 32;
        } else {
            depth = 24;
        }
        break;
    default:
        depth = cm.getPixelSize();
    }
    if (cm instanceof DirectColorModel) {
        DirectColorModel dcm = (DirectColorModel)cm;
        rMask = dcm.getRedMask();
        gMask = dcm.getGreenMask();
        bMask = dcm.getBlueMask();
    }
    this.graphicsConfig =
        (Win32GraphicsConfig) peer.getGraphicsConfiguration();
    this.solidloops = graphicsConfig.getSolidLoops(sType);

    Win32GraphicsDevice gd =
        (Win32GraphicsDevice)graphicsConfig.getDevice();
    initOps(peer, depth, rMask, gMask, bMask, gd.getScreen());
    setBlitProxyKey(graphicsConfig.getProxyKey());
}
 
Example #14
Source File: D3DVolatileSurfaceManager.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * If the destination surface's peer can potentially handle accelerated
 * on-screen rendering then it is likely that the condition which resulted
 * in VI to Screen operation is temporary, so this method sets the
 * restore countdown in hope that the on-screen accelerated rendering will
 * resume. In the meantime the backup surface of the VISM will be used.
 *
 * The countdown is needed because otherwise we may never break out
 * of "do { vi.validate()..} while(vi.lost)" loop since validate() could
 * restore the source surface every time and it will get lost again on the
 * next copy attempt, and we would never get a chance to use the backup
 * surface. By using the countdown we allow the backup surface to be used
 * while the screen surface gets sorted out, or if it for some reason can
 * never be restored.
 *
 * If the destination surface's peer could never do accelerated onscreen
 * rendering then the acceleration for the SurfaceManager associated with
 * the source surface is disabled forever.
 */
static void handleVItoScreenOp(SurfaceData src, SurfaceData dst) {
    if (src instanceof D3DSurfaceData &&
        dst instanceof GDIWindowSurfaceData)
    {
        D3DSurfaceData d3dsd = (D3DSurfaceData)src;
        SurfaceManager mgr =
            SurfaceManager.getManager((Image)d3dsd.getDestination());
        if (mgr instanceof D3DVolatileSurfaceManager) {
            D3DVolatileSurfaceManager vsm = (D3DVolatileSurfaceManager)mgr;
            if (vsm != null) {
                d3dsd.setSurfaceLost(true);

                GDIWindowSurfaceData wsd = (GDIWindowSurfaceData)dst;
                WComponentPeer p = wsd.getPeer();
                if (D3DScreenUpdateManager.canUseD3DOnScreen(p,
                        (Win32GraphicsConfig)p.getGraphicsConfiguration(),
                        p.getBackBuffersNum()))
                {
                    // 10 is only chosen to be greater than the number of
                    // times a sane person would call validate() inside
                    // a validation loop, and to reduce thrashing between
                    // accelerated and backup surfaces
                    vsm.setRestoreCountdown(10);
                } else {
                    vsm.setAccelerationEnabled(false);
                }
            }
        }
    }
}
 
Example #15
Source File: D3DVolatileSurfaceManager.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * If the destination surface's peer can potentially handle accelerated
 * on-screen rendering then it is likely that the condition which resulted
 * in VI to Screen operation is temporary, so this method sets the
 * restore countdown in hope that the on-screen accelerated rendering will
 * resume. In the meantime the backup surface of the VISM will be used.
 *
 * The countdown is needed because otherwise we may never break out
 * of "do { vi.validate()..} while(vi.lost)" loop since validate() could
 * restore the source surface every time and it will get lost again on the
 * next copy attempt, and we would never get a chance to use the backup
 * surface. By using the countdown we allow the backup surface to be used
 * while the screen surface gets sorted out, or if it for some reason can
 * never be restored.
 *
 * If the destination surface's peer could never do accelerated onscreen
 * rendering then the acceleration for the SurfaceManager associated with
 * the source surface is disabled forever.
 */
static void handleVItoScreenOp(SurfaceData src, SurfaceData dst) {
    if (src instanceof D3DSurfaceData &&
        dst instanceof GDIWindowSurfaceData)
    {
        D3DSurfaceData d3dsd = (D3DSurfaceData)src;
        SurfaceManager mgr =
            SurfaceManager.getManager((Image)d3dsd.getDestination());
        if (mgr instanceof D3DVolatileSurfaceManager) {
            D3DVolatileSurfaceManager vsm = (D3DVolatileSurfaceManager)mgr;
            if (vsm != null) {
                d3dsd.setSurfaceLost(true);

                GDIWindowSurfaceData wsd = (GDIWindowSurfaceData)dst;
                WComponentPeer p = wsd.getPeer();
                if (D3DScreenUpdateManager.canUseD3DOnScreen(p,
                        (Win32GraphicsConfig)p.getGraphicsConfiguration(),
                        p.getBackBuffersNum()))
                {
                    // 10 is only chosen to be greater than the number of
                    // times a sane person would call validate() inside
                    // a validation loop, and to reduce thrashing between
                    // accelerated and backup surfaces
                    vsm.setRestoreCountdown(10);
                } else {
                    vsm.setAccelerationEnabled(false);
                }
            }
        }
    }
}
 
Example #16
Source File: WComponentPeer.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
public ColorModel getDeviceColorModel() {
    Win32GraphicsConfig gc =
        (Win32GraphicsConfig)getGraphicsConfiguration();
    if (gc != null) {
        return gc.getDeviceColorModel();
    }
    else {
        return null;
    }
}
 
Example #17
Source File: D3DVolatileSurfaceManager.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
/**
 * If the destination surface's peer can potentially handle accelerated
 * on-screen rendering then it is likely that the condition which resulted
 * in VI to Screen operation is temporary, so this method sets the
 * restore countdown in hope that the on-screen accelerated rendering will
 * resume. In the meantime the backup surface of the VISM will be used.
 *
 * The countdown is needed because otherwise we may never break out
 * of "do { vi.validate()..} while(vi.lost)" loop since validate() could
 * restore the source surface every time and it will get lost again on the
 * next copy attempt, and we would never get a chance to use the backup
 * surface. By using the countdown we allow the backup surface to be used
 * while the screen surface gets sorted out, or if it for some reason can
 * never be restored.
 *
 * If the destination surface's peer could never do accelerated onscreen
 * rendering then the acceleration for the SurfaceManager associated with
 * the source surface is disabled forever.
 */
static void handleVItoScreenOp(SurfaceData src, SurfaceData dst) {
    if (src instanceof D3DSurfaceData &&
        dst instanceof GDIWindowSurfaceData)
    {
        D3DSurfaceData d3dsd = (D3DSurfaceData)src;
        SurfaceManager mgr =
            SurfaceManager.getManager((Image)d3dsd.getDestination());
        if (mgr instanceof D3DVolatileSurfaceManager) {
            D3DVolatileSurfaceManager vsm = (D3DVolatileSurfaceManager)mgr;
            if (vsm != null) {
                d3dsd.setSurfaceLost(true);

                GDIWindowSurfaceData wsd = (GDIWindowSurfaceData)dst;
                WComponentPeer p = wsd.getPeer();
                if (D3DScreenUpdateManager.canUseD3DOnScreen(p,
                        (Win32GraphicsConfig)p.getGraphicsConfiguration(),
                        p.getBackBuffersNum()))
                {
                    // 10 is only chosen to be greater than the number of
                    // times a sane person would call validate() inside
                    // a validation loop, and to reduce thrashing between
                    // accelerated and backup surfaces
                    vsm.setRestoreCountdown(10);
                } else {
                    vsm.setAccelerationEnabled(false);
                }
            }
        }
    }
}
 
Example #18
Source File: WComponentPeer.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
public void createScreenSurface(boolean isResize)
{
    Win32GraphicsConfig gc = (Win32GraphicsConfig)getGraphicsConfiguration();
    ScreenUpdateManager mgr = ScreenUpdateManager.getInstance();

    surfaceData = mgr.createScreenSurface(gc, this, numBackBuffers, isResize);
}
 
Example #19
Source File: WComponentPeer.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
public void createScreenSurface(boolean isResize)
{
    Win32GraphicsConfig gc = (Win32GraphicsConfig)getGraphicsConfiguration();
    ScreenUpdateManager mgr = ScreenUpdateManager.getInstance();

    surfaceData = mgr.createScreenSurface(gc, this, numBackBuffers, isResize);
}
 
Example #20
Source File: D3DVolatileSurfaceManager.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
/**
 * If the destination surface's peer can potentially handle accelerated
 * on-screen rendering then it is likely that the condition which resulted
 * in VI to Screen operation is temporary, so this method sets the
 * restore countdown in hope that the on-screen accelerated rendering will
 * resume. In the meantime the backup surface of the VISM will be used.
 *
 * The countdown is needed because otherwise we may never break out
 * of "do { vi.validate()..} while(vi.lost)" loop since validate() could
 * restore the source surface every time and it will get lost again on the
 * next copy attempt, and we would never get a chance to use the backup
 * surface. By using the countdown we allow the backup surface to be used
 * while the screen surface gets sorted out, or if it for some reason can
 * never be restored.
 *
 * If the destination surface's peer could never do accelerated onscreen
 * rendering then the acceleration for the SurfaceManager associated with
 * the source surface is disabled forever.
 */
static void handleVItoScreenOp(SurfaceData src, SurfaceData dst) {
    if (src instanceof D3DSurfaceData &&
        dst instanceof GDIWindowSurfaceData)
    {
        D3DSurfaceData d3dsd = (D3DSurfaceData)src;
        SurfaceManager mgr =
            SurfaceManager.getManager((Image)d3dsd.getDestination());
        if (mgr instanceof D3DVolatileSurfaceManager) {
            D3DVolatileSurfaceManager vsm = (D3DVolatileSurfaceManager)mgr;
            if (vsm != null) {
                d3dsd.setSurfaceLost(true);

                GDIWindowSurfaceData wsd = (GDIWindowSurfaceData)dst;
                WComponentPeer p = wsd.getPeer();
                if (D3DScreenUpdateManager.canUseD3DOnScreen(p,
                        (Win32GraphicsConfig)p.getGraphicsConfiguration(),
                        p.getBackBuffersNum()))
                {
                    // 10 is only chosen to be greater than the number of
                    // times a sane person would call validate() inside
                    // a validation loop, and to reduce thrashing between
                    // accelerated and backup surfaces
                    vsm.setRestoreCountdown(10);
                } else {
                    vsm.setAccelerationEnabled(false);
                }
            }
        }
    }
}
 
Example #21
Source File: WComponentPeer.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
public boolean updateGraphicsData(GraphicsConfiguration gc) {
    winGraphicsConfig = (Win32GraphicsConfig)gc;
    try {
        replaceSurfaceData();
    } catch (InvalidPipeException e) {
        // REMIND : what do we do if our surface creation failed?
    }
    return false;
}
 
Example #22
Source File: GDIWindowSurfaceData.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
private GDIWindowSurfaceData(WComponentPeer peer, SurfaceType sType) {
    super(sType, peer.getDeviceColorModel());
    ColorModel cm = peer.getDeviceColorModel();
    this.peer = peer;
    int rMask = 0, gMask = 0, bMask = 0;
    int depth;
    switch (cm.getPixelSize()) {
    case 32:
    case 24:
        if (cm instanceof DirectColorModel) {
            depth = 32;
        } else {
            depth = 24;
        }
        break;
    default:
        depth = cm.getPixelSize();
    }
    if (cm instanceof DirectColorModel) {
        DirectColorModel dcm = (DirectColorModel)cm;
        rMask = dcm.getRedMask();
        gMask = dcm.getGreenMask();
        bMask = dcm.getBlueMask();
    }
    this.graphicsConfig =
        (Win32GraphicsConfig) peer.getGraphicsConfiguration();
    this.solidloops = graphicsConfig.getSolidLoops(sType);

    Win32GraphicsDevice gd =
        (Win32GraphicsDevice)graphicsConfig.getDevice();
    initOps(peer, depth, rMask, gMask, bMask, gd.getScreen());
    setBlitProxyKey(graphicsConfig.getProxyKey());
}
 
Example #23
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 #24
Source File: WComponentPeer.java    From jdk8u_jdk with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void flip(int x1, int y1, int x2, int y2,
                              BufferCapabilities.FlipContents flipAction)
{
    VolatileImage backBuffer = this.backBuffer;
    if (backBuffer == null) {
        throw new IllegalStateException("Buffers have not been created");
    }
    Win32GraphicsConfig gc =
        (Win32GraphicsConfig)getGraphicsConfiguration();
    gc.flip(this, (Component)target, backBuffer, x1, y1, x2, y2, flipAction);
}
 
Example #25
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 #26
Source File: WComponentPeer.java    From jdk8u-dev-jdk with GNU General Public License v2.0 5 votes vote down vote up
public ColorModel getDeviceColorModel() {
    Win32GraphicsConfig gc =
        (Win32GraphicsConfig)getGraphicsConfiguration();
    if (gc != null) {
        return gc.getDeviceColorModel();
    }
    else {
        return null;
    }
}
 
Example #27
Source File: WComponentPeer.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void flip(int x1, int y1, int x2, int y2,
                              BufferCapabilities.FlipContents flipAction)
{
    VolatileImage backBuffer = this.backBuffer;
    if (backBuffer == null) {
        throw new IllegalStateException("Buffers have not been created");
    }
    Win32GraphicsConfig gc =
        (Win32GraphicsConfig)getGraphicsConfiguration();
    gc.flip(this, (Component)target, backBuffer, x1, y1, x2, y2, flipAction);
}
 
Example #28
Source File: WComponentPeer.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void flip(int x1, int y1, int x2, int y2,
                              BufferCapabilities.FlipContents flipAction)
{
    VolatileImage backBuffer = this.backBuffer;
    if (backBuffer == null) {
        throw new IllegalStateException("Buffers have not been created");
    }
    Win32GraphicsConfig gc =
        (Win32GraphicsConfig)getGraphicsConfiguration();
    gc.flip(this, (Component)target, backBuffer, x1, y1, x2, y2, flipAction);
}
 
Example #29
Source File: WComponentPeer.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
public ColorModel getDeviceColorModel() {
    Win32GraphicsConfig gc =
        (Win32GraphicsConfig)getGraphicsConfiguration();
    if (gc != null) {
        return gc.getDeviceColorModel();
    }
    else {
        return null;
    }
}
 
Example #30
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"));
}