Java Code Examples for sun.java2d.d3d.D3DSurfaceData.D3DWindowSurfaceData#restoreSurface()

The following examples show how to use sun.java2d.d3d.D3DSurfaceData.D3DWindowSurfaceData#restoreSurface() . 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: D3DScreenUpdateManager.java    From dragonwell8_jdk with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Restores the passed surface if it was lost, resets the lost status.
 * @param sd surface to be validated
 * @return true if surface wasn't lost or if restoration was successful,
 * false otherwise
 */
private boolean validate(D3DWindowSurfaceData sd) {
    if (sd.isSurfaceLost()) {
        try {
            sd.restoreSurface();
            // if succeeded, first fill the surface with bg color
            // note: use the non-synch method to avoid incorrect lock order
            Color bg = sd.getPeer().getBackgroundNoSync();
            SunGraphics2D sg2d = new SunGraphics2D(sd, bg, bg, null);
            sg2d.fillRect(0, 0, sd.getBounds().width, sd.getBounds().height);
            sg2d.dispose();
            // now clean the dirty status so that we don't flip it
            // next time before it gets repainted; it is safe
            // to do without the lock because we will issue a
            // repaint anyway so we will not lose any rendering
            sd.markClean();
            // since the surface was successfully restored we need to
            // repaint whole window to repopulate the back-buffer
            repaintPeerTarget(sd.getPeer());
        } catch (InvalidPipeException ipe) {
            return false;
        }
    }
    return true;
}
 
Example 2
Source File: D3DScreenUpdateManager.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Restores the passed surface if it was lost, resets the lost status.
 * @param sd surface to be validated
 * @return true if surface wasn't lost or if restoration was successful,
 * false otherwise
 */
private boolean validate(D3DWindowSurfaceData sd) {
    if (sd.isSurfaceLost()) {
        try {
            sd.restoreSurface();
            // if succeeded, first fill the surface with bg color
            // note: use the non-synch method to avoid incorrect lock order
            Color bg = sd.getPeer().getBackgroundNoSync();
            SunGraphics2D sg2d = new SunGraphics2D(sd, bg, bg, null);
            sg2d.fillRect(0, 0, sd.getBounds().width, sd.getBounds().height);
            sg2d.dispose();
            // now clean the dirty status so that we don't flip it
            // next time before it gets repainted; it is safe
            // to do without the lock because we will issue a
            // repaint anyway so we will not lose any rendering
            sd.markClean();
            // since the surface was successfully restored we need to
            // repaint whole window to repopulate the back-buffer
            repaintPeerTarget(sd.getPeer());
        } catch (InvalidPipeException ipe) {
            return false;
        }
    }
    return true;
}
 
Example 3
Source File: D3DScreenUpdateManager.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Restores the passed surface if it was lost, resets the lost status.
 * @param sd surface to be validated
 * @return true if surface wasn't lost or if restoration was successful,
 * false otherwise
 */
private boolean validate(D3DWindowSurfaceData sd) {
    if (sd.isSurfaceLost()) {
        try {
            sd.restoreSurface();
            // if succeeded, first fill the surface with bg color
            // note: use the non-synch method to avoid incorrect lock order
            Color bg = sd.getPeer().getBackgroundNoSync();
            SunGraphics2D sg2d = new SunGraphics2D(sd, bg, bg, null);
            sg2d.fillRect(0, 0, sd.getBounds().width, sd.getBounds().height);
            sg2d.dispose();
            // now clean the dirty status so that we don't flip it
            // next time before it gets repainted; it is safe
            // to do without the lock because we will issue a
            // repaint anyway so we will not lose any rendering
            sd.markClean();
            // since the surface was successfully restored we need to
            // repaint whole window to repopulate the back-buffer
            repaintPeerTarget(sd.getPeer());
        } catch (InvalidPipeException ipe) {
            return false;
        }
    }
    return true;
}
 
