Merge remote-tracking branch 'origin/master' into Font-Update

Former-commit-id: ae0244334123a3442c7675df80b1a501a6837257
This commit is contained in:
Lynix
2014-12-17 14:00:20 +01:00
28 changed files with 652 additions and 64 deletions

View File

@@ -11,12 +11,16 @@
#include <Nazara/Utility/Debug.hpp>
///TODO: Rajouter des warnings (Formats compressés avec les méthodes Copy/Update, tests taille dans Copy)
///TODO: Rendre les méthodes exception-safe
///TODO: Rendre les méthodes exception-safe (Virer toute cette merde de calcul de pointeurs, faire usage du RAII)
///FIXME: Gérer correctement les formats utilisant moins d'un octet par pixel
namespace
{
inline unsigned int GetLevelSize(unsigned int size, nzUInt8 level)
{
if (size == 0) // Possible dans le cas d'une image invalide
return 0;
return std::max(size >> level, 1U);
}
@@ -28,7 +32,7 @@ namespace
bool NzImageParams::IsValid() const
{
return true;
return true; // Rien à vérifier
}
NzImage::NzImage() :
@@ -195,7 +199,7 @@ void NzImage::Copy(const NzImage& source, const NzBoxui& srcBox, const NzVector3
bool NzImage::Create(nzImageType type, nzPixelFormat format, unsigned int width, unsigned int height, unsigned int depth, nzUInt8 levelCount)
{
ReleaseImage();
Destroy();
#if NAZARA_UTILITY_SAFE
if (!NzPixelFormat::IsValid(format))

View File

@@ -5,6 +5,7 @@
#include <Nazara/Utility/VideoMode.hpp>
#include <Nazara/Utility/VideoModeImpl.hpp>
#include <algorithm>
#include <functional>
#include <Nazara/Utility/Debug.hpp>
NzVideoMode::NzVideoMode() :

View File

@@ -222,7 +222,7 @@ NzVector2i NzEventImpl::GetMousePosition(const NzWindow& relativeTo)
}
else
{
NazaraError("Window's handle is invalid");
NazaraError("Invalid window handle");
// Attention que (-1, -1) est une position tout à fait valide et ne doit pas servir de test
return NzVector2i(-1, -1);
@@ -289,5 +289,5 @@ void NzEventImpl::SetMousePosition(int x, int y, const NzWindow& relativeTo)
SetCursorPos(pos.x, pos.y);
}
else
NazaraError("Window's handle is invalid");
NazaraError("Invalid window handle");
}

View File

@@ -79,7 +79,7 @@ m_scrolling(0)
{
}
bool NzWindowImpl::Create(NzVideoMode mode, const NzString& title, nzUInt32 style)
bool NzWindowImpl::Create(const NzVideoMode& mode, const NzString& title, nzUInt32 style)
{
bool fullscreen = (style & nzWindowStyle_Fullscreen) != 0;
DWORD win32Style, win32StyleEx;
@@ -183,7 +183,7 @@ bool NzWindowImpl::Create(NzVideoMode mode, const NzString& title, nzUInt32 styl
GetWindowRect(m_handle, &windowRect);
m_position.Set(windowRect.left, windowRect.top);
m_size.Set(clientRect.right-clientRect.left, clientRect.bottom-clientRect.top);
m_size.Set(clientRect.right - clientRect.left, clientRect.bottom - clientRect.top);
return true;
}

View File

@@ -34,7 +34,7 @@ class NzWindowImpl : NzNonCopyable
NzWindowImpl(NzWindow* parent);
~NzWindowImpl() = default;
bool Create(NzVideoMode mode, const NzString& title, nzUInt32 style);
bool Create(const NzVideoMode& mode, const NzString& title, nzUInt32 style);
bool Create(NzWindowHandle handle);
void Destroy();