Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
itdan3344
stb
提交
2a170dae
S
stb
项目概览
itdan3344
/
stb
与 Fork 源项目一致
从无法访问的项目Fork
通知
2
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
S
stb
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
2a170dae
编写于
11月 28, 2016
作者:
J
jon
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
warning fixes, more RGBE fix
上级
a2defc3d
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
13 addition
and
9 deletion
+13
-9
stb_image.h
stb_image.h
+13
-9
未找到文件。
stb_image.h
浏览文件 @
2a170dae
...
@@ -4500,7 +4500,7 @@ static int stbi__parse_png_file(stbi__png *z, int scan, int req_comp)
...
@@ -4500,7 +4500,7 @@ static int stbi__parse_png_file(stbi__png *z, int scan, int req_comp)
if
(
c
.
length
!=
(
stbi__uint32
)
s
->
img_n
*
2
)
return
stbi__err
(
"bad tRNS len"
,
"Corrupt PNG"
);
if
(
c
.
length
!=
(
stbi__uint32
)
s
->
img_n
*
2
)
return
stbi__err
(
"bad tRNS len"
,
"Corrupt PNG"
);
has_trans
=
1
;
has_trans
=
1
;
if
(
z
->
depth
==
16
)
{
if
(
z
->
depth
==
16
)
{
for
(
k
=
0
;
k
<
s
->
img_n
;
++
k
)
tc16
[
k
]
=
stbi__get16be
(
s
);
// copy the values as-is
for
(
k
=
0
;
k
<
s
->
img_n
;
++
k
)
tc16
[
k
]
=
(
stbi__uint16
)
stbi__get16be
(
s
);
// copy the values as-is
}
else
{
}
else
{
for
(
k
=
0
;
k
<
s
->
img_n
;
++
k
)
tc
[
k
]
=
(
stbi_uc
)(
stbi__get16be
(
s
)
&
255
)
*
stbi__depth_scale_table
[
z
->
depth
];
// non 8-bit images will be larger
for
(
k
=
0
;
k
<
s
->
img_n
;
++
k
)
tc
[
k
]
=
(
stbi_uc
)(
stbi__get16be
(
s
)
&
255
)
*
stbi__depth_scale_table
[
z
->
depth
];
// non 8-bit images will be larger
}
}
...
@@ -5079,16 +5079,16 @@ errorEnd:
...
@@ -5079,16 +5079,16 @@ errorEnd:
// read 16bit value and convert to 24bit RGB
// read 16bit value and convert to 24bit RGB
void
stbi__tga_read_rgb16
(
stbi__context
*
s
,
stbi_uc
*
out
)
void
stbi__tga_read_rgb16
(
stbi__context
*
s
,
stbi_uc
*
out
)
{
{
stbi__uint16
px
=
stbi__get16le
(
s
);
stbi__uint16
px
=
(
stbi__uint16
)
stbi__get16le
(
s
);
stbi__uint16
fiveBitMask
=
31
;
stbi__uint16
fiveBitMask
=
31
;
// we have 3 channels with 5bits each
// we have 3 channels with 5bits each
int
r
=
(
px
>>
10
)
&
fiveBitMask
;
int
r
=
(
px
>>
10
)
&
fiveBitMask
;
int
g
=
(
px
>>
5
)
&
fiveBitMask
;
int
g
=
(
px
>>
5
)
&
fiveBitMask
;
int
b
=
px
&
fiveBitMask
;
int
b
=
px
&
fiveBitMask
;
// Note that this saves the data in RGB(A) order, so it doesn't need to be swapped later
// Note that this saves the data in RGB(A) order, so it doesn't need to be swapped later
out
[
0
]
=
(
r
*
255
)
/
31
;
out
[
0
]
=
(
stbi_uc
)((
r
*
255
)
/
31
)
;
out
[
1
]
=
(
g
*
255
)
/
31
;
out
[
1
]
=
(
stbi_uc
)((
g
*
255
)
/
31
)
;
out
[
2
]
=
(
b
*
255
)
/
31
;
out
[
2
]
=
(
stbi_uc
)((
b
*
255
)
/
31
)
;
// some people claim that the most significant bit might be used for alpha
// some people claim that the most significant bit might be used for alpha
// (possibly if an alpha-bit is set in the "image descriptor byte")
// (possibly if an alpha-bit is set in the "image descriptor byte")
...
@@ -6069,20 +6069,24 @@ static int stbi__gif_info(stbi__context *s, int *x, int *y, int *comp)
...
@@ -6069,20 +6069,24 @@ static int stbi__gif_info(stbi__context *s, int *x, int *y, int *comp)
// Radiance RGBE HDR loader
// Radiance RGBE HDR loader
// originally by Nicolas Schulz
// originally by Nicolas Schulz
#ifndef STBI_NO_HDR
#ifndef STBI_NO_HDR
static
int
stbi__hdr_test_core
(
stbi__context
*
s
)
static
int
stbi__hdr_test_core
(
stbi__context
*
s
,
const
char
*
signature
)
{
{
const
char
*
signature
=
"#?RADIANCE
\n
"
;
int
i
;
int
i
;
for
(
i
=
0
;
signature
[
i
];
++
i
)
for
(
i
=
0
;
signature
[
i
];
++
i
)
if
(
stbi__get8
(
s
)
!=
signature
[
i
])
if
(
stbi__get8
(
s
)
!=
signature
[
i
])
return
0
;
return
0
;
stbi__rewind
(
s
);
return
1
;
return
1
;
}
}
static
int
stbi__hdr_test
(
stbi__context
*
s
)
static
int
stbi__hdr_test
(
stbi__context
*
s
)
{
{
int
r
=
stbi__hdr_test_core
(
s
);
int
r
=
stbi__hdr_test_core
(
s
,
"#?RADIANCE
\n
"
);
stbi__rewind
(
s
);
stbi__rewind
(
s
);
if
(
!
r
)
{
r
=
stbi__hdr_test_core
(
s
,
"#?RGBE
\n
"
);
stbi__rewind
(
s
);
}
return
r
;
return
r
;
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录