Java Code Examples for sun.java2d.windows.GDIWindowSurfaceData#createData()

The following examples show how to use sun.java2d.windows.GDIWindowSurfaceData#createData() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: WGLGraphicsConfig.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Creates a new SurfaceData that will be associated with the given
 * WComponentPeer.
 */
@Override
public SurfaceData createSurfaceData(WComponentPeer peer,
                                     int numBackBuffers)
{
    SurfaceData sd = WGLSurfaceData.createData(peer);
    if (sd == null) {
        sd = GDIWindowSurfaceData.createData(peer);
    }
    return sd;
}
 
Example 2
Source File: D3DScreenUpdateManager.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Creates (or returns a cached one) gdi surface for the same peer as
 * the passed d3dw surface has.
 *
 * @param d3dw surface used as key into the cache
 * @return gdi window surface associated with the d3d window surfaces' peer
 */
private synchronized SurfaceData getGdiSurface(D3DWindowSurfaceData d3dw) {
    if (gdiSurfaces == null) {
        gdiSurfaces =
            new HashMap<D3DWindowSurfaceData, GDIWindowSurfaceData>();
    }
    GDIWindowSurfaceData gdisd = gdiSurfaces.get(d3dw);
    if (gdisd == null) {
        gdisd = GDIWindowSurfaceData.createData(d3dw.getPeer());
        gdiSurfaces.put(d3dw, gdisd);
    }
    return gdisd;
}
 
Example 3
Source File: D3DScreenUpdateManager.java    From jdk8u_jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Creates (or returns a cached one) gdi surface for the same peer as
 * the passed d3dw surface has.
 *
 * @param d3dw surface used as key into the cache
 * @return gdi window surface associated with the d3d window surfaces' peer
 */
private synchronized SurfaceData getGdiSurface(D3DWindowSurfaceData d3dw) {
    if (gdiSurfaces == null) {
        gdiSurfaces =
            new HashMap<D3DWindowSurfaceData, GDIWindowSurfaceData>();
    }
    GDIWindowSurfaceData gdisd = gdiSurfaces.get(d3dw);
    if (gdisd == null) {
        gdisd = GDIWindowSurfaceData.createData(d3dw.getPeer());
        gdiSurfaces.put(d3dw, gdisd);
    }
    return gdisd;
}
 
Example 4
Source File: WGLGraphicsConfig.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Creates a new SurfaceData that will be associated with the given
 * WComponentPeer.
 */
@Override
public SurfaceData createSurfaceData(WComponentPeer peer,
                                     int numBackBuffers)
{
    SurfaceData sd = WGLSurfaceData.createData(peer);
    if (sd == null) {
        sd = GDIWindowSurfaceData.createData(peer);
    }
    return sd;
}
 
Example 5
Source File: WGLGraphicsConfig.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Creates a new SurfaceData that will be associated with the given
 * WComponentPeer.
 */
@Override
public SurfaceData createSurfaceData(WComponentPeer peer,
                                     int numBackBuffers)
{
    SurfaceData sd = WGLSurfaceData.createData(peer);
    if (sd == null) {
        sd = GDIWindowSurfaceData.createData(peer);
    }
    return sd;
}
 
Example 6
Source File: D3DScreenUpdateManager.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Creates (or returns a cached one) gdi surface for the same peer as
 * the passed d3dw surface has.
 *
 * @param d3dw surface used as key into the cache
 * @return gdi window surface associated with the d3d window surfaces' peer
 */
private synchronized SurfaceData getGdiSurface(D3DWindowSurfaceData d3dw) {
    if (gdiSurfaces == null) {
        gdiSurfaces =
            new HashMap<D3DWindowSurfaceData, GDIWindowSurfaceData>();
    }
    GDIWindowSurfaceData gdisd = gdiSurfaces.get(d3dw);
    if (gdisd == null) {
        gdisd = GDIWindowSurfaceData.createData(d3dw.getPeer());
        gdiSurfaces.put(d3dw, gdisd);
    }
    return gdisd;
}
 
Example 7
Source File: D3DScreenUpdateManager.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Creates (or returns a cached one) gdi surface for the same peer as
 * the passed d3dw surface has.
 *
 * @param d3dw surface used as key into the cache
 * @return gdi window surface associated with the d3d window surfaces' peer
 */
