Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Third Party Libpng
提交
2d3bd021
T
Third Party Libpng
项目概览
OpenHarmony
/
Third Party Libpng
12 个月 前同步成功
通知
4
Star
22
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
Third Party Libpng
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
2d3bd021
编写于
1月 29, 2016
作者:
G
Glenn Randers-Pehrson
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'libpng16' of
git://github.com/jbowler/libpng
into libpng16
上级
2a28a432
e717842a
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
79 addition
and
45 deletion
+79
-45
contrib/libtests/pngstest.c
contrib/libtests/pngstest.c
+51
-19
tests/pngstest
tests/pngstest
+28
-26
未找到文件。
contrib/libtests/pngstest.c
浏览文件 @
2d3bd021
...
...
@@ -108,10 +108,18 @@ make_random_bytes(png_uint_32* seed, void* pv, size_t size)
seed
[
1
]
=
u1
;
}
static
png_uint_32
color_seed
[
2
];
static
void
reseed
(
void
)
{
color_seed
[
0
]
=
0x12345678U
;
color_seed
[
1
]
=
0x9abcdefU
;
}
static
void
random_color
(
png_colorp
color
)
{
static
png_uint_32
color_seed
[
2
]
=
{
0x12345678
,
0x9abcdef
};
make_random_bytes
(
color_seed
,
color
,
sizeof
*
color
);
}
...
...
@@ -325,6 +333,9 @@ compare_16bit(int v1, int v2, int error_limit, int multiple_algorithms)
#define ACCUMULATE 64
#define FAST_WRITE 128
#define sRGB_16BIT 256
#define NO_RESEED 512
/* do not reseed on each new file */
#define GBG_ERROR 1024
/* do not ignore the gamma+background_rgb_to_gray
* libpng warning. */
static
void
print_opts
(
png_uint_32
opts
)
...
...
@@ -333,8 +344,8 @@ print_opts(png_uint_32 opts)
printf
(
" --file"
);
if
(
opts
&
USE_STDIO
)
printf
(
" --stdio"
);
if
(
opts
&
STRICT
)
printf
(
" --strict"
);
if
(
!
(
opts
&
STRICT
)
)
printf
(
" --
no
strict"
);
if
(
opts
&
VERBOSE
)
printf
(
" --verbose"
);
if
(
opts
&
KEEP_TMPFILES
)
...
...
@@ -347,6 +358,12 @@ print_opts(png_uint_32 opts)
printf
(
" --slow"
);
if
(
opts
&
sRGB_16BIT
)
printf
(
" --sRGB-16bit"
);
if
(
opts
&
NO_RESEED
)
printf
(
" --noreseed"
);
#if PNG_LIBPNG_VER < 10700
/* else on by default */
if
(
opts
&
GBG_ERROR
)
printf
(
" --fault-gbg-warning"
);
#endif
}
#define FORMAT_NO_CHANGE 0x80000000
/* additional flag */
...
...
@@ -750,8 +767,15 @@ checkopaque(Image *image)
return
logerror
(
image
,
image
->
file_name
,
": opaque not NULL"
,
""
);
}
else
if
(
image
->
image
.
warning_or_error
!=
0
&&
(
image
->
opts
&
STRICT
)
!=
0
)
return
logerror
(
image
,
image
->
file_name
,
" --strict"
,
""
);
/* Separate out the gamma+background_rgb_to_gray warning because it may
* produce opaque component errors:
*/
else
if
(
image
->
image
.
warning_or_error
!=
0
&&
(
strcmp
(
image
->
image
.
message
,
"libpng does not support gamma+background+rgb_to_gray"
)
==
0
?
(
image
->
opts
&
GBG_ERROR
)
!=
0
:
(
image
->
opts
&
STRICT
)
!=
0
))
return
logerror
(
image
,
image
->
file_name
,
(
image
->
opts
&
GBG_ERROR
)
!=
0
?
" --fault-gbg-warning"
:
" --strict"
,
""
);
else
return
1
;
...
...
@@ -3207,13 +3231,11 @@ write_one_file(Image *output, Image *image, int convert_to_8bit)
if
(
png_image_write_get_memory_size
(
image
->
image
,
size
,
convert_to_8bit
,
image
->
buffer
+
16
,
(
png_int_32
)
image
->
stride
,
image
->
colormap
))
{
/* This is non-fatal: */
/* This is non-fatal but ignoring it was causing serious problems in
* the macro to be ignored:
*/
if
(
size
>
PNG_IMAGE_PNG_SIZE_MAX
(
image
->
image
))
{
logerror
(
image
,
"memory"
,
": PNG_IMAGE_SIZE_MAX wrong"
,
""
);
if
((
image
->
opts
&
STRICT
)
!=
0
)
return
0
;
}
return
logerror
(
image
,
"memory"
,
": PNG_IMAGE_SIZE_MAX wrong"
,
""
);
initimage
(
output
,
image
->
opts
,
"memory"
,
image
->
stride_extra
);
output
->
input_memory
=
malloc
(
size
);
...
...
@@ -3226,14 +3248,10 @@ write_one_file(Image *output, Image *image, int convert_to_8bit)
&
output
->
input_memory_size
,
convert_to_8bit
,
image
->
buffer
+
16
,
(
png_int_32
)
image
->
stride
,
image
->
colormap
))
{
/* This is also non-fatal (maybe): */
/* This is also non-fatal but it safes safer to error out anyway:
*/
if
(
size
!=
output
->
input_memory_size
)
{
logerror
(
image
,
"memory"
,
": memory size wrong"
,
""
);
if
((
image
->
opts
&
STRICT
)
!=
0
)
return
0
;
}
return
logerror
(
image
,
"memory"
,
": memory size wrong"
,
""
);
}
else
...
...
@@ -3421,6 +3439,8 @@ test_one_file(const char *file_name, format_list *formats, png_uint_32 opts,
int
result
;
Image
image
;
if
(
!
(
opts
&
NO_RESEED
))
reseed
();
/* ensure that the random numbers don't depend on file order */
newimage
(
&
image
);
initimage
(
&
image
,
opts
,
file_name
,
stride_extra
);
result
=
read_one_file
(
&
image
);
...
...
@@ -3458,7 +3478,7 @@ test_one_file(const char *file_name, format_list *formats, png_uint_32 opts,
int
main
(
int
argc
,
char
**
argv
)
{
png_uint_32
opts
=
FAST_WRITE
;
png_uint_32
opts
=
FAST_WRITE
|
STRICT
;
format_list
formats
;
const
char
*
touch
=
NULL
;
int
log_pass
=
0
;
...
...
@@ -3467,11 +3487,17 @@ main(int argc, char **argv)
int
retval
=
0
;
int
c
;
#if PNG_LIBPNG_VER >= 10700
/* This error should not exist in 1.7 or later: */
opts
|=
GBG_ERROR
;
#endif
init_sRGB_to_d
();
#if 0
init_error_via_linear();
#endif
format_init
(
&
formats
);
reseed
();
/* initialize random number seeds */
for
(
c
=
1
;
c
<
argc
;
++
c
)
{
...
...
@@ -3522,10 +3548,16 @@ main(int argc, char **argv)
opts
&=
~
KEEP_GOING
;
else
if
(
strcmp
(
arg
,
"--strict"
)
==
0
)
opts
|=
STRICT
;
else
if
(
strcmp
(
arg
,
"--nostrict"
)
==
0
)
opts
&=
~
STRICT
;
else
if
(
strcmp
(
arg
,
"--sRGB-16bit"
)
==
0
)
opts
|=
sRGB_16BIT
;
else
if
(
strcmp
(
arg
,
"--linear-16bit"
)
==
0
)
opts
&=
~
sRGB_16BIT
;
else
if
(
strcmp
(
arg
,
"--noreseed"
)
==
0
)
opts
|=
NO_RESEED
;
else
if
(
strcmp
(
arg
,
"--fault-gbg-warning"
)
==
0
)
opts
|=
GBG_ERROR
;
else
if
(
strcmp
(
arg
,
"--tmpfile"
)
==
0
)
{
if
(
c
+
1
<
argc
)
...
...
tests/pngstest
浏览文件 @
2d3bd021
...
...
@@ -17,36 +17,38 @@ gamma="$1"
shift
alpha
=
"
$1
"
shift
exec
./pngstest
--tmpfile
"
${
gamma
}
-
${
alpha
}
-"
--log
${
1
+
"
$@
"
}
`
for
f
in
"
${
srcdir
}
/contrib/testpngs/"
*
.png
do
g
=
case
"
$f
"
in
*
-linear
[
.-]
*
)
test
"
$gamma
"
=
"linear"
&&
g
=
"
$f
"
;;
args
=
LC_ALL
=
"C"
# fix glob sort order to ASCII:
for
f
in
"
${
srcdir
}
/contrib/testpngs/"
*
.png
do
g
=
case
"
$f
"
in
*
-linear
[
.-]
*
)
test
"
$gamma
"
=
"linear"
&&
g
=
"
$f
"
;;
*
-sRGB
[
.-]
*
)
test
"
$gamma
"
=
"sRGB"
&&
g
=
"
$f
"
;;
*
-sRGB
[
.-]
*
)
test
"
$gamma
"
=
"sRGB"
&&
g
=
"
$f
"
;;
*
-1
.8[.-]
*
)
test
"
$gamma
"
=
"1.8"
&&
g
=
"
$f
"
;;
*
-1
.8[.-]
*
)
test
"
$gamma
"
=
"1.8"
&&
g
=
"
$f
"
;;
*
)
test
"
$gamma
"
=
"none"
&&
g
=
"
$f
"
;;
esac
*
)
test
"
$gamma
"
=
"none"
&&
g
=
"
$f
"
;;
esac
case
"
$g
"
in
""
)
:
;;
case
"
$g
"
in
""
)
:
;;
*
-alpha
[
-.]
*
)
test
"
$alpha
"
=
"alpha"
&&
echo
"
$g
"
;;
*
-alpha
[
-.]
*
)
test
"
$alpha
"
=
"alpha"
&&
args
=
"
$args
$g
"
;;
*
-tRNS
[
-.]
*
)
test
"
$alpha
"
=
"tRNS"
-o
"
$alpha
"
=
"none"
&&
echo
"
$g
"
;;
*
-tRNS
[
-.]
*
)
test
"
$alpha
"
=
"tRNS"
-o
"
$alpha
"
=
"none"
&&
args
=
"
$args
$g
"
;;
*
)
test
"
$alpha
"
=
"opaque"
-o
"
$alpha
"
=
"none"
&&
echo
"
$g
"
;;
esac
done
`
*
)
test
"
$alpha
"
=
"opaque"
-o
"
$alpha
"
=
"none"
&&
args
=
"
$args
$g
"
;;
esac
done
# This only works if the arguments don't contain spaces; they don't.
exec
./pngstest
--tmpfile
"
${
gamma
}
-
${
alpha
}
-"
--log
${
1
+
"
$@
"
}
$args
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录