Author: Carlos Lopez <[email protected]>
Date:   Wed Oct  3 22:00:37 2012 +0200

Cairo operators: simplify the Straight method

---

 synfig-core/src/synfig/cairo_operators.cpp |   28 +++++-----------------------
 1 files changed, 5 insertions(+), 23 deletions(-)

diff --git a/synfig-core/src/synfig/cairo_operators.cpp 
b/synfig-core/src/synfig/cairo_operators.cpp
index 42311fd..55b0f60 100644
--- a/synfig-core/src/synfig/cairo_operators.cpp
+++ b/synfig-core/src/synfig/cairo_operators.cpp
@@ -61,32 +61,14 @@ void cairo_paint_with_alpha_operator(cairo_t* acr, float 
alpha, Color::BlendMeth
                {
                        cairo_save(cr);
                        
-                       cairo_surface_t* dest=cairo_get_target(cr);
-                       cairo_surface_flush(dest);
-                       cairo_surface_t* 
destimage=cairo_surface_map_to_image(dest, NULL);
-                       int w=cairo_image_surface_get_width(destimage);
-                       int h=cairo_image_surface_get_height(destimage);
-                       cairo_surface_t* 
newdest=cairo_image_surface_create(CAIRO_FORMAT_ARGB32, w, h);
+                       cairo_set_source_rgba(cr, 1.0, 1.0, 1.0, 1.0-alpha);
+                       cairo_set_operator(cr, CAIRO_OPERATOR_DEST_IN);
+                       cairo_paint(cr);
                        
-                       cairo_t* destcr=cairo_create(newdest);
-                       cairo_set_source_surface(destcr, destimage, 0, 0);
-                       cairo_paint_with_alpha(destcr, 1.0-alpha);
-                       cairo_destroy(destcr);
-                       
-                       destcr=cairo_create(destimage);
-                       cairo_set_source_surface(destcr, newdest, 0, 0);
-                       cairo_set_operator(destcr, CAIRO_OPERATOR_SOURCE);
-                       cairo_paint(destcr);
-                       cairo_destroy(destcr);
-                       
-                       cairo_surface_unmap_image(dest, destimage);
-                       cairo_surface_mark_dirty(dest);
-                       
-                       cairo_surface_destroy(newdest);
                        cairo_restore(cr);
-
+                       
                        cairo_set_operator(cr, CAIRO_OPERATOR_ADD);
-                       cairo_paint_with_alpha(cr, alpha);
+                       cairo_paint_with_alpha(cr, alpha);              
                        break;
                }
                case Color::BLEND_BEHIND:


------------------------------------------------------------------------------
Don't let slow site performance ruin your business. Deploy New Relic APM
Deploy New Relic app performance management and know exactly
what is happening inside your Ruby, Python, PHP, Java, and .NET app
Try New Relic at no cost today and get our sweet Data Nerd shirt too!
http://p.sf.net/sfu/newrelic-dev2dev
_______________________________________________
Synfig-devl mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/synfig-devl

Reply via email to