Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_jdk
提交
f8f1d2ef
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看板
提交
f8f1d2ef
编写于
12月 10, 2015
作者:
L
lbourges
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
8144446: Automate the Marlin crash test
Reviewed-by: prr, flar
上级
21e3f434
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
38 addition
and
28 deletion
+38
-28
src/share/classes/sun/java2d/marlin/Renderer.java
src/share/classes/sun/java2d/marlin/Renderer.java
+7
-0
test/sun/java2d/marlin/CrashTest.java
test/sun/java2d/marlin/CrashTest.java
+31
-28
未找到文件。
src/share/classes/sun/java2d/marlin/Renderer.java
浏览文件 @
f8f1d2ef
...
...
@@ -629,6 +629,13 @@ final class Renderer implements PathConsumer2D, MarlinConst {
}
if
(
edgeMinY
!=
Float
.
POSITIVE_INFINITY
)
{
// if context is maked as DIRTY:
if
(
rdrCtx
.
dirty
)
{
// may happen if an exception if thrown in the pipeline processing:
// clear completely buckets arrays:
buckets_minY
=
0
;
buckets_maxY
=
boundsMaxY
-
boundsMinY
;
}
// clear used part
if
(
edgeBuckets
==
edgeBuckets_initial
)
{
// fill only used part
...
...
test/sun/java2d/marlin/CrashTest.java
浏览文件 @
f8f1d2ef
...
...
@@ -31,31 +31,44 @@ import java.awt.image.BufferedImage;
import
java.io.File
;
import
java.io.IOException
;
import
javax.imageio.ImageIO
;
import
sun.java2d.pipe.RenderingEngine
;
/**
* Simple crash rendering test using huge GeneralPaths with marlin renderer
*
* run it with large heap (2g):
* java -Dsun.java2d.renderer=sun.java2d.marlin.MarlinRenderingEngine marlin.CrashTest
*
* @author bourgesl
*/
* @test
* @summary Simple crash rendering test using huge GeneralPaths with the Marlin renderer
* @run main/othervm -mx512m CrashTest
* @ignore tests that take a long time and consumes 5Gb memory
* @run main/othervm -ms4g -mx4g CrashTest -slow
*/
public
class
CrashTest
{
static
final
boolean
SAVE_IMAGE
=
false
;
static
boolean
USE_ROUND_CAPS_AND_JOINS
=
true
;
public
static
void
main
(
String
[]
args
)
{
boolean
runSlowTests
=
(
args
.
length
!=
0
&&
"-slow"
.
equals
(
args
[
0
]));
// First display which renderer is tested:
System
.
setProperty
(
"sun.java2d.renderer.verbose"
,
"true"
);
// try insane image sizes:
// subpixel coords may overflow:
// testHugeImage((Integer.MAX_VALUE >> 3) + 1, 6);
// check MAX_VALUE / (8 * 2); overflow may happen due to orientation flag
// But as it is impossible to allocate an image larger than 2Gb (byte) then
// it is also impossible to have rowAAChunk larger than 2Gb !
// Disabled test as it consumes 4GB heap + offheap (2Gb) ie > 6Gb !
if
(
runSlowTests
)
{
testHugeImage
((
Integer
.
MAX_VALUE
>>
4
)
-
100
,
16
);
}
// larger than 23 bits: (RLE)
testHugeImage
(
8388608
+
1
,
10
);
test
(
0.1f
,
false
,
0
);
test
(
0.1f
,
true
,
7
f
);
if
(
runSlowTests
)
{
test
(
0.1f
,
false
,
0
);
test
(
0.1f
,
true
,
7
f
);
}
// Exceed 2Gb OffHeap buffer for edges:
try
{
...
...
@@ -67,17 +80,15 @@ public class CrashTest {
if
(
th
instanceof
ArrayIndexOutOfBoundsException
)
{
System
.
out
.
println
(
"ArrayIndexOutOfBoundsException expected."
);
}
else
{
System
.
out
.
println
(
"Exception occured:"
);
th
.
printStackTrace
();
throw
new
RuntimeException
(
"Unexpected exception"
,
th
);
}
}
}
private
static
void
test
(
final
float
lineStroke
,
final
boolean
useDashes
,
final
float
dashMinLen
)
throws
ArrayIndexOutOfBoundsException
throws
ArrayIndexOutOfBoundsException
{
System
.
out
.
println
(
"---\n"
+
"test: "
+
"lineStroke="
+
lineStroke
...
...
@@ -85,9 +96,6 @@ public class CrashTest {
+
", dashMinLen="
+
dashMinLen
);
final
String
renderer
=
RenderingEngine
.
getInstance
().
getClass
().
getSimpleName
();
System
.
out
.
println
(
"Testing renderer = "
+
renderer
);
final
BasicStroke
stroke
=
createStroke
(
lineStroke
,
useDashes
,
dashMinLen
);
// TODO: test Dasher.firstSegmentsBuffer resizing ?
...
...
@@ -135,7 +143,7 @@ public class CrashTest {
if
(
SAVE_IMAGE
)
{
try
{
final
File
file
=
new
File
(
"CrashTest-
"
+
renderer
+
"-
dash-"
+
useDashes
+
".bmp"
);
final
File
file
=
new
File
(
"CrashTest-dash-"
+
useDashes
+
".bmp"
);
System
.
out
.
println
(
"Writing file: "
+
file
.
getAbsolutePath
());
ImageIO
.
write
(
image
,
"BMP"
,
file
);
...
...
@@ -150,15 +158,10 @@ public class CrashTest {
}
private
static
void
testHugeImage
(
final
int
width
,
final
int
height
)
throws
ArrayIndexOutOfBoundsException
throws
ArrayIndexOutOfBoundsException
{
System
.
out
.
println
(
"---\n"
+
"testHugeImage: "
+
"width="
+
width
+
", height="
+
height
);
final
String
renderer
=
RenderingEngine
.
getInstance
().
getClass
().
getSimpleName
();
System
.
out
.
println
(
"Testing renderer = "
+
renderer
);
+
"width="
+
width
+
", height="
+
height
);
final
BasicStroke
stroke
=
createStroke
(
2.5f
,
false
,
0
);
...
...
@@ -195,8 +198,8 @@ public class CrashTest {
if
(
SAVE_IMAGE
)
{
try
{
final
File
file
=
new
File
(
"CrashTest-
"
+
renderer
+
"-huge-"
+
width
+
"x"
+
height
+
".bmp"
);
final
File
file
=
new
File
(
"CrashTest-
huge-"
+
width
+
"x"
+
height
+
".bmp"
);
System
.
out
.
println
(
"Writing file: "
+
file
.
getAbsolutePath
());
ImageIO
.
write
(
image
,
"BMP"
,
file
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录