Skip to content

Commit

Permalink
xrCore/Media/Image: Reimplemented via stdio.
Browse files Browse the repository at this point in the history
  • Loading branch information
Kaffeine committed Nov 6, 2015
1 parent 3f65531 commit 1a0d2ff
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions src/xrCore/Media/Image.cpp
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
#include "stdafx.h"
#include "Image.hpp"
#include <fcntl.h>
#include <sys/stat.h>
#include <io.h>

#include <cstdio>

using namespace XRay::Media;

Expand All @@ -18,11 +17,11 @@ Image &Image::Create(u16 width, u16 height, void *data, ImageFormat format)

void Image::SaveTGA(const char *name, ImageFormat format, bool align)
{
int fd = _open(name, O_CREAT|O_WRONLY|O_BINARY, S_IREAD|S_IWRITE);
FILE *file = std::fopen( name, "wb");
auto writerFunc = [&](void *data, u32 dataSize)
{ _write(fd, data, dataSize); };
{ std::fwrite(data, dataSize, 1, file); };
SaveTGA(writerFunc, format, align);
_close(fd);
std::fclose(file);
}

void Image::SaveTGA(IWriter& writer, bool align)
Expand Down

0 comments on commit 1a0d2ff

Please sign in to comment.