Author: Carlos Lopez <genet...@gmail.com>
Date:   Tue Aug 21 18:38:39 2012 +0200

Zoom layer: add support for Cairo render.

---

 synfig-core/src/modules/lyr_std/zoom.cpp |   19 +++++++++++++++++++
 synfig-core/src/modules/lyr_std/zoom.h   |    1 +
 2 files changed, 20 insertions(+), 0 deletions(-)

diff --git a/synfig-core/src/modules/lyr_std/zoom.cpp 
b/synfig-core/src/modules/lyr_std/zoom.cpp
index 430e5c6..b8a8bcb 100644
--- a/synfig-core/src/modules/lyr_std/zoom.cpp
+++ b/synfig-core/src/modules/lyr_std/zoom.cpp
@@ -157,6 +157,25 @@ Zoom::accelerated_render(Context context,Surface 
*surface,int quality, const Ren
        return context.accelerated_render(surface,quality,desc,cb);
 }
 
+/////
+bool
+Zoom::accelerated_cairorender(Context context,cairo_surface_t *surface,int 
quality, const RendDesc &renddesc, ProgressCallback *cb)const
+{
+       Vector::value_type zoomfactor=1.0/exp(amount);
+       RendDesc desc(renddesc);
+       desc.clear_flags();
+       
+    // Adjust the top_left and bottom_right points
+       // for our zoom amount
+       desc.set_tl((desc.get_tl()-center)*zoomfactor+center);
+       desc.set_br((desc.get_br()-center)*zoomfactor+center);
+       
+       // Render the scene
+       return context.accelerated_cairorender(surface,quality,desc,cb);
+}
+/////
+
+
 synfig::Rect
 Zoom::get_full_bounding_rect(synfig::Context context)const
 {
diff --git a/synfig-core/src/modules/lyr_std/zoom.h 
b/synfig-core/src/modules/lyr_std/zoom.h
index aaced17..e1654a1 100644
--- a/synfig-core/src/modules/lyr_std/zoom.h
+++ b/synfig-core/src/modules/lyr_std/zoom.h
@@ -56,6 +56,7 @@ public:
        virtual ValueBase get_param(const String & param)const;
        virtual Color get_color(Context context, const Point &pos)const;
        virtual bool accelerated_render(Context context,Surface *surface,int 
quality, const RendDesc &renddesc, ProgressCallback *cb)const;
+       virtual bool accelerated_cairorender(Context context,cairo_surface_t 
*surface,int quality, const RendDesc &renddesc, ProgressCallback *cb)const;
        synfig::Layer::Handle hit_check(synfig::Context context, const 
synfig::Point &point)const;
        virtual Vocab get_param_vocab()const;
        virtual synfig::Rect get_full_bounding_rect(synfig::Context 
context)const;


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

Reply via email to