sun.awt.image.SunVolatileImage Java Examples

The following examples show how to use sun.awt.image.SunVolatileImage. 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: CGLGraphicsConfig.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
@Override
public VolatileImage createCompatibleVolatileImage(int width, int height,
                                                   int transparency,
                                                   int type) {
    if ((type != FBOBJECT && type != TEXTURE)
            || transparency == Transparency.BITMASK
            || type == FBOBJECT && !isCapPresent(CAPS_EXT_FBOBJECT)) {
        return null;
    }
    SunVolatileImage vi = new AccelTypedVolatileImage(this, width, height,
                                                      transparency, type);
    Surface sd = vi.getDestSurface();
    if (!(sd instanceof AccelSurface) ||
        ((AccelSurface)sd).getType() != type)
    {
        vi.flush();
        vi = null;
    }

    return vi;
}
 
Example #2
Source File: WGLGraphicsConfig.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * {@inheritDoc}
 *
 * @see sun.java2d.pipe.hw.AccelGraphicsConfig#createCompatibleVolatileImage
 */
@Override
public VolatileImage
    createCompatibleVolatileImage(int width, int height,
                                  int transparency, int type)
{
    if ((type != FBOBJECT && type != TEXTURE)
            || transparency == Transparency.BITMASK
            || type == FBOBJECT && !isCapPresent(CAPS_EXT_FBOBJECT)) {
        return null;
    }
    SunVolatileImage vi = new AccelTypedVolatileImage(this, width, height,
                                                      transparency, type);
    Surface sd = vi.getDestSurface();
    if (!(sd instanceof AccelSurface) ||
        ((AccelSurface)sd).getType() != type)
    {
        vi.flush();
        vi = null;
    }

    return vi;
}
 
Example #3
Source File: X11VolatileSurfaceManager.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
public X11VolatileSurfaceManager(SunVolatileImage vImg, Object context) {
    super(vImg, context);

    // We only accelerated opaque vImages currently
    accelerationEnabled = X11SurfaceData.isAccelerationEnabled() &&
        (vImg.getTransparency() == Transparency.OPAQUE);

    if ((context != null) && !accelerationEnabled) {
        // if we're wrapping a backbuffer drawable, we must ensure that
        // the accelerated surface is initialized up front, regardless
        // of whether acceleration is enabled. But we need to set
        // the  accelerationEnabled field to true to reflect that this
        // SM is actually accelerated.
        accelerationEnabled = true;
        sdAccel = initAcceleratedSurface();
        sdCurrent = sdAccel;

        if (sdBackup != null) {
            // release the system memory backup surface, as we won't be
            // needing it in this case
            sdBackup = null;
        }
    }
}
 
Example #4
Source File: CGLVolatileSurfaceManager.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
public CGLVolatileSurfaceManager(SunVolatileImage vImg, Object context) {
    super(vImg, context);

    /*
     * We will attempt to accelerate this image only under the
     * following conditions:
     *   - the image is opaque OR
     *   - the image is translucent AND
     *       - the GraphicsConfig supports the FBO extension OR
     *       - the GraphicsConfig has a stored alpha channel
     */
    int transparency = vImg.getTransparency();
    CGLGraphicsConfig gc = (CGLGraphicsConfig)vImg.getGraphicsConfig();
    accelerationEnabled =
        (transparency == Transparency.OPAQUE) ||
        ((transparency == Transparency.TRANSLUCENT) &&
         (gc.isCapPresent(CAPS_EXT_FBOBJECT) ||
          gc.isCapPresent(CAPS_STORED_ALPHA)));
}
 
