]> www.fi.muni.cz Git - evince.git/commitdiff
Implement "split" effect.
authorCarlos Garnacho <carlosg@gnome.org>
Fri, 4 Jan 2008 20:26:33 +0000 (20:26 +0000)
committerCarlos Garnacho <carlosg@src.gnome.org>
Fri, 4 Jan 2008 20:26:33 +0000 (20:26 +0000)
2008-01-04  Carlos Garnacho  <carlosg@gnome.org>

        * shell/ev-transition-animation.c (ev_transition_animation_split)
        (ev_transition_animation_paint): Implement "split" effect.

svn path=/trunk/; revision=2801

ChangeLog
shell/ev-transition-animation.c

index c82fc3c0519fce4124e455dd1462e3429b70272e..0fd0c80ffc66701086f7abcd6d8e103eb9160db8 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2008-01-04  Carlos Garnacho  <carlosg@gnome.org>
+
+       * shell/ev-transition-animation.c (ev_transition_animation_split)
+       (ev_transition_animation_paint): Implement "split" effect.
+
 2008-01-04  Carlos Garnacho  <carlosg@gnome.org>
 
        * shell/ev-view-private.h: Add a EvTransitionAnimation to the struct.
index 13c8f01c9de89b4d2255135d843fa26392c6b07f..e2bc323444849a6430fe9f8cccee81540367fcd1 100644 (file)
@@ -217,6 +217,71 @@ paint_surface (cairo_t         *cr,
        cairo_restore (cr);
 }
 
+/* animations */
+static void
+ev_transition_animation_split (cairo_t               *cr,
+                              EvTransitionAnimation *animation,
+                              EvTransitionEffect    *effect,
+                              gdouble                progress,
+                              GdkRectangle           page_area)
+{
+       EvTransitionAnimationPriv *priv;
+       EvTransitionEffectAlignment alignment;
+       EvTransitionEffectDirection direction;
+       gint width, height;
+
+       priv = EV_TRANSITION_ANIMATION_GET_PRIVATE (animation);
+       width = page_area.width;
+       height = page_area.height;
+
+       g_object_get (effect,
+                     "alignment", &alignment,
+                     "direction", &direction,
+                     NULL);
+
+       if (direction == EV_TRANSITION_DIRECTION_INWARD) {
+               paint_surface (cr, priv->dest_surface, 0, 0, 0, page_area);
+
+               if (alignment == EV_TRANSITION_ALIGNMENT_HORIZONTAL) {
+                       cairo_rectangle (cr,
+                                        0,
+                                        height * progress / 2,
+                                        width,
+                                        height * (1 - progress));
+               } else {
+                       cairo_rectangle (cr,
+                                        width * progress / 2,
+                                        0,
+                                        width * (1 - progress),
+                                        height);
+               }
+
+               cairo_clip (cr);
+
+               paint_surface (cr, priv->origin_surface, 0, 0, 0, page_area);
+       } else {
+               paint_surface (cr, priv->origin_surface, 0, 0, 0, page_area);
+
+               if (alignment == EV_TRANSITION_ALIGNMENT_HORIZONTAL) {
+                       cairo_rectangle (cr,
+                                        0,
+                                        (height / 2) - (height * progress / 2),
+                                        width,
+                                        height * progress);
+               } else {
+                       cairo_rectangle (cr,
+                                        (width / 2) - (width * progress / 2),
+                                        0,
+                                        width * progress,
+                                        height);
+               }
+
+               cairo_clip (cr);
+
+               paint_surface (cr, priv->dest_surface, 0, 0, 0, page_area);
+       }
+}
+
 void
 ev_transition_animation_paint (EvTransitionAnimation *animation,
                               cairo_t               *cr,
@@ -243,6 +308,9 @@ ev_transition_animation_paint (EvTransitionAnimation *animation,
                /* just paint the destination slide */
                paint_surface (cr, priv->dest_surface, 0, 0, 0, page_area);
                break;
+       case EV_TRANSITION_EFFECT_SPLIT:
+               ev_transition_animation_split (cr, animation, priv->effect, progress, page_area);
+               break;
        default: {
                GEnumValue *enum_value;