Renderer: Replaced RenderTarget::Get[Height|Width] by RenderTarget::GetSize

Utility: Removed Window::Get[Height|Width] methods
This commit is contained in:
Lynix
2017-10-28 23:26:22 +02:00
parent bf8ebbd046
commit d688cecbde
20 changed files with 44 additions and 102 deletions

View File

@@ -218,11 +218,6 @@ namespace Nz
return m_handle;
}
unsigned int WindowImpl::GetHeight() const
{
return m_size.y;
}
Vector2i WindowImpl::GetPosition() const
{
return m_position;
@@ -252,11 +247,6 @@ namespace Nz
return String::Unicode(wTitle.get());
}
unsigned int WindowImpl::GetWidth() const
{
return m_size.x;
}
bool WindowImpl::HasFocus() const
{
return GetForegroundWindow() == m_handle;

View File

@@ -46,12 +46,10 @@ namespace Nz
void EnableSmoothScrolling(bool enable);
WindowHandle GetHandle() const;
unsigned int GetHeight() const;
Vector2i GetPosition() const;
Vector2ui GetSize() const;
WindowStyleFlags GetStyle() const;
String GetTitle() const;
unsigned int GetWidth() const;
bool HasFocus() const;

View File

@@ -203,19 +203,6 @@ namespace Nz
return m_impl->GetHandle();
}
unsigned int Window::GetHeight() const
{
#if NAZARA_PLATFORM_SAFE
if (!m_impl)
{
NazaraError("Window not created");
return 0;
}
#endif
return m_impl->GetHeight();
}
Vector2i Window::GetPosition() const
{
#if NAZARA_PLATFORM_SAFE
@@ -268,19 +255,6 @@ namespace Nz
return m_impl->GetTitle();
}
unsigned int Window::GetWidth() const
{
#if NAZARA_PLATFORM_SAFE
if (!m_impl)
{
NazaraError("Window not created");
return 0;
}
#endif
return m_impl->GetWidth();
}
bool Window::HasFocus() const
{
#if NAZARA_PLATFORM_SAFE

View File

@@ -402,7 +402,7 @@ namespace Nz
{
if (s_contextStates->currentTarget)
{
unsigned int height = s_contextStates->currentTarget->GetHeight();
unsigned int height = s_contextStates->currentTarget->GetSize().y;
glScissor(scissorBox.x, height - scissorBox.height - scissorBox.y, scissorBox.width, scissorBox.height);
s_contextStates->scissorBoxUpdated = true;
}
@@ -494,7 +494,7 @@ namespace Nz
{
if (s_contextStates->currentTarget)
{
unsigned int height = s_contextStates->currentTarget->GetHeight();
unsigned int height = s_contextStates->currentTarget->GetSize().y;
glViewport(viewport.x, height - viewport.height - viewport.y, viewport.width, viewport.height);
s_contextStates->viewportUpdated = true;
}
@@ -1287,7 +1287,7 @@ namespace Nz
{
const Recti& scissorBox = s_contextStates->currentViewport;
unsigned int height = s_contextStates->currentTarget->GetHeight();
unsigned int height = s_contextStates->currentTarget->GetSize().y;
glScissor(scissorBox.x, height - scissorBox.height - scissorBox.y, scissorBox.width, scissorBox.height);
s_contextStates->scissorBoxUpdated = true;
@@ -1297,7 +1297,7 @@ namespace Nz
{
const Recti& viewport = s_contextStates->currentViewport;
unsigned int height = s_contextStates->currentTarget->GetHeight();
unsigned int height = s_contextStates->currentTarget->GetSize().y;
glViewport(viewport.x, height - viewport.height - viewport.y, viewport.width, viewport.height);
s_contextStates->viewportUpdated = true;

View File

@@ -438,16 +438,6 @@ namespace Nz
m_checked = false;
}
unsigned int RenderTexture::GetHeight() const
{
NazaraAssert(m_impl, "Invalid render texture");
if (!m_sizeUpdated)
UpdateSize();
return m_impl->height;
}
RenderTargetParameters RenderTexture::GetParameters() const
{
NazaraAssert(m_impl, "Invalid render texture");
@@ -466,16 +456,6 @@ namespace Nz
return Vector2ui(m_impl->width, m_impl->height);
}
unsigned int RenderTexture::GetWidth() const
{
NazaraAssert(m_impl, "Invalid render texture");
if (!m_sizeUpdated)
UpdateSize();
return m_impl->width;
}
bool RenderTexture::IsComplete() const
{
NazaraAssert(m_impl, "Invalid render texture");
@@ -665,13 +645,15 @@ namespace Nz
NazaraAssert(dst && dst->IsValid(), "Invalid destination render texture");
#if NAZARA_RENDERER_SAFE
if (srcRect.x+srcRect.width > src->GetWidth() || srcRect.y+srcRect.height > src->GetHeight())
Vector2ui srcSize = src->GetSize();
if (srcRect.x+srcRect.width > srcSize.x || srcRect.y+srcRect.height > srcSize.y)
{
NazaraError("Source rectangle dimensions are out of bounds");
return;
}
if (dstRect.x+dstRect.width > dst->GetWidth() || dstRect.y+dstRect.height > dst->GetHeight())
Vector2ui dstSize = dst->GetSize();
if (dstRect.x+dstRect.width > dstSize.x || dstRect.y+dstRect.height > dstSize.y)
{
NazaraError("Destination rectangle dimensions are out of bounds");
return;

View File

@@ -162,11 +162,6 @@ namespace Nz
NazaraError("No context");
}
unsigned int RenderWindow::GetHeight() const
{
return Window::GetHeight();
}
RenderTargetParameters RenderWindow::GetParameters() const
{
if (m_context)
@@ -181,9 +176,9 @@ namespace Nz
}
}
unsigned int RenderWindow::GetWidth() const
Vector2ui RenderWindow::GetSize() const
{
return Window::GetWidth();
return Window::GetSize();
}
bool RenderWindow::IsRenderable() const

View File

@@ -1444,7 +1444,7 @@ namespace Nz
}
// Envoi des uniformes liées au Renderer
Vector2ui targetSize(s_target->GetWidth(), s_target->GetHeight());
Vector2ui targetSize = s_target->GetSize();
if (s_targetSize != targetSize)
{
int location;