// 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.
SurfaceManager sm = SurfaceManager.getManager(bi);
if (sm.getClass().getName().equals("sun.awt.image.CachingSurfaceManager")) {
try {
accEnabled = (Boolean) ReflectionUtils.callGet(sm, "isLocalAccelerationEnabled");
}
catch (Exception e) {
// ignore
}
}
WritableRaster raster = bi.getRaster();
DataBufferInt buffer = (DataBufferInt) raster.getDataBuffer();
ThemeReader.paintBackground(buffer.getData(),
part.getControlName(c), part.getValue(),
TMSchema.State.getValue(part, state),
0, 0, w, h, w);
if (sm.getClass().getName().equals("sun.awt.image.CachingSurfaceManager")) {
try {
boolean oldAccEnabled = (Boolean) ReflectionUtils.callGet(sm, "isLocalAccelerationEnabled");
if (accEnabled != oldAccEnabled) {
ReflectionUtils.callSet(sm, "setLocalAccelerationEnabled", accEnabled);
ReflectionUtils.call(sm, "rasterChanged");