Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_jdk
提交
f471610c
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看板
提交
f471610c
编写于
4月 08, 2013
作者:
P
prr
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
8011257: Better Byte Component Rasters
Reviewed-by: bae, vadim, mschoene
上级
7e29bf28
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
52 addition
and
30 deletion
+52
-30
src/share/classes/sun/awt/image/ByteBandedRaster.java
src/share/classes/sun/awt/image/ByteBandedRaster.java
+44
-21
src/share/classes/sun/awt/image/ByteComponentRaster.java
src/share/classes/sun/awt/image/ByteComponentRaster.java
+8
-9
未找到文件。
src/share/classes/sun/awt/image/ByteBandedRaster.java
浏览文件 @
f471610c
...
...
@@ -159,7 +159,7 @@ public class ByteBandedRaster extends SunWritableRaster {
throw
new
RasterFormatException
(
"ByteBandedRasters must have"
+
"BandedSampleModels"
);
}
verify
(
false
);
verify
();
}
...
...
@@ -731,16 +731,30 @@ public class ByteBandedRaster extends SunWritableRaster {
}
/**
* Verify that the layout parameters are consistent with
* the data. If strictCheck
* is false, this method will check for ArrayIndexOutOfBounds conditions. If
* strictCheck is true, this method will check for additional error
* conditions such as line wraparound (width of a line greater than
* the scanline stride).
* @return String Error string, if the layout is incompatible with
* the data. Otherwise returns null.
* Verify that the layout parameters are consistent with the data.
* Verifies whether the data buffer has enough data for the raster,
* taking into account offsets, after ensuring all offsets are >=0.
* @throws RasterFormatException if a problem is detected.
*/
private
void
verify
(
boolean
strictCheck
)
{
private
void
verify
()
{
/* Need to re-verify the dimensions since a sample model may be
* specified to the constructor
*/
if
(
width
<=
0
||
height
<=
0
||
height
>
(
Integer
.
MAX_VALUE
/
width
))
{
throw
new
RasterFormatException
(
"Invalid raster dimension"
);
}
if
(
scanlineStride
<
0
||
scanlineStride
>
(
Integer
.
MAX_VALUE
/
height
))
{
// integer overflow
throw
new
RasterFormatException
(
"Incorrect scanline stride: "
+
scanlineStride
);
}
// Make sure data for Raster is in a legal range
for
(
int
i
=
0
;
i
<
dataOffsets
.
length
;
i
++)
{
if
(
dataOffsets
[
i
]
<
0
)
{
...
...
@@ -750,32 +764,41 @@ public class ByteBandedRaster extends SunWritableRaster {
}
}
int
maxSize
=
0
;
int
size
;
int
lastScanOffset
=
(
height
-
1
)
*
scanlineStride
;
int
lastPixelOffset
=
lastScanOffset
+
(
width
-
1
);
if
(
lastPixelOffset
<
lastScanOffset
)
{
throw
new
RasterFormatException
(
"Invalid raster dimension"
);
}
int
maxIndex
=
0
;
int
index
;
for
(
int
i
=
0
;
i
<
numDataElements
;
i
++)
{
size
=
(
height
-
1
)*
scanlineStride
+
(
width
-
1
)
+
dataOffsets
[
i
];
if
(
size
>
maxSize
)
{
maxSize
=
size
;
index
=
lastPixelOffset
+
dataOffsets
[
i
];
if
(
index
<
lastPixelOffset
)
{
throw
new
RasterFormatException
(
"Invalid raster dimension"
);
}
if
(
index
>
maxIndex
)
{
maxIndex
=
index
;
}
}
if
(
data
.
length
==
1
)
{
if
(
data
[
0
].
length
<
maxSize
*
numDataElements
)
{
if
(
data
[
0
].
length
<
=
maxIndex
*
numDataElements
)
{
throw
new
RasterFormatException
(
"Data array too small "
+
"(it is "
+
data
[
0
].
length
+
" and should be "
+
(
max
Size
*
numDataElements
)+
" and should be
>
"
+
(
max
Index
*
numDataElements
)+
" )"
);
}
}
else
{
for
(
int
i
=
0
;
i
<
numDataElements
;
i
++)
{
if
(
data
[
i
].
length
<
maxSize
)
{
if
(
data
[
i
].
length
<
=
maxIndex
)
{
throw
new
RasterFormatException
(
"Data array too small "
+
"(it is "
+
data
[
i
].
length
+
" and should be "
+
max
Size
+
" )"
);
" and should be
>
"
+
max
Index
+
" )"
);
}
}
}
...
...
src/share/classes/sun/awt/image/ByteComponentRaster.java
浏览文件 @
f471610c
...
...
@@ -885,9 +885,6 @@ public class ByteComponentRaster extends SunWritableRaster {
}
}
int
maxSize
=
0
;
int
size
;
// we can be sure that width and height are greater than 0
if
(
scanlineStride
<
0
||
scanlineStride
>
(
Integer
.
MAX_VALUE
/
height
))
...
...
@@ -913,6 +910,8 @@ public class ByteComponentRaster extends SunWritableRaster {
}
lastPixelOffset
+=
lastScanOffset
;
int
index
;
int
maxIndex
=
0
;
for
(
int
i
=
0
;
i
<
numDataElements
;
i
++)
{
if
(
dataOffsets
[
i
]
>
(
Integer
.
MAX_VALUE
-
lastPixelOffset
))
{
throw
new
RasterFormatException
(
"Incorrect band offset: "
...
...
@@ -920,15 +919,15 @@ public class ByteComponentRaster extends SunWritableRaster {
}
size
=
lastPixelOffset
+
dataOffsets
[
i
];
index
=
lastPixelOffset
+
dataOffsets
[
i
];
if
(
size
>
maxSize
)
{
max
Size
=
size
;
if
(
index
>
maxIndex
)
{
max
Index
=
index
;
}
}
if
(
data
.
length
<
maxSize
)
{
throw
new
RasterFormatException
(
"Data array too small (should be "
+
max
Size
+
" )"
);
if
(
data
.
length
<
=
maxIndex
)
{
throw
new
RasterFormatException
(
"Data array too small (should be
>
"
+
max
Index
+
" )"
);
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录