Example 4
Source File: D3DScreenUpdateManager.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Restores the passed surface if it was lost, resets the lost status.
 * @param sd surface to be validated
 * @return true if surface wasn't lost or if restoration was successful,
 * false otherwise
 */
private boolean validate(D3DWindowSurfaceData sd) {
    if (sd.isSurfaceLost()) {
        try {
            sd.restoreSurface();
            // if succeeded, first fill the surface with bg color
            // note: use the non-synch method to avoid incorrect lock order
            Color bg = sd.getPeer().getBackgroundNoSync();
            SunGraphics2D sg2d = new SunGraphics2D(sd, bg, bg, null);
            sg2d.fillRect(0, 0, sd.getBounds().width, sd.getBounds().height);
            sg2d.dispose();
            // now clean the dirty status so that we don't flip it
            // next time before it gets repainted; it is safe
            // to do without the lock because we will issue a
            // repaint anyway so we will not lose any rendering
            sd.markClean();
            // since the surface was successfully restored we need to
            // repaint whole window to repopulate the back-buffer
            repaintPeerTarget(sd.getPeer());
        } catch (InvalidPipeException ipe) {
            return false;
        }
    }
    return true;
}
 
Example 5
Source File: D3DScreenUpdateManager.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Restores the passed surface if it was lost, resets the lost status.
 * @param sd surface to be validated
 * @return true if surface wasn't lost or if restoration was successful,
 * false otherwise
 */
private boolean validate(D3DWindowSurfaceData sd) {
    if (sd.isSurfaceLost()) {
        try {
            sd.restoreSurface();
            // if succeeded, first fill the surface with bg color
            // note: use the non-synch method to avoid incorrect lock order
            Color bg = sd.getPeer().getBackgroundNoSync();
            SunGraphics2D sg2d = new SunGraphics2D(sd, bg, bg, null);
            sg2d.fillRect(0, 0, sd.getBounds().width, sd.getBounds().height);
            sg2d.dispose();
            // now clean the dirty status so that we don't flip it
            // next time before it gets repainted; it is safe
            // to do without the lock because we will issue a
            // repaint anyway so we will not lose any rendering
            sd.markClean();
            // since the surface was successfully restored we need to
            // repaint whole window to repopulate the back-buffer
            repaintPeerTarget(sd.getPeer());
        } catch (InvalidPipeException ipe) {
            return false;
        }
    }
    return true;
}
 
Example 6
Source File: D3DScreenUpdateManager.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Restores the passed surface if it was lost, resets the lost status.
 * @param sd surface to be validated
 * @return true if surface wasn't lost or if restoration was successful,
 * false otherwise
 */
private boolean validate(D3DWindowSurfaceData sd) {
    if (sd.isSurfaceLost()) {
        try {
            sd.restoreSurface();
            // if succeeded, first fill the surface with bg color
            // note: use the non-synch method to avoid incorrect lock order
            Color bg = sd.getPeer().getBackgroundNoSync();
            SunGraphics2D sg2d = new SunGraphics2D(sd, bg, bg, null);
            sg2d.fillRect(0, 0, sd.getBounds().width, sd.getBounds().height);
            sg2d.dispose();
            // now clean the dirty status so that we don't flip it
            // next time before it gets repainted; it is safe
            // to do without the lock because we will issue a
            // repaint anyway so we will not lose any rendering
            sd.markClean();
            // since the surface was successfully restored we need to
            // repaint whole window to repopulate the back-buffer
            repaintPeerTarget(sd.getPeer());
        } catch (InvalidPipeException ipe) {
            return false;
        }
    }
    return true;
}
 
Example 7
Source File: D3DScreenUpdateManager.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Restores the passed surface if it was lost, resets the lost status.
 * @param sd surface to be validated
 * @return true if surface wasn't lost or if restoration was successful,
 * false otherwise
 */