private synchronized SurfaceData getGdiSurface(D3DWindowSurfaceData d3dw) {
    if (gdiSurfaces == null) {
        gdiSurfaces =
            new HashMap<D3DWindowSurfaceData, GDIWindowSurfaceData>();
    }
    GDIWindowSurfaceData gdisd = gdiSurfaces.get(d3dw);
    if (gdisd == null) {
        gdisd = GDIWindowSurfaceData.createData(d3dw.getPeer());
        gdiSurfaces.put(d3dw, gdisd);
    }
    return gdisd;
}
 
Example 8
Source File: WGLGraphicsConfig.java    From jdk8u-dev-jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Creates a new SurfaceData that will be associated with the given
 * WComponentPeer.
 */
@Override
public SurfaceData createSurfaceData(WComponentPeer peer,
                                     int numBackBuffers)
{
    SurfaceData sd = WGLSurfaceData.createData(peer);
    if (sd == null) {
        sd = GDIWindowSurfaceData.createData(peer);
    }
    return sd;
}
 
Example 9
Source File: Win32GraphicsConfig.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Creates a new SurfaceData that will be associated with the given
 * WComponentPeer.
 */
public SurfaceData createSurfaceData(WComponentPeer peer,
                                     int numBackBuffers)
{
    return GDIWindowSurfaceData.createData(peer);
}
 
Example 10
Source File: Win32GraphicsConfig.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Creates a new SurfaceData that will be associated with the given
 * WComponentPeer.
 */
public SurfaceData createSurfaceData(WComponentPeer peer,
                                     int numBackBuffers)
{
    return GDIWindowSurfaceData.createData(peer);
}
 
Example 11
Source File: Win32GraphicsConfig.java    From openjdk-jdk8u with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Creates a new SurfaceData that will be associated with the given
 * WComponentPeer.
 */
public SurfaceData createSurfaceData(WComponentPeer peer,
                                     int numBackBuffers)
{
    return GDIWindowSurfaceData.createData(peer);
}
 
Example 12
Source File: D3DScreenUpdateManager.java    From openjdk-jdk8u with GNU General Public License v2.0 4 votes vote down vote up
/**
 * If possible, creates a D3DWindowSurfaceData (which is actually
 * a back-buffer surface). If the creation fails, returns GDI
 * onscreen surface instead.
 *
 * Note that the created D3D surface does not initialize the native
 * resources (and is marked lost) to avoid wasting video memory. It is
 * restored when a graphics object is requested from the peer.
 *
 * Note that this method is called from a synchronized block in
 * WComponentPeer, so we don't need to synchronize
 *
 * Note that we only create a substibute d3dw surface if certain conditions
 * are met
 * <ul>
 *  <li>the fake d3d rendering on screen is not disabled via flag
 *  <li>d3d on the device is enabled
 *  <li>surface is larger than MIN_WIN_SIZE (don't bother for smaller ones)
 *  <li>it doesn't have a backBuffer for a BufferStrategy already
 *  <li>the peer is either Canvas, Panel, Window, Frame,
 *  Dialog or EmbeddedFrame
 * </ul>
 *
 * @param gc GraphicsConfiguration on associated with the surface
 * @param peer peer for which the surface is to be created
 * @param bbNum number of back-buffers requested. if this number is >0,
 * method returns GDI surface (we don't want to have two swap chains)
 * @param isResize whether this surface is being created in response to
 * a component resize event. This determines whether a repaint event will
 * be issued after a surface is created: it will be if <code>isResize</code>
 * is <code>true</code>.
 * @return surface data to be use for onscreen rendering
 */
@Override
public SurfaceData createScreenSurface(Win32GraphicsConfig gc,
                                       WComponentPeer peer,
                                       int bbNum, boolean isResize)
{
    if (done || !(gc instanceof D3DGraphicsConfig)) {
        return super.createScreenSurface(gc, peer, bbNum, isResize);
    }

    SurfaceData sd = null;

    if (canUseD3DOnScreen(peer, gc, bbNum)) {
        try {
            // note that the created surface will be in the "lost"
            // state, it will be restored prior to rendering to it
            // for the first time. This is done so that vram is not
            // wasted for surfaces never rendered to
            sd = D3DSurfaceData.createData(peer);
        }  catch (InvalidPipeException ipe) {
            sd = null;
        }
    }
    if (sd == null) {
        sd = GDIWindowSurfaceData.createData(peer);
        // note that we do not add this surface to the list of cached gdi
        // surfaces as there's no d3dw surface to associate it with;
        // this peer will have a gdi surface until next time a surface
        // will need to be replaced
    }

    if (isResize) {
        // since we'd potentially replaced the back-buffer surface
        // (either with another bb, or a gdi one), the
        // component will need to be completely repainted;
        // this only need to be done when the surface is created in
        // response to a resize event since when a component is created it
        // will be repainted anyway
        repaintPeerTarget(peer);
    }

    return sd;
}
 