Example #5
Source File: CGLVolatileSurfaceManager.java    From dragonwell8_jdk with GNU General Public License v2.0 6 votes vote down vote up
public CGLVolatileSurfaceManager(SunVolatileImage vImg, Object context) {
    super(vImg, context);

    /*
     * We will attempt to accelerate this image only under the
     * following conditions:
     *   - the image is opaque OR
     *   - the image is translucent AND
     *       - the GraphicsConfig supports the FBO extension OR
     *       - the GraphicsConfig has a stored alpha channel
     */
    int transparency = vImg.getTransparency();
    CGLGraphicsConfig gc = (CGLGraphicsConfig)vImg.getGraphicsConfig();
    accelerationEnabled =
        (transparency == Transparency.OPAQUE) ||
        ((transparency == Transparency.TRANSLUCENT) &&
         (gc.isCapPresent(CAPS_EXT_FBOBJECT) ||
          gc.isCapPresent(CAPS_STORED_ALPHA)));
}
 
Example #6
Source File: X11VolatileSurfaceManager.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
public X11VolatileSurfaceManager(SunVolatileImage vImg, Object context) {
    super(vImg, context);

    // We only accelerated opaque vImages currently
    accelerationEnabled = X11SurfaceData.isAccelerationEnabled() &&
        (vImg.getTransparency() == Transparency.OPAQUE);

    if ((context != null) && !accelerationEnabled) {
        // if we're wrapping a backbuffer drawable, we must ensure that
        // the accelerated surface is initialized up front, regardless
        // of whether acceleration is enabled. But we need to set
        // the  accelerationEnabled field to true to reflect that this
        // SM is actually accelerated.
        accelerationEnabled = true;
        sdAccel = initAcceleratedSurface();
        sdCurrent = sdAccel;

        if (sdBackup != null) {
            // release the system memory backup surface, as we won't be
            // needing it in this case
            sdBackup = null;
        }
    }
}
 
Example #7
Source File: D3DVolatileSurfaceManager.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
public D3DVolatileSurfaceManager(SunVolatileImage vImg, Object context) {
    super(vImg, context);

    /*
     * We will attempt to accelerate this image only under the
     * following conditions:
     *   - the image is opaque OR
     *   - the image is translucent AND
     *       - the GraphicsConfig supports the FBO extension OR
     *       - the GraphicsConfig has a stored alpha channel
     */
    int transparency = vImg.getTransparency();
    D3DGraphicsDevice gd = (D3DGraphicsDevice)
        vImg.getGraphicsConfig().getDevice();
    accelerationEnabled =
        (transparency == Transparency.OPAQUE) ||
        (transparency == Transparency.TRANSLUCENT &&
         (gd.isCapPresent(CAPS_RT_PLAIN_ALPHA) ||
          gd.isCapPresent(CAPS_RT_TEXTURE_ALPHA)));
}
 
Example #8
Source File: GLXVolatileSurfaceManager.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
public GLXVolatileSurfaceManager(SunVolatileImage vImg, Object context) {
    super(vImg, context);

    /*
     * We will attempt to accelerate this image only under the
     * following conditions:
     *   - the image is opaque OR
     *   - the image is translucent AND
     *       - the GraphicsConfig supports the FBO extension OR
     *       - the GraphicsConfig has a stored alpha channel
     */
    int transparency = vImg.getTransparency();
    GLXGraphicsConfig gc = (GLXGraphicsConfig)vImg.getGraphicsConfig();
    accelerationEnabled =
        (transparency == Transparency.OPAQUE) ||
        ((transparency == Transparency.TRANSLUCENT) &&
         (gc.isCapPresent(CAPS_EXT_FBOBJECT) ||
          gc.isCapPresent(CAPS_STORED_ALPHA)));
}
 
Example #9
Source File: GLXVolatileSurfaceManager.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
public GLXVolatileSurfaceManager(SunVolatileImage vImg, Object context) {
    super(vImg, context);

    /*
     * We will attempt to accelerate this image only under the
     * following conditions:
     *   - the image is opaque OR
     *   - the image is translucent AND
     *       - the GraphicsConfig supports the FBO extension OR
     *       - the GraphicsConfig has a stored alpha channel
     */
    int transparency = vImg.getTransparency();
    GLXGraphicsConfig gc = (GLXGraphicsConfig)vImg.getGraphicsConfig();
    accelerationEnabled =
        (transparency == Transparency.OPAQUE) ||
        ((transparency == Transparency.TRANSLUCENT) &&
         (gc.isCapPresent(CAPS_EXT_FBOBJECT) ||
          gc.isCapPresent(CAPS_STORED_ALPHA)));
}
 
