Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_jdk
提交
feeaf679
D
dragonwell8_jdk
项目概览
openanolis
/
dragonwell8_jdk
通知
4
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看板
提交
feeaf679
编写于
8月 04, 2008
作者:
T
tdv
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
6728834: D3D/OGL: LCD AA text becomes bold and blurred when rendering to a non-opaque destination
Reviewed-by: campbell
上级
1e6412b1
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
180 addition
and
2 deletion
+180
-2
src/share/classes/sun/java2d/opengl/OGLSurfaceData.java
src/share/classes/sun/java2d/opengl/OGLSurfaceData.java
+3
-1
src/windows/classes/sun/java2d/d3d/D3DSurfaceData.java
src/windows/classes/sun/java2d/d3d/D3DSurfaceData.java
+3
-1
test/sun/java2d/DirectX/NonOpaqueDestLCDAATest/NonOpaqueDestLCDAATest.java
...irectX/NonOpaqueDestLCDAATest/NonOpaqueDestLCDAATest.java
+174
-0
未找到文件。
src/share/classes/sun/java2d/opengl/OGLSurfaceData.java
浏览文件 @
feeaf679
...
...
@@ -401,6 +401,7 @@ public abstract class OGLSurfaceData extends SurfaceData
* - the fragment shader extension is available, and
* - blending is disabled, and
* - the source color is opaque
* - and the destination is opaque
*
* Eventually, we could enhance the native OGL text rendering code
* and remove the above restrictions, but that would require significantly
...
...
@@ -410,7 +411,8 @@ public abstract class OGLSurfaceData extends SurfaceData
return
graphicsConfig
.
isCapPresent
(
CAPS_EXT_LCD_SHADER
)
&&
sg2d
.
compositeState
<=
SunGraphics2D
.
COMP_ISCOPY
&&
sg2d
.
paintState
<=
SunGraphics2D
.
PAINT_OPAQUECOLOR
;
sg2d
.
paintState
<=
SunGraphics2D
.
PAINT_OPAQUECOLOR
&&
sg2d
.
surfaceData
.
getTransparency
()
==
Transparency
.
OPAQUE
;
}
public
void
validatePipe
(
SunGraphics2D
sg2d
)
{
...
...
src/windows/classes/sun/java2d/d3d/D3DSurfaceData.java
浏览文件 @
feeaf679
...
...
@@ -501,12 +501,14 @@ public class D3DSurfaceData extends SurfaceData implements AccelSurface {
* - the pixel shaders are available, and
* - blending is disabled, and
* - the source color is opaque
* - and the destination is opaque
*/
public
boolean
canRenderLCDText
(
SunGraphics2D
sg2d
)
{
return
graphicsDevice
.
isCapPresent
(
CAPS_LCD_SHADER
)
&&
sg2d
.
compositeState
<=
SunGraphics2D
.
COMP_ISCOPY
&&
sg2d
.
paintState
<=
SunGraphics2D
.
PAINT_OPAQUECOLOR
;
sg2d
.
paintState
<=
SunGraphics2D
.
PAINT_OPAQUECOLOR
&&
sg2d
.
surfaceData
.
getTransparency
()
==
Transparency
.
OPAQUE
;
}
public
void
validatePipe
(
SunGraphics2D
sg2d
)
{
...
...
test/sun/java2d/DirectX/NonOpaqueDestLCDAATest/NonOpaqueDestLCDAATest.java
0 → 100644
浏览文件 @
feeaf679
/*
* Copyright 2008 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*/
/*
* @test
* @bug 6728834
* @summary Tests that LCD AA text rendering works properly with destinations
* being VolatileImage of all transparency types
* @author Dmitri.Trembovetski: area=Graphics
* @run main/manual/othervm NonOpaqueDestLCDAATest
* @run main/manual/othervm -Dsun.java2d.opengl=True NonOpaqueDestLCDAATest
*/
import
java.awt.AlphaComposite
;
import
java.awt.Color
;
import
java.awt.Dimension
;
import
java.awt.EventQueue
;
import
java.awt.Graphics
;
import
java.awt.Graphics2D
;
import
java.awt.GraphicsConfiguration
;
import
java.awt.RenderingHints
;
import
java.awt.event.ActionEvent
;
import
java.awt.event.ActionListener
;
import
java.awt.event.ComponentAdapter
;
import
java.awt.event.ComponentEvent
;
import
java.awt.event.WindowAdapter
;
import
java.awt.event.WindowEvent
;
import
java.awt.image.VolatileImage
;
import
java.io.File
;
import
java.util.concurrent.CountDownLatch
;
import
javax.imageio.ImageIO
;
import
javax.swing.JButton
;
import
javax.swing.JFrame
;
import
javax.swing.JPanel
;
import
javax.swing.JTextArea
;
import
static
java
.
awt
.
Transparency
.*;
public
class
NonOpaqueDestLCDAATest
extends
JFrame
implements
ActionListener
{
private
static
volatile
boolean
passed
=
true
;
private
static
CountDownLatch
complete
=
new
CountDownLatch
(
1
);
public
NonOpaqueDestLCDAATest
()
{
JTextArea
desc
=
new
JTextArea
();
desc
.
setText
(
"\n Instructions: the three text strings below should appear\n"
+
" readable, without smudges or misshapen bold glyphs.\n\n"
+
" If they look fine the test PASSED otherwise it FAILED.\n"
);
desc
.
setEditable
(
false
);
desc
.
setBackground
(
Color
.
black
);
desc
.
setForeground
(
Color
.
green
);
add
(
"North"
,
desc
);
JPanel
renderPanel
=
new
JPanel
()
{
public
void
paintComponent
(
Graphics
g
)
{
render
(
g
,
getWidth
(),
getHeight
());
}
};
renderPanel
.
setPreferredSize
(
new
Dimension
(
350
,
150
));
renderPanel
.
addComponentListener
(
new
ComponentAdapter
()
{
public
void
componentResized
(
ComponentEvent
e
)
{
images
=
null
;
}
});
add
(
"Center"
,
renderPanel
);
JButton
passed
=
new
JButton
(
"Passed"
);
JButton
failed
=
new
JButton
(
"Failed"
);
passed
.
addActionListener
(
this
);
failed
.
addActionListener
(
this
);
JPanel
p
=
new
JPanel
();
p
.
add
(
passed
);
p
.
add
(
failed
);
add
(
"South"
,
p
);
addWindowListener
(
new
WindowAdapter
()
{
public
void
windowClosing
(
WindowEvent
e
)
{
complete
.
countDown
();
}
});
setDefaultCloseOperation
(
JFrame
.
DISPOSE_ON_CLOSE
);
}
public
void
render
(
Graphics
g
,
int
w
,
int
h
)
{
initImages
(
w
,
h
);
Graphics2D
g2d
=
(
Graphics2D
)
g
.
create
();
for
(
VolatileImage
vi
:
images
)
{
g2d
.
drawImage
(
vi
,
0
,
0
,
null
);
g2d
.
translate
(
0
,
vi
.
getHeight
());
}
}
String
tr
[]
=
{
"OPAQUE"
,
"BITMASK"
,
"TRANSLUCENT"
};
public
void
actionPerformed
(
ActionEvent
e
)
{
if
(
e
.
getActionCommand
().
equals
(
"Passed"
))
{
passed
=
true
;
System
.
out
.
println
(
"Test Passed"
);
}
else
if
(
e
.
getActionCommand
().
equals
(
"Failed"
))
{
System
.
out
.
println
(
"Test Failed"
);
for
(
int
i
=
0
;
i
<
images
.
length
;
i
++)
{
String
f
=
"NonOpaqueDestLCDAATest_"
+
tr
[
i
]+
".png"
;
try
{
ImageIO
.
write
(
images
[
i
].
getSnapshot
(),
"png"
,
new
File
(
f
));
System
.
out
.
printf
(
"Dumped %s image to %s\n"
,
tr
[
i
],
f
);
}
catch
(
Throwable
t
)
{}
}
passed
=
false
;
}
dispose
();
complete
.
countDown
();
}
static
void
clear
(
Graphics2D
g
,
int
w
,
int
h
)
{
Graphics2D
gg
=
(
Graphics2D
)
g
.
create
();
gg
.
setColor
(
new
Color
(
0
,
0
,
0
,
0
));
gg
.
setComposite
(
AlphaComposite
.
Src
);
gg
.
fillRect
(
0
,
0
,
w
,
h
);
}
VolatileImage
images
[];
private
void
initImages
(
int
w
,
int
h
)
{
if
(
images
==
null
)
{
images
=
new
VolatileImage
[
3
];
GraphicsConfiguration
gc
=
getGraphicsConfiguration
();
for
(
int
i
=
OPAQUE
;
i
<=
TRANSLUCENT
;
i
++)
{
VolatileImage
vi
=
gc
.
createCompatibleVolatileImage
(
w
,
h
/
3
,
i
);
images
[
i
-
1
]
=
vi
;
vi
.
validate
(
gc
);
Graphics2D
g2d
=
(
Graphics2D
)
vi
.
getGraphics
();
if
(
i
>
OPAQUE
)
{
clear
(
g2d
,
vi
.
getWidth
(),
vi
.
getHeight
());
}
g2d
.
setRenderingHint
(
RenderingHints
.
KEY_TEXT_ANTIALIASING
,
RenderingHints
.
VALUE_TEXT_ANTIALIAS_LCD_HRGB
);
String
s
=
"LCD AA Text rendered to "
+
tr
[
i
-
1
]+
" destination"
;
g2d
.
drawString
(
s
,
10
,
vi
.
getHeight
()/
2
);
}
}
}
public
static
void
main
(
String
[]
args
)
throws
InterruptedException
{
EventQueue
.
invokeLater
(
new
Runnable
()
{
public
void
run
()
{
NonOpaqueDestLCDAATest
t
=
new
NonOpaqueDestLCDAATest
();
t
.
pack
();
t
.
setVisible
(
true
);
}
});
complete
.
await
();
if
(!
passed
)
{
throw
new
RuntimeException
(
"Test Failed!"
);
}
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录