Java 类sun.awt.image.SurfaceManager 实例源码

项目:OLD-OpenJDK8    文件:SunGraphics2D.java   
private boolean drawHiDPIImage(Image img, int dx1, int dy1, int dx2,
                               int dy2, int sx1, int sy1, int sx2, int sy2,
                               Color bgcolor, ImageObserver observer) {
    final int scale = SurfaceManager.getImageScale(img);
    sx1 = Region.clipScale(sx1, scale);
    sx2 = Region.clipScale(sx2, scale);
    sy1 = Region.clipScale(sy1, scale);
    sy2 = Region.clipScale(sy2, scale);
    try {
        return imagepipe.scaleImage(this, img, dx1, dy1, dx2, dy2, sx1, sy1,
                                    sx2, sy2, bgcolor, observer);
    } catch (InvalidPipeException e) {
        try {
            revalidateAll();
            return imagepipe.scaleImage(this, img, dx1, dy1, dx2, dy2, sx1,
                                        sy1, sx2, sy2, bgcolor, observer);
        } catch (InvalidPipeException e2) {
            // Still catching the exception; we are not yet ready to
            // validate the surfaceData correctly.  Fail for now and
            // try again next time around.
            return false;
        }
    } finally {
        surfaceData.markDirty();
    }
}
项目:openjdk-jdk7u-jdk    文件:SunGraphics2D.java   
private boolean drawHiDPIImage(Image img, int dx1, int dy1, int dx2,
                               int dy2, int sx1, int sy1, int sx2, int sy2,
                               Color bgcolor, ImageObserver observer) {
    final int scale = SurfaceManager.getImageScale(img);
    sx1 = Region.clipScale(sx1, scale);
    sx2 = Region.clipScale(sx2, scale);
    sy1 = Region.clipScale(sy1, scale);
    sy2 = Region.clipScale(sy2, scale);
    try {
        return imagepipe.scaleImage(this, img, dx1, dy1, dx2, dy2, sx1, sy1,
                                    sx2, sy2, bgcolor, observer);
    } catch (InvalidPipeException e) {
        try {
            revalidateAll();
            return imagepipe.scaleImage(this, img, dx1, dy1, dx2, dy2, sx1,
                                        sy1, sx2, sy2, bgcolor, observer);
        } catch (InvalidPipeException e2) {
            // Still catching the exception; we are not yet ready to
            // validate the surfaceData correctly.  Fail for now and
            // try again next time around.
            return false;
        }
    } finally {
        surfaceData.markDirty();
    }
}
项目:openjdk-icedtea7    文件:SunGraphics2D.java   
private boolean drawHiDPIImage(Image img, int dx1, int dy1, int dx2,
                               int dy2, int sx1, int sy1, int sx2, int sy2,
                               Color bgcolor, ImageObserver observer) {
    final int scale = SurfaceManager.getImageScale(img);
    sx1 = Region.clipScale(sx1, scale);
    sx2 = Region.clipScale(sx2, scale);
    sy1 = Region.clipScale(sy1, scale);
    sy2 = Region.clipScale(sy2, scale);
    try {
        return imagepipe.scaleImage(this, img, dx1, dy1, dx2, dy2, sx1, sy1,
                                    sx2, sy2, bgcolor, observer);
    } catch (InvalidPipeException e) {
        try {
            revalidateAll();
            return imagepipe.scaleImage(this, img, dx1, dy1, dx2, dy2, sx1,
                                        sy1, sx2, sy2, bgcolor, observer);
        } catch (InvalidPipeException e2) {
            // Still catching the exception; we are not yet ready to
            // validate the surfaceData correctly.  Fail for now and
            // try again next time around.
            return false;
        }
    } finally {
        surfaceData.markDirty();
    }
}
项目:OpenJSharp    文件:D3DSurfaceData.java   
/**
 * If acceleration should no longer be used for this surface.
 * This implementation flags to the manager that it should no
 * longer attempt to re-create a D3DSurface.
 */
void disableAccelerationForSurface() {
    if (offscreenImage != null) {
        SurfaceManager sm = SurfaceManager.getManager(offscreenImage);
        if (sm instanceof D3DVolatileSurfaceManager) {
            setSurfaceLost(true);
            ((D3DVolatileSurfaceManager)sm).setAccelerationEnabled(false);
        }
    }
}
项目:OpenJSharp    文件:D3DSurfaceData.java   
/**
 * We need to let the surface manager know that the surface is lost so
 * that for example BufferStrategy.contentsLost() returns correct result.
 * Normally the status of contentsLost is set in validate(), but in some
 * cases (like Swing's buffer per window) we intentionally don't call
 * validate from the toolkit thread but only check for the BS status.
 */
@Override
public void setSurfaceLost(boolean lost) {
    super.setSurfaceLost(lost);
    if (lost && offscreenImage != null) {
        SurfaceManager sm = SurfaceManager.getManager(offscreenImage);
        sm.acceleratedSurfaceLost();
    }
}
项目:OpenJSharp    文件:D3DVolatileSurfaceManager.java   
/**
 * If the destination surface's peer can potentially handle accelerated
 * on-screen rendering then it is likely that the condition which resulted
 * in VI to Screen operation is temporary, so this method sets the
 * restore countdown in hope that the on-screen accelerated rendering will
 * resume. In the meantime the backup surface of the VISM will be used.
 *
 * The countdown is needed because otherwise we may never break out
 * of "do { vi.validate()..} while(vi.lost)" loop since validate() could
 * restore the source surface every time and it will get lost again on the
 * next copy attempt, and we would never get a chance to use the backup
 * surface. By using the countdown we allow the backup surface to be used
 * while the screen surface gets sorted out, or if it for some reason can
 * never be restored.
 *
 * If the destination surface's peer could never do accelerated onscreen
 * rendering then the acceleration for the SurfaceManager associated with
 * the source surface is disabled forever.
 */
