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))); }
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))); }
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))); }
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))); }
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; } } }
/** * {@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; }
@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; }
/** * Shows a frame, then refs its back buffer. */ static void showFrame(CountDownLatch latch) { JFrame frame = new JFrame("frame") { @Override public VolatileImage createVolatileImage(int w, int h) { // Back the frame buffer by BufferedImage so that it's allocated in RAM VolatileImage img = new SunVolatileImage(BI_GC, w, h, Transparency.TRANSLUCENT, new ImageCapabilities(false)); STRONG_MAP.put(img, null); EventQueue.invokeLater(() -> { dispose(); // release the frame buffer latch.countDown(); }); return img; } }; frame.setSize(500, 500); frame.setLocationRelativeTo(null); frame.setVisible(true); }