本文整理汇总了Java中sun.java2d.windows.GDIWindowSurfaceData.getPeer方法的典型用法代码示例。如果您正苦于以下问题:Java GDIWindowSurfaceData.getPeer方法的具体用法?Java GDIWindowSurfaceData.getPeer怎么用?Java GDIWindowSurfaceData.getPeer使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sun.java2d.windows.GDIWindowSurfaceData
的用法示例。
在下文中一共展示了GDIWindowSurfaceData.getPeer方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: handleVItoScreenOp
import sun.java2d.windows.GDIWindowSurfaceData; //导入方法依赖的package包/类
/**
* 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);
}
}
}
}
}