static void handleVItoScreenOp(SurfaceData src, SurfaceData dst) {
    if (src instanceof D3DSurfaceData &&
        dst instanceof GDIWindowSurfaceData)
    {
        D3DSurfaceData d3dsd = (D3DSurfaceData)src;
        SurfaceManager mgr =
            SurfaceManager.getManager((Image)d3dsd.getDestination());
        if (mgr instanceof D3DVolatileSurfaceManager) {
            D3DVolatileSurfaceManager vsm = (D3DVolatileSurfaceManager)mgr;
            if (vsm != null) {
                d3dsd.setSurfaceLost(true);

                GDIWindowSurfaceData wsd = (GDIWindowSurfaceData)dst;
                WComponentPeer p = wsd.getPeer();
                if (D3DScreenUpdateManager.canUseD3DOnScreen(p,
                        (Win32GraphicsConfig)p.getGraphicsConfiguration(),
                        p.getBackBuffersNum()))
                {
                    // 10 is only chosen to be greater than the number of
                    // times a sane person would call validate() inside
                    // a validation loop, and to reduce thrashing between
                    // accelerated and backup surfaces
                    vsm.setRestoreCountdown(10);
                } else {
                    vsm.setAccelerationEnabled(false);
                }
            }
        }
    }
}
项目:jdk8u-jdk    文件:D3DSurfaceData.java   
/**
 * If acceleration should no longer be used for this surface.
 * This implementation flags to the manager that it should no
 * longer attempt to re-create a D3DSurface.
 */
void disableAccelerationForSurface() {
    if (offscreenImage != null) {
        SurfaceManager sm = SurfaceManager.getManager(offscreenImage);
        if (sm instanceof D3DVolatileSurfaceManager) {
            setSurfaceLost(true);
            ((D3DVolatileSurfaceManager)sm).setAccelerationEnabled(false);
        }
    }
}
项目:jdk8u-jdk    文件:D3DSurfaceData.java   
/**
 * We need to let the surface manager know that the surface is lost so
 * that for example BufferStrategy.contentsLost() returns correct result.
 * Normally the status of contentsLost is set in validate(), but in some
 * cases (like Swing's buffer per window) we intentionally don't call
 * validate from the toolkit thread but only check for the BS status.
 */
@Override
public void setSurfaceLost(boolean lost) {
    super.setSurfaceLost(lost);
    if (lost && offscreenImage != null) {
        SurfaceManager sm = SurfaceManager.getManager(offscreenImage);
        sm.acceleratedSurfaceLost();
    }
}
项目:jdk8u-jdk    文件:D3DVolatileSurfaceManager.java   
/**
 * If the destination surface's peer can potentially handle accelerated
 * on-screen rendering then it is likely that the condition which resulted
 * in VI to Screen operation is temporary, so this method sets the
 * restore countdown in hope that the on-screen accelerated rendering will
 * resume. In the meantime the backup surface of the VISM will be used.
 *
 * The countdown is needed because otherwise we may never break out
 * of "do { vi.validate()..} while(vi.lost)" loop since validate() could
 * restore the source surface every time and it will get lost again on the
 * next copy attempt, and we would never get a chance to use the backup
 * surface. By using the countdown we allow the backup surface to be used
 * while the screen surface gets sorted out, or if it for some reason can
 * never be restored.
 *
 * If the destination surface's peer could never do accelerated onscreen
 * rendering then the acceleration for the SurfaceManager associated with
 * the source surface is disabled forever.
 */
static void handleVItoScreenOp(SurfaceData src, SurfaceData dst) {
    if (src instanceof D3DSurfaceData &&
        dst instanceof GDIWindowSurfaceData)
    {
        D3DSurfaceData d3dsd = (D3DSurfaceData)src;
        SurfaceManager mgr =
            SurfaceManager.getManager((Image)d3dsd.getDestination());
        if (mgr instanceof D3DVolatileSurfaceManager) {
            D3DVolatileSurfaceManager vsm = (D3DVolatileSurfaceManager)mgr;
            if (vsm != null) {
                d3dsd.setSurfaceLost(true);

                GDIWindowSurfaceData wsd = (GDIWindowSurfaceData)dst;
                WComponentPeer p = wsd.getPeer();
                if (D3DScreenUpdateManager.canUseD3DOnScreen(p,
                        (Win32GraphicsConfig)p.getGraphicsConfiguration(),
                        p.getBackBuffersNum()))
                {
                    // 10 is only chosen to be greater than the number of
                    // times a sane person would call validate() inside
                    // a validation loop, and to reduce thrashing between
                    // accelerated and backup surfaces
                    vsm.setRestoreCountdown(10);
                } else {
                    vsm.setAccelerationEnabled(false);
                }
            }
        }
    }
}
项目:openjdk-jdk10    文件:D3DSurfaceData.java   
/**
 * If acceleration should no longer be used for this surface.
 * This implementation flags to the manager that it should no
 * longer attempt to re-create a D3DSurface.
 */
void disableAccelerationForSurface() {
    if (offscreenImage != null) {
        SurfaceManager sm = SurfaceManager.getManager(offscreenImage);
        if (sm instanceof D3DVolatileSurfaceManager) {
            setSurfaceLost(true);
            ((D3DVolatileSurfaceManager)sm).setAccelerationEnabled(false);
        }
    }
}
项目:openjdk-jdk10    文件:D3DSurfaceData.java   
/**
 * We need to let the surface manager know that the surface is lost so
 * that for example BufferStrategy.contentsLost() returns correct result.
 * Normally the status of contentsLost is set in validate(), but in some
 * cases (like Swing's buffer per window) we intentionally don't call
 * validate from the toolkit thread but only check for the BS status.
 */