Example 13
Source File: D3DScreenUpdateManager.java    From jdk8u_jdk with GNU General Public License v2.0 4 votes vote down vote up
/**
 * If possible, creates a D3DWindowSurfaceData (which is actually
 * a back-buffer surface). If the creation fails, returns GDI
 * onscreen surface instead.
 *
 * Note that the created D3D surface does not initialize the native
 * resources (and is marked lost) to avoid wasting video memory. It is
 * restored when a graphics object is requested from the peer.
 *
 * Note that this method is called from a synchronized block in
 * WComponentPeer, so we don't need to synchronize
 *
 * Note that we only create a substibute d3dw surface if certain conditions
 * are met
 * <ul>
 *  <li>the fake d3d rendering on screen is not disabled via flag
 *  <li>d3d on the device is enabled
 *  <li>surface is larger than MIN_WIN_SIZE (don't bother for smaller ones)
 *  <li>it doesn't have a backBuffer for a BufferStrategy already
 *  <li>the peer is either Canvas, Panel, Window, Frame,
 *  Dialog or EmbeddedFrame
 * </ul>
 *
 * @param gc GraphicsConfiguration on associated with the surface
 * @param peer peer for which the surface is to be created
 * @param bbNum number of back-buffers requested. if this number is >0,
 * method returns GDI surface (we don't want to have two swap chains)
 * @param isResize whether this surface is being created in response to
 * a component resize event. This determines whether a repaint event will
 * be issued after a surface is created: it will be if <code>isResize</code>
 * is <code>true</code>.
 * @return surface data to be use for onscreen rendering
 */
@Override
public SurfaceData createScreenSurface(Win32GraphicsConfig gc,
                                       WComponentPeer peer,
                                       int bbNum, boolean isResize)
{
    if (done || !(gc instanceof D3DGraphicsConfig)) {
        return super.createScreenSurface(gc, peer, bbNum, isResize);
    }

    SurfaceData sd = null;

    if (canUseD3DOnScreen(peer, gc, bbNum)) {
        try {
            // note that the created surface will be in the "lost"
            // state, it will be restored prior to rendering to it
            // for the first time. This is done so that vram is not
            // wasted for surfaces never rendered to
            sd = D3DSurfaceData.createData(peer);
        }  catch (InvalidPipeException ipe) {
            sd = null;
        }
    }
    if (sd == null) {
        sd = GDIWindowSurfaceData.createData(peer);
        // note that we do not add this surface to the list of cached gdi
        // surfaces as there's no d3dw surface to associate it with;
        // this peer will have a gdi surface until next time a surface
        // will need to be replaced
    }

    if (isResize) {
        // since we'd potentially replaced the back-buffer surface
        // (either with another bb, or a gdi one), the
        // component will need to be completely repainted;
        // this only need to be done when the surface is created in
        // response to a resize event since when a component is created it
        // will be repainted anyway
        repaintPeerTarget(peer);
    }

    return sd;
}
 
