Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_jdk
提交
c096f95c
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看板
提交
c096f95c
编写于
10月 09, 2008
作者:
T
tdv
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
6749060: LCD AA text rendered incorrectly when destination is non opaque (sw pipeline only)
Reviewed-by: campbell, prr
上级
0b0f9f6b
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
70 addition
and
31 deletion
+70
-31
src/share/classes/sun/java2d/SurfaceData.java
src/share/classes/sun/java2d/SurfaceData.java
+2
-1
test/sun/java2d/DirectX/NonOpaqueDestLCDAATest/NonOpaqueDestLCDAATest.java
...irectX/NonOpaqueDestLCDAATest/NonOpaqueDestLCDAATest.java
+68
-30
未找到文件。
src/share/classes/sun/java2d/SurfaceData.java
浏览文件 @
c096f95c
...
...
@@ -449,7 +449,8 @@ public abstract class SurfaceData
// For now the answer can only be true in the following cases:
if
(
sg2d
.
compositeState
<=
SunGraphics2D
.
COMP_ISCOPY
&&
sg2d
.
paintState
<=
SunGraphics2D
.
PAINT_ALPHACOLOR
&&
sg2d
.
clipState
<=
SunGraphics2D
.
CLIP_RECTANGULAR
)
sg2d
.
clipState
<=
SunGraphics2D
.
CLIP_RECTANGULAR
&&
sg2d
.
surfaceData
.
getTransparency
()
==
Transparency
.
OPAQUE
)
{
if
(
haveLCDLoop
==
LCDLOOP_UNKNOWN
)
{
DrawGlyphListLCD
loop
=
...
...
test/sun/java2d/DirectX/NonOpaqueDestLCDAATest/NonOpaqueDestLCDAATest.java
浏览文件 @
c096f95c
...
...
@@ -23,10 +23,11 @@
/*
* @test
* @bug 6728834
* @bug 6728834
6749060
* @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 -Dsun.java2d.d3d=false NonOpaqueDestLCDAATest
* @run main/manual/othervm NonOpaqueDestLCDAATest
* @run main/manual/othervm -Dsun.java2d.opengl=True NonOpaqueDestLCDAATest
*/
...
...
@@ -35,9 +36,11 @@ import java.awt.AlphaComposite;
import
java.awt.Color
;
import
java.awt.Dimension
;
import
java.awt.EventQueue
;
import
java.awt.Font
;
import
java.awt.Graphics
;
import
java.awt.Graphics2D
;
import
java.awt.GraphicsConfiguration
;
import
java.awt.Image
;
import
java.awt.RenderingHints
;
import
java.awt.event.ActionEvent
;
import
java.awt.event.ActionListener
;
...
...
@@ -45,6 +48,7 @@ import java.awt.event.ComponentAdapter;
import
java.awt.event.ComponentEvent
;
import
java.awt.event.WindowAdapter
;
import
java.awt.event.WindowEvent
;
import
java.awt.image.BufferedImage
;
import
java.awt.image.VolatileImage
;
import
java.io.File
;
import
java.util.concurrent.CountDownLatch
;
...
...
@@ -62,35 +66,43 @@ public class NonOpaqueDestLCDAATest extends JFrame implements ActionListener {
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"
);
"\n Instructions: the three text strings below should appear"
+
" readable, without smudges or misshapen bold glyphs.\n"
+
" You may need a magnifier to notice some bad colorfringing in "
+
" in SW Translucent case, especially in vertical stems.\n\n"
+
" Basically text rendered to TRANSLUCENT destination should look"
+
" similar to one rendered to OPAQUE - it may differ in whether or"
+
" not it's LCD, but it should look 'correct'\n\n"
+
"If the text looks 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
()
{
@Override
public
void
paintComponent
(
Graphics
g
)
{
render
(
g
,
getWidth
(),
getHeight
());
}
};
renderPanel
.
setPreferredSize
(
new
Dimension
(
350
,
1
50
));
renderPanel
.
setPreferredSize
(
new
Dimension
(
1024
,
6
50
));
renderPanel
.
addComponentListener
(
new
ComponentAdapter
()
{
@Override
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
);
JButton
passed
Btn
=
new
JButton
(
"Passed"
);
JButton
failed
Btn
=
new
JButton
(
"Failed"
);
passed
Btn
.
addActionListener
(
this
);
failed
Btn
.
addActionListener
(
this
);
JPanel
p
=
new
JPanel
();
p
.
add
(
passed
);
p
.
add
(
failed
);
p
.
add
(
passed
Btn
);
p
.
add
(
failed
Btn
);
add
(
"South"
,
p
);
addWindowListener
(
new
WindowAdapter
()
{
@Override
public
void
windowClosing
(
WindowEvent
e
)
{
complete
.
countDown
();
}
...
...
@@ -101,14 +113,18 @@ public class NonOpaqueDestLCDAATest extends JFrame implements ActionListener {
public
void
render
(
Graphics
g
,
int
w
,
int
h
)
{
initImages
(
w
,
h
);
g
.
setColor
(
new
Color
(
0xAD
,
0xD8
,
0xE6
));
g
.
fillRect
(
0
,
0
,
w
,
h
);
Graphics2D
g2d
=
(
Graphics2D
)
g
.
create
();
for
(
VolatileImage
vi
:
images
)
{
g2d
.
drawImage
(
vi
,
0
,
0
,
null
);
g2d
.
translate
(
0
,
vi
.
getHeight
(
));
for
(
Image
im
:
images
)
{
g2d
.
drawImage
(
im
,
0
,
0
,
null
);
g2d
.
translate
(
0
,
im
.
getHeight
(
null
));
}
}
String
tr
[]
=
{
"OPAQUE"
,
"BITMASK"
,
"TRANSLUCENT"
};
@Override
public
void
actionPerformed
(
ActionEvent
e
)
{
if
(
e
.
getActionCommand
().
equals
(
"Passed"
))
{
passed
=
true
;
...
...
@@ -116,9 +132,17 @@ public class NonOpaqueDestLCDAATest extends JFrame implements ActionListener {
}
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"
;
String
f
=
"NonOpaqueDestLCDAATest_"
+
tr
[
i
];
try
{
ImageIO
.
write
(
images
[
i
].
getSnapshot
(),
"png"
,
new
File
(
f
));
if
(
images
[
i
]
instanceof
VolatileImage
)
{
f
+=
"_vi.png"
;
ImageIO
.
write
(((
VolatileImage
)
images
[
i
]).
getSnapshot
(),
"png"
,
new
File
(
f
));
}
else
{
f
+=
"_bi.png"
;
ImageIO
.
write
((
BufferedImage
)
images
[
i
],
"png"
,
new
File
(
f
));
}
System
.
out
.
printf
(
"Dumped %s image to %s\n"
,
tr
[
i
],
f
);
}
catch
(
Throwable
t
)
{}
}
...
...
@@ -128,37 +152,51 @@ public class NonOpaqueDestLCDAATest extends JFrame implements ActionListener {
complete
.
countDown
();
}
static
void
clear
(
Graphics2D
g
,
int
w
,
int
h
)
{
static
void
clear
(
Graphics2D
g
,
int
type
,
int
w
,
int
h
)
{
Graphics2D
gg
=
(
Graphics2D
)
g
.
create
();
gg
.
setColor
(
new
Color
(
0
,
0
,
0
,
0
));
gg
.
setComposite
(
AlphaComposite
.
Src
);
if
(
type
>
OPAQUE
)
{
gg
.
setColor
(
new
Color
(
0
,
0
,
0
,
0
));
gg
.
setComposite
(
AlphaComposite
.
Src
);
}
else
{
gg
.
setColor
(
new
Color
(
0xAD
,
0xD8
,
0xE6
));
}
gg
.
fillRect
(
0
,
0
,
w
,
h
);
}
VolatileImage
images
[];
private
void
render
(
Image
im
,
int
type
,
String
s
)
{
Graphics2D
g2d
=
(
Graphics2D
)
im
.
getGraphics
();
clear
(
g2d
,
type
,
im
.
getWidth
(
null
),
im
.
getHeight
(
null
));
g2d
.
setRenderingHint
(
RenderingHints
.
KEY_TEXT_ANTIALIASING
,
RenderingHints
.
VALUE_TEXT_ANTIALIAS_LCD_HRGB
);
Font
f
=
new
Font
(
"Dialog"
,
Font
.
BOLD
,
40
);
// g2d.getFont().deriveFont(32.0f);
g2d
.
setColor
(
Color
.
white
);
g2d
.
setFont
(
g2d
.
getFont
().
deriveFont
(
36.0f
));
g2d
.
drawString
(
s
,
10
,
im
.
getHeight
(
null
)
/
2
);
}
Image
images
[];
private
void
initImages
(
int
w
,
int
h
)
{
if
(
images
==
null
)
{
images
=
new
VolatileImage
[
3
];
images
=
new
Image
[
6
];
GraphicsConfiguration
gc
=
getGraphicsConfiguration
();
for
(
int
i
=
OPAQUE
;
i
<=
TRANSLUCENT
;
i
++)
{
VolatileImage
vi
=
gc
.
createCompatibleVolatileImage
(
w
,
h
/
3
,
i
);
gc
.
createCompatibleVolatileImage
(
w
,
h
/
images
.
length
,
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
);
String
s
=
"LCD AA Text rendered to "
+
tr
[
i
-
1
]
+
" HW destination"
;
render
(
vi
,
i
,
s
);
s
=
"LCD AA Text rendered to "
+
tr
[
i
-
1
]
+
" SW destination"
;
images
[
i
-
1
+
3
]
=
gc
.
createCompatibleImage
(
w
,
h
/
images
.
length
,
i
);
render
(
images
[
i
-
1
+
3
],
i
,
s
);
}
}
}
public
static
void
main
(
String
[]
args
)
throws
InterruptedException
{
EventQueue
.
invokeLater
(
new
Runnable
()
{
@Override
public
void
run
()
{
NonOpaqueDestLCDAATest
t
=
new
NonOpaqueDestLCDAATest
();
t
.
pack
();
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录