Author: Carlos Lopez <[email protected]>
Date:   Tue Nov 20 22:03:24 2012 +0100

Cairo Operators: complete the OVERLAY method using properly the right context 
pixels when blending the source pattern with the context. Now it renders fine.

---

 synfig-core/src/synfig/cairo_operators.cpp |   13 +++++++++++--
 1 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/synfig-core/src/synfig/cairo_operators.cpp 
b/synfig-core/src/synfig/cairo_operators.cpp
index 855cef1..667da2d 100644
--- a/synfig-core/src/synfig/cairo_operators.cpp
+++ b/synfig-core/src/synfig/cairo_operators.cpp
@@ -199,13 +199,22 @@ void cairo_paint_with_alpha_operator(cairo_t* acr, float 
alpha, Color::BlendMeth
                        assert(cdest.map_cairo_image());
                        assert(csource.map_cairo_image());
                        
+                       double x1, y1, x2, y2, x0, y0;
+                       cairo_clip_extents(cr, &x1, &y1, &x2, &y2);
+                       cairo_user_to_device(cr, &x1, &y1);
+                       cairo_user_to_device(cr, &x2, &y2);
+                       x0=x2<x1?x2:x1;
+                       y0=y2<y1?y2:y1;
+
                        int w=csource.get_w();
                        int h=csource.get_h();
-                       
+                       int h0=(int)y0;
+                       int w0=(int)x0;
+                                                                       
                        for(int y=0;y<h;y++)
                                for(int x=0;x<w;x++)
                                {
-                                       
csource[y][x]=CairoColor::blend(csource[y][x], cdest[y][x], alpha,      method);
+                                       
csource[y][x]=CairoColor::blend(csource[y][x], cdest[h0+y][w0+x], alpha,        
method);
                                }
                        csource.unmap_cairo_image();
                        cdest.unmap_cairo_image();


------------------------------------------------------------------------------
Monitor your physical, virtual and cloud infrastructure from a single
web console. Get in-depth insight into apps, servers, databases, vmware,
SAP, cloud infrastructure, etc. Download 30-day Free Trial.
Pricing starts from $795 for 25 servers or applications!
http://p.sf.net/sfu/zoho_dev2dev_nov
_______________________________________________
Synfig-devl mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/synfig-devl

Reply via email to