// Getting the DataBuffer for an image (as it's done below) defeats
// possible future acceleration.
// Calling setLocalAccelerationEnabled on that image's surface
// manager re-enables it.
boolean accelerated = false;
CachingSurfaceManager csm = null;
SurfaceManager sm = SurfaceManager.getManager(image);
if (sm instanceof CachingSurfaceManager) {
csm = (CachingSurfaceManager)sm;
accelerated = csm.isLocalAccelerationEnabled();
}
DataBufferInt data = (DataBufferInt)image.getRaster().getDataBuffer();
synchronized(sun.awt.UNIXToolkit.GTK_LOCK) {
native_get_image(data.getData(), size.width, size.height,
widgetType, state);
}
if (csm != null && accelerated != csm.isLocalAccelerationEnabled()) {
csm.setLocalAccelerationEnabled(accelerated);
csm.rasterChanged();
}
return images[state] = image;
}