From 546e76987d5b4d86066624dc194490be4c73d92e Mon Sep 17 00:00:00 2001 From: Sam Hocevar Date: Mon, 23 Jun 2014 06:40:24 +0000 Subject: [PATCH] image: fix inconsistent data after image resizing. --- src/image/image.cpp | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/image/image.cpp b/src/image/image.cpp index db2468a0..300939ff 100644 --- a/src/image/image.cpp +++ b/src/image/image.cpp @@ -156,6 +156,9 @@ ivec2 Image::GetSize() const void Image::SetSize(ivec2 size) { + ASSERT(size.x > 0); + ASSERT(size.y > 0); + if (m_data->m_size != size) { /* FIXME: delete data or resize it */ @@ -163,14 +166,10 @@ void Image::SetSize(ivec2 size) { m_data->m_pixels.Remove((int)m_data->m_format); } + m_data->m_format = PixelFormat::Unknown; } - m_data->m_size = size; - /* FIXME: don’t do this! It’s useless. */ - if (m_data->m_format != PixelFormat::Unknown) - { - Unlock(Lock()); - } + m_data->m_size = size; } /* Wrap-around mode for some operations */