Author: Carlos Lopez <[email protected]>
Date: Fri Mar 8 18:15:49 2013 +0100
Center and scale properly the rendered image when displayed on Preview Window
---
synfig-studio/src/gui/preview.cpp | 8 ++++++--
1 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/synfig-studio/src/gui/preview.cpp
b/synfig-studio/src/gui/preview.cpp
index 5b110f3..1d16ce5 100644
--- a/synfig-studio/src/gui/preview.cpp
+++ b/synfig-studio/src/gui/preview.cpp
@@ -763,6 +763,8 @@ bool studio::Widget_Preview::redraw(GdkEventExpose */*heh*/)
if (text != _("Fit") & text != "fit")
{
draw_area.set_size_request(nw, nh);
+ dw = draw_area.get_width();
+ dh = draw_area.get_height();
}
//synfig::info("Now to draw to the window...");
@@ -790,7 +792,7 @@ bool studio::Widget_Preview::redraw(GdkEventExpose */*heh*/)
cr, //cairo context
pxnew, //pixbuf
//coordinates to place center of the preview window
- (draw_area.get_width() - nw) / 2,
(draw_area.get_height() - nh) / 2
+ (dw - nw) / 2, (dh - nh) / 2
);
cr->paint();
cr->restore();
@@ -798,7 +800,9 @@ bool studio::Widget_Preview::redraw(GdkEventExpose */*heh*/)
else
{
cr->save();
- cairo_set_source_surface(cr->cobj(), cs, 0, 0);
+ cr->scale(sx, sx);
+ cairo_set_source_surface(cr->cobj(), cs, (dw - nw)/(2*sx), (dh
- nh)/(2*sx));
+ cairo_pattern_set_filter(cairo_get_source(cr->cobj()),
CAIRO_FILTER_NEAREST);
cairo_surface_destroy(cs);
cr->paint();
cr->restore();
------------------------------------------------------------------------------
Symantec Endpoint Protection 12 positioned as A LEADER in The Forrester
Wave(TM): Endpoint Security, Q1 2013 and "remains a good choice" in the
endpoint security space. For insight on selecting the right partner to
tackle endpoint security challenges, access the full report.
http://p.sf.net/sfu/symantec-dev2dev
_______________________________________________
Synfig-devl mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/synfig-devl