@Override
public void setSurfaceLost(boolean lost) {
    super.setSurfaceLost(lost);
    if (lost && offscreenImage != null) {
        SurfaceManager sm = SurfaceManager.getManager(offscreenImage);
        sm.acceleratedSurfaceLost();
    }
}
项目:openjdk-jdk10    文件:D3DVolatileSurfaceManager.java   
/**
 * If the destination surface's peer can potentially handle accelerated
 * on-screen rendering then it is likely that the condition which resulted
 * in VI to Screen operation is temporary, so this method sets the
 * restore countdown in hope that the on-screen accelerated rendering will
 * resume. In the meantime the backup surface of the VISM will be used.
 *
 * The countdown is needed because otherwise we may never break out
 * of "do { vi.validate()..} while(vi.lost)" loop since validate() could
 * restore the source surface every time and it will get lost again on the
 * next copy attempt, and we would never get a chance to use the backup
 * surface. By using the countdown we allow the backup surface to be used
 * while the screen surface gets sorted out, or if it for some reason can
 * never be restored.
 *
 * If the destination surface's peer could never do accelerated onscreen
 * rendering then the acceleration for the SurfaceManager associated with
 * the source surface is disabled forever.
 */
static void handleVItoScreenOp(SurfaceData src, SurfaceData dst) {
    if (src instanceof D3DSurfaceData &&
        dst instanceof GDIWindowSurfaceData)
    {
        D3DSurfaceData d3dsd = (D3DSurfaceData)src;
        SurfaceManager mgr =
            SurfaceManager.getManager((Image)d3dsd.getDestination());
        if (mgr instanceof D3DVolatileSurfaceManager) {
            D3DVolatileSurfaceManager vsm = (D3DVolatileSurfaceManager)mgr;
            if (vsm != null) {
                d3dsd.setSurfaceLost(true);

                GDIWindowSurfaceData wsd = (GDIWindowSurfaceData)dst;
                WComponentPeer p = wsd.getPeer();
                if (D3DScreenUpdateManager.canUseD3DOnScreen(p,
                        (Win32GraphicsConfig)p.getGraphicsConfiguration(),
                        p.getBackBuffersNum()))
                {
                    // 10 is only chosen to be greater than the number of
                    // times a sane person would call validate() inside
                    // a validation loop, and to reduce thrashing between
                    // accelerated and backup surfaces
                    vsm.setRestoreCountdown(10);
                } else {
                    vsm.setAccelerationEnabled(false);
                }
            }
        }
    }
}
项目:openjdk9    文件:D3DSurfaceData.java   
/**
 * If acceleration should no longer be used for this surface.
 * This implementation flags to the manager that it should no
 * longer attempt to re-create a D3DSurface.
 */
void disableAccelerationForSurface() {
    if (offscreenImage != null) {
        SurfaceManager sm = SurfaceManager.getManager(offscreenImage);
        if (sm instanceof D3DVolatileSurfaceManager) {
            setSurfaceLost(true);
            ((D3DVolatileSurfaceManager)sm).setAccelerationEnabled(false);
        }
    }
}
项目:openjdk9    文件:D3DSurfaceData.java   
/**
 * We need to let the surface manager know that the surface is lost so
 * that for example BufferStrategy.contentsLost() returns correct result.
 * Normally the status of contentsLost is set in validate(), but in some
 * cases (like Swing's buffer per window) we intentionally don't call
 * validate from the toolkit thread but only check for the BS status.
 */
@Override
public void setSurfaceLost(boolean lost) {
    super.setSurfaceLost(lost);
    if (lost && offscreenImage != null) {
        SurfaceManager sm = SurfaceManager.getManager(offscreenImage);
        sm.acceleratedSurfaceLost();
    }
}
项目:openjdk9    文件:D3DVolatileSurfaceManager.java   
/**
 * If the destination surface's peer can potentially handle accelerated
 * on-screen rendering then it is likely that the condition which resulted
 * in VI to Screen operation is temporary, so this method sets the
 * restore countdown in hope that the on-screen accelerated rendering will
 * resume. In the meantime the backup surface of the VISM will be used.
 *
 * The countdown is needed because otherwise we may never break out
 * of "do { vi.validate()..} while(vi.lost)" loop since validate() could
 * restore the source surface every time and it will get lost again on the
 * next copy attempt, and we would never get a chance to use the backup
 * surface. By using the countdown we allow the backup surface to be used
 * while the screen surface gets sorted out, or if it for some reason can
 * never be restored.
 *
 * If the destination surface's peer could never do accelerated onscreen
 * rendering then the acceleration for the SurfaceManager associated with
 * the source surface is disabled forever.
 */
static void handleVItoScreenOp(SurfaceData src, SurfaceData dst) {
    if (src instanceof D3DSurfaceData &&
        dst instanceof GDIWindowSurfaceData)
    {
        D3DSurfaceData d3dsd = (D3DSurfaceData)src;
        SurfaceManager mgr =
            SurfaceManager.getManager((Image)d3dsd.getDestination());
        if (mgr instanceof D3DVolatileSurfaceManager) {
            D3DVolatileSurfaceManager vsm = (D3DVolatileSurfaceManager)mgr;
            if (vsm != null) {
                d3dsd.setSurfaceLost(true);

                GDIWindowSurfaceData wsd = (GDIWindowSurfaceData)dst;
                WComponentPeer p = wsd.getPeer();
                if (D3DScreenUpdateManager.canUseD3DOnScreen(p,
                        (Win32GraphicsConfig)p.getGraphicsConfiguration(),
                        p.getBackBuffersNum()))
                {
                    // 10 is only chosen to be greater than the number of
                    // times a sane person would call validate() inside
                    // a validation loop, and to reduce thrashing between
                    // accelerated and backup surfaces
                    vsm.setRestoreCountdown(10);
                } else {
                    vsm.setAccelerationEnabled(false);
                }
            }
        }
    }
}
项目:jdk8u_jdk    文件:D3DSurfaceData.java   
/**
 * If acceleration should no longer be used for this surface.
 * This implementation flags to the manager that it should no
 * longer attempt to re-create a D3DSurface.
 */
