Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_jdk
提交
81f1717d
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看板
体验新版 GitCode,发现更多精彩内容 >>
提交
81f1717d
编写于
11月 25, 2013
作者:
B
bae
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
8027841: Enhance pixel manipulations
Reviewed-by: prr, vadim, mschoene
上级
0ef74b41
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
65 addition
and
17 deletion
+65
-17
src/share/native/sun/awt/medialib/awt_ImagingLib.c
src/share/native/sun/awt/medialib/awt_ImagingLib.c
+65
-17
未找到文件。
src/share/native/sun/awt/medialib/awt_ImagingLib.c
浏览文件 @
81f1717d
...
...
@@ -228,6 +228,49 @@ getMlibEdgeHint(jint edgeHint) {
}
}
/*
* We have to make sure that awt_setPixels can be safely applied to the given pair of
* raster and mlib image.
*
* In particular, make sure that
* - dimension is the same
* - number of channels in mlib image corresponds to the number of bands in the raster
* - sample size in image and raster are the same.
*
* Returns:
* -1 to indicate failure,
* 1 to indicate success
*/
static
int
setPixelsFormMlibImage
(
JNIEnv
*
env
,
RasterS_t
*
rasterP
,
mlib_image
*
img
)
{
if
(
rasterP
->
width
!=
img
->
width
||
rasterP
->
height
!=
img
->
height
)
{
/* dimension does not match */
return
-
1
;
}
if
(
rasterP
->
numBands
!=
img
->
channels
)
{
/* number of bands does not match */
return
-
1
;
}
switch
(
rasterP
->
dataType
)
{
case
BYTE_DATA_TYPE
:
if
(
img
->
type
!=
MLIB_BYTE
)
{
return
-
1
;
}
break
;
case
SHORT_DATA_TYPE
:
if
(
img
->
type
!=
MLIB_SHORT
&&
img
->
type
!=
MLIB_USHORT
)
{
return
-
1
;
}
break
;
default:
/* awt_setPixels does not support such rasters */
return
-
1
;
}
return
awt_setPixels
(
env
,
rasterP
,
mlib_ImageGetData
(
img
));
}
/***************************************************************************
* External Functions *
***************************************************************************/
...
...
@@ -700,7 +743,9 @@ Java_sun_awt_image_ImagingLib_convolveRaster(JNIEnv *env, jobject this,
/* Means that we couldn't write directly into the destination buffer */
if
(
ddata
==
NULL
)
{
retStatus
=
awt_setPixels
(
env
,
dstRasterP
,
mlib_ImageGetData
(
dst
));
if
(
storeRasterArray
(
env
,
srcRasterP
,
dstRasterP
,
dst
)
<
0
)
{
retStatus
=
setPixelsFormMlibImage
(
env
,
dstRasterP
,
dst
);
}
}
/* Release the pinned memory */
...
...
@@ -1106,7 +1151,7 @@ fprintf(stderr,"Flags : %d\n",dst->flags);
if
(
ddata
==
NULL
)
{
/* Need to store it back into the array */
if
(
storeRasterArray
(
env
,
srcRasterP
,
dstRasterP
,
dst
)
<
0
)
{
retStatus
=
awt_setPixels
(
env
,
dstRasterP
,
mlib_ImageGetData
(
dst
)
);
retStatus
=
setPixelsFormMlibImage
(
env
,
dstRasterP
,
dst
);
}
}
...
...
@@ -1432,6 +1477,14 @@ Java_sun_awt_image_ImagingLib_lookupByteBI(JNIEnv *env, jobject thisLib,
retStatus
=
0
;
}
/* Release the LUT */
for
(
i
=
0
;
i
<
lut_nbands
;
i
++
)
{
(
*
env
)
->
ReleasePrimitiveArrayCritical
(
env
,
jtable
[
i
].
jArray
,
(
jbyte
*
)
jtable
[
i
].
table
,
JNI_ABORT
);
}
free
((
void
*
)
jtable
);
free
((
void
*
)
tbl
);
/*
* Means that we couldn't write directly into
* the destination buffer
...
...
@@ -1445,13 +1498,6 @@ Java_sun_awt_image_ImagingLib_lookupByteBI(JNIEnv *env, jobject thisLib,
}
}
/* Release the LUT */
for
(
i
=
0
;
i
<
lut_nbands
;
i
++
)
{
(
*
env
)
->
ReleasePrimitiveArrayCritical
(
env
,
jtable
[
i
].
jArray
,
(
jbyte
*
)
jtable
[
i
].
table
,
JNI_ABORT
);
}
free
((
void
*
)
jtable
);
free
((
void
*
)
tbl
);
/* Release the pinned memory */
freeArray
(
env
,
srcImageP
,
src
,
sdata
,
dstImageP
,
dst
,
ddata
);
...
...
@@ -1669,18 +1715,20 @@ Java_sun_awt_image_ImagingLib_lookupByteRaster(JNIEnv *env,
retStatus
=
0
;
}
/* Release the LUT */
for
(
i
=
0
;
i
<
lut_nbands
;
i
++
)
{
(
*
env
)
->
ReleasePrimitiveArrayCritical
(
env
,
jtable
[
i
].
jArray
,
(
jbyte
*
)
jtable
[
i
].
table
,
JNI_ABORT
);
}
/*
* Means that we couldn't write directly into
* the destination buffer
*/
if
(
ddata
==
NULL
)
{
retStatus
=
awt_setPixels
(
env
,
dstRasterP
,
mlib_ImageGetData
(
dst
));
}
/* Release the LUT */
for
(
i
=
0
;
i
<
lut_nbands
;
i
++
)
{
(
*
env
)
->
ReleasePrimitiveArrayCritical
(
env
,
jtable
[
i
].
jArray
,
(
jbyte
*
)
jtable
[
i
].
table
,
JNI_ABORT
);
if
(
storeRasterArray
(
env
,
srcRasterP
,
dstRasterP
,
dst
)
<
0
)
{
retStatus
=
setPixelsFormMlibImage
(
env
,
dstRasterP
,
dst
);
}
}
/* Release the pinned memory */
...
...
@@ -2640,7 +2688,7 @@ storeImageArray(JNIEnv *env, BufImageS_t *srcP, BufImageS_t *dstP,
}
}
else
if
(
mlibImP
->
type
==
MLIB_SHORT
)
{
return
awt_setPixels
(
env
,
rasterP
,
mlibImP
->
data
);
return
setPixelsFormMlibImage
(
env
,
rasterP
,
mlibImP
);
}
}
else
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录