本文整理汇总了Java中sun.java2d.SurfaceData.invalidate方法的典型用法代码示例。如果您正苦于以下问题:Java SurfaceData.invalidate方法的具体用法?Java SurfaceData.invalidate怎么用?Java SurfaceData.invalidate使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sun.java2d.SurfaceData
的用法示例。
在下文中一共展示了SurfaceData.invalidate方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: displayChanged
import sun.java2d.SurfaceData; //导入方法依赖的package包/类
/**
* Called from SunGraphicsEnv when there has been a display mode change.
* Note that we simply invalidate hardware surfaces here; we do not
* attempt to recreate or re-render them. This is to avoid threading
* conflicts with the native toolkit and associated threads. Instead,
* we just nullify the old surface data object and wait for a future
* method in the rendering process to recreate the surface.
*/
public void displayChanged() {
if (!isAccelerationEnabled()) {
return;
}
lostSurface = true;
if (sdAccel != null) {
// First, nullify the software surface. This guards against
// using a SurfaceData that was created in a different
// display mode.
sdBackup = null;
// Now, invalidate the old hardware-based SurfaceData
// Note that getBackupSurface may set sdAccel to null so we have to invalidate it before
SurfaceData oldData = sdAccel;
sdAccel = null;
oldData.invalidate();
sdCurrent = getBackupSurface();
}
// Update graphicsConfig for the vImg in case it changed due to
// this display change event
vImg.updateGraphicsConfig();
}
示例2: disposeImpl
import sun.java2d.SurfaceData; //导入方法依赖的package包/类
@Override
protected void disposeImpl() {
SurfaceData oldData = surfaceData;
surfaceData = null;
ScreenUpdateManager.getInstance().dropScreenSurface(oldData);
oldData.invalidate();
// remove from updater before calling targetDisposedPeer
WToolkit.targetDisposedPeer(target, this);
_dispose();
}
示例3: doValidateSurface
import sun.java2d.SurfaceData; //导入方法依赖的package包/类
final void doValidateSurface() {
SurfaceData oldData = surfaceData;
if (oldData != null) {
surfaceData = graphicsConfig.createSurfaceData(this);
oldData.invalidate();
}
}
示例4: dispose
import sun.java2d.SurfaceData; //导入方法依赖的package包/类
public void dispose() {
SurfaceData oldData = surfaceData;
surfaceData = null;
if (oldData != null) {
oldData.invalidate();
}
XToolkit.targetDisposedPeer(target, this);
destroy();
}
示例5: doDispose
import sun.java2d.SurfaceData; //导入方法依赖的package包/类
/**
* Performs disposal of menu window.
* Should be called only on eventHandlerThread
*/
protected void doDispose() {
xSetVisible(false);
SurfaceData oldData = surfaceData;
surfaceData = null;
if (oldData != null) {
oldData.invalidate();
}
destroy();
}
示例6: dispose
import sun.java2d.SurfaceData; //导入方法依赖的package包/类
@Override
public void dispose() {
cancelTasks();
SurfaceData surfaceData = contentView.getSurfaceData();
if (surfaceData != null) {
surfaceData.invalidate();
}
super.dispose();
}
示例7: replaceSurfaceData
import sun.java2d.SurfaceData; //导入方法依赖的package包/类
/**
* Multi-buffer version of replaceSurfaceData. This version is called
* by createBuffers(), which needs to acquire the same locks in the same
* order, but also needs to perform additional functions inside the
* locks.
*/
public void replaceSurfaceData(int newNumBackBuffers,
BufferCapabilities caps)
{
SurfaceData oldData = null;
VolatileImage oldBB = null;
synchronized(((Component)target).getTreeLock()) {
synchronized(this) {
if (pData == 0) {
return;
}
numBackBuffers = newNumBackBuffers;
ScreenUpdateManager mgr = ScreenUpdateManager.getInstance();
oldData = surfaceData;
mgr.dropScreenSurface(oldData);
createScreenSurface(true);
if (oldData != null) {
oldData.invalidate();
}
oldBB = backBuffer;
if (numBackBuffers > 0) {
// set the caps first, they're used when creating the bb
backBufferCaps = caps;
Win32GraphicsConfig gc =
(Win32GraphicsConfig)getGraphicsConfiguration();
backBuffer = gc.createBackBuffer(this);
} else if (backBuffer != null) {
backBufferCaps = null;
backBuffer = null;
}
}
}
// it would be better to do this before we create new ones,
// but then we'd run into deadlock issues
if (oldData != null) {
oldData.flush();
// null out the old data to make it collected faster
oldData = null;
}
if (oldBB != null) {
oldBB.flush();
// null out the old data to make it collected faster
oldData = null;
}
}
示例8: displayChanged
import sun.java2d.SurfaceData; //导入方法依赖的package包/类
/**
* Called from SunGraphicsEnv when there has been a display mode change.
* Note that we simply invalidate hardware surfaces here; we do not
* attempt to recreate or re-render them. This is to avoid threading
* conflicts with the native toolkit and associated threads. Instead,
* we just nullify the old surface data object and wait for a future
* method in the rendering process to recreate the surface.
*/
public void displayChanged() {
lostSurface = true;
if (sdAccel != null) {
// First, nullify the software surface. This guards against
// using a SurfaceData that was created in a different
// display mode.
sdBackup = null;
// Now, invalidate the old hardware-based SurfaceData
// Note that getBackupSurface may set sdAccel to null so we have to invalidate it before
SurfaceData oldData = sdAccel;
sdAccel = null;
oldData.invalidate();
sdCurrent = getBackupSurface();
}
// Update graphicsConfig for the vImg in case it changed due to
// this display change event
vImg.updateGraphicsConfig();
// Compare the Graphics configuration transforms to determine
// whether the software backed surface needs to be invalidated.
AffineTransform atUpdated = vImg.getGraphicsConfig()
.getDefaultTransform();
if (!isAccelerationEnabled()) {
if (!atUpdated.equals(atCurrent)) {
// Ideally there is no need to re-create a software surface.
// But some OSs allow changes to display state at runtime. Such
// a provision would cause mismatch in graphics configuration of
// the display and the surface. Hence we re-create the software
// surface as well.
sdBackup = null;
sdCurrent = getBackupSurface();
} else {
// Software backed surface was not invalidated.
lostSurface = false;
}
}
// Update the AffineTransformation backing the volatile image
atCurrent = atUpdated;
}