void disableAccelerationForSurface() {
    if (offscreenImage != null) {
        SurfaceManager sm = SurfaceManager.getManager(offscreenImage);
        if (sm instanceof D3DVolatileSurfaceManager) {
            setSurfaceLost(true);
            ((D3DVolatileSurfaceManager)sm).setAccelerationEnabled(false);
        }
    }
}
项目:jdk8u_jdk    文件:D3DSurfaceData.java   
/**
 * We need to let the surface manager know that the surface is lost so
 * that for example BufferStrategy.contentsLost() returns correct result.
 * Normally the status of contentsLost is set in validate(), but in some
 * cases (like Swing's buffer per window) we intentionally don't call
 * validate from the toolkit thread but only check for the BS status.
 */
@Override
public void setSurfaceLost(boolean lost) {
    super.setSurfaceLost(lost);
    if (lost && offscreenImage != null) {
        SurfaceManager sm = SurfaceManager.getManager(offscreenImage);
        sm.acceleratedSurfaceLost();
    }
}
项目:jdk8u_jdk    文件:D3DVolatileSurfaceManager.java   
/**
 * If the destination surface's peer can potentially handle accelerated
 * on-screen rendering then it is likely that the condition which resulted
 * in VI to Screen operation is temporary, so this method sets the
 * restore countdown in hope that the on-screen accelerated rendering will
 * resume. In the meantime the backup surface of the VISM will be used.
 *
 * The countdown is needed because otherwise we may never break out
 * of "do { vi.validate()..} while(vi.lost)" loop since validate() could
 * restore the source surface every time and it will get lost again on the
 * next copy attempt, and we would never get a chance to use the backup
 * surface. By using the countdown we allow the backup surface to be used
 * while the screen surface gets sorted out, or if it for some reason can
 * never be restored.
 *
 * If the destination surface's peer could never do accelerated onscreen
 * rendering then the acceleration for the SurfaceManager associated with
 * the source surface is disabled forever.
 */
static void handleVItoScreenOp(SurfaceData src, SurfaceData dst) {
    if (src instanceof D3DSurfaceData &&
        dst instanceof GDIWindowSurfaceData)
    {
        D3DSurfaceData d3dsd = (D3DSurfaceData)src;
        SurfaceManager mgr =
            SurfaceManager.getManager((Image)d3dsd.getDestination());
        if (mgr instanceof D3DVolatileSurfaceManager) {
            D3DVolatileSurfaceManager vsm = (D3DVolatileSurfaceManager)mgr;
            if (vsm != null) {
                d3dsd.setSurfaceLost(true);

                GDIWindowSurfaceData wsd = (GDIWindowSurfaceData)dst;
                WComponentPeer p = wsd.getPeer();
                if (D3DScreenUpdateManager.canUseD3DOnScreen(p,
                        (Win32GraphicsConfig)p.getGraphicsConfiguration(),
                        p.getBackBuffersNum()))
                {
                    // 10 is only chosen to be greater than the number of
                    // times a sane person would call validate() inside
                    // a validation loop, and to reduce thrashing between
                    // accelerated and backup surfaces
                    vsm.setRestoreCountdown(10);
                } else {
                    vsm.setAccelerationEnabled(false);
                }
            }
        }
    }
}
项目:lookaside_java-1.8.0-openjdk    文件:D3DSurfaceData.java   
/**
 * If acceleration should no longer be used for this surface.
 * This implementation flags to the manager that it should no
 * longer attempt to re-create a D3DSurface.
 */
void disableAccelerationForSurface() {
    if (offscreenImage != null) {
        SurfaceManager sm = SurfaceManager.getManager(offscreenImage);
        if (sm instanceof D3DVolatileSurfaceManager) {
            setSurfaceLost(true);
            ((D3DVolatileSurfaceManager)sm).setAccelerationEnabled(false);
        }
    }
}
项目:lookaside_java-1.8.0-openjdk    文件:D3DSurfaceData.java   
/**
 * We need to let the surface manager know that the surface is lost so
 * that for example BufferStrategy.contentsLost() returns correct result.
 * Normally the status of contentsLost is set in validate(), but in some
 * cases (like Swing's buffer per window) we intentionally don't call
 * validate from the toolkit thread but only check for the BS status.
 */
@Override
public void setSurfaceLost(boolean lost) {
    super.setSurfaceLost(lost);
    if (lost && offscreenImage != null) {
        SurfaceManager sm = SurfaceManager.getManager(offscreenImage);
        sm.acceleratedSurfaceLost();
    }
}
项目:lookaside_java-1.8.0-openjdk    文件:D3DVolatileSurfaceManager.java   
/**
 * If the destination surface's peer can potentially handle accelerated
 * on-screen rendering then it is likely that the condition which resulted
 * in VI to Screen operation is temporary, so this method sets the
 * restore countdown in hope that the on-screen accelerated rendering will
 * resume. In the meantime the backup surface of the VISM will be used.
 *
 * The countdown is needed because otherwise we may never break out
 * of "do { vi.validate()..} while(vi.lost)" loop since validate() could
 * restore the source surface every time and it will get lost again on the
 * next copy attempt, and we would never get a chance to use the backup
 * surface. By using the countdown we allow the backup surface to be used
 * while the screen surface gets sorted out, or if it for some reason can
 * never be restored.
 *
 * If the destination surface's peer could never do accelerated onscreen
 * rendering then the acceleration for the SurfaceManager associated with
 * the source surface is disabled forever.
 */
