Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_jdk
提交
56e695c4
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看板
提交
56e695c4
编写于
10月 04, 2010
作者:
L
lana
浏览文件
操作
浏览文件
下载
差异文件
Merge
上级
5bf9cf4d
90567e57
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
157 addition
and
7 deletion
+157
-7
make/sun/cmm/lcms/Makefile
make/sun/cmm/lcms/Makefile
+6
-1
src/share/classes/java/awt/image/SampleModel.java
src/share/classes/java/awt/image/SampleModel.java
+30
-6
test/java/awt/image/GetSamplesTest.java
test/java/awt/image/GetSamplesTest.java
+121
-0
未找到文件。
make/sun/cmm/lcms/Makefile
浏览文件 @
56e695c4
...
...
@@ -80,7 +80,12 @@ vpath %.c $(SHARE_SRC)/native/$(PKGDIR)
vpath
%.c
$(SHARE_SRC)/native/sun/java2d
ifeq
($(PLATFORM), windows)
OTHER_CFLAGS
+=
-DCMS_IS_WINDOWS_
-Dsqrtf
=
sqrt
OTHER_CFLAGS
+=
-DCMS_IS_WINDOWS_
ifeq
($(COMPILER_VERSION), VS2003)
OTHER_CFLAGS
+=
-Dsqrtf
=
sqrt
endif
OTHER_LDLIBS
=
$(OBJDIR)
/../../../sun.awt/awt/
$(OBJDIRNAME)
/awt.lib
OTHER_INCLUDES
+=
-I
$(SHARE_SRC)
/native/sun/java2d
\
-I
$(SHARE_SRC)
/native/sun/awt/debug
...
...
src/share/classes/java/awt/image/SampleModel.java
浏览文件 @
56e695c4
...
...
@@ -937,14 +937,22 @@ public abstract class SampleModel
int
iArray
[],
DataBuffer
data
)
{
int
pixels
[];
int
Offset
=
0
;
int
x1
=
x
+
w
;
int
y1
=
y
+
h
;
if
(
x
<
0
||
x1
<
x
||
x1
>
width
||
y
<
0
||
y1
<
y
||
y1
>
height
)
{
throw
new
ArrayIndexOutOfBoundsException
(
"Invalid coordinates."
);
}
if
(
iArray
!=
null
)
pixels
=
iArray
;
else
pixels
=
new
int
[
w
*
h
];
for
(
int
i
=
y
;
i
<
(
h
+
y
)
;
i
++)
{
for
(
int
j
=
x
;
j
<
(
w
+
x
)
;
j
++)
{
for
(
int
i
=
y
;
i
<
y1
;
i
++)
{
for
(
int
j
=
x
;
j
<
x1
;
j
++)
{
pixels
[
Offset
++]
=
getSample
(
j
,
i
,
b
,
data
);
}
}
...
...
@@ -978,14 +986,22 @@ public abstract class SampleModel
DataBuffer
data
)
{
float
pixels
[];
int
Offset
=
0
;
int
x1
=
x
+
w
;
int
y1
=
y
+
h
;
if
(
x
<
0
||
x1
<
x
||
x1
>
width
||
y
<
0
||
y1
<
y
||
y1
>
height
)
{
throw
new
ArrayIndexOutOfBoundsException
(
"Invalid coordinates"
);
}
if
(
fArray
!=
null
)
pixels
=
fArray
;
else
pixels
=
new
float
[
w
*
h
];
for
(
int
i
=
y
;
i
<
(
h
+
y
)
;
i
++)
{
for
(
int
j
=
x
;
j
<
(
w
+
x
)
;
j
++)
{
for
(
int
i
=
y
;
i
<
y1
;
i
++)
{
for
(
int
j
=
x
;
j
<
x1
;
j
++)
{
pixels
[
Offset
++]
=
getSampleFloat
(
j
,
i
,
b
,
data
);
}
}
...
...
@@ -1019,14 +1035,22 @@ public abstract class SampleModel
DataBuffer
data
)
{
double
pixels
[];
int
Offset
=
0
;
int
x1
=
x
+
w
;
int
y1
=
y
+
h
;
if
(
x
<
0
||
x1
<
x
||
x1
>
width
||
y
<
0
||
y1
<
y
||
y1
>
height
)
{
throw
new
ArrayIndexOutOfBoundsException
(
"Invalid coordinates"
);
}
if
(
dArray
!=
null
)
pixels
=
dArray
;
else
pixels
=
new
double
[
w
*
h
];
for
(
int
i
=
y
;
i
<
(
y
+
h
)
;
i
++)
{
for
(
int
j
=
x
;
j
<
(
x
+
w
)
;
j
++)
{
for
(
int
i
=
y
;
i
<
y1
;
i
++)
{
for
(
int
j
=
x
;
j
<
x1
;
j
++)
{
pixels
[
Offset
++]
=
getSampleDouble
(
j
,
i
,
b
,
data
);
}
}
...
...
test/java/awt/image/GetSamplesTest.java
0 → 100644
浏览文件 @
56e695c4
/*
* Copyright (c) 2010, Oracle and/or its affiliates. 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* @test
* @bug 6735275
* @summary Test verifies that SampleModel.getSamples() throws an appropriate
* exception if coordinates are not in bounds.
*
* @run main GetSamplesTest
*/
import
java.awt.image.BandedSampleModel
;
import
java.awt.image.ComponentSampleModel
;
import
java.awt.image.DataBuffer
;
import
java.awt.image.MultiPixelPackedSampleModel
;
import
java.awt.image.PixelInterleavedSampleModel
;
import
java.awt.image.SampleModel
;
import
java.awt.image.SinglePixelPackedSampleModel
;
import
java.util.Vector
;
public
class
GetSamplesTest
{
public
static
int
width
=
100
;
public
static
int
height
=
100
;
public
static
int
dataType
=
DataBuffer
.
TYPE_BYTE
;
public
static
int
numBands
=
4
;
public
static
void
main
(
String
[]
args
)
{
Vector
<
Class
<?
extends
SampleModel
>>
classes
=
new
Vector
<
Class
<?
extends
SampleModel
>>();
classes
.
add
(
ComponentSampleModel
.
class
);
classes
.
add
(
MultiPixelPackedSampleModel
.
class
);
classes
.
add
(
SinglePixelPackedSampleModel
.
class
);
classes
.
add
(
BandedSampleModel
.
class
);
classes
.
add
(
PixelInterleavedSampleModel
.
class
);
for
(
Class
<?
extends
SampleModel
>
c
:
classes
)
{
doTest
(
c
);
}
}
private
static
void
doTest
(
Class
<?
extends
SampleModel
>
c
)
{
System
.
out
.
println
(
"Test for: "
+
c
.
getName
());
SampleModel
sm
=
createSampleModel
(
c
);
DataBuffer
db
=
sm
.
createDataBuffer
();
int
[]
iArray
=
new
int
[
width
*
height
+
numBands
];
float
[]
fArray
=
new
float
[
width
*
height
+
numBands
];
double
[]
dArray
=
new
double
[
width
*
height
+
numBands
];
boolean
iOk
=
false
;
boolean
fOk
=
false
;
boolean
dOk
=
false
;
try
{
sm
.
getSamples
(
Integer
.
MAX_VALUE
,
0
,
1
,
1
,
0
,
iArray
,
db
);
}
catch
(
ArrayIndexOutOfBoundsException
e
)
{
System
.
out
.
println
(
e
.
getMessage
());
iOk
=
true
;
}
try
{
sm
.
getSamples
(
Integer
.
MAX_VALUE
,
0
,
1
,
1
,
0
,
fArray
,
db
);
}
catch
(
ArrayIndexOutOfBoundsException
e
)
{
System
.
out
.
println
(
e
.
getMessage
());
fOk
=
true
;
}
try
{
sm
.
getSamples
(
0
,
Integer
.
MAX_VALUE
,
1
,
1
,
0
,
dArray
,
db
);
}
catch
(
ArrayIndexOutOfBoundsException
e
)
{
System
.
out
.
println
(
e
.
getMessage
());
dOk
=
true
;
}
if
(!
iOk
||
!
fOk
||
!
dOk
)
{
throw
new
RuntimeException
(
"Test for "
+
c
.
getSimpleName
()
+
" failed: iOk="
+
iOk
+
"; fOk="
+
fOk
+
"; dOk="
+
dOk
);
}
}
private
static
SampleModel
createSampleModel
(
Class
<?
extends
SampleModel
>
cls
)
{
SampleModel
res
=
null
;
if
(
cls
==
ComponentSampleModel
.
class
)
{
res
=
new
ComponentSampleModel
(
dataType
,
width
,
height
,
4
,
width
*
4
,
new
int
[]
{
0
,
1
,
2
,
3
}
);
}
else
if
(
cls
==
MultiPixelPackedSampleModel
.
class
)
{
res
=
new
MultiPixelPackedSampleModel
(
dataType
,
width
,
height
,
4
);
}
else
if
(
cls
==
SinglePixelPackedSampleModel
.
class
)
{
res
=
new
SinglePixelPackedSampleModel
(
dataType
,
width
,
height
,
new
int
[]{
0xff000000
,
0x00ff0000
,
0x0000ff00
,
0x000000ff
});
}
else
if
(
cls
==
BandedSampleModel
.
class
)
{
res
=
new
BandedSampleModel
(
dataType
,
width
,
height
,
numBands
);
}
else
if
(
cls
==
PixelInterleavedSampleModel
.
class
)
{
res
=
new
PixelInterleavedSampleModel
(
dataType
,
width
,
height
,
4
,
width
*
4
,
new
int
[]
{
0
,
1
,
2
,
3
});
}
else
{
throw
new
RuntimeException
(
"Unknown class "
+
cls
);
}
return
res
;
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录