提交 8b8d47c4 编写于 作者: B bae

6663447: D3D: excessive surface data replacements

Reviewed-by: prr, art
上级 700731ea
...@@ -605,6 +605,7 @@ public class WWindowPeer extends WPanelPeer implements WindowPeer, ...@@ -605,6 +605,7 @@ public class WWindowPeer extends WPanelPeer implements WindowPeer,
} }
private native void setOpacity(int iOpacity); private native void setOpacity(int iOpacity);
private float opacity = 1.0f;
public void setOpacity(float opacity) { public void setOpacity(float opacity) {
if (!((SunToolkit)((Window)target).getToolkit()). if (!((SunToolkit)((Window)target).getToolkit()).
...@@ -613,7 +614,21 @@ public class WWindowPeer extends WPanelPeer implements WindowPeer, ...@@ -613,7 +614,21 @@ public class WWindowPeer extends WPanelPeer implements WindowPeer,
return; return;
} }
if (opacity < 0.0f || opacity > 1.0f) {
throw new IllegalArgumentException(
"The value of opacity should be in the range [0.0f .. 1.0f].");
}
if (((this.opacity == 1.0f && opacity < 1.0f) ||
(this.opacity < 1.0f && opacity == 1.0f)) &&
!Win32GraphicsEnvironment.isVistaOS())
{
// non-Vista OS: only replace the surface data if opacity status
// changed (see WComponentPeer.isAccelCapable() for more)
replaceSurfaceDataRecursively((Component)getTarget()); replaceSurfaceDataRecursively((Component)getTarget());
}
this.opacity = opacity;
final int maxOpacity = 0xff; final int maxOpacity = 0xff;
int iOpacity = (int)(opacity * maxOpacity); int iOpacity = (int)(opacity * maxOpacity);
...@@ -655,7 +670,7 @@ public class WWindowPeer extends WPanelPeer implements WindowPeer, ...@@ -655,7 +670,7 @@ public class WWindowPeer extends WPanelPeer implements WindowPeer,
boolean isVistaOS = Win32GraphicsEnvironment.isVistaOS(); boolean isVistaOS = Win32GraphicsEnvironment.isVistaOS();
if (!isVistaOS) { if (this.isOpaque != isOpaque && !isVistaOS) {
// non-Vista OS: only replace the surface data if the opacity // non-Vista OS: only replace the surface data if the opacity
// status changed (see WComponentPeer.isAccelCapable() for more) // status changed (see WComponentPeer.isAccelCapable() for more)
replaceSurfaceDataRecursively(target); replaceSurfaceDataRecursively(target);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册