Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
itdan3344
stb
提交
faf08e00
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,体验更适合开发者的 AI 搜索 >>
提交
faf08e00
编写于
1月 29, 2018
作者:
S
Sean Barrett
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'stb_image_write_mscrt_errors' of
https://github.com/xeekworx/stb
上级
4254a9f2
76d9e05b
变更
1
显示空白变更内容
内联
并排
Showing
1 changed file
with
19 addition
and
1 deletion
+19
-1
stb_image_write.h
stb_image_write.h
+19
-1
未找到文件。
stb_image_write.h
浏览文件 @
faf08e00
...
...
@@ -10,6 +10,11 @@
Will probably not work correctly with strict-aliasing optimizations.
If using a modern Microsoft Compiler, non-safe versions of CRT calls may cause
compilation warnings or even errors. To avoid this, also before #including,
#define STBI_MSC_SECURE_CRT
ABOUT:
This header file is a library for writing images to C stdio. It could be
...
...
@@ -265,7 +270,12 @@ static void stbi__stdio_write(void *context, void *data, int size)
static
int
stbi__start_write_file
(
stbi__write_context
*
s
,
const
char
*
filename
)
{
FILE
*
f
=
fopen
(
filename
,
"wb"
);
FILE
*
f
;
#ifdef STBI_MSC_SECURE_CRT
fopen_s
(
&
f
,
filename
,
"wb"
);
#else
f
=
fopen
(
filename
,
"wb"
);
#endif
stbi__start_write_callbacks
(
s
,
stbi__stdio_write
,
(
void
*
)
f
);
return
f
!=
NULL
;
}
...
...
@@ -668,7 +678,11 @@ static int stbi_write_hdr_core(stbi__write_context *s, int x, int y, int comp, f
char
header
[]
=
"#?RADIANCE
\n
# Written by stb_image_write.h
\n
FORMAT=32-bit_rle_rgbe
\n
"
;
s
->
func
(
s
->
context
,
header
,
sizeof
(
header
)
-
1
);
#ifdef STBI_MSC_SECURE_CRT
len
=
sprintf_s
(
buffer
,
"EXPOSURE= 1.0000000000000
\n\n
-Y %d +X %d
\n
"
,
y
,
x
);
#else
len
=
sprintf
(
buffer
,
"EXPOSURE= 1.0000000000000
\n\n
-Y %d +X %d
\n
"
,
y
,
x
);
#endif
s
->
func
(
s
->
context
,
buffer
,
len
);
for
(
i
=
0
;
i
<
y
;
i
++
)
...
...
@@ -1086,7 +1100,11 @@ STBIWDEF int stbi_write_png(char const *filename, int x, int y, int comp, const
int
len
;
unsigned
char
*
png
=
stbi_write_png_to_mem
((
unsigned
char
*
)
data
,
stride_bytes
,
x
,
y
,
comp
,
&
len
);
if
(
png
==
NULL
)
return
0
;
#ifdef STBI_MSC_SECURE_CRT
fopen_s
(
&
f
,
filename
,
"wb"
);
#else
f
=
fopen
(
filename
,
"wb"
);
#endif
if
(
!
f
)
{
STBIW_FREE
(
png
);
return
0
;
}
fwrite
(
png
,
1
,
len
,
f
);
fclose
(
f
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录