Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_jdk
提交
8d0ad842
D
dragonwell8_jdk
项目概览
openanolis
/
dragonwell8_jdk
通知
3
Star
2
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
D
dragonwell8_jdk
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
8d0ad842
编写于
12月 17, 2010
作者:
J
jgodinez
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
6635462: D3D: REGRESSION: XOR rendering is extremly slow
Reviewed-by: igor, prr
上级
2a4ebf93
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
89 addition
and
3 deletion
+89
-3
src/share/classes/javax/swing/DefaultDesktopManager.java
src/share/classes/javax/swing/DefaultDesktopManager.java
+24
-2
src/windows/classes/sun/awt/windows/WComponentPeer.java
src/windows/classes/sun/awt/windows/WComponentPeer.java
+21
-0
src/windows/classes/sun/java2d/d3d/D3DSurfaceData.java
src/windows/classes/sun/java2d/d3d/D3DSurfaceData.java
+44
-1
未找到文件。
src/share/classes/javax/swing/DefaultDesktopManager.java
浏览文件 @
8d0ad842
...
...
@@ -359,7 +359,22 @@ public class DefaultDesktopManager implements DesktopManager, java.io.Serializab
f
.
getWidth
()-
1
,
f
.
getHeight
()-
1
);
}
g
.
drawRect
(
newX
,
newY
,
f
.
getWidth
()-
1
,
f
.
getHeight
()-
1
);
currentLoc
=
new
Point
(
newX
,
newY
);
/* Work around for 6635462: XOR mode may cause a SurfaceLost on first use.
* Swing doesn't expect that its XOR drawRect did
* not complete, so believes that on re-entering at
* the next update location, that there is an XOR rect
* to draw out at "currentLoc". But in fact
* its now got a new clean surface without that rect,
* so drawing it "out" in fact draws it on, leaving garbage.
* So only update/set currentLoc if the draw completed.
*/
sun
.
java2d
.
SurfaceData
sData
=
((
sun
.
java2d
.
SunGraphics2D
)
g
).
getSurfaceData
();
if
(!
sData
.
isSurfaceLost
())
{
currentLoc
=
new
Point
(
newX
,
newY
);
}
;
g
.
dispose
();
}
}
else
if
(
dragMode
==
FASTER_DRAG_MODE
)
{
...
...
@@ -412,7 +427,14 @@ public class DefaultDesktopManager implements DesktopManager, java.io.Serializab
g
.
drawRect
(
currentBounds
.
x
,
currentBounds
.
y
,
currentBounds
.
width
-
1
,
currentBounds
.
height
-
1
);
}
g
.
drawRect
(
newX
,
newY
,
newWidth
-
1
,
newHeight
-
1
);
currentBounds
=
new
Rectangle
(
newX
,
newY
,
newWidth
,
newHeight
);
// Work around for 6635462, see comment in dragFrame()
sun
.
java2d
.
SurfaceData
sData
=
((
sun
.
java2d
.
SunGraphics2D
)
g
).
getSurfaceData
();
if
(!
sData
.
isSurfaceLost
())
{
currentBounds
=
new
Rectangle
(
newX
,
newY
,
newWidth
,
newHeight
);
}
g
.
setPaintMode
();
g
.
dispose
();
}
...
...
src/windows/classes/sun/awt/windows/WComponentPeer.java
浏览文件 @
8d0ad842
...
...
@@ -999,6 +999,8 @@ public abstract class WComponentPeer extends WObjectPeer
public
void
setBoundsOperation
(
int
operation
)
{
}
private
volatile
boolean
isAccelCapable
=
true
;
/**
* Returns whether this component is capable of being hw accelerated.
* More specifically, whether rendering to this component or a
...
...
@@ -1009,11 +1011,22 @@ public abstract class WComponentPeer extends WObjectPeer
* {@link GraphicsDevice.WindowTranslucency#PERPIXEL_TRANSLUCENT
* PERPIXEL_TRANSLUCENT}.
*
* Another condition is if Xor paint mode was detected when rendering
* to an on-screen accelerated surface associated with this peer.
* in this case both on- and off-screen acceleration for this peer is
* disabled.
*
* @return {@code true} if this component is capable of being hw
* accelerated, {@code false} otherwise
* @see GraphicsDevice.WindowTranslucency#PERPIXEL_TRANSLUCENT
*/
public
boolean
isAccelCapable
()
{
if
(!
isAccelCapable
||
!
isContainingTopLevelAccelCapable
((
Component
)
target
))
{
return
false
;
}
boolean
isTranslucent
=
SunToolkit
.
isContainingTopLevelTranslucent
((
Component
)
target
);
// D3D/OGL and translucent windows interacted poorly in Windows XP;
...
...
@@ -1021,6 +1034,14 @@ public abstract class WComponentPeer extends WObjectPeer
return
!
isTranslucent
||
Win32GraphicsEnvironment
.
isVistaOS
();
}
/**
* Disables acceleration for this peer.
*/
public
void
disableAcceleration
()
{
isAccelCapable
=
false
;
}
native
void
setRectangularShape
(
int
lox
,
int
loy
,
int
hix
,
int
hiy
,
Region
region
);
...
...
src/windows/classes/sun/java2d/d3d/D3DSurfaceData.java
浏览文件 @
8d0ad842
...
...
@@ -437,6 +437,10 @@ public class D3DSurfaceData extends SurfaceData implements AccelSurface {
protected
int
getElem
(
final
int
x
,
final
int
y
,
final
SurfaceData
sData
)
{
if
(
sData
.
isSurfaceLost
())
{
return
0
;
}
int
retPixel
;
D3DRenderQueue
rq
=
D3DRenderQueue
.
getInstance
();
rq
.
lock
();
...
...
@@ -456,6 +460,10 @@ public class D3DSurfaceData extends SurfaceData implements AccelSurface {
protected
void
setElem
(
final
int
x
,
final
int
y
,
final
int
pixel
,
final
SurfaceData
sData
)
{
if
(
sData
.
isSurfaceLost
())
{
return
;
}
D3DRenderQueue
rq
=
D3DRenderQueue
.
getInstance
();
rq
.
lock
();
try
{
...
...
@@ -512,15 +520,32 @@ public class D3DSurfaceData extends SurfaceData implements AccelSurface {
sg2d
.
surfaceData
.
getTransparency
()
==
Transparency
.
OPAQUE
;
}
/**
* 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
);
}
}
}
public
void
validatePipe
(
SunGraphics2D
sg2d
)
{
TextPipe
textpipe
;
boolean
validated
=
false
;
// REMIND: the D3D pipeline doesn't support XOR!, more
// fixes will be needed below
// fixes will be needed below. For now we disable D3D rendering
// for the surface which had any XOR rendering done to.
if
(
sg2d
.
compositeState
>=
sg2d
.
COMP_XOR
)
{
super
.
validatePipe
(
sg2d
);
sg2d
.
imagepipe
=
d3dImagePipe
;
disableAccelerationForSurface
();
return
;
}
...
...
@@ -894,8 +919,26 @@ public class D3DSurfaceData extends SurfaceData implements AccelSurface {
return
peer
.
getTarget
();
}
@Override
void
disableAccelerationForSurface
()
{
// for on-screen surfaces we need to make sure a backup GDI surface is
// is used until a new one is set (which may happen during a resize). We
// don't want the screen update maanger to replace the surface right way
// because it causes repainting issues in Swing, so we invalidate it,
// this will prevent SUM from issuing a replaceSurfaceData call.
setSurfaceLost
(
true
);
invalidate
();
flush
();
peer
.
disableAcceleration
();
ScreenUpdateManager
.
getInstance
().
dropScreenSurface
(
this
);
}
@Override
void
restoreSurface
()
{
if
(!
peer
.
isAccelCapable
())
{
throw
new
InvalidPipeException
(
"Onscreen acceleration "
+
"disabled for this surface"
);
}
Window
fsw
=
graphicsDevice
.
getFullScreenWindow
();
if
(
fsw
!=
null
&&
fsw
!=
peer
.
getTarget
())
{
throw
new
InvalidPipeException
(
"Can't restore onscreen surface"
+
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录