Example #10
Source File: D3DVolatileSurfaceManager.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
public D3DVolatileSurfaceManager(SunVolatileImage vImg, Object context) {
    super(vImg, context);

    /*
     * We will attempt to accelerate this image only under the
     * following conditions:
     *   - the image is opaque OR
     *   - the image is translucent AND
     *       - the GraphicsConfig supports the FBO extension OR
     *       - the GraphicsConfig has a stored alpha channel
     */
    int transparency = vImg.getTransparency();
    D3DGraphicsDevice gd = (D3DGraphicsDevice)
        vImg.getGraphicsConfig().getDevice();
    accelerationEnabled =
        (transparency == Transparency.OPAQUE) ||
        (transparency == Transparency.TRANSLUCENT &&
         (gd.isCapPresent(CAPS_RT_PLAIN_ALPHA) ||
          gd.isCapPresent(CAPS_RT_TEXTURE_ALPHA)));
}
 
Example #11
Source File: X11VolatileSurfaceManager.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
public X11VolatileSurfaceManager(SunVolatileImage vImg, Object context) {
    super(vImg, context);

    // We only accelerated opaque vImages currently
    accelerationEnabled = X11SurfaceData.isAccelerationEnabled() &&
        (vImg.getTransparency() == Transparency.OPAQUE);

    if ((context != null) && !accelerationEnabled) {
        // if we're wrapping a backbuffer drawable, we must ensure that
        // the accelerated surface is initialized up front, regardless
        // of whether acceleration is enabled. But we need to set
        // the  accelerationEnabled field to true to reflect that this
        // SM is actually accelerated.
        accelerationEnabled = true;
        sdAccel = initAcceleratedSurface();
        sdCurrent = sdAccel;

        if (sdBackup != null) {
            // release the system memory backup surface, as we won't be
            // needing it in this case
            sdBackup = null;
        }
    }
}
 
Example #12
Source File: GLXVolatileSurfaceManager.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
public GLXVolatileSurfaceManager(SunVolatileImage vImg, Object context) {
    super(vImg, context);

    /*
     * We will attempt to accelerate this image only under the
     * following conditions:
     *   - the image is opaque OR
     *   - the image is translucent AND
     *       - the GraphicsConfig supports the FBO extension OR
     *       - the GraphicsConfig has a stored alpha channel
     */
    int transparency = vImg.getTransparency();
    GLXGraphicsConfig gc = (GLXGraphicsConfig)vImg.getGraphicsConfig();
    accelerationEnabled =
        (transparency == Transparency.OPAQUE) ||
        ((transparency == Transparency.TRANSLUCENT) &&
         (gc.isCapPresent(CAPS_EXT_FBOBJECT) ||
          gc.isCapPresent(CAPS_STORED_ALPHA)));
}
 
Example #13
Source File: CGLVolatileSurfaceManager.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
public CGLVolatileSurfaceManager(SunVolatileImage vImg, Object context) {
    super(vImg, context);

    /*
     * We will attempt to accelerate this image only under the
     * following conditions:
     *   - the image is opaque OR
     *   - the image is translucent AND
     *       - the GraphicsConfig supports the FBO extension OR
     *       - the GraphicsConfig has a stored alpha channel
     */
    int transparency = vImg.getTransparency();
    CGLGraphicsConfig gc = (CGLGraphicsConfig)vImg.getGraphicsConfig();
    accelerationEnabled =
        (transparency == Transparency.OPAQUE) ||
        ((transparency == Transparency.TRANSLUCENT) &&
         (gc.isCapPresent(CAPS_EXT_FBOBJECT) ||
          gc.isCapPresent(CAPS_STORED_ALPHA)));
}
 
