Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
itdan3344
stb
提交
52d40074
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,发现更多精彩内容 >>
提交
52d40074
编写于
9月 13, 2015
作者:
S
Sean Barrett
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
detect all 0-alpha bmp and replace with all-255;
fix bug in reedbeta patch
上级
fee80f3d
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
21 addition
and
12 deletion
+21
-12
stb_image.h
stb_image.h
+21
-12
未找到文件。
stb_image.h
浏览文件 @
52d40074
/* stb_image - v2.0
6
- public domain image loader - http://nothings.org/stb_image.h
/* stb_image - v2.0
8
- public domain image loader - http://nothings.org/stb_image.h
no warranty implied; use at your own risk
Do this:
...
...
@@ -205,6 +205,7 @@
Joseph Thomson
Phil Jordan
Nathan Reed
urraka@github
LICENSE
...
...
@@ -4112,20 +4113,21 @@ static int stbi__create_png_image_raw(stbi__png *a, stbi_uc *raw, stbi__uint32 r
if
(
k
>
6
)
*
cur
++
=
scale
*
((
*
in
>>
1
)
&
0x01
);
}
if
(
img_n
!=
out_n
)
{
int
q
;
// insert alpha = 255
cur
=
a
->
out
+
stride
*
j
;
if
(
img_n
==
1
)
{
for
(
i
=
x
-
1
;
i
>=
0
;
--
i
)
{
cur
[
i
*
2
+
1
]
=
255
;
cur
[
i
*
2
+
0
]
=
cur
[
i
];
for
(
q
=
x
-
1
;
q
>=
0
;
--
q
)
{
cur
[
q
*
2
+
1
]
=
255
;
cur
[
q
*
2
+
0
]
=
cur
[
q
];
}
}
else
{
STBI_ASSERT
(
img_n
==
3
);
for
(
i
=
x
-
1
;
i
>=
0
;
--
i
)
{
cur
[
i
*
4
+
3
]
=
255
;
cur
[
i
*
4
+
2
]
=
cur
[
i
*
3
+
2
];
cur
[
i
*
4
+
1
]
=
cur
[
i
*
3
+
1
];
cur
[
i
*
4
+
0
]
=
cur
[
i
*
3
+
0
];
for
(
q
=
x
-
1
;
q
>=
0
;
--
q
)
{
cur
[
q
*
4
+
3
]
=
255
;
cur
[
q
*
4
+
2
]
=
cur
[
q
*
3
+
2
];
cur
[
q
*
4
+
1
]
=
cur
[
q
*
3
+
1
];
cur
[
q
*
4
+
0
]
=
cur
[
q
*
3
+
0
];
}
}
}
...
...
@@ -4580,7 +4582,7 @@ static int stbi__shiftsigned(int v, int shift, int bits)
static
stbi_uc
*
stbi__bmp_load
(
stbi__context
*
s
,
int
*
x
,
int
*
y
,
int
*
comp
,
int
req_comp
)
{
stbi_uc
*
out
;
unsigned
int
mr
=
0
,
mg
=
0
,
mb
=
0
,
ma
=
0
,
fake_a
=
0
;
unsigned
int
mr
=
0
,
mg
=
0
,
mb
=
0
,
ma
=
0
,
all_a
=
255
;
stbi_uc
pal
[
256
][
4
];
int
psize
=
0
,
i
,
j
,
compress
=
0
,
width
;
int
bpp
,
flip_vertically
,
pad
,
target
,
offset
,
hsz
;
...
...
@@ -4629,8 +4631,7 @@ static stbi_uc *stbi__bmp_load(stbi__context *s, int *x, int *y, int *comp, int
mg
=
0xffu
<<
8
;
mb
=
0xffu
<<
0
;
ma
=
0xffu
<<
24
;
fake_a
=
1
;
// @TODO: check for cases like alpha value is all 0 and switch it to 255
STBI_NOTUSED
(
fake_a
);
all_a
=
0
;
// if all_a is 0 at end, then we loaded alpha channel but it was all 0
}
else
{
mr
=
31u
<<
10
;
mg
=
31u
<<
5
;
...
...
@@ -4741,6 +4742,7 @@ static stbi_uc *stbi__bmp_load(stbi__context *s, int *x, int *y, int *comp, int
out
[
z
+
0
]
=
stbi__get8
(
s
);
z
+=
3
;
a
=
(
easy
==
2
?
stbi__get8
(
s
)
:
255
);
all_a
|=
a
;
if
(
target
==
4
)
out
[
z
++
]
=
a
;
}
}
else
{
...
...
@@ -4751,12 +4753,19 @@ static stbi_uc *stbi__bmp_load(stbi__context *s, int *x, int *y, int *comp, int
out
[
z
++
]
=
STBI__BYTECAST
(
stbi__shiftsigned
(
v
&
mg
,
gshift
,
gcount
));
out
[
z
++
]
=
STBI__BYTECAST
(
stbi__shiftsigned
(
v
&
mb
,
bshift
,
bcount
));
a
=
(
ma
?
stbi__shiftsigned
(
v
&
ma
,
ashift
,
acount
)
:
255
);
all_a
|=
a
;
if
(
target
==
4
)
out
[
z
++
]
=
STBI__BYTECAST
(
a
);
}
}
stbi__skip
(
s
,
pad
);
}
}
// if alpha channel is all 0s, replace with all 255s
if
(
target
==
4
&&
all_a
==
0
)
for
(
i
=
4
*
s
->
img_x
*
s
->
img_y
-
1
;
i
>=
0
;
i
-=
4
)
out
[
i
]
=
255
;
if
(
flip_vertically
)
{
stbi_uc
t
;
for
(
j
=
0
;
j
<
(
int
)
s
->
img_y
>>
1
;
++
j
)
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录