changeset 548:f45e3e2995e0

* Corrected the h,w calculation for zooming in layercache.cpp. * Fixed the bug, that x,y camera position result in an screen offset. fixes[ticket:462] Note: chewie was right, the ExactModellCoordinate object for camera creating is useless(always 0,0,0). I'm believe that we can remove it from the camera constructor but that would mean an api change.
author helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
date Fri, 11 Jun 2010 21:10:40 +0000
parents e59ece21ab3e
children c9113e23b004
files engine/core/view/camera.cpp engine/core/view/layercache.cpp
diffstat 2 files changed, 5 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/engine/core/view/camera.cpp	Fri Jun 04 21:01:34 2010 +0000
+++ b/engine/core/view/camera.cpp	Fri Jun 11 21:10:40 2010 +0000
@@ -294,7 +294,7 @@
 		m_matrix.applyScale(scale, scale, scale);
 		m_matrix.applyRotate(-m_rotation, 0.0, 0.0, 1.0);
 		m_matrix.applyRotate(-m_tilt, 1.0, 0.0, 0.0);
-		m_matrix.applyTranslate(+m_viewport.w/2, +m_viewport.h/2, 0);
+		m_matrix.applyTranslate(+m_viewport.x+m_viewport.w/2, +m_viewport.y+m_viewport.h/2, 0);
 		m_inverse_matrix = m_matrix.inverse();
 
 
--- a/engine/core/view/layercache.cpp	Fri Jun 04 21:01:34 2010 +0000
+++ b/engine/core/view/layercache.cpp	Fri Jun 11 21:10:40 2010 +0000
@@ -323,15 +323,15 @@
 
 			item.dimensions.x = screen_point.x;
 			item.dimensions.y = screen_point.y;
-			item.dimensions.w = unsigned(double(item.bbox.w) * zoom + OVERDRAW);
-			item.dimensions.h = unsigned(double(item.bbox.h) * zoom + OVERDRAW);
+			item.dimensions.w = item.bbox.w;
+			item.dimensions.h = item.bbox.h;
 
 			if (zoom != 1.0) {
 				// NOTE: Due to image alignment, there is additional additions on image dimensions 
 				//       There's probabaly some better solution for this, but works "good enough" for now. 
 				//       In case additions are removed, gaps appear between tiles. 
-				item.dimensions.w = unsigned(ceil(double(item.bbox.w) * zoom)) + OVERDRAW;
-				item.dimensions.h = unsigned(ceil(double(item.bbox.h) * zoom)) + OVERDRAW;
+				item.dimensions.w = unsigned(double(item.bbox.w) * zoom + OVERDRAW);
+				item.dimensions.h = unsigned(double(item.bbox.h) * zoom + OVERDRAW);
 			}
 
 			if(item.dimensions.intersects(screen_viewport))