Java Code Examples for sun.java2d.SurfaceData#invalidate()

The following examples show how to use sun.java2d.SurfaceData#invalidate() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: VolatileSurfaceManager.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
/**
 * 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();
}
 
Example 2
Source File: VolatileSurfaceManager.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
/**
 * 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();
}
 
Example 3
Source File: VolatileSurfaceManager.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * 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();
}
 
Example 4
Source File: VolatileSurfaceManager.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * 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();
}
 
Example 5
Source File: VolatileSurfaceManager.java    From dragonwell8_jdk with GNU General Public License v2.0 6 votes vote down vote up
/**
 * 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();
}
 
Example 6
Source File: XWindow.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
public void dispose() {
    SurfaceData oldData = surfaceData;
    surfaceData = null;
    if (oldData != null) {
        oldData.invalidate();
    }
    XToolkit.targetDisposedPeer(target, this);
    destroy();
}
 
Example 7
Source File: XWindow.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
final void doValidateSurface() {
    SurfaceData oldData = surfaceData;
    if (oldData != null) {
        surfaceData = graphicsConfig.createSurfaceData(this);
        oldData.invalidate();
    }
}
 
Example 8
Source File: WComponentPeer.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
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();
}
 
Example 9
Source File: XWindow.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
final void doValidateSurface() {
    SurfaceData oldData = surfaceData;
    if (oldData != null) {
        surfaceData = graphicsConfig.createSurfaceData(this);
        oldData.invalidate();
    }
}
 
Example 10
Source File: XWindow.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
final void doValidateSurface() {
    SurfaceData oldData = surfaceData;
    if (oldData != null) {
        surfaceData = graphicsConfig.createSurfaceData(this);
        oldData.invalidate();
    }
}
 
Example 11
Source File: XBaseMenuWindow.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
/**
 * 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();
}
 
Example 12
Source File: XWindow.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
final void doValidateSurface() {
    SurfaceData oldData = surfaceData;
    if (oldData != null) {
        surfaceData = graphicsConfig.createSurfaceData(this);
        oldData.invalidate();
    }
}
 
Example 13
Source File: XBaseMenuWindow.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
/**
 * 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();
}
 
Example 14
Source File: XWindow.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
public void dispose() {
    SurfaceData oldData = surfaceData;
    surfaceData = null;
    if (oldData != null) {
        oldData.invalidate();
    }
    XToolkit.targetDisposedPeer(target, this);
    destroy();
}
 
Example 15
Source File: XWindow.java    From jdk8u-dev-jdk with GNU General Public License v2.0 5 votes vote down vote up
public void dispose() {
    SurfaceData oldData = surfaceData;
    surfaceData = null;
    if (oldData != null) {
        oldData.invalidate();
    }
    XToolkit.targetDisposedPeer(target, this);
    destroy();
}
 
Example 16
Source File: XWindow.java    From dragonwell8_jdk with GNU General Public License v2.0 5 votes vote down vote up
public void dispose() {
    SurfaceData oldData = surfaceData;
    surfaceData = null;
    if (oldData != null) {
        oldData.invalidate();
    }
    XToolkit.targetDisposedPeer(target, this);
    destroy();
}
 
Example 17
Source File: XWindow.java    From dragonwell8_jdk with GNU General Public License v2.0 5 votes vote down vote up
final void doValidateSurface() {
    SurfaceData oldData = surfaceData;
    if (oldData != null) {
        surfaceData = graphicsConfig.createSurfaceData(this);
        oldData.invalidate();
    }
}
 
Example 18
Source File: XBaseMenuWindow.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * 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();
}
 
Example 19
Source File: VolatileSurfaceManager.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * 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;
}
 
Example 20
Source File: WComponentPeer.java    From hottub with GNU General Public License v2.0 4 votes vote down vote up
/**
 * 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;
    }
}