Author: Carlos Lopez <genet...@gmail.com>
Date:   Thu Nov  8 21:21:48 2012 +0100

Layer_Shade: now inverted shades and/or with amount > 1.0 are rendered 
correctly.

---

 synfig-core/src/modules/lyr_std/shade.cpp |    7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/synfig-core/src/modules/lyr_std/shade.cpp 
b/synfig-core/src/modules/lyr_std/shade.cpp
index b0529f2..d1b0813 100644
--- a/synfig-core/src/modules/lyr_std/shade.cpp
+++ b/synfig-core/src/modules/lyr_std/shade.cpp
@@ -521,8 +521,10 @@ Layer_Shade::accelerated_cairorender(Context 
context,cairo_surface_t *surface,in
                for(x=0;x<workdesc.get_w();x++)
                {
                        float a=blurred[y][x];
+                       if(invert)
+                               a=1.0-a;
                        ccolor.set_a(a*am);
-                       ccolor.clamped();
+                       ccolor=ccolor.clamped();
                        
cairoworksurface[y][x]=CairoColor(ccolor).premult_alpha();
                }
        
@@ -531,8 +533,7 @@ Layer_Shade::accelerated_cairorender(Context 
context,cairo_surface_t *surface,in
        // Now lets blend the result in the output surface
        cairo_t *cr=cairo_create(surface);
        cairo_set_source_surface(cr, worksurface, 
-halfsizex+(origin_u<0?origin_u:0)-origin_u, 
-halfsizey+(origin_v<0?origin_v:0)-origin_v);
-       cairo_set_operator(cr, CAIRO_OPERATOR_OVER); // TODO this has to be the 
real operator
-       cairo_paint(cr); // not need to paint with alpha because it is already 
included
+       cairo_paint_with_alpha_operator(cr, 1.0, get_blend_method()); // TODO: 
add cairo_paint_opertor function when alpha=1.0 (it is quicker)
        cairo_destroy(cr);
        
        cairo_surface_destroy(worksurface);


------------------------------------------------------------------------------
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
Synfig-devl@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/synfig-devl

Reply via email to