static void handleVItoScreenOp(SurfaceData src, SurfaceData dst) {
    if (src instanceof D3DSurfaceData &&
        dst instanceof GDIWindowSurfaceData)
    {
        D3DSurfaceData d3dsd = (D3DSurfaceData)src;
        SurfaceManager mgr =
            SurfaceManager.getManager((Image)d3dsd.getDestination());
        if (mgr instanceof D3DVolatileSurfaceManager) {
            D3DVolatileSurfaceManager vsm = (D3DVolatileSurfaceManager)mgr;
            if (vsm != null) {
                d3dsd.setSurfaceLost(true);

                GDIWindowSurfaceData wsd = (GDIWindowSurfaceData)dst;
                WComponentPeer p = wsd.getPeer();
                if (D3DScreenUpdateManager.canUseD3DOnScreen(p,
                        (Win32GraphicsConfig)p.getGraphicsConfiguration(),
                        p.getBackBuffersNum()))
                {
                    // 10 is only chosen to be greater than the number of
                    // times a sane person would call validate() inside
                    // a validation loop, and to reduce thrashing between
                    // accelerated and backup surfaces
                    vsm.setRestoreCountdown(10);
                } else {
                    vsm.setAccelerationEnabled(false);
                }
            }
        }
    }
}
项目:infobip-open-jdk-8    文件:D3DSurfaceData.java   
/**
 * If acceleration should no longer be used for this surface.
 * This implementation flags to the manager that it should no
 * longer attempt to re-create a D3DSurface.
 */
void disableAccelerationForSurface() {
    if (offscreenImage != null) {
        SurfaceManager sm = SurfaceManager.getManager(offscreenImage);
        if (sm instanceof D3DVolatileSurfaceManager) {
            setSurfaceLost(true);
            ((D3DVolatileSurfaceManager)sm).setAccelerationEnabled(false);
        }
    }
}
项目:infobip-open-jdk-8    文件:D3DSurfaceData.java   
/**
 * We need to let the surface manager know that the surface is lost so
 * that for example BufferStrategy.contentsLost() returns correct result.
 * Normally the status of contentsLost is set in validate(), but in some
 * cases (like Swing's buffer per window) we intentionally don't call
 * validate from the toolkit thread but only check for the BS status.
 */
@Override
public void setSurfaceLost(boolean lost) {
    super.setSurfaceLost(lost);
    if (lost && offscreenImage != null) {
        SurfaceManager sm = SurfaceManager.getManager(offscreenImage);
        sm.acceleratedSurfaceLost();
    }
}
项目:infobip-open-jdk-8    文件:D3DVolatileSurfaceManager.java   
/**
 * If the destination surface's peer can potentially handle accelerated
 * on-screen rendering then it is likely that the condition which resulted
 * in VI to Screen operation is temporary, so this method sets the
 * restore countdown in hope that the on-screen accelerated rendering will
 * resume. In the meantime the backup surface of the VISM will be used.
 *
 * The countdown is needed because otherwise we may never break out
 * of "do { vi.validate()..} while(vi.lost)" loop since validate() could
 * restore the source surface every time and it will get lost again on the
 * next copy attempt, and we would never get a chance to use the backup
 * surface. By using the countdown we allow the backup surface to be used
 * while the screen surface gets sorted out, or if it for some reason can
 * never be restored.
 *
 * If the destination surface's peer could never do accelerated onscreen
 * rendering then the acceleration for the SurfaceManager associated with
 * the source surface is disabled forever.
 */
static void handleVItoScreenOp(SurfaceData src, SurfaceData dst) {
    if (src instanceof D3DSurfaceData &&
        dst instanceof GDIWindowSurfaceData)
    {
        D3DSurfaceData d3dsd = (D3DSurfaceData)src;
        SurfaceManager mgr =
            SurfaceManager.getManager((Image)d3dsd.getDestination());
        if (mgr instanceof D3DVolatileSurfaceManager) {
            D3DVolatileSurfaceManager vsm = (D3DVolatileSurfaceManager)mgr;
            if (vsm != null) {
                d3dsd.setSurfaceLost(true);

                GDIWindowSurfaceData wsd = (GDIWindowSurfaceData)dst;
                WComponentPeer p = wsd.getPeer();
                if (D3DScreenUpdateManager.canUseD3DOnScreen(p,
                        (Win32GraphicsConfig)p.getGraphicsConfiguration(),
                        p.getBackBuffersNum()))
                {
                    // 10 is only chosen to be greater than the number of
                    // times a sane person would call validate() inside
                    // a validation loop, and to reduce thrashing between
                    // accelerated and backup surfaces
                    vsm.setRestoreCountdown(10);
                } else {
                    vsm.setAccelerationEnabled(false);
                }
            }
        }
    }
}
项目:jdk8u-dev-jdk    文件:D3DSurfaceData.java   
/**
 * If acceleration should no longer be used for this surface.
 * This implementation flags to the manager that it should no
 * longer attempt to re-create a D3DSurface.
 */
void disableAccelerationForSurface() {
    if (offscreenImage != null) {
        SurfaceManager sm = SurfaceManager.getManager(offscreenImage);
        if (sm instanceof D3DVolatileSurfaceManager) {
            setSurfaceLost(true);
            ((D3DVolatileSurfaceManager)sm).setAccelerationEnabled(false);
        }
    }
}
项目:jdk8u-dev-jdk    文件:D3DSurfaceData.java   
/**
 * We need to let the surface manager know that the surface is lost so
 * that for example BufferStrategy.contentsLost() returns correct result.
 * Normally the status of contentsLost is set in validate(), but in some
 * cases (like Swing's buffer per window) we intentionally don't call
 * validate from the toolkit thread but only check for the BS status.
 */
