rpcs3/Utilities/rPlatform.cpp

42 lines
900 B
C++
Raw Normal View History

#include "stdafx.h"
#include "restore_new.h"
2015-10-17 17:47:18 +00:00
#include "Utilities/Log.h"
2015-04-23 16:58:37 +00:00
#pragma warning(push)
#pragma message("TODO: remove wx dependency: <wx/image.h>")
2015-01-25 16:23:24 +00:00
#pragma warning(disable : 4996)
#include <wx/image.h>
2015-04-23 16:58:37 +00:00
#pragma warning(pop)
#include "define_new_memleakdetect.h"
#ifndef _WIN32
#include <dirent.h>
#endif
2014-08-24 17:42:19 +00:00
#include "rPlatform.h"
rImage::rImage()
{
handle = static_cast<void*>(new wxImage());
}
rImage::~rImage()
{
delete static_cast<wxImage*>(handle);
}
void rImage::Create(int width, int height, void *data, void *alpha)
{
static_cast<wxImage*>(handle)->Create(width, height, static_cast<unsigned char*>(data), static_cast<unsigned char*>(alpha));
}
void rImage::SaveFile(const std::string& name, rImageType type)
{
if (type == rBITMAP_TYPE_PNG)
{
static_cast<wxImage*>(handle)->SaveFile(fmt::FromUTF8(name),wxBITMAP_TYPE_PNG);
}
else
{
throw EXCEPTION("unsupported type");
}
}