private boolean validate(D3DWindowSurfaceData sd) {
    if (sd.isSurfaceLost()) {
        try {
            sd.restoreSurface();
            // if succeeded, first fill the surface with bg color
            // note: use the non-synch method to avoid incorrect lock order
            Color bg = sd.getPeer().getBackgroundNoSync();
            SunGraphics2D sg2d = new SunGraphics2D(sd, bg, bg, null);
            sg2d.fillRect(0, 0, sd.getBounds().width, sd.getBounds().height);
            sg2d.dispose();
            // now clean the dirty status so that we don't flip it
            // next time before it gets repainted; it is safe
            // to do without the lock because we will issue a
            // repaint anyway so we will not lose any rendering
            sd.markClean();
            // since the surface was successfully restored we need to
            // repaint whole window to repopulate the back-buffer
            repaintPeerTarget(sd.getPeer());
        } catch (InvalidPipeException ipe) {
            return false;
        }
    }
    return true;
}
 
Example 8
Source File: D3DScreenUpdateManager.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Restores the passed surface if it was lost, resets the lost status.
 * @param sd surface to be validated
 * @return true if surface wasn't lost or if restoration was successful,
 * false otherwise
 */
private boolean validate(D3DWindowSurfaceData sd) {
    if (sd.isSurfaceLost()) {
        try {
            sd.restoreSurface();
            // if succeeded, first fill the surface with bg color
            // note: use the non-synch method to avoid incorrect lock order
            Color bg = sd.getPeer().getBackgroundNoSync();
            SunGraphics2D sg2d = new SunGraphics2D(sd, bg, bg, null);
            sg2d.fillRect(0, 0, sd.getBounds().width, sd.getBounds().height);
            sg2d.dispose();
            // now clean the dirty status so that we don't flip it
            // next time before it gets repainted; it is safe
            // to do without the lock because we will issue a
            // repaint anyway so we will not lose any rendering
            sd.markClean();
            // since the surface was successfully restored we need to
            // repaint whole window to repopulate the back-buffer
            repaintPeerTarget(sd.getPeer());
        } catch (InvalidPipeException ipe) {
            return false;
        }
    }
    return true;
}
 
Example 9
Source File: D3DScreenUpdateManager.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Restores the passed surface if it was lost, resets the lost status.
 * @param sd surface to be validated
 * @return true if surface wasn't lost or if restoration was successful,
 * false otherwise
 */
private boolean validate(D3DWindowSurfaceData sd) {
    if (sd.isSurfaceLost()) {
        try {
            sd.restoreSurface();
            // if succeeded, first fill the surface with bg color
            // note: use the non-synch method to avoid incorrect lock order
            Color bg = sd.getPeer().getBackgroundNoSync();
            SunGraphics2D sg2d = new SunGraphics2D(sd, bg, bg, null);
            sg2d.fillRect(0, 0, sd.getBounds().width, sd.getBounds().height);
            sg2d.dispose();
            // now clean the dirty status so that we don't flip it
            // next time before it gets repainted; it is safe
            // to do without the lock because we will issue a
            // repaint anyway so we will not lose any rendering
            sd.markClean();
            // since the surface was successfully restored we need to
            // repaint whole window to repopulate the back-buffer
            repaintPeerTarget(sd.getPeer());
        } catch (InvalidPipeException ipe) {
            return false;
        }
    }
    return true;
}
 
Example 10
Source File: D3DScreenUpdateManager.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Restores the passed surface if it was lost, resets the lost status.
 * @param sd surface to be validated
 * @return true if surface wasn't lost or if restoration was successful,
 * false otherwise
 */
private boolean validate(D3DWindowSurfaceData sd) {
    if (sd.isSurfaceLost()) {
        try {
            sd.restoreSurface();
            // if succeeded, first fill the surface with bg color
            // note: use the non-synch method to avoid incorrect lock order
            Color bg = sd.getPeer().getBackgroundNoSync();
            SunGraphics2D sg2d = new SunGraphics2D(sd, bg, bg, null);
            sg2d.fillRect(0, 0, sd.getBounds().width, sd.getBounds().height);
            sg2d.dispose();
            // now clean the dirty status so that we don't flip it
            // next time before it gets repainted; it is safe
            // to do without the lock because we will issue a
            // repaint anyway so we will not lose any rendering
            sd.markClean();
            // since the surface was successfully restored we need to
            // repaint whole window to repopulate the back-buffer
            repaintPeerTarget(sd.getPeer());
        } catch (InvalidPipeException ipe) {
            return false;
        }
    }
    return true;
}
 