Example #14
Source File: GLXVolatileSurfaceManager.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
public GLXVolatileSurfaceManager(SunVolatileImage vImg, Object context) {
    super(vImg, context);

    /*
     * We will attempt to accelerate this image only under the
     * following conditions:
     *   - the image is opaque OR
     *   - the image is translucent AND
     *       - the GraphicsConfig supports the FBO extension OR
     *       - the GraphicsConfig has a stored alpha channel
     */
    int transparency = vImg.getTransparency();
    GLXGraphicsConfig gc = (GLXGraphicsConfig)vImg.getGraphicsConfig();
    accelerationEnabled =
        (transparency == Transparency.OPAQUE) ||
        ((transparency == Transparency.TRANSLUCENT) &&
         (gc.isCapPresent(CAPS_EXT_FBOBJECT) ||
          gc.isCapPresent(CAPS_STORED_ALPHA)));
}
 
Example #15
Source File: WGLVolatileSurfaceManager.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
public WGLVolatileSurfaceManager(SunVolatileImage vImg, Object context) {
    super(vImg, context);

    /*
     * We will attempt to accelerate this image only under the
     * following conditions:
     *   - the image is opaque OR
     *   - the image is translucent AND
     *       - the GraphicsConfig supports the FBO extension OR
     *       - the GraphicsConfig has a stored alpha channel
     */
    int transparency = vImg.getTransparency();
    WGLGraphicsConfig gc = (WGLGraphicsConfig)vImg.getGraphicsConfig();
    accelerationEnabled =
        (transparency == Transparency.OPAQUE) ||
        ((transparency == Transparency.TRANSLUCENT) &&
         (gc.isCapPresent(CAPS_EXT_FBOBJECT) ||
          gc.isCapPresent(CAPS_STORED_ALPHA)));
}
 
Example #16
Source File: WGLVolatileSurfaceManager.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
public WGLVolatileSurfaceManager(SunVolatileImage vImg, Object context) {
    super(vImg, context);

    /*
     * We will attempt to accelerate this image only under the
     * following conditions:
     *   - the image is opaque OR
     *   - the image is translucent AND
     *       - the GraphicsConfig supports the FBO extension OR
     *       - the GraphicsConfig has a stored alpha channel
     */
    int transparency = vImg.getTransparency();
    WGLGraphicsConfig gc = (WGLGraphicsConfig)vImg.getGraphicsConfig();
    accelerationEnabled =
        (transparency == Transparency.OPAQUE) ||
        ((transparency == Transparency.TRANSLUCENT) &&
         (gc.isCapPresent(CAPS_EXT_FBOBJECT) ||
          gc.isCapPresent(CAPS_STORED_ALPHA)));
}
 
Example #17
Source File: WindowsSurfaceManagerFactory.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Creates a new instance of a VolatileSurfaceManager given any
 * arbitrary SunVolatileImage.  An optional context Object can be supplied
 * as a way for the caller to pass pipeline-specific context data to
 * the VolatileSurfaceManager (such as a backbuffer handle, for example).
 *
 * For Windows platforms, this method returns a Windows-specific
 * VolatileSurfaceManager.
 */
public VolatileSurfaceManager createVolatileManager(SunVolatileImage vImg,
                                                    Object context)
{
    GraphicsConfiguration gc = vImg.getGraphicsConfig();
    if (gc instanceof D3DGraphicsConfig) {
        return new D3DVolatileSurfaceManager(vImg, context);
    } else if (gc instanceof WGLGraphicsConfig) {
        return new WGLVolatileSurfaceManager(vImg, context);
    } else {
        return new BufImgVolatileSurfaceManager(vImg, context);
    }
}
 
Example #18
Source File: WGLGraphicsConfig.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * {@inheritDoc}
 *
 * @see sun.java2d.pipe.hw.AccelGraphicsConfig#createCompatibleVolatileImage
 */
