From 2dcea171b5b5cba9e1d40589b4f7056cfc9ffde3 Mon Sep 17 00:00:00 2001 From: avolkov Date: Tue, 31 Jul 2007 09:39:27 +0000 Subject: [PATCH] Align the space origin on a whole pixel: fixes dancing Sa-Matra on slow flybys (part of bug #685); this does not resolve the object positioning jitter completely git-svn-id: svn://svn.code.sf.net/p/sc2/code/trunk@2826 8092fc87-c524-0410-9efc-e669fe64eaf9 --- sc2/src/sc2code/process.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/sc2/src/sc2code/process.c b/sc2/src/sc2code/process.c index e659be264..4651e1f56 100644 --- a/sc2/src/sc2code/process.c +++ b/sc2/src/sc2code/process.c @@ -324,10 +324,12 @@ CalcView (POINT *pNewScrollPt, SIZE next_reduction, && zoom_out - next_reduction > ZOOM_JUMP) next_reduction = zoom_out - ZOOM_JUMP; - SpaceOrg.x = (int)(LOG_SPACE_WIDTH >> 1) - - (LOG_SPACE_WIDTH * next_reduction / (MAX_ZOOM_OUT << 2)); - SpaceOrg.y = (int)(LOG_SPACE_HEIGHT >> 1) - - (LOG_SPACE_HEIGHT * next_reduction / (MAX_ZOOM_OUT << 2)); + // Always align the origin on a whole pixel to reduce the + // amount of object positioning jitter + SpaceOrg.x = DISPLAY_ALIGN((int)(LOG_SPACE_WIDTH >> 1) - + (LOG_SPACE_WIDTH * next_reduction / (MAX_ZOOM_OUT << 2))); + SpaceOrg.y = DISPLAY_ALIGN((int)(LOG_SPACE_HEIGHT >> 1) - + (LOG_SPACE_HEIGHT * next_reduction / (MAX_ZOOM_OUT << 2))); } zoom_out = next_reduction; view_state = VIEW_CHANGE;