< prev index next >
src/java.desktop/unix/classes/sun/java2d/opengl/GLXVolatileSurfaceManager.java
Print this page
*** 44,81 ****
import static sun.java2d.pipe.hw.AccelSurface.*;
import static sun.java2d.pipe.hw.ExtendedBufferCapabilities.VSyncType.*;
public class GLXVolatileSurfaceManager extends VolatileSurfaceManager {
! private boolean accelerationEnabled;
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)));
}
protected boolean isAccelerationEnabled() {
return accelerationEnabled;
}
/**
! * Create a pbuffer-based SurfaceData object (or init the backbuffer
* of an existing window if this is a double buffered GraphicsConfig)
*/
protected SurfaceData initAcceleratedSurface() {
SurfaceData sData;
Component comp = vImg.getComponent();
--- 44,76 ----
import static sun.java2d.pipe.hw.AccelSurface.*;
import static sun.java2d.pipe.hw.ExtendedBufferCapabilities.VSyncType.*;
public class GLXVolatileSurfaceManager extends VolatileSurfaceManager {
! private final boolean accelerationEnabled;
public GLXVolatileSurfaceManager(SunVolatileImage vImg, Object context) {
super(vImg, context);
/*
* We will attempt to accelerate this image only under the
* following conditions:
! * - the image is not bitmask AND the GraphicsConfig supports the FBO
! * extension
*/
int transparency = vImg.getTransparency();
! GLXGraphicsConfig gc = (GLXGraphicsConfig) vImg.getGraphicsConfig();
! accelerationEnabled = gc.isCapPresent(CAPS_EXT_FBOBJECT)
! && transparency != Transparency.BITMASK;
}
protected boolean isAccelerationEnabled() {
return accelerationEnabled;
}
/**
! * Create a FBO-based SurfaceData object (or init the backbuffer
* of an existing window if this is a double buffered GraphicsConfig)
*/
protected SurfaceData initAcceleratedSurface() {
SurfaceData sData;
Component comp = vImg.getComponent();
*** 111,124 ****
GLXGraphicsConfig gc =
(GLXGraphicsConfig)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) {
sData = GLXSurfaceData.createData(peer, vImg, type);
} else {
sData = GLXSurfaceData.createData(gc,
--- 106,118 ----
GLXGraphicsConfig gc =
(GLXGraphicsConfig)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) {
sData = GLXSurfaceData.createData(peer, vImg, type);
} else {
sData = GLXSurfaceData.createData(gc,
< prev index next >