Example 14
Source File: D3DScreenUpdateManager.java    From jdk8u60 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * If possible, creates a D3DWindowSurfaceData (which is actually
 * a back-buffer surface). If the creation fails, returns GDI
 * onscreen surface instead.
 *
 * Note that the created D3D surface does not initialize the native
 * resources (and is marked lost) to avoid wasting video memory. It is
 * restored when a graphics object is requested from the peer.
 *
 * Note that this method is called from a synchronized block in
 * WComponentPeer, so we don't need to synchronize
 *
 * Note that we only create a substibute d3dw surface if certain conditions
 * are met
 * <ul>
 *  <li>the fake d3d rendering on screen is not disabled via flag
 *  <li>d3d on the device is enabled
 *  <li>surface is larger than MIN_WIN_SIZE (don't bother for smaller ones)
 *  <li>it doesn't have a backBuffer for a BufferStrategy already
 *  <li>the peer is either Canvas, Panel, Window, Frame,
 *  Dialog or EmbeddedFrame
 * </ul>
 *
 * @param gc GraphicsConfiguration on associated with the surface
 * @param peer peer for which the surface is to be created
 * @param bbNum number of back-buffers requested. if this number is >0,
 * method returns GDI surface (we don't want to have two swap chains)
 * @param isResize whether this surface is being created in response to
 * a component resize event. This determines whether a repaint event will
 * be issued after a surface is created: it will be if <code>isResize</code>
 * is <code>true</code>.
 * @return surface data to be use for onscreen rendering
 */
@Override
public SurfaceData createScreenSurface(Win32GraphicsConfig gc,
                                       WComponentPeer peer,
                                       int bbNum, boolean isResize)
{
    if (done || !(gc instanceof D3DGraphicsConfig)) {
        return super.createScreenSurface(gc, peer, bbNum, isResize);
    }

    SurfaceData sd = null;

    if (canUseD3DOnScreen(peer, gc, bbNum)) {
        try {
            // note that the created surface will be in the "lost"
            // state, it will be restored prior to rendering to it
            // for the first time. This is done so that vram is not
            // wasted for surfaces never rendered to
            sd = D3DSurfaceData.createData(peer);
        }  catch (InvalidPipeException ipe) {
            sd = null;
        }
    }
    if (sd == null) {
        sd = GDIWindowSurfaceData.createData(peer);
        // note that we do not add this surface to the list of cached gdi
        // surfaces as there's no d3dw surface to associate it with;
        // this peer will have a gdi surface until next time a surface
        // will need to be replaced
    }

    if (isResize) {
        // since we'd potentially replaced the back-buffer surface
        // (either with another bb, or a gdi one), the
        // component will need to be completely repainted;
        // this only need to be done when the surface is created in
        // response to a resize event since when a component is created it
        // will be repainted anyway
        repaintPeerTarget(peer);
    }

    return sd;
}
 
Example 15
Source File: Win32GraphicsConfig.java    From TencentKona-8 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Creates a new SurfaceData that will be associated with the given
 * WComponentPeer.
 */
public SurfaceData createSurfaceData(WComponentPeer peer,
                                     int numBackBuffers)
{
    return GDIWindowSurfaceData.createData(peer);
}
 
Example 16
Source File: Win32GraphicsConfig.java    From jdk8u-dev-jdk with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Creates a new SurfaceData that will be associated with the given
 * WComponentPeer.
 */
public SurfaceData createSurfaceData(WComponentPeer peer,
                                     int numBackBuffers)
{
    return GDIWindowSurfaceData.createData(peer);
}
 
Example 17
Source File: D3DScreenUpdateManager.java    From TencentKona-8 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * If possible, creates a D3DWindowSurfaceData (which is actually
 * a back-buffer surface). If the creation fails, returns GDI
 * onscreen surface instead.
 *
 * Note that the created D3D surface does not initialize the native
 * resources (and is marked lost) to avoid wasting video memory. It is
 * restored when a graphics object is requested from the peer.
 *
 * Note that this method is called from a synchronized block in
 * WComponentPeer, so we don't need to synchronize
 *
 * Note that we only create a substibute d3dw surface if certain conditions
 * are met
 * <ul>
 *  <li>the fake d3d rendering on screen is not disabled via flag
 *  <li>d3d on the device is enabled
 *  <li>surface is larger than MIN_WIN_SIZE (don't bother for smaller ones)
 *  <li>it doesn't have a backBuffer for a BufferStrategy already
 *  <li>the peer is either Canvas, Panel, Window, Frame,
 *  Dialog or EmbeddedFrame
 * </ul>
 *
 * @param gc GraphicsConfiguration on associated with the surface
 * @param peer peer for which the surface is to be created
 * @param bbNum number of back-buffers requested. if this number is >0,
 * method returns GDI surface (we don't want to have two swap chains)
 * @param isResize whether this surface is being created in response to
 * a component resize event. This determines whether a repaint event will
 * be issued after a surface is created: it will be if <code>isResize</code>
 * is <code>true</code>.
 * @return surface data to be use for onscreen rendering
 */
@Override
public SurfaceData createScreenSurface(Win32GraphicsConfig gc,
                                       WComponentPeer peer,
                                       int bbNum, boolean isResize)
{
    if (done || !(gc instanceof D3DGraphicsConfig)) {
        return super.createScreenSurface(gc, peer, bbNum, isResize);
    }

    SurfaceData sd = null;

    if (canUseD3DOnScreen(peer, gc, bbNum)) {
        try {
            // note that the created surface will be in the "lost"
            // state, it will be restored prior to rendering to it
            // for the first time. This is done so that vram is not
            // wasted for surfaces never rendered to
            sd = D3DSurfaceData.createData(peer);
        }  catch (InvalidPipeException ipe) {
            sd = null;
        }
    }
    if (sd == null) {
        sd = GDIWindowSurfaceData.createData(peer);
        // note that we do not add this surface to the list of cached gdi
        // surfaces as there's no d3dw surface to associate it with;
        // this peer will have a gdi surface until next time a surface
        // will need to be replaced
    }

    if (isResize) {
        // since we'd potentially replaced the back-buffer surface
        // (either with another bb, or a gdi one), the
        // component will need to be completely repainted;
        // this only need to be done when the surface is created in
        // response to a resize event since when a component is created it
        // will be repainted anyway
        repaintPeerTarget(peer);
    }

    return sd;
}
 
Example 18
Source File: Win32GraphicsConfig.java    From dragonwell8_jdk with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Creates a new SurfaceData that will be associated with the given
 * WComponentPeer.
 */
public SurfaceData createSurfaceData(WComponentPeer peer,
                                     int numBackBuffers)
{
    return GDIWindowSurfaceData.createData(peer);
}
 
Example 19
Source File: D3DScreenUpdateManager.java    From jdk8u-jdk with GNU General Public License v2.0 4 votes vote down vote up
/**
 * If possible, creates a D3DWindowSurfaceData (which is actually
 * a back-buffer surface). If the creation fails, returns GDI
 * onscreen surface instead.
 *
 * Note that the created D3D surface does not initialize the native
 * resources (and is marked lost) to avoid wasting video memory. It is
 * restored when a graphics object is requested from the peer.
 *
 * Note that this method is called from a synchronized block in
 * WComponentPeer, so we don't need to synchronize
 *
 * Note that we only create a substibute d3dw surface if certain conditions
 * are met
 * <ul>
 *  <li>the fake d3d rendering on screen is not disabled via flag
 *  <li>d3d on the device is enabled
 *  <li>surface is larger than MIN_WIN_SIZE (don't bother for smaller ones)
 *  <li>it doesn't have a backBuffer for a BufferStrategy already
 *  <li>the peer is either Canvas, Panel, Window, Frame,
 *  Dialog or EmbeddedFrame
 * </ul>
 *
 * @param gc GraphicsConfiguration on associated with the surface
 * @param peer peer for which the surface is to be created
 * @param bbNum number of back-buffers requested. if this number is >0,
 * method returns GDI surface (we don't want to have two swap chains)
 * @param isResize whether this surface is being created in response to
 * a component resize event. This determines whether a repaint event will
 * be issued after a surface is created: it will be if <code>isResize</code>
 * is <code>true</code>.
 * @return surface data to be use for onscreen rendering
 */
@Override
public SurfaceData createScreenSurface(Win32GraphicsConfig gc,
                                       WComponentPeer peer,
                                       int bbNum, boolean isResize)
{
    if (done || !(gc instanceof D3DGraphicsConfig)) {
        return super.createScreenSurface(gc, peer, bbNum, isResize);
    }

    SurfaceData sd = null;

    if (canUseD3DOnScreen(peer, gc, bbNum)) {
        try {
            // note that the created surface will be in the "lost"
            // state, it will be restored prior to rendering to it
            // for the first time. This is done so that vram is not
            // wasted for surfaces never rendered to
            sd = D3DSurfaceData.createData(peer);
        }  catch (InvalidPipeException ipe) {
            sd = null;
        }
    }
    if (sd == null) {
        sd = GDIWindowSurfaceData.createData(peer);
        // note that we do not add this surface to the list of cached gdi
        // surfaces as there's no d3dw surface to associate it with;
        // this peer will have a gdi surface until next time a surface
        // will need to be replaced
    }

    if (isResize) {
        // since we'd potentially replaced the back-buffer surface
        // (either with another bb, or a gdi one), the
        // component will need to be completely repainted;
        // this only need to be done when the surface is created in
        // response to a resize event since when a component is created it
        // will be repainted anyway
        repaintPeerTarget(peer);
    }

    return sd;
}
 
Example 20
Source File: Win32GraphicsConfig.java    From jdk8u_jdk with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Creates a new SurfaceData that will be associated with the given
 * WComponentPeer.
 */
public SurfaceData createSurfaceData(WComponentPeer peer,
                                     int numBackBuffers)
{
    return GDIWindowSurfaceData.createData(peer);
}