Upgrade Platform
This commit is contained in:
@@ -3,20 +3,20 @@
|
||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||
|
||||
#include <Nazara/Platform/Debug.hpp>
|
||||
#include <Nazara/Core/ErrorFlags.hpp>
|
||||
#include <Nazara/Platform/SDL2/IconImpl.hpp>
|
||||
#include <Nazara/Utility/Image.hpp>
|
||||
#include <Nazara/Utility/PixelFormat.hpp>
|
||||
|
||||
namespace Nz
|
||||
{
|
||||
bool IconImpl::Create(const Image& icon)
|
||||
IconImpl::IconImpl(const Image& icon)
|
||||
{
|
||||
ErrorFlags errFlags(ErrorFlag_ThrowException);
|
||||
|
||||
m_iconImage = icon;
|
||||
if (!m_iconImage.Convert(PixelFormat_BGRA8))
|
||||
{
|
||||
if (!m_iconImage.Convert(PixelFormat::BGRA8))
|
||||
NazaraError("Failed to convert icon to BGRA8");
|
||||
return false;
|
||||
}
|
||||
|
||||
m_icon = SDL_CreateRGBSurfaceWithFormatFrom(
|
||||
m_iconImage.GetPixels(),
|
||||
@@ -25,21 +25,16 @@ namespace Nz
|
||||
32,
|
||||
32 * m_iconImage.GetWidth(),
|
||||
SDL_PIXELFORMAT_BGRA8888
|
||||
);
|
||||
);
|
||||
|
||||
if (!m_icon)
|
||||
{
|
||||
NazaraError(SDL_GetError());
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
NazaraError("failed to create SDL Surface for icon: " + std::string(SDL_GetError()));
|
||||
}
|
||||
|
||||
void IconImpl::Destroy()
|
||||
IconImpl::~IconImpl()
|
||||
{
|
||||
SDL_FreeSurface(m_icon);
|
||||
m_iconImage.Destroy();
|
||||
if (m_icon)
|
||||
SDL_FreeSurface(m_icon);
|
||||
}
|
||||
|
||||
SDL_Surface* IconImpl::GetIcon()
|
||||
|
||||
Reference in New Issue
Block a user