@Override
public VolatileImage
    createCompatibleVolatileImage(int width, int height,
                                  int transparency, int type)
{
    if (type == FLIP_BACKBUFFER || type == WINDOW || type == UNDEFINED ||
        transparency == Transparency.BITMASK)
    {
        return null;
    }

    if (type == FBOBJECT) {
        if (!isCapPresent(CAPS_EXT_FBOBJECT)) {
            return null;
        }
    } else if (type == PBUFFER) {
        boolean isOpaque = transparency == Transparency.OPAQUE;
        if (!isOpaque && !isCapPresent(CAPS_STORED_ALPHA)) {
            return null;
        }
    }

    SunVolatileImage vi = new AccelTypedVolatileImage(this, width, height,
                                                      transparency, type);
    Surface sd = vi.getDestSurface();
    if (!(sd instanceof AccelSurface) ||
        ((AccelSurface)sd).getType() != type)
    {
        vi.flush();
        vi = null;
    }

    return vi;
}
 
Example #19
Source File: X11GraphicsConfig.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Creates a VolatileImage that essentially wraps the target Component's
 * backbuffer, using the provided backbuffer handle.
 */
public VolatileImage createBackBufferImage(Component target,
                                           long backBuffer)
{
    // it is possible for the component to have size 0x0, adjust it to
    // be at least 1x1 to avoid IAE
    int w = Math.max(1, target.getWidth());
    int h = Math.max(1, target.getHeight());
    return new SunVolatileImage(target,
                                w, h,
                                Long.valueOf(backBuffer));
}
 
Example #20
Source File: GLXGraphicsConfig.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * {@inheritDoc}
 *
 * @see sun.java2d.pipe.hw.AccelGraphicsConfig#createCompatibleVolatileImage
 */
@Override
public VolatileImage
    createCompatibleVolatileImage(int width, int height,
                                  int transparency, int type)
{
    if (type == FLIP_BACKBUFFER || type == WINDOW || type == UNDEFINED ||
        transparency == Transparency.BITMASK)
    {
        return null;
    }

    if (type == FBOBJECT) {
        if (!isCapPresent(CAPS_EXT_FBOBJECT)) {
            return null;
        }
    } else if (type == PBUFFER) {
        boolean isOpaque = transparency == Transparency.OPAQUE;
        if (!isOpaque && !isCapPresent(CAPS_STORED_ALPHA)) {
            return null;
        }
    }

    SunVolatileImage vi = new AccelTypedVolatileImage(this, width, height,
                                                      transparency, type);
    Surface sd = vi.getDestSurface();
    if (!(sd instanceof AccelSurface) ||
        ((AccelSurface)sd).getType() != type)
    {
        vi.flush();
        vi = null;
    }

    return vi;
}
 
Example #21
Source File: GLXGraphicsConfig.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * {@inheritDoc}
 *
 * @see sun.java2d.pipe.hw.AccelGraphicsConfig#createCompatibleVolatileImage
 */
@Override
public VolatileImage
    createCompatibleVolatileImage(int width, int height,
                                  int transparency, int type)
{
    if (type == FLIP_BACKBUFFER || type == WINDOW || type == UNDEFINED ||
        transparency == Transparency.BITMASK)
    {
        return null;
    }

    if (type == FBOBJECT) {
        if (!isCapPresent(CAPS_EXT_FBOBJECT)) {
            return null;
        }
    } else if (type == PBUFFER) {
        boolean isOpaque = transparency == Transparency.OPAQUE;
        if (!isOpaque && !isCapPresent(CAPS_STORED_ALPHA)) {
            return null;
        }
    }

    SunVolatileImage vi = new AccelTypedVolatileImage(this, width, height,
                                                      transparency, type);
    Surface sd = vi.getDestSurface();
    if (!(sd instanceof AccelSurface) ||
        ((AccelSurface)sd).getType() != type)
    {
        vi.flush();
        vi = null;
    }

    return vi;
}
 
