about summary refs log tree commit diff
path: root/src/game/editor/popups.cpp
diff options
context:
space:
mode:
authoroy <Tom_Adams@web.de>2011-08-06 13:08:29 +0200
committeroy <Tom_Adams@web.de>2011-08-06 13:08:29 +0200
commit003c0aa28132ade7b89ba5ed001bf819c8d0d381 (patch)
treef25b18be7d2f0c367fd42e3c1f3fc585cec1c911 /src/game/editor/popups.cpp
parentf1ea039df7b625c28073f46239b64854c480c1dc (diff)
downloadzcatch-003c0aa28132ade7b89ba5ed001bf819c8d0d381.tar.gz
zcatch-003c0aa28132ade7b89ba5ed001bf819c8d0d381.zip
fixed aspect ratio in the editor's image preview. Closes #784
Diffstat (limited to 'src/game/editor/popups.cpp')
-rw-r--r--src/game/editor/popups.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/game/editor/popups.cpp b/src/game/editor/popups.cpp
index f29ae7e2..59f731fa 100644
--- a/src/game/editor/popups.cpp
+++ b/src/game/editor/popups.cpp
@@ -703,7 +703,16 @@ int CEditor::PopupSelectImage(CEditor *pEditor, CUIRect View)
 	}
 
 	if(ShowImage >= 0 && ShowImage < pEditor->m_Map.m_lImages.size())
+	{
+		if(ImageView.h < ImageView.w)
+			ImageView.w = ImageView.h;
+		else
+			ImageView.h = ImageView.w;
+		float Max = (float)(max(pEditor->m_Map.m_lImages[ShowImage]->m_Width, pEditor->m_Map.m_lImages[ShowImage]->m_Height));
+		ImageView.w *= pEditor->m_Map.m_lImages[ShowImage]->m_Width/Max;
+		ImageView.h *= pEditor->m_Map.m_lImages[ShowImage]->m_Height/Max;
 		pEditor->Graphics()->TextureSet(pEditor->m_Map.m_lImages[ShowImage]->m_TexID);
+	}
 	else
 		pEditor->Graphics()->TextureSet(-1);
 	pEditor->Graphics()->QuadsBegin();