@Override
public void setSurfaceLost(boolean lost) {
    super.setSurfaceLost(lost);
    if (lost && offscreenImage != null) {
        SurfaceManager sm = SurfaceManager.getManager(offscreenImage);
        sm.acceleratedSurfaceLost();
    }
}
项目:jdk8u-dev-jdk    文件:D3DVolatileSurfaceManager.java   
/**
 * If the destination surface's peer can potentially handle accelerated
 * on-screen rendering then it is likely that the condition which resulted
 * in VI to Screen operation is temporary, so this method sets the
 * restore countdown in hope that the on-screen accelerated rendering will
 * resume. In the meantime the backup surface of the VISM will be used.
 *
 * The countdown is needed because otherwise we may never break out
 * of "do { vi.validate()..} while(vi.lost)" loop since validate() could
 * restore the source surface every time and it will get lost again on the
 * next copy attempt, and we would never get a chance to use the backup
 * surface. By using the countdown we allow the backup surface to be used
 * while the screen surface gets sorted out, or if it for some reason can
 * never be restored.
 *
 * If the destination surface's peer could never do accelerated onscreen
 * rendering then the acceleration for the SurfaceManager associated with
 * the source surface is disabled forever.
 */
static void handleVItoScreenOp(SurfaceData src, SurfaceData dst) {
    if (src instanceof D3DSurfaceData &&
        dst instanceof GDIWindowSurfaceData)
    {
        D3DSurfaceData d3dsd = (D3DSurfaceData)src;
        SurfaceManager mgr =
            SurfaceManager.getManager((Image)d3dsd.getDestination());
        if (mgr instanceof D3DVolatileSurfaceManager) {
            D3DVolatileSurfaceManager vsm = (D3DVolatileSurfaceManager)mgr;
            if (vsm != null) {
                d3dsd.setSurfaceLost(true);

                GDIWindowSurfaceData wsd = (GDIWindowSurfaceData)dst;
                WComponentPeer p = wsd.getPeer();
                if (D3DScreenUpdateManager.canUseD3DOnScreen(p,
                        (Win32GraphicsConfig)p.getGraphicsConfiguration(),
                        p.getBackBuffersNum()))
                {
                    // 10 is only chosen to be greater than the number of
                    // times a sane person would call validate() inside
                    // a validation loop, and to reduce thrashing between
                    // accelerated and backup surfaces
                    vsm.setRestoreCountdown(10);
                } else {
                    vsm.setAccelerationEnabled(false);
                }
            }
        }
    }
}
项目:jdk7-jdk    文件:D3DSurfaceData.java   
/**
 * If acceleration should no longer be used for this surface.
 * This implementation flags to the manager that it should no
 * longer attempt to re-create a D3DSurface.
 */
void disableAccelerationForSurface() {
    if (offscreenImage != null) {
        SurfaceManager sm = SurfaceManager.getManager(offscreenImage);
        if (sm instanceof D3DVolatileSurfaceManager) {
            setSurfaceLost(true);
            ((D3DVolatileSurfaceManager)sm).setAccelerationEnabled(false);
        }
    }
}
项目:jdk7-jdk    文件:D3DSurfaceData.java   
/**
 * We need to let the surface manager know that the surface is lost so
 * that for example BufferStrategy.contentsLost() returns correct result.
 * Normally the status of contentsLost is set in validate(), but in some
 * cases (like Swing's buffer per window) we intentionally don't call
 * validate from the toolkit thread but only check for the BS status.
 */
@Override
public void setSurfaceLost(boolean lost) {
    super.setSurfaceLost(lost);
    if (lost && offscreenImage != null) {
        SurfaceManager sm = SurfaceManager.getManager(offscreenImage);
        sm.acceleratedSurfaceLost();
    }
}
项目:jdk7-jdk    文件:D3DVolatileSurfaceManager.java   
/**
 * If the destination surface's peer can potentially handle accelerated
 * on-screen rendering then it is likely that the condition which resulted
 * in VI to Screen operation is temporary, so this method sets the
 * restore countdown in hope that the on-screen accelerated rendering will
 * resume. In the meantime the backup surface of the VISM will be used.
 *
 * The countdown is needed because otherwise we may never break out
 * of "do { vi.validate()..} while(vi.lost)" loop since validate() could
 * restore the source surface every time and it will get lost again on the
 * next copy attempt, and we would never get a chance to use the backup
 * surface. By using the countdown we allow the backup surface to be used
 * while the screen surface gets sorted out, or if it for some reason can
 * never be restored.
 *
 * If the destination surface's peer could never do accelerated onscreen
 * rendering then the acceleration for the SurfaceManager associated with
 * the source surface is disabled forever.
 */
static void handleVItoScreenOp(SurfaceData src, SurfaceData dst) {
    if (src instanceof D3DSurfaceData &&
        dst instanceof GDIWindowSurfaceData)
    {
        D3DSurfaceData d3dsd = (D3DSurfaceData)src;
        SurfaceManager mgr =
            SurfaceManager.getManager((Image)d3dsd.getDestination());
        if (mgr instanceof D3DVolatileSurfaceManager) {
            D3DVolatileSurfaceManager vsm = (D3DVolatileSurfaceManager)mgr;
            if (vsm != null) {
                d3dsd.setSurfaceLost(true);

                GDIWindowSurfaceData wsd = (GDIWindowSurfaceData)dst;
                WComponentPeer p = wsd.getPeer();
                if (D3DScreenUpdateManager.canUseD3DOnScreen(p,
                        (Win32GraphicsConfig)p.getGraphicsConfiguration(),
                        p.getBackBuffersNum()))
                {
                    // 10 is only chosen to be greater than the number of
                    // times a sane person would call validate() inside
                    // a validation loop, and to reduce thrashing between
                    // accelerated and backup surfaces
                    vsm.setRestoreCountdown(10);
                } else {
                    vsm.setAccelerationEnabled(false);
                }
            }
        }
    }
}
项目:openjdk-source-code-learn    文件:D3DSurfaceData.java   
/**
 * If acceleration should no longer be used for this surface.
 * This implementation flags to the manager that it should no
 * longer attempt to re-create a D3DSurface.
 */
