Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Third Party Libpng
提交
3615d03e
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,发现更多精彩内容 >>
提交
3615d03e
编写于
11月 08, 2011
作者:
J
John Bowler
提交者:
Glenn Randers-Pehrson
11月 08, 2011
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[libpng15] Fix PNG_SIMPLIFIED transformations,
adding alpha and reducing to 8-bit
上级
e0a6c06b
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
39 addition
and
19 deletion
+39
-19
pngread.c
pngread.c
+36
-19
pngwrite.c
pngwrite.c
+3
-0
未找到文件。
pngread.c
浏览文件 @
3615d03e
...
...
@@ -1708,12 +1708,13 @@ png_image_read_end(png_voidp argument)
{
png_uint_32
base_format
=
png_image_format
(
png_ptr
,
info_ptr
);
png_uint_32
change
=
format
^
base_format
;
png_fixed_point
output_gamma
;
int
mode
;
/* alpha mode */
/* Set the gamma appropriately, linear for 16-bit input, sRGB otherwise.
*/
{
png_fixed_point
input_gamma_default
,
output_gamma
;
int
mode
;
png_fixed_point
input_gamma_default
;
if
(
base_format
&
PNG_FORMAT_FLAG_LINEAR
)
input_gamma_default
=
PNG_GAMMA_LINEAR
;
...
...
@@ -1722,7 +1723,7 @@ png_image_read_end(png_voidp argument)
if
(
linear
)
{
mode
=
PNG_ALPHA_STANDARD
;
mode
=
PNG_ALPHA_STANDARD
;
/* associated alpha */
output_gamma
=
PNG_GAMMA_LINEAR
;
}
...
...
@@ -1732,24 +1733,25 @@ png_image_read_end(png_voidp argument)
output_gamma
=
PNG_DEFAULT_sRGB
;
}
/* Set the mode, the default gamma for the file and then, if it
* doesn't match the default, the output gamma.
/* If the input default and output gamma do not match, because sRGB is
* being changed to linear, set the input default now via a dummy call
* to png_set_alpha_mode_fixed.
*/
png_set_alpha_mode_fixed
(
png_ptr
,
mode
,
input_gamma_default
);
if
(
input_gamma_default
!=
output_gamma
)
png_set_alpha_mode
(
png_ptr
,
mode
,
output_gamma
);
png_set_alpha_mode_fixed
(
png_ptr
,
PNG_ALPHA_PNG
,
input_gamma_default
);
}
/* If the bit-depth changes then handle that here. */
if
(
change
&
PNG_FORMAT_FLAG_LINEAR
)
{
if
(
linear
/*16-bit output*/
)
png_set_expand_16
(
png_ptr
);
/* If the bit-depth changes then handle that here. */
if
(
change
&
PNG_FORMAT_FLAG_LINEAR
)
{
if
(
linear
/*16-bit output*/
)
png_set_expand_16
(
png_ptr
);
else
/* 8-bit output */
png_set_scale_16
(
png_ptr
);
else
/* 8-bit output */
png_set_scale_16
(
png_ptr
);
change
&=
~
PNG_FORMAT_FLAG_LINEAR
;
}
change
&=
~
PNG_FORMAT_FLAG_LINEAR
;
}
/* Now the background/alpha channel changes. */
...
...
@@ -1761,9 +1763,11 @@ png_image_read_end(png_voidp argument)
*/
if
(
base_format
&
PNG_FORMAT_FLAG_ALPHA
)
{
/* 16-bit output: just remove the channel */
if
(
linear
)
/* compose on black (well, pre-multiply) */
png_set_strip_alpha
(
png_ptr
);
/* 8-bit output: do an appropriate compose */
else
if
(
display
->
background
!=
NULL
)
{
png_color_16
c
;
...
...
@@ -1793,8 +1797,7 @@ png_image_read_end(png_voidp argument)
* one so the code only has to hack on the pixels that require
* composition.
*/
png_set_alpha_mode
(
png_ptr
,
PNG_ALPHA_OPTIMIZED
,
PNG_DEFAULT_sRGB
);
mode
=
PNG_ALPHA_OPTIMIZED
;
}
}
...
...
@@ -1804,12 +1807,26 @@ png_image_read_end(png_voidp argument)
* been accomplished, so always add the alpha channel after the
* component channels.
*/
png_set_add_alpha
(
png_ptr
,
255
/*opaque*/
,
PNG_FILLER_AFTER
);
png_uint_32
filler
;
/* opaque filler */
if
(
linear
)
filler
=
65535
;
else
filler
=
255
;
png_set_add_alpha
(
png_ptr
,
filler
,
PNG_FILLER_AFTER
);
}
change
&=
~
PNG_FORMAT_FLAG_ALPHA
;
}
/* Now set the alpha mode correctly; this is always done, even if there is
* no alpha channel in either the input or the output because it correctly
* sets the output gamma.
*/
png_set_alpha_mode_fixed
(
png_ptr
,
mode
,
output_gamma
);
if
(
change
&
PNG_FORMAT_FLAG_COLOR
)
{
/* gray<->color transformation required. */
...
...
pngwrite.c
浏览文件 @
3615d03e
...
...
@@ -1910,6 +1910,9 @@ png_write_image_8bit(png_voidp argument)
++
in_ptr
;
++
out_ptr
;
}
/* while out_ptr < row_end */
png_write_row
(
png_ptr
,
output_row
);
input_row
+=
display
->
row_bytes
/
(
sizeof
(
png_uint_16
));
}
/* while y */
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录