< prev index next >
src/java.desktop/macosx/classes/sun/java2d/opengl/CGLVolatileSurfaceManager.java
Print this page
*** 27,37 ****
import java.awt.BufferCapabilities;
import static java.awt.BufferCapabilities.FlipContents.*;
import java.awt.Component;
import java.awt.GraphicsConfiguration;
- import java.awt.Transparency;
import java.awt.image.ColorModel;
import java.awt.peer.ComponentPeer;
import sun.awt.AWTAccessor;
import sun.awt.AWTAccessor.ComponentAccessor;
--- 27,36 ----
*** 43,72 ****
import sun.java2d.pipe.hw.ExtendedBufferCapabilities;
import static sun.java2d.pipe.hw.ExtendedBufferCapabilities.VSyncType.*;
public class CGLVolatileSurfaceManager extends VolatileSurfaceManager {
! private boolean accelerationEnabled;
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)));
}
protected boolean isAccelerationEnabled() {
return accelerationEnabled;
}
--- 42,63 ----
import sun.java2d.pipe.hw.ExtendedBufferCapabilities;
import static sun.java2d.pipe.hw.ExtendedBufferCapabilities.VSyncType.*;
public class CGLVolatileSurfaceManager extends VolatileSurfaceManager {
! private final boolean accelerationEnabled;
public CGLVolatileSurfaceManager(SunVolatileImage vImg, Object context) {
super(vImg, context);
/*
* We will attempt to accelerate this image only under the
* following conditions:
! * - the GraphicsConfig supports the FBO extension
*/
CGLGraphicsConfig gc = (CGLGraphicsConfig)vImg.getGraphicsConfig();
! accelerationEnabled = gc.isCapPresent(CAPS_EXT_FBOBJECT);
}
protected boolean isAccelerationEnabled() {
return accelerationEnabled;
}
*** 111,124 ****
CGLGraphicsConfig gc =
(CGLGraphicsConfig)vImg.getGraphicsConfig();
ColorModel cm = gc.getColorModel(vImg.getTransparency());
int type = vImg.getForcedAccelSurfaceType();
// if acceleration type is forced (type != UNDEFINED) then
! // use the forced type, otherwise choose one based on caps
if (type == OGLSurfaceData.UNDEFINED) {
! type = gc.isCapPresent(CAPS_EXT_FBOBJECT) ?
! OGLSurfaceData.FBOBJECT : OGLSurfaceData.PBUFFER;
}
if (createVSynced) {
// TODO: modify parameter to delegate
// sData = CGLSurfaceData.createData(peer, vImg, type);
} else {
--- 102,114 ----
CGLGraphicsConfig gc =
(CGLGraphicsConfig)vImg.getGraphicsConfig();
ColorModel cm = gc.getColorModel(vImg.getTransparency());
int type = vImg.getForcedAccelSurfaceType();
// if acceleration type is forced (type != UNDEFINED) then
! // use the forced type, otherwise choose FBOBJECT
if (type == OGLSurfaceData.UNDEFINED) {
! type = OGLSurfaceData.FBOBJECT;
}
if (createVSynced) {
// TODO: modify parameter to delegate
// sData = CGLSurfaceData.createData(peer, vImg, type);
} else {
< prev index next >