Author: Carlos Lopez <genet...@gmail.com>
Date:   Wed Aug  8 19:36:59 2012 +0200

Fix bug: Translation was wrong for non centered canvases.

---

 synfig-core/src/modules/mod_geometry/circle.cpp    |    8 ++++----
 synfig-core/src/modules/mod_geometry/rectangle.cpp |   14 +++++++-------
 2 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/synfig-core/src/modules/mod_geometry/circle.cpp 
b/synfig-core/src/modules/mod_geometry/circle.cpp
index 9052f98..6a99191 100644
--- a/synfig-core/src/modules/mod_geometry/circle.cpp
+++ b/synfig-core/src/modules/mod_geometry/circle.cpp
@@ -848,8 +848,8 @@ Circle::accelerated_cairorender(Context 
context,cairo_surface_t *surface,int qua
                        // Now clear a hole on the surface with out_radius
                        cairo_save(cr);
                        // This is the scale and translation values
-                       double tx((br[0]-tl[0])/2/pw);
-                       double ty((br[1]-tl[1])/2/ph);
+                       double tx(-tl[0]/pw);
+                       double ty(-tl[1]/ph);
                        double sx(1/pw);
                        double sy(1/ph);
                        
@@ -888,8 +888,8 @@ Circle::accelerated_cairorender(Context 
context,cairo_surface_t *surface,int qua
                                double width (inter_max[0]-inter_min[0]);
                                double height(inter_max[1]-inter_min[1]);
                                // This is the scale and translation values
-                               double tx((br[0]-tl[0])/2/pw);
-                               double ty((br[1]-tl[1])/2/ph);
+                               double tx(-tl[0]/pw);
+                               double ty(-tl[1]/ph);
                                double sx(1/pw);
                                double sy(1/ph);
                                
diff --git a/synfig-core/src/modules/mod_geometry/rectangle.cpp 
b/synfig-core/src/modules/mod_geometry/rectangle.cpp
index 0eae01d..8e538b2 100644
--- a/synfig-core/src/modules/mod_geometry/rectangle.cpp
+++ b/synfig-core/src/modules/mod_geometry/rectangle.cpp
@@ -628,7 +628,7 @@ Rectangle::accelerated_cairorender(Context 
context,cairo_surface_t *surface,int
                        // Modify the Render Description to render on the 
intersection.
                        // this will modify the w and h values in pixels.
                        RendDesc desc(renddesc);
-                       //desc.set_flags(0);
+                       desc.set_flags(0);
                        desc.set_tl(Point(inter.get_min()[0], 
inter.get_max()[1]));
                        desc.set_br(Point(inter.get_max()[0], 
inter.get_min()[1]));
                        // create a new similar surface with the wxh dimensions
@@ -646,8 +646,8 @@ Rectangle::accelerated_cairorender(Context 
context,cairo_surface_t *surface,int
                        cairo_save(cr);
                        double width (inter_max[0]-inter_min[0]);
                        double height(inter_max[1]-inter_min[1]);
-                       double tx((br[0]-tl[0])/2/pw);
-                       double ty((br[1]-tl[1])/2/ph);
+                       double tx(-tl[0]/pw);
+                       double ty(-tl[1]/ph);
                        double sx(1/pw);
                        double sy(1/ph);  
                        cairo_set_source_surface(cr, subimage, 
(inter_min[0]-tl[0])/pw, (inter_max[1]-tl[1])/ph);
@@ -682,8 +682,8 @@ Rectangle::accelerated_cairorender(Context 
context,cairo_surface_t *surface,int
                        cairo_save(subcr);
                        double width (inter_max[0]-inter_min[0]);
                        double height(inter_max[1]-inter_min[1]);
-                       double tx((br[0]-tl[0])/2/pw);
-                       double ty((br[1]-tl[1])/2/ph);
+                       double tx(-tl[0]/pw);
+                       double ty(-tl[1]/ph);
                        double sx(1/pw);
                        double sy(1/ph);  
                        cairo_translate(subcr, tx , ty);
@@ -732,8 +732,8 @@ Rectangle::accelerated_cairorender(Context 
context,cairo_surface_t *surface,int
        cairo_set_source_rgba(cr, r, g, b, a);
        double width (inter_max[0]-inter_min[0]);
        double height(inter_max[1]-inter_min[1]);
-       double tx((br[0]-tl[0])/2/pw);
-       double ty((br[1]-tl[1])/2/ph);
+       double tx(-tl[0]/pw);
+       double ty(-tl[1]/ph);
        double sx(1/pw);
        double sy(1/ph);  
        cairo_translate(cr, tx , ty);


------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Synfig-devl mailing list
Synfig-devl@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/synfig-devl

Reply via email to