Author: Carlos Lopez <[email protected]>
Date:   Fri Apr 19 14:40:17 2013 +0200

Fix bug 385: Feathered shapes render is affected by render tile mode in Cairo

---

 .../src/modules/mod_geometry/advanced_outline.cpp  |   12 ++++++++----
 synfig-core/src/modules/mod_geometry/outline.cpp   |   12 ++++++++----
 synfig-core/src/modules/mod_geometry/region.cpp    |   14 +++++++++-----
 synfig-core/src/synfig/layer_polygon.cpp           |   12 ++++++++----
 4 files changed, 33 insertions(+), 17 deletions(-)

diff --git a/synfig-core/src/modules/mod_geometry/advanced_outline.cpp 
b/synfig-core/src/modules/mod_geometry/advanced_outline.cpp
index 22a1cd5..f4344ec 100644
--- a/synfig-core/src/modules/mod_geometry/advanced_outline.cpp
+++ b/synfig-core/src/modules/mod_geometry/advanced_outline.cpp
@@ -1590,7 +1590,11 @@ Advanced_Outline::accelerated_cairorender(Context 
context,cairo_surface_t *surfa
                cairo_paint(subcr);
        }
        // Draw the outline
-       cairo_translate(subcr, tx , ty);
+       // Calculate new translations after expand the tile
+       const double extx((-workdesc.get_tl()[0]+origin[0])*sx);
+       const double exty((-workdesc.get_tl()[1]+origin[1])*sy);
+       
+       cairo_translate(subcr, extx , exty);
        cairo_scale(subcr, sx, sy);
        switch(winding_style)
        {
@@ -1659,10 +1663,10 @@ Advanced_Outline::accelerated_cairorender(Context 
context,cairo_surface_t *surfa
                        cairo_surface_destroy(subimage);
                        return false;
                }
-       double px(tl[0]-workdesc.get_tl()[0]);
-       double py(tl[1]-workdesc.get_tl()[1]);
        cairo_save(cr);
-       cairo_set_source_surface(cr, subimage, px, py );
+       const double px(tl[0]-workdesc.get_tl()[0]);
+       const double py(tl[1]-workdesc.get_tl()[1]);
+       cairo_set_source_surface(cr, subimage, -px*sx, -py*sy);
        cairo_paint_with_alpha_operator(cr, get_amount(), get_blend_method());
        cairo_restore(cr);
        cairo_surface_destroy(subimage);
diff --git a/synfig-core/src/modules/mod_geometry/outline.cpp 
b/synfig-core/src/modules/mod_geometry/outline.cpp
index 74f29b4..630cd90 100644
--- a/synfig-core/src/modules/mod_geometry/outline.cpp
+++ b/synfig-core/src/modules/mod_geometry/outline.cpp
@@ -980,7 +980,11 @@ Outline::accelerated_cairorender(Context 
context,cairo_surface_t *surface,int qu
                cairo_paint(subcr);
        }
        // Draw the outline
-       cairo_translate(subcr, tx , ty);
+       // Calculate new translations after expand the tile
+       const double extx((-workdesc.get_tl()[0]+origin[0])*sx);
+       const double exty((-workdesc.get_tl()[1]+origin[1])*sy);
+       
+       cairo_translate(subcr, extx , exty);
        cairo_scale(subcr, sx, sy);
        switch(winding_style)
        {
@@ -1089,10 +1093,10 @@ Outline::accelerated_cairorender(Context 
context,cairo_surface_t *surface,int qu
                        cairo_surface_destroy(subimage);
                        return false;
                }
-       double px(tl[0]-workdesc.get_tl()[0]);
-       double py(tl[1]-workdesc.get_tl()[1]);
        cairo_save(cr);
-       cairo_set_source_surface(cr, subimage, px, py );
+       const double px(tl[0]-workdesc.get_tl()[0]);
+       const double py(tl[1]-workdesc.get_tl()[1]);
+       cairo_set_source_surface(cr, subimage, -px*sx, -py*sy);
        cairo_paint_with_alpha_operator(cr, get_amount(), get_blend_method());
        cairo_restore(cr);
        cairo_surface_destroy(subimage);
diff --git a/synfig-core/src/modules/mod_geometry/region.cpp 
b/synfig-core/src/modules/mod_geometry/region.cpp
index 1f84cf2..b09cdcb 100644
--- a/synfig-core/src/modules/mod_geometry/region.cpp
+++ b/synfig-core/src/modules/mod_geometry/region.cpp
@@ -360,8 +360,12 @@ Region::accelerated_cairorender(Context 
context,cairo_surface_t *surface,int qua
        {
                cairo_paint(subcr);
        }
-       // Draw the region
-       cairo_translate(subcr, tx , ty);
+       // Draw the region      
+       // Calculate new translations after expand the tile
+       const double extx((-workdesc.get_tl()[0]+origin[0])*sx);
+       const double exty((-workdesc.get_tl()[1]+origin[1])*sy);
+
+       cairo_translate(subcr, extx , exty);
        cairo_scale(subcr, sx, sy);
 
        vector<Segment>::const_iterator iter=segments.begin();
@@ -451,10 +455,10 @@ Region::accelerated_cairorender(Context 
context,cairo_surface_t *surface,int qua
                        cairo_surface_destroy(subimage);
                        return false;
                }
-       double px(tl[0]-workdesc.get_tl()[0]);
-       double py(tl[1]-workdesc.get_tl()[1]);
        cairo_save(cr);
-       cairo_set_source_surface(cr, subimage, px, py );
+       const double px(tl[0]-workdesc.get_tl()[0]);
+       const double py(tl[1]-workdesc.get_tl()[1]);
+       cairo_set_source_surface(cr, subimage, -px*sx, -py*sy);
        cairo_paint_with_alpha_operator(cr, get_amount(), get_blend_method());
        cairo_restore(cr);
        cairo_surface_destroy(subimage);
diff --git a/synfig-core/src/synfig/layer_polygon.cpp 
b/synfig-core/src/synfig/layer_polygon.cpp
index ac6d373..ca77307 100644
--- a/synfig-core/src/synfig/layer_polygon.cpp
+++ b/synfig-core/src/synfig/layer_polygon.cpp
@@ -285,8 +285,12 @@ Layer_Polygon::accelerated_cairorender(Context 
context,cairo_surface_t *surface,
                cairo_paint(subcr);
        }
        // Draw the polygon
+       // Calculate new translations after expand the tile
+       const double extx((-workdesc.get_tl()[0]+origin[0])*sx);
+       const double exty((-workdesc.get_tl()[1]+origin[1])*sy);
+       
        cairo_save(subcr);
-       cairo_translate(subcr, tx , ty);
+       cairo_translate(subcr, extx , exty);
        cairo_scale(subcr, sx, sy);
        int i,pointcount=vector_list.size();
        for(i=0;i<pointcount; i++)
@@ -357,9 +361,9 @@ Layer_Polygon::accelerated_cairorender(Context 
context,cairo_surface_t *surface,
                        cairo_surface_destroy(subimage);
                        return false;
                }
-       double px(tl[0]-workdesc.get_tl()[0]);
-       double py(tl[1]-workdesc.get_tl()[1]);
-       cairo_set_source_surface(cr, subimage, px, py );
+       const double px(tl[0]-workdesc.get_tl()[0]);
+       const double py(tl[1]-workdesc.get_tl()[1]);
+       cairo_set_source_surface(cr, subimage, -px*sx, -py*sy);
        cairo_paint_with_alpha_operator(cr, get_amount(), get_blend_method());
        cairo_restore(cr);
        cairo_surface_destroy(subimage);


------------------------------------------------------------------------------
Precog is a next-generation analytics platform capable of advanced
analytics on semi-structured data. The platform includes APIs for building
apps and a phenomenal toolset for data science. Developers can use
our toolset for easy data analysis & visualization. Get a free account!
http://www2.precog.com/precogplatform/slashdotnewsletter
_______________________________________________
Synfig-devl mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/synfig-devl

Reply via email to