Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_jdk
提交
07c61882
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看板
提交
07c61882
编写于
5月 20, 2013
作者:
B
bae
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
8014102: Improve image conversion
Reviewed-by: mschoene, prr, jgodinez
上级
72de5c13
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
63 addition
and
31 deletion
+63
-31
src/share/native/sun/awt/medialib/awt_ImagingLib.c
src/share/native/sun/awt/medialib/awt_ImagingLib.c
+63
-31
未找到文件。
src/share/native/sun/awt/medialib/awt_ImagingLib.c
浏览文件 @
07c61882
...
@@ -1985,21 +1985,25 @@ expandPacked(JNIEnv *env, BufImageS_t *img, ColorModelS_t *cmP,
...
@@ -1985,21 +1985,25 @@ expandPacked(JNIEnv *env, BufImageS_t *img, ColorModelS_t *cmP,
return
0
;
return
0
;
}
}
#define NUM_LINES 10
static
int
static
int
cvtCustomToDefault
(
JNIEnv
*
env
,
BufImageS_t
*
imageP
,
int
component
,
cvtCustomToDefault
(
JNIEnv
*
env
,
BufImageS_t
*
imageP
,
int
component
,
unsigned
char
*
dataP
)
{
unsigned
char
*
dataP
)
{
ColorModelS_t
*
cmP
=
&
imageP
->
cmodel
;
const
RasterS_t
*
rasterP
=
&
imageP
->
raster
;
RasterS_t
*
rasterP
=
&
imageP
->
raster
;
const
int
w
=
rasterP
->
width
;
const
int
h
=
rasterP
->
height
;
int
y
;
int
y
;
j
object
jpixels
=
NULL
;
j
intArray
jpixels
=
NULL
;
jint
*
pixels
;
jint
*
pixels
;
unsigned
char
*
dP
=
dataP
;
unsigned
char
*
dP
=
dataP
;
#define NUM_LINES 10
int
numLines
=
h
>
NUM_LINES
?
NUM_LINES
:
h
;
int
numLines
=
NUM_LINES
;
/* it is safe to calculate the scan length, because width has been verified
/* it is safe to calculate the scan length, because width has been verified
* on creation of the mlib image
* on creation of the mlib image
*/
*/
int
scanLength
=
rasterP
->
width
*
4
;
const
int
scanLength
=
w
*
4
;
int
nbytes
=
0
;
int
nbytes
=
0
;
if
(
!
SAFE_TO_MULT
(
numLines
,
scanLength
))
{
if
(
!
SAFE_TO_MULT
(
numLines
,
scanLength
))
{
...
@@ -2008,42 +2012,70 @@ cvtCustomToDefault(JNIEnv *env, BufImageS_t *imageP, int component,
...
@@ -2008,42 +2012,70 @@ cvtCustomToDefault(JNIEnv *env, BufImageS_t *imageP, int component,
nbytes
=
numLines
*
scanLength
;
nbytes
=
numLines
*
scanLength
;
for
(
y
=
0
;
y
<
rasterP
->
height
;
y
+=
numLines
)
{
jpixels
=
(
*
env
)
->
NewIntArray
(
env
,
nbytes
);
/* getData, one scanline at a time */
if
(
JNU_IsNull
(
env
,
jpixels
))
{
if
(
y
+
numLines
>
rasterP
->
height
)
{
JNU_ThrowOutOfMemoryError
(
env
,
"Out of Memory"
);
numLines
=
rasterP
->
height
-
y
;
return
-
1
;
}
for
(
y
=
0
;
y
<
h
;
y
+=
numLines
)
{
if
(
y
+
numLines
>
h
)
{
numLines
=
h
-
y
;
nbytes
=
numLines
*
scanLength
;
nbytes
=
numLines
*
scanLength
;
}
}
jpixels
=
(
*
env
)
->
CallObjectMethod
(
env
,
imageP
->
jimage
,
g_BImgGetRGBMID
,
0
,
y
,
(
*
env
)
->
CallObjectMethod
(
env
,
imageP
->
jimage
,
rasterP
->
width
,
numLines
,
g_BImgGetRGBMID
,
0
,
y
,
jpixels
,
0
,
rasterP
->
width
);
w
,
numLines
,
if
(
jpixels
==
NULL
)
{
jpixels
,
0
,
w
);
JNU_ThrowInternalError
(
env
,
"Can't retrieve pixels."
);
if
((
*
env
)
->
ExceptionOccurred
(
env
))
{
(
*
env
)
->
DeleteLocalRef
(
env
,
jpixels
);
return
-
1
;
return
-
1
;
}
}
pixels
=
(
*
env
)
->
GetPrimitiveArrayCritical
(
env
,
jpixels
,
NULL
);
pixels
=
(
*
env
)
->
GetPrimitiveArrayCritical
(
env
,
jpixels
,
NULL
);
if
(
pixels
==
NULL
)
{
(
*
env
)
->
DeleteLocalRef
(
env
,
jpixels
);
return
-
1
;
}
memcpy
(
dP
,
pixels
,
nbytes
);
memcpy
(
dP
,
pixels
,
nbytes
);
dP
+=
nbytes
;
dP
+=
nbytes
;
(
*
env
)
->
ReleasePrimitiveArrayCritical
(
env
,
jpixels
,
pixels
,
(
*
env
)
->
ReleasePrimitiveArrayCritical
(
env
,
jpixels
,
pixels
,
JNI_ABORT
);
JNI_ABORT
);
}
}
/* Need to release the array */
(
*
env
)
->
DeleteLocalRef
(
env
,
jpixels
);
return
0
;
return
0
;
}
}
static
int
static
int
cvtDefaultToCustom
(
JNIEnv
*
env
,
BufImageS_t
*
imageP
,
int
component
,
cvtDefaultToCustom
(
JNIEnv
*
env
,
BufImageS_t
*
imageP
,
int
component
,
unsigned
char
*
dataP
)
{
unsigned
char
*
dataP
)
{
ColorModelS_t
*
cmP
=
&
imageP
->
cmodel
;
const
RasterS_t
*
rasterP
=
&
imageP
->
raster
;
RasterS_t
*
rasterP
=
&
imageP
->
raster
;
const
int
w
=
rasterP
->
width
;
const
int
h
=
rasterP
->
height
;
int
y
;
int
y
;
jintArray
jpixels
=
NULL
;
jint
*
pixels
;
jint
*
pixels
;
unsigned
char
*
dP
=
dataP
;
unsigned
char
*
dP
=
dataP
;
#define NUM_LINES 10
int
numLines
=
h
>
NUM_LINES
?
NUM_LINES
:
h
;
int
numLines
=
NUM_LINES
;
int
nbytes
=
rasterP
->
width
*
4
*
NUM_LINES
;
/* it is safe to calculate the scan length, because width has been verified
jintArray
jpixels
;
* on creation of the mlib image
*/
const
int
scanLength
=
w
*
4
;
int
nbytes
=
0
;
if
(
!
SAFE_TO_MULT
(
numLines
,
scanLength
))
{
return
-
1
;
}
nbytes
=
numLines
*
scanLength
;
jpixels
=
(
*
env
)
->
NewIntArray
(
env
,
nbytes
);
jpixels
=
(
*
env
)
->
NewIntArray
(
env
,
nbytes
);
if
(
JNU_IsNull
(
env
,
jpixels
))
{
if
(
JNU_IsNull
(
env
,
jpixels
))
{
...
@@ -2051,14 +2083,15 @@ cvtDefaultToCustom(JNIEnv *env, BufImageS_t *imageP, int component,
...
@@ -2051,14 +2083,15 @@ cvtDefaultToCustom(JNIEnv *env, BufImageS_t *imageP, int component,
return
-
1
;
return
-
1
;
}
}
for
(
y
=
0
;
y
<
rasterP
->
height
;
y
+=
NUM_LINES
)
{
for
(
y
=
0
;
y
<
h
;
y
+=
numLines
)
{
if
(
y
+
numLines
>
rasterP
->
height
)
{
if
(
y
+
numLines
>
h
)
{
numLines
=
rasterP
->
height
-
y
;
numLines
=
h
-
y
;
nbytes
=
rasterP
->
width
*
4
*
numLines
;
nbytes
=
numLines
*
scanLength
;
}
}
pixels
=
(
*
env
)
->
GetPrimitiveArrayCritical
(
env
,
jpixels
,
NULL
);
pixels
=
(
*
env
)
->
GetPrimitiveArrayCritical
(
env
,
jpixels
,
NULL
);
if
(
pixels
==
NULL
)
{
if
(
pixels
==
NULL
)
{
/* JNI error */
(
*
env
)
->
DeleteLocalRef
(
env
,
jpixels
);
return
-
1
;
return
-
1
;
}
}
...
@@ -2067,12 +2100,11 @@ cvtDefaultToCustom(JNIEnv *env, BufImageS_t *imageP, int component,
...
@@ -2067,12 +2100,11 @@ cvtDefaultToCustom(JNIEnv *env, BufImageS_t *imageP, int component,
(
*
env
)
->
ReleasePrimitiveArrayCritical
(
env
,
jpixels
,
pixels
,
0
);
(
*
env
)
->
ReleasePrimitiveArrayCritical
(
env
,
jpixels
,
pixels
,
0
);
/* setData, one scanline at a time */
/* Fix 4223648, 4184283 */
(
*
env
)
->
CallVoidMethod
(
env
,
imageP
->
jimage
,
g_BImgSetRGBMID
,
0
,
y
,
(
*
env
)
->
CallVoidMethod
(
env
,
imageP
->
jimage
,
g_BImgSetRGBMID
,
0
,
y
,
rasterP
->
width
,
numLines
,
jpixels
,
0
,
w
,
numLines
,
jpixels
,
rasterP
->
width
);
0
,
w
);
if
((
*
env
)
->
ExceptionOccurred
(
env
))
{
if
((
*
env
)
->
ExceptionOccurred
(
env
))
{
(
*
env
)
->
DeleteLocalRef
(
env
,
jpixels
);
return
-
1
;
return
-
1
;
}
}
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录