Example #22
Source File: CGLGraphicsConfig.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
@Override
public VolatileImage createCompatibleVolatileImage(int width, int height,
                                                   int transparency,
                                                   int type) {
    if (type == FLIP_BACKBUFFER || type == WINDOW || type == UNDEFINED ||
        transparency == Transparency.BITMASK)
    {
        return null;
    }

    if (type == FBOBJECT) {
        if (!isCapPresent(CAPS_EXT_FBOBJECT)) {
            return null;
        }
    } else if (type == PBUFFER) {
        boolean isOpaque = transparency == Transparency.OPAQUE;
        if (!isOpaque && !isCapPresent(CAPS_STORED_ALPHA)) {
            return null;
        }
    }

    SunVolatileImage vi = new AccelTypedVolatileImage(this, width, height,
                                                      transparency, type);
    Surface sd = vi.getDestSurface();
    if (!(sd instanceof AccelSurface) ||
        ((AccelSurface)sd).getType() != type)
    {
        vi.flush();
        vi = null;
    }

    return vi;
}
 
Example #23
Source File: GLXGraphicsConfig.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
/**
 * {@inheritDoc}
 *
 * @see sun.java2d.pipe.hw.AccelGraphicsConfig#createCompatibleVolatileImage
 */
@Override
public VolatileImage
    createCompatibleVolatileImage(int width, int height,
                                  int transparency, int type)
{
    if (type == FLIP_BACKBUFFER || type == WINDOW || type == UNDEFINED ||
        transparency == Transparency.BITMASK)
    {
        return null;
    }

    if (type == FBOBJECT) {
        if (!isCapPresent(CAPS_EXT_FBOBJECT)) {
            return null;
        }
    } else if (type == PBUFFER) {
        boolean isOpaque = transparency == Transparency.OPAQUE;
        if (!isOpaque && !isCapPresent(CAPS_STORED_ALPHA)) {
            return null;
        }
    }

    SunVolatileImage vi = new AccelTypedVolatileImage(this, width, height,
                                                      transparency, type);
    Surface sd = vi.getDestSurface();
    if (!(sd instanceof AccelSurface) ||
        ((AccelSurface)sd).getType() != type)
    {
        vi.flush();
        vi = null;
    }

    return vi;
}
 
Example #24
Source File: UnixSurfaceManagerFactory.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Creates a new instance of a VolatileSurfaceManager given any
 * arbitrary SunVolatileImage.  An optional context Object can be supplied
 * as a way for the caller to pass pipeline-specific context data to
 * the VolatileSurfaceManager (such as a backbuffer handle, for example).
 *
 * For Unix platforms, this method returns either an X11- or a GLX-
 * specific VolatileSurfaceManager based on the GraphicsConfiguration
 * under which the SunVolatileImage was created.
 */
public VolatileSurfaceManager createVolatileManager(SunVolatileImage vImg,
                                                    Object context)
{
    GraphicsConfiguration gc = vImg.getGraphicsConfig();

    if (gc instanceof GLXGraphicsConfig) {
        return new GLXVolatileSurfaceManager(vImg, context);
    } else if(gc instanceof XRGraphicsConfig) {
        return new XRVolatileSurfaceManager(vImg, context);
    }else {
        return new X11VolatileSurfaceManager(vImg, context);
    }
}
 
Example #25
Source File: WGLGraphicsConfig.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Creates a WGL-based backbuffer for the given peer and returns the
 * image wrapper.
 */
@Override
public VolatileImage createBackBuffer(WComponentPeer peer) {
    Component target = (Component)peer.getTarget();
    // it is possible for the component to have size 0x0, adjust it to
    // be at least 1x1 to avoid IAE
    int w = Math.max(1, target.getWidth());
    int h = Math.max(1, target.getHeight());
    return new SunVolatileImage(target,
                                w, h,
                                Boolean.TRUE);
}
 