Example 11
Source File: D3DScreenUpdateManager.java    From jdk8u_jdk with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Restores the passed surface if it was lost, resets the lost status.
 * @param sd surface to be validated
 * @return true if surface wasn't lost or if restoration was successful,
 * false otherwise
 */
private boolean validate(D3DWindowSurfaceData sd) {
    if (sd.isSurfaceLost()) {
        try {
            sd.restoreSurface();
            // if succeeded, first fill the surface with bg color
            // note: use the non-synch method to avoid incorrect lock order
            Color bg = sd.getPeer().getBackgroundNoSync();
            SunGraphics2D sg2d = new SunGraphics2D(sd, bg, bg, null);
            sg2d.fillRect(0, 0, sd.getBounds().width, sd.getBounds().height);
            sg2d.dispose();
            // now clean the dirty status so that we don't flip it
            // next time before it gets repainted; it is safe
            // to do without the lock because we will issue a
            // repaint anyway so we will not lose any rendering
            sd.markClean();
            // since the surface was successfully restored we need to
            // repaint whole window to repopulate the back-buffer
            repaintPeerTarget(sd.getPeer());
        } catch (InvalidPipeException ipe) {
            return false;
        }
    }
    return true;
}
 
Example 12
Source File: D3DScreenUpdateManager.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Restores the passed surface if it was lost, resets the lost status.
 * @param sd surface to be validated
 * @return true if surface wasn't lost or if restoration was successful,
 * false otherwise
 */
private boolean validate(D3DWindowSurfaceData sd) {
    if (sd.isSurfaceLost()) {
        try {
            sd.restoreSurface();
            // if succeeded, first fill the surface with bg color
            // note: use the non-synch method to avoid incorrect lock order
            Color bg = sd.getPeer().getBackgroundNoSync();
            SunGraphics2D sg2d = new SunGraphics2D(sd, bg, bg, null);
            sg2d.fillRect(0, 0, sd.getBounds().width, sd.getBounds().height);
            sg2d.dispose();
            // now clean the dirty status so that we don't flip it
            // next time before it gets repainted; it is safe
            // to do without the lock because we will issue a
            // repaint anyway so we will not lose any rendering
            sd.markClean();
            // since the surface was successfully restored we need to
            // repaint whole window to repopulate the back-buffer
            repaintPeerTarget(sd.getPeer());
        } catch (InvalidPipeException ipe) {
            return false;
        }
    }
    return true;
}
 
Example 13
Source File: D3DScreenUpdateManager.java    From jdk8u-dev-jdk with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Restores the passed surface if it was lost, resets the lost status.
 * @param sd surface to be validated
 * @return true if surface wasn't lost or if restoration was successful,
 * false otherwise
 */
private boolean validate(D3DWindowSurfaceData sd) {
    if (sd.isSurfaceLost()) {
        try {
            sd.restoreSurface();
            // if succeeded, first fill the surface with bg color
            // note: use the non-synch method to avoid incorrect lock order
            Color bg = sd.getPeer().getBackgroundNoSync();
            SunGraphics2D sg2d = new SunGraphics2D(sd, bg, bg, null);
            sg2d.fillRect(0, 0, sd.getBounds().width, sd.getBounds().height);
            sg2d.dispose();
            // now clean the dirty status so that we don't flip it
            // next time before it gets repainted; it is safe
            // to do without the lock because we will issue a
            // repaint anyway so we will not lose any rendering
            sd.markClean();
            // since the surface was successfully restored we need to
            // repaint whole window to repopulate the back-buffer
            repaintPeerTarget(sd.getPeer());
        } catch (InvalidPipeException ipe) {
            return false;
        }
    }
    return true;
}