X-Git-Url: https://www.fi.muni.cz/~kas/git//home/kas/public_html/git/?a=blobdiff_plain;ds=sidebyside;f=shell%2Fev-transition-animation.c;h=028a36c9b0254ac504f87db0e8c17bf1e6efa9a6;hb=a228d600b794b4cb081e372b2d356897fb956196;hp=e2bc323444849a6430fe9f8cccee81540367fcd1;hpb=1d75fddea8eab6fa418fd6ff7434462e121d69f4;p=evince.git diff --git a/shell/ev-transition-animation.c b/shell/ev-transition-animation.c index e2bc3234..028a36c9 100644 --- a/shell/ev-transition-animation.c +++ b/shell/ev-transition-animation.c @@ -282,6 +282,148 @@ ev_transition_animation_split (cairo_t *cr, } } +static void +ev_transition_animation_blinds (cairo_t *cr, + EvTransitionAnimation *animation, + EvTransitionEffect *effect, + gdouble progress, + GdkRectangle page_area) +{ + EvTransitionAnimationPriv *priv; + EvTransitionEffectAlignment alignment; + gint width, height, i; + + priv = EV_TRANSITION_ANIMATION_GET_PRIVATE (animation); + width = page_area.width; + height = page_area.height; + + g_object_get (effect, + "alignment", &alignment, + NULL); + + paint_surface (cr, priv->origin_surface, 0, 0, 0, page_area); + + for (i = 0; i < N_BLINDS; i++) { + cairo_save (cr); + + if (alignment == EV_TRANSITION_ALIGNMENT_HORIZONTAL) { + cairo_rectangle (cr, + 0, + height / N_BLINDS * i, + width, + height / N_BLINDS * progress); + } else { + cairo_rectangle (cr, + width / N_BLINDS * i, + 0, + width / N_BLINDS * progress, + height); + } + + cairo_clip (cr); + paint_surface (cr, priv->dest_surface, 0, 0, 0, page_area); + cairo_restore (cr); + } +} + +static void +ev_transition_animation_box (cairo_t *cr, + EvTransitionAnimation *animation, + EvTransitionEffect *effect, + gdouble progress, + GdkRectangle page_area) +{ + EvTransitionAnimationPriv *priv; + EvTransitionEffectDirection direction; + gint width, height; + + priv = EV_TRANSITION_ANIMATION_GET_PRIVATE (animation); + width = page_area.width; + height = page_area.height; + + g_object_get (effect, + "direction", &direction, + NULL); + + if (direction == EV_TRANSITION_DIRECTION_INWARD) { + paint_surface (cr, priv->dest_surface, 0, 0, 0, page_area); + + cairo_rectangle (cr, + width * progress / 2, + height * progress / 2, + width * (1 - progress), + height * (1 - progress)); + 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); + + cairo_rectangle (cr, + (width / 2) - (width * progress / 2), + (height / 2) - (height * progress / 2), + width * progress, + height * progress); + cairo_clip (cr); + + paint_surface (cr, priv->dest_surface, 0, 0, 0, page_area); + } +} + +static void +ev_transition_animation_wipe (cairo_t *cr, + EvTransitionAnimation *animation, + EvTransitionEffect *effect, + gdouble progress, + GdkRectangle page_area) +{ + EvTransitionAnimationPriv *priv; + gint width, height; + gint angle; + + priv = EV_TRANSITION_ANIMATION_GET_PRIVATE (animation); + width = page_area.width; + height = page_area.height; + + g_object_get (effect, + "angle", &angle, + NULL); + + paint_surface (cr, priv->origin_surface, 0, 0, 0, page_area); + + if (angle == 0) { + /* left to right */ + cairo_rectangle (cr, + 0, 0, + width * progress, + height); + } else if (angle <= 90) { + /* bottom to top */ + cairo_rectangle (cr, + 0, + height * (1 - progress), + width, + height * progress); + } else if (angle <= 180) { + /* right to left */ + cairo_rectangle (cr, + width * (1 - progress), + 0, + width * progress, + height); + } else if (angle <= 270) { + /* top to bottom */ + cairo_rectangle (cr, + 0, 0, + width, + height * progress); + } + + cairo_clip (cr); + + paint_surface (cr, priv->dest_surface, 0, 0, 0, page_area); +} + void ev_transition_animation_paint (EvTransitionAnimation *animation, cairo_t *cr, @@ -311,6 +453,15 @@ ev_transition_animation_paint (EvTransitionAnimation *animation, case EV_TRANSITION_EFFECT_SPLIT: ev_transition_animation_split (cr, animation, priv->effect, progress, page_area); break; + case EV_TRANSITION_EFFECT_BLINDS: + ev_transition_animation_blinds (cr, animation, priv->effect, progress, page_area); + break; + case EV_TRANSITION_EFFECT_BOX: + ev_transition_animation_box (cr, animation, priv->effect, progress, page_area); + break; + case EV_TRANSITION_EFFECT_WIPE: + ev_transition_animation_wipe (cr, animation, priv->effect, progress, page_area); + break; default: { GEnumValue *enum_value;