Example #26
Source File: VolatileSurfaceManager.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
protected VolatileSurfaceManager(SunVolatileImage vImg, Object context) {
    this.vImg = vImg;
    this.context = context;

    GraphicsEnvironment ge =
        GraphicsEnvironment.getLocalGraphicsEnvironment();
    // We could have a HeadlessGE at this point, so double-check before
    // assuming anything.
    if (ge instanceof SunGraphicsEnvironment) {
        ((SunGraphicsEnvironment)ge).addDisplayChangedListener(this);
    }
}
 
Example #27
Source File: GLXGraphicsConfig.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
/**
 * {@inheritDoc}
 *
 * @see sun.java2d.pipe.hw.AccelGraphicsConfig#createCompatibleVolatileImage
 */
@Override
public VolatileImage
    createCompatibleVolatileImage(int width, int height,
                                  int transparency, int type)
{
    if (type == FLIP_BACKBUFFER || type == WINDOW || type == UNDEFINED ||
        transparency == Transparency.BITMASK)
    {
        return null;
    }

    if (type == FBOBJECT) {
        if (!isCapPresent(CAPS_EXT_FBOBJECT)) {
            return null;
        }
    } else if (type == PBUFFER) {
        boolean isOpaque = transparency == Transparency.OPAQUE;
        if (!isOpaque && !isCapPresent(CAPS_STORED_ALPHA)) {
            return null;
        }
    }

    SunVolatileImage vi = new AccelTypedVolatileImage(this, width, height,
                                                      transparency, type);
    Surface sd = vi.getDestSurface();
    if (!(sd instanceof AccelSurface) ||
        ((AccelSurface)sd).getType() != type)
    {
        vi.flush();
        vi = null;
    }

    return vi;
}
 
Example #28
Source File: X11GraphicsConfig.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Creates a VolatileImage that essentially wraps the target Component's
 * backbuffer, using the provided backbuffer handle.
 */
public VolatileImage createBackBufferImage(Component target,
                                           long backBuffer)
{
    // it is possible for the component to have size 0x0, adjust it to
    // be at least 1x1 to avoid IAE
    int w = Math.max(1, target.getWidth());
    int h = Math.max(1, target.getHeight());
    return new SunVolatileImage(target,
                                w, h,
                                Long.valueOf(backBuffer));
}
 
Example #29
Source File: D3DGraphicsConfig.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Creates a D3D-based backbuffer for the given peer and returns the
 * image wrapper.
 */
@Override
public VolatileImage createBackBuffer(WComponentPeer peer) {
    Component target = (Component)peer.getTarget();
    // it is possible for the component to have size 0x0, adjust it to
    // be at least 1x1 to avoid IAE
    int w = Math.max(1, target.getWidth());
    int h = Math.max(1, target.getHeight());
    return new SunVolatileImage(target, w, h, Boolean.TRUE);
}
 
Example #30
Source File: UnixSurfaceManagerFactory.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Creates a new instance of a VolatileSurfaceManager given any
 * arbitrary SunVolatileImage.  An optional context Object can be supplied
 * as a way for the caller to pass pipeline-specific context data to
 * the VolatileSurfaceManager (such as a backbuffer handle, for example).
 *
 * For Unix platforms, this method returns either an X11- or a GLX-
 * specific VolatileSurfaceManager based on the GraphicsConfiguration
 * under which the SunVolatileImage was created.
 */
public VolatileSurfaceManager createVolatileManager(SunVolatileImage vImg,
                                                    Object context)
{
    GraphicsConfiguration gc = vImg.getGraphicsConfig();

    if (gc instanceof GLXGraphicsConfig) {
        return new GLXVolatileSurfaceManager(vImg, context);
    } else if(gc instanceof XRGraphicsConfig) {
        return new XRVolatileSurfaceManager(vImg, context);
    }else {
        return new X11VolatileSurfaceManager(vImg, context);
    }
}