Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_jdk
提交
1aba89f0
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看板
提交
1aba89f0
编写于
12月 24, 2012
作者:
B
bae
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
7124245: [lcms] ColorConvertOp to color space CS_GRAY apparently converts orange to 244,244,0
Reviewed-by: prr
上级
f7f8a699
变更
5
显示空白变更内容
内联
并排
Showing
5 changed file
with
133 addition
and
20 deletion
+133
-20
src/share/classes/sun/java2d/cmm/lcms/LCMS.java
src/share/classes/sun/java2d/cmm/lcms/LCMS.java
+3
-1
src/share/classes/sun/java2d/cmm/lcms/LCMSImageLayout.java
src/share/classes/sun/java2d/cmm/lcms/LCMSImageLayout.java
+2
-1
src/share/classes/sun/java2d/cmm/lcms/LCMSTransform.java
src/share/classes/sun/java2d/cmm/lcms/LCMSTransform.java
+12
-5
src/share/native/sun/java2d/cmm/lcms/LCMS.c
src/share/native/sun/java2d/cmm/lcms/LCMS.c
+14
-13
test/sun/java2d/cmm/ColorConvertOp/GrayTest.java
test/sun/java2d/cmm/ColorConvertOp/GrayTest.java
+102
-0
未找到文件。
src/share/classes/sun/java2d/cmm/lcms/LCMS.java
浏览文件 @
1aba89f0
...
@@ -53,7 +53,9 @@ public class LCMS implements PCMM {
...
@@ -53,7 +53,9 @@ public class LCMS implements PCMM {
public
static
native
long
getProfileID
(
ICC_Profile
profile
);
public
static
native
long
getProfileID
(
ICC_Profile
profile
);
public
static
native
long
createNativeTransform
(
public
static
native
long
createNativeTransform
(
long
[]
profileIDs
,
int
renderType
,
int
inFormatter
,
int
outFormatter
,
long
[]
profileIDs
,
int
renderType
,
int
inFormatter
,
boolean
isInIntPacked
,
int
outFormatter
,
boolean
isOutIntPacked
,
Object
disposerRef
);
Object
disposerRef
);
/**
/**
...
...
src/share/classes/sun/java2d/cmm/lcms/LCMSImageLayout.java
浏览文件 @
1aba89f0
...
@@ -196,7 +196,8 @@ class LCMSImageLayout {
...
@@ -196,7 +196,8 @@ class LCMSImageLayout {
case
BufferedImage
.
TYPE_4BYTE_ABGR
:
case
BufferedImage
.
TYPE_4BYTE_ABGR
:
byteRaster
=
(
ByteComponentRaster
)
image
.
getRaster
();
byteRaster
=
(
ByteComponentRaster
)
image
.
getRaster
();
nextRowOffset
=
byteRaster
.
getScanlineStride
();
nextRowOffset
=
byteRaster
.
getScanlineStride
();
offset
=
byteRaster
.
getDataOffset
(
0
);
int
firstBand
=
image
.
getSampleModel
().
getNumBands
()
-
1
;
offset
=
byteRaster
.
getDataOffset
(
firstBand
);
dataArray
=
byteRaster
.
getDataStorage
();
dataArray
=
byteRaster
.
getDataStorage
();
dataType
=
DT_BYTE
;
dataType
=
DT_BYTE
;
break
;
break
;
...
...
src/share/classes/sun/java2d/cmm/lcms/LCMSTransform.java
浏览文件 @
1aba89f0
...
@@ -55,8 +55,10 @@ import sun.java2d.cmm.lcms.*;
...
@@ -55,8 +55,10 @@ import sun.java2d.cmm.lcms.*;
public
class
LCMSTransform
implements
ColorTransform
{
public
class
LCMSTransform
implements
ColorTransform
{
long
ID
;
long
ID
;
private
int
inFormatter
;
private
int
inFormatter
=
0
;
private
int
outFormatter
;
private
boolean
isInIntPacked
=
false
;
private
int
outFormatter
=
0
;
private
boolean
isOutIntPacked
=
false
;
ICC_Profile
[]
profiles
;
ICC_Profile
[]
profiles
;
long
[]
profileIDs
;
long
[]
profileIDs
;
...
@@ -135,18 +137,23 @@ public class LCMSTransform implements ColorTransform {
...
@@ -135,18 +137,23 @@ public class LCMSTransform implements ColorTransform {
LCMSImageLayout
out
)
{
LCMSImageLayout
out
)
{
// update native transfrom if needed
// update native transfrom if needed
if
(
ID
==
0L
||
if
(
ID
==
0L
||
inFormatter
!=
in
.
pixelType
||
inFormatter
!=
in
.
pixelType
||
isInIntPacked
!=
in
.
isIntPacked
||
outFormatter
!=
out
.
pixelType
)
{
outFormatter
!=
out
.
pixelType
||
isOutIntPacked
!=
out
.
isIntPacked
)
{
if
(
ID
!=
0L
)
{
if
(
ID
!=
0L
)
{
// Disposer will destroy forgotten transform
// Disposer will destroy forgotten transform
disposerReferent
=
new
Object
();
disposerReferent
=
new
Object
();
}
}
inFormatter
=
in
.
pixelType
;
inFormatter
=
in
.
pixelType
;
isInIntPacked
=
in
.
isIntPacked
;
outFormatter
=
out
.
pixelType
;
outFormatter
=
out
.
pixelType
;
isOutIntPacked
=
out
.
isIntPacked
;
ID
=
LCMS
.
createNativeTransform
(
profileIDs
,
renderType
,
ID
=
LCMS
.
createNativeTransform
(
profileIDs
,
renderType
,
inFormatter
,
outFormatter
,
inFormatter
,
isInIntPacked
,
outFormatter
,
isOutIntPacked
,
disposerReferent
);
disposerReferent
);
}
}
...
...
src/share/native/sun/java2d/cmm/lcms/LCMS.c
浏览文件 @
1aba89f0
...
@@ -159,7 +159,8 @@ void LCMS_freeTransform(JNIEnv *env, jlong ID)
...
@@ -159,7 +159,8 @@ void LCMS_freeTransform(JNIEnv *env, jlong ID)
*/
*/
JNIEXPORT
jlong
JNICALL
Java_sun_java2d_cmm_lcms_LCMS_createNativeTransform
JNIEXPORT
jlong
JNICALL
Java_sun_java2d_cmm_lcms_LCMS_createNativeTransform
(
JNIEnv
*
env
,
jclass
cls
,
jlongArray
profileIDs
,
jint
renderType
,
(
JNIEnv
*
env
,
jclass
cls
,
jlongArray
profileIDs
,
jint
renderType
,
jint
inFormatter
,
jint
outFormatter
,
jobject
disposerRef
)
jint
inFormatter
,
jboolean
isInIntPacked
,
jint
outFormatter
,
jboolean
isOutIntPacked
,
jobject
disposerRef
)
{
{
cmsHPROFILE
_iccArray
[
DF_ICC_BUF_SIZE
];
cmsHPROFILE
_iccArray
[
DF_ICC_BUF_SIZE
];
cmsHPROFILE
*
iccArray
=
&
_iccArray
[
0
];
cmsHPROFILE
*
iccArray
=
&
_iccArray
[
0
];
...
@@ -170,6 +171,16 @@ JNIEXPORT jlong JNICALL Java_sun_java2d_cmm_lcms_LCMS_createNativeTransform
...
@@ -170,6 +171,16 @@ JNIEXPORT jlong JNICALL Java_sun_java2d_cmm_lcms_LCMS_createNativeTransform
size
=
(
*
env
)
->
GetArrayLength
(
env
,
profileIDs
);
size
=
(
*
env
)
->
GetArrayLength
(
env
,
profileIDs
);
ids
=
(
*
env
)
->
GetPrimitiveArrayCritical
(
env
,
profileIDs
,
0
);
ids
=
(
*
env
)
->
GetPrimitiveArrayCritical
(
env
,
profileIDs
,
0
);
#ifdef _LITTLE_ENDIAN
/* Reversing data packed into int for LE archs */
if
(
isInIntPacked
)
{
inFormatter
^=
DOSWAP_SH
(
1
);
}
if
(
isOutIntPacked
)
{
outFormatter
^=
DOSWAP_SH
(
1
);
}
#endif
if
(
DF_ICC_BUF_SIZE
<
size
*
2
)
{
if
(
DF_ICC_BUF_SIZE
<
size
*
2
)
{
iccArray
=
(
cmsHPROFILE
*
)
malloc
(
iccArray
=
(
cmsHPROFILE
*
)
malloc
(
size
*
2
*
sizeof
(
cmsHPROFILE
));
size
*
2
*
sizeof
(
cmsHPROFILE
));
...
@@ -567,7 +578,7 @@ JNIEXPORT void JNICALL Java_sun_java2d_cmm_lcms_LCMS_colorConvert
...
@@ -567,7 +578,7 @@ JNIEXPORT void JNICALL Java_sun_java2d_cmm_lcms_LCMS_colorConvert
(
JNIEnv
*
env
,
jclass
obj
,
jobject
trans
,
jobject
src
,
jobject
dst
)
(
JNIEnv
*
env
,
jclass
obj
,
jobject
trans
,
jobject
src
,
jobject
dst
)
{
{
storeID_t
sTrans
;
storeID_t
sTrans
;
int
inFmt
,
outFmt
,
srcDType
,
dstDType
;
int
srcDType
,
dstDType
;
int
srcOffset
,
srcNextRowOffset
,
dstOffset
,
dstNextRowOffset
;
int
srcOffset
,
srcNextRowOffset
,
dstOffset
,
dstNextRowOffset
;
int
width
,
height
,
i
;
int
width
,
height
,
i
;
void
*
inputBuffer
;
void
*
inputBuffer
;
...
@@ -576,23 +587,13 @@ JNIEXPORT void JNICALL Java_sun_java2d_cmm_lcms_LCMS_colorConvert
...
@@ -576,23 +587,13 @@ JNIEXPORT void JNICALL Java_sun_java2d_cmm_lcms_LCMS_colorConvert
char
*
outputRow
;
char
*
outputRow
;
jobject
srcData
,
dstData
;
jobject
srcData
,
dstData
;
inFmt
=
(
*
env
)
->
GetIntField
(
env
,
src
,
IL_pixelType_fID
);
outFmt
=
(
*
env
)
->
GetIntField
(
env
,
dst
,
IL_pixelType_fID
);
srcOffset
=
(
*
env
)
->
GetIntField
(
env
,
src
,
IL_offset_fID
);
srcOffset
=
(
*
env
)
->
GetIntField
(
env
,
src
,
IL_offset_fID
);
srcNextRowOffset
=
(
*
env
)
->
GetIntField
(
env
,
src
,
IL_nextRowOffset_fID
);
srcNextRowOffset
=
(
*
env
)
->
GetIntField
(
env
,
src
,
IL_nextRowOffset_fID
);
dstOffset
=
(
*
env
)
->
GetIntField
(
env
,
dst
,
IL_offset_fID
);
dstOffset
=
(
*
env
)
->
GetIntField
(
env
,
dst
,
IL_offset_fID
);
dstNextRowOffset
=
(
*
env
)
->
GetIntField
(
env
,
dst
,
IL_nextRowOffset_fID
);
dstNextRowOffset
=
(
*
env
)
->
GetIntField
(
env
,
dst
,
IL_nextRowOffset_fID
);
width
=
(
*
env
)
->
GetIntField
(
env
,
src
,
IL_width_fID
);
width
=
(
*
env
)
->
GetIntField
(
env
,
src
,
IL_width_fID
);
height
=
(
*
env
)
->
GetIntField
(
env
,
src
,
IL_height_fID
);
height
=
(
*
env
)
->
GetIntField
(
env
,
src
,
IL_height_fID
);
#ifdef _LITTLE_ENDIAN
/* Reversing data packed into int for LE archs */
if
((
*
env
)
->
GetBooleanField
(
env
,
src
,
IL_isIntPacked_fID
)
==
JNI_TRUE
)
{
inFmt
^=
DOSWAP_SH
(
1
);
}
if
((
*
env
)
->
GetBooleanField
(
env
,
dst
,
IL_isIntPacked_fID
)
==
JNI_TRUE
)
{
outFmt
^=
DOSWAP_SH
(
1
);
}
#endif
sTrans
.
j
=
(
*
env
)
->
GetLongField
(
env
,
trans
,
Trans_ID_fID
);
sTrans
.
j
=
(
*
env
)
->
GetLongField
(
env
,
trans
,
Trans_ID_fID
);
if
(
sTrans
.
xf
==
NULL
)
{
if
(
sTrans
.
xf
==
NULL
)
{
...
...
test/sun/java2d/cmm/ColorConvertOp/GrayTest.java
0 → 100644
浏览文件 @
1aba89f0
/*
* Copyright (c) 2012, 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 7124245
* @summary Test verifies that color conversion does not distort
* colors in destination image of standard type.
*
* @run main GrayTest
*/
import
java.awt.Color
;
import
java.awt.Graphics2D
;
import
java.awt.color.ColorSpace
;
import
java.awt.image.BufferedImage
;
import
java.awt.image.ColorConvertOp
;
public
class
GrayTest
{
public
static
void
main
(
String
[]
args
)
{
GrayTest
t
=
new
GrayTest
();
t
.
doTest
(
BufferedImage
.
TYPE_INT_RGB
);
t
.
doTest
(
BufferedImage
.
TYPE_INT_BGR
);
t
.
doTest
(
BufferedImage
.
TYPE_INT_ARGB
);
t
.
doTest
(
BufferedImage
.
TYPE_3BYTE_BGR
);
t
.
doTest
(
BufferedImage
.
TYPE_4BYTE_ABGR
);
System
.
out
.
println
(
"Test passed."
);
}
private
static
final
int
w
=
3
;
private
static
final
int
h
=
3
;
private
BufferedImage
src
;
private
BufferedImage
dst
;
private
ColorConvertOp
op
;
public
GrayTest
()
{
ColorSpace
cs
=
ColorSpace
.
getInstance
(
ColorSpace
.
CS_GRAY
);
op
=
new
ColorConvertOp
(
cs
,
null
);
}
private
void
render
(
Graphics2D
g
)
{
g
.
setColor
(
Color
.
red
);
g
.
fillRect
(
0
,
0
,
w
,
h
);
}
private
BufferedImage
initImage
(
int
type
)
{
BufferedImage
img
=
new
BufferedImage
(
w
,
h
,
type
);
Graphics2D
g
=
img
.
createGraphics
();
render
(
g
);
g
.
dispose
();
return
img
;
}
public
void
doTest
(
int
type
)
{
System
.
out
.
println
(
"Test for type: "
+
type
);
src
=
initImage
(
type
);
dst
=
initImage
(
type
);
dst
=
op
.
filter
(
src
,
dst
);
int
pixel
=
dst
.
getRGB
(
1
,
1
);
int
r
=
0xff
&
(
pixel
>>
16
);
int
g
=
0xff
&
(
pixel
>>
8
);
int
b
=
0xff
&
(
pixel
);
System
.
out
.
printf
(
"dst: r:%02x, g: %02x, %02x\n"
,
r
,
g
,
b
);
if
(
r
!=
g
||
r
!=
b
)
{
String
msg
=
String
.
format
(
"Invalid pixel: %08x"
,
pixel
);
throw
new
RuntimeException
(
msg
);
}
System
.
out
.
println
(
"Done."
);
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录