From 69dec3923341f50673aeb5a7d61aa0f7e1bf74e5 Mon Sep 17 00:00:00 2001 From: dooglus Date: Sat, 11 Oct 2008 07:00:11 +0000 Subject: [PATCH] Move a bunch of code into a block to make it clear which variables are only used locally. git-svn-id: https://synfig.svn.sourceforge.net/svnroot/synfig@2092 1f10aa63-cdf2-0310-b900-c93c546f37ac --- synfig-core/trunk/src/modules/lyr_std/rotate.cpp | 63 +++++++++++++----------- 1 file changed, 33 insertions(+), 30 deletions(-) diff --git a/synfig-core/trunk/src/modules/lyr_std/rotate.cpp b/synfig-core/trunk/src/modules/lyr_std/rotate.cpp index a17a854..39dcbf4 100644 --- a/synfig-core/trunk/src/modules/lyr_std/rotate.cpp +++ b/synfig-core/trunk/src/modules/lyr_std/rotate.cpp @@ -189,37 +189,40 @@ Rotate::accelerated_render(Context context,Surface *surface,int quality, const R Point tl(renddesc.get_tl()-origin); Point br(renddesc.get_br()-origin); - Point rot_tl(cos_val*tl[0]+sin_val*tl[1],-sin_val*tl[0]+cos_val*tl[1]); - Point rot_br(cos_val*br[0]+sin_val*br[1],-sin_val*br[0]+cos_val*br[1]); - Point rot_tr(cos_val*br[0]+sin_val*tl[1],-sin_val*br[0]+cos_val*tl[1]); - Point rot_bl(cos_val*tl[0]+sin_val*br[1],-sin_val*tl[0]+cos_val*br[1]); - rot_tl+=origin; - rot_br+=origin; - rot_tr+=origin; - rot_bl+=origin; - - Point min_point(min(min(min(rot_tl[0],rot_br[0]),rot_tr[0]),rot_bl[0]),min(min(min(rot_tl[1],rot_br[1]),rot_tr[1]),rot_bl[1])); - Point max_point(max(max(max(rot_tl[0],rot_br[0]),rot_tr[0]),rot_bl[0]),max(max(max(rot_tl[1],rot_br[1]),rot_tr[1]),rot_bl[1])); - - if(tl[0]>br[0]) - { - tl[0]=max_point[0]; - br[0]=min_point[0]; - } - else - { - br[0]=max_point[0]; - tl[0]=min_point[0]; - } - if(tl[1]>br[1]) - { - tl[1]=max_point[1]; - br[1]=min_point[1]; - } - else + { - br[1]=max_point[1]; - tl[1]=min_point[1]; + Point rot_tl(cos_val*tl[0]+sin_val*tl[1],-sin_val*tl[0]+cos_val*tl[1]); + Point rot_br(cos_val*br[0]+sin_val*br[1],-sin_val*br[0]+cos_val*br[1]); + Point rot_tr(cos_val*br[0]+sin_val*tl[1],-sin_val*br[0]+cos_val*tl[1]); + Point rot_bl(cos_val*tl[0]+sin_val*br[1],-sin_val*tl[0]+cos_val*br[1]); + rot_tl+=origin; + rot_br+=origin; + rot_tr+=origin; + rot_bl+=origin; + + Point min_point(min(min(min(rot_tl[0],rot_br[0]),rot_tr[0]),rot_bl[0]),min(min(min(rot_tl[1],rot_br[1]),rot_tr[1]),rot_bl[1])); + Point max_point(max(max(max(rot_tl[0],rot_br[0]),rot_tr[0]),rot_bl[0]),max(max(max(rot_tl[1],rot_br[1]),rot_tr[1]),rot_bl[1])); + + if(tl[0]>br[0]) + { + tl[0]=max_point[0]; + br[0]=min_point[0]; + } + else + { + br[0]=max_point[0]; + tl[0]=min_point[0]; + } + if(tl[1]>br[1]) + { + tl[1]=max_point[1]; + br[1]=min_point[1]; + } + else + { + br[1]=max_point[1]; + tl[1]=min_point[1]; + } } Real pw=(renddesc.get_w())/(renddesc.get_br()[0]-renddesc.get_tl()[0]); -- 2.7.4