void disableAccelerationForSurface() {
    if (offscreenImage != null) {
        SurfaceManager sm = SurfaceManager.getManager(offscreenImage);
        if (sm instanceof D3DVolatileSurfaceManager) {
            setSurfaceLost(true);
            ((D3DVolatileSurfaceManager)sm).setAccelerationEnabled(false);
        }
    }
}
项目:openjdk-source-code-learn    文件:D3DSurfaceData.java   
/**
 * We need to let the surface manager know that the surface is lost so
 * that for example BufferStrategy.contentsLost() returns correct result.
 * Normally the status of contentsLost is set in validate(), but in some
 * cases (like Swing's buffer per window) we intentionally don't call
 * validate from the toolkit thread but only check for the BS status.
 */
@Override
public void setSurfaceLost(boolean lost) {
    super.setSurfaceLost(lost);
    if (lost && offscreenImage != null) {
        SurfaceManager sm = SurfaceManager.getManager(offscreenImage);
        sm.acceleratedSurfaceLost();
    }
}
项目:openjdk-source-code-learn    文件:D3DVolatileSurfaceManager.java   
/**
 * If the destination surface's peer can potentially handle accelerated
 * on-screen rendering then it is likely that the condition which resulted
 * in VI to Screen operation is temporary, so this method sets the
 * restore countdown in hope that the on-screen accelerated rendering will
 * resume. In the meantime the backup surface of the VISM will be used.
 *
 * The countdown is needed because otherwise we may never break out
 * of "do { vi.validate()..} while(vi.lost)" loop since validate() could
 * restore the source surface every time and it will get lost again on the
 * next copy attempt, and we would never get a chance to use the backup
 * surface. By using the countdown we allow the backup surface to be used
 * while the screen surface gets sorted out, or if it for some reason can
 * never be restored.
 *
 * If the destination surface's peer could never do accelerated onscreen
 * rendering then the acceleration for the SurfaceManager associated with
 * the source surface is disabled forever.
 */
static void handleVItoScreenOp(SurfaceData src, SurfaceData dst) {
    if (src instanceof D3DSurfaceData &&
        dst instanceof GDIWindowSurfaceData)
    {
        D3DSurfaceData d3dsd = (D3DSurfaceData)src;
        SurfaceManager mgr =
            SurfaceManager.getManager((Image)d3dsd.getDestination());
        if (mgr instanceof D3DVolatileSurfaceManager) {
            D3DVolatileSurfaceManager vsm = (D3DVolatileSurfaceManager)mgr;
            if (vsm != null) {
                d3dsd.setSurfaceLost(true);

                GDIWindowSurfaceData wsd = (GDIWindowSurfaceData)dst;
                WComponentPeer p = wsd.getPeer();
                if (D3DScreenUpdateManager.canUseD3DOnScreen(p,
                        (Win32GraphicsConfig)p.getGraphicsConfiguration(),
                        p.getBackBuffersNum()))
                {
                    // 10 is only chosen to be greater than the number of
                    // times a sane person would call validate() inside
                    // a validation loop, and to reduce thrashing between
                    // accelerated and backup surfaces
                    vsm.setRestoreCountdown(10);
                } else {
                    vsm.setAccelerationEnabled(false);
                }
            }
        }
    }
}
项目:OLD-OpenJDK8    文件:D3DSurfaceData.java   
/**
 * If acceleration should no longer be used for this surface.
 * This implementation flags to the manager that it should no
 * longer attempt to re-create a D3DSurface.
 */
void disableAccelerationForSurface() {
    if (offscreenImage != null) {
        SurfaceManager sm = SurfaceManager.getManager(offscreenImage);
        if (sm instanceof D3DVolatileSurfaceManager) {
            setSurfaceLost(true);
            ((D3DVolatileSurfaceManager)sm).setAccelerationEnabled(false);
        }
    }
}
项目:OLD-OpenJDK8    文件:D3DSurfaceData.java   
/**
 * We need to let the surface manager know that the surface is lost so
 * that for example BufferStrategy.contentsLost() returns correct result.
 * Normally the status of contentsLost is set in validate(), but in some
 * cases (like Swing's buffer per window) we intentionally don't call
 * validate from the toolkit thread but only check for the BS status.
 */
@Override
public void setSurfaceLost(boolean lost) {
    super.setSurfaceLost(lost);
    if (lost && offscreenImage != null) {
        SurfaceManager sm = SurfaceManager.getManager(offscreenImage);
        sm.acceleratedSurfaceLost();
    }
}
项目:OLD-OpenJDK8    文件:D3DVolatileSurfaceManager.java   
/**
 * If the destination surface's peer can potentially handle accelerated
 * on-screen rendering then it is likely that the condition which resulted
 * in VI to Screen operation is temporary, so this method sets the
 * restore countdown in hope that the on-screen accelerated rendering will
 * resume. In the meantime the backup surface of the VISM will be used.
 *
 * The countdown is needed because otherwise we may never break out
 * of "do { vi.validate()..} while(vi.lost)" loop since validate() could
 * restore the source surface every time and it will get lost again on the
 * next copy attempt, and we would never get a chance to use the backup
 * surface. By using the countdown we allow the backup surface to be used
 * while the screen surface gets sorted out, or if it for some reason can
 * never be restored.
 *
 * If the destination surface's peer could never do accelerated onscreen
 * rendering then the acceleration for the SurfaceManager associated with
 * the source surface is disabled forever.
 */
static void handleVItoScreenOp(SurfaceData src, SurfaceData dst) {
    if (src instanceof D3DSurfaceData &&
        dst instanceof GDIWindowSurfaceData)
    {
        D3DSurfaceData d3dsd = (D3DSurfaceData)src;
        SurfaceManager mgr =
            SurfaceManager.getManager((Image)d3dsd.getDestination());
        if (mgr instanceof D3DVolatileSurfaceManager) {
            D3DVolatileSurfaceManager vsm = (D3DVolatileSurfaceManager)mgr;
            if (vsm != null) {
                d3dsd.setSurfaceLost(true);

                GDIWindowSurfaceData wsd = (GDIWindowSurfaceData)dst;
                WComponentPeer p = wsd.getPeer();
                if (D3DScreenUpdateManager.canUseD3DOnScreen(p,
                        (Win32GraphicsConfig)p.getGraphicsConfiguration(),
                        p.getBackBuffersNum()))
                {
                    // 10 is only chosen to be greater than the number of
                    // times a sane person would call validate() inside
                    // a validation loop, and to reduce thrashing between
                    // accelerated and backup surfaces
                    vsm.setRestoreCountdown(10);
                } else {
                    vsm.setAccelerationEnabled(false);
                }
            }
        }
    }
}
项目:openjdk-jdk7u-jdk    文件:D3DSurfaceData.java   
/**
 * If acceleration should no longer be used for this surface.
 * This implementation flags to the manager that it should no
 * longer attempt to re-create a D3DSurface.
 */
void disableAccelerationForSurface() {
    if (offscreenImage != null) {
        SurfaceManager sm = SurfaceManager.getManager(offscreenImage);
        if (sm instanceof D3DVolatileSurfaceManager) {
            setSurfaceLost(true);
            ((D3DVolatileSurfaceManager)sm).setAccelerationEnabled(false);
        }
    }
}
项目:openjdk-jdk7u-jdk    文件:D3DSurfaceData.java   
/**
 * We need to let the surface manager know that the surface is lost so
 * that for example BufferStrategy.contentsLost() returns correct result.
 * Normally the status of contentsLost is set in validate(), but in some
 * cases (like Swing's buffer per window) we intentionally don't call
 * validate from the toolkit thread but only check for the BS status.
 */
@Override
public void setSurfaceLost(boolean lost) {
    super.setSurfaceLost(lost);
    if (lost && offscreenImage != null) {
        SurfaceManager sm = SurfaceManager.getManager(offscreenImage);
        sm.acceleratedSurfaceLost();
    }
}
项目:openjdk-jdk7u-jdk    文件:D3DVolatileSurfaceManager.java   
/**
 * If the destination surface's peer can potentially handle accelerated
 * on-screen rendering then it is likely that the condition which resulted
 * in VI to Screen operation is temporary, so this method sets the
 * restore countdown in hope that the on-screen accelerated rendering will
 * resume. In the meantime the backup surface of the VISM will be used.
 *
 * The countdown is needed because otherwise we may never break out
 * of "do { vi.validate()..} while(vi.lost)" loop since validate() could
 * restore the source surface every time and it will get lost again on the
 * next copy attempt, and we would never get a chance to use the backup
 * surface. By using the countdown we allow the backup surface to be used
 * while the screen surface gets sorted out, or if it for some reason can
 * never be restored.
 *
 * If the destination surface's peer could never do accelerated onscreen
 * rendering then the acceleration for the SurfaceManager associated with
 * the source surface is disabled forever.
 */
static void handleVItoScreenOp(SurfaceData src, SurfaceData dst) {
    if (src instanceof D3DSurfaceData &&
        dst instanceof GDIWindowSurfaceData)
    {
        D3DSurfaceData d3dsd = (D3DSurfaceData)src;
        SurfaceManager mgr =
            SurfaceManager.getManager((Image)d3dsd.getDestination());
        if (mgr instanceof D3DVolatileSurfaceManager) {
            D3DVolatileSurfaceManager vsm = (D3DVolatileSurfaceManager)mgr;
            if (vsm != null) {
                d3dsd.setSurfaceLost(true);

                GDIWindowSurfaceData wsd = (GDIWindowSurfaceData)dst;
                WComponentPeer p = wsd.getPeer();
                if (D3DScreenUpdateManager.canUseD3DOnScreen(p,
                        (Win32GraphicsConfig)p.getGraphicsConfiguration(),
                        p.getBackBuffersNum()))
                {
                    // 10 is only chosen to be greater than the number of
                    // times a sane person would call validate() inside
                    // a validation loop, and to reduce thrashing between
                    // accelerated and backup surfaces
                    vsm.setRestoreCountdown(10);
                } else {
                    vsm.setAccelerationEnabled(false);
                }
            }
        }
    }
}
项目:openjdk-icedtea7    文件:D3DSurfaceData.java   
/**
 * If acceleration should no longer be used for this surface.
 * This implementation flags to the manager that it should no
 * longer attempt to re-create a D3DSurface.
 */
void disableAccelerationForSurface() {
    if (offscreenImage != null) {
        SurfaceManager sm = SurfaceManager.getManager(offscreenImage);
        if (sm instanceof D3DVolatileSurfaceManager) {
            setSurfaceLost(true);
            ((D3DVolatileSurfaceManager)sm).setAccelerationEnabled(false);
        }
    }
}