Author: Carlos Lopez <[email protected]>
Date:   Sat Jul 21 19:31:30 2012 +0200

Rectangle: fix cairorender of alpha inverted rectangle

---

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

diff --git a/synfig-core/src/modules/mod_geometry/rectangle.cpp 
b/synfig-core/src/modules/mod_geometry/rectangle.cpp
index a64f69e..40f5b65 100644
--- a/synfig-core/src/modules/mod_geometry/rectangle.cpp
+++ b/synfig-core/src/modules/mod_geometry/rectangle.cpp
@@ -680,9 +680,19 @@ Rectangle::accelerated_cairorender(Context 
context,cairo_surface_t *surface,int
                        cairo_set_source_rgba(subcr, r, g, b, a);
                        cairo_paint(subcr);
                        // now remove the area of the intersection rectangle
-                       cairo_rectangle(subcr, inter_min[0], inter_min[1], 
inter_max[0]-inter_min[0], inter_max[1]-inter_min[1]);
+                       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 sx(1/pw);
+                       double sy(1/ph);  
+                       cairo_translate(subcr, tx , ty);
+                       cairo_scale(subcr, sx, sy);
+                       cairo_rectangle(subcr, inter_min[0], inter_min[1], 
width, height);
                        cairo_set_operator(subcr, CAIRO_OPERATOR_CLEAR);
-                       cairo_fill(cr);
+                       cairo_fill(subcr);
+                       cairo_restore(subcr);
                        // now let's paint the inverted rectangle with the hole 
on the rendered context 
                        cairo_save(cr);
                        cairo_set_source_surface(cr, subimage, 0, 0);


------------------------------------------------------------------------------
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
[email protected]
https://lists.sourceforge.net/lists/listinfo/synfig-devl

Reply via email to