Fix broken markup in Finnish user docs translation
[empathy-mirror.git] / src / empathy-rounded-effect.c
blob0c9e6d1d2b01e72857604449d23f59ae98511329
1 /*
2 * empathy-rounded-effect.c - Source for EmpathyRoundedEffect
3 * Copyright (C) 2011 Collabora Ltd.
4 * @author Emilio Pozuelo Monfort <emilio.pozuelo@collabora.co.uk>
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
21 #include "config.h"
22 #include "empathy-rounded-effect.h"
24 G_DEFINE_TYPE (EmpathyRoundedEffect,
25 empathy_rounded_effect,
26 CLUTTER_TYPE_EFFECT)
28 static void
29 empathy_rounded_effect_paint (ClutterEffect *effect,
30 ClutterEffectPaintFlags flags)
32 EmpathyRoundedEffect *self = EMPATHY_ROUNDED_EFFECT (effect);
33 ClutterActor *actor;
34 ClutterActorBox allocation = { 0, };
35 gfloat width, height;
37 actor = clutter_actor_meta_get_actor (CLUTTER_ACTOR_META (self));
38 clutter_actor_get_allocation_box (actor, &allocation);
39 clutter_actor_box_get_size (&allocation, &width, &height);
41 cogl_path_new ();
43 /* Create and store a path describing a rounded rectangle. The small
44 * size of the preview window makes the radius of the rounded corners
45 * very small too, so we can safely use a very coarse angle step
46 * without loosing rendering accuracy. It also significantly reduces
47 * the time spent in the underlying internal cogl path functions */
48 cogl_path_round_rectangle (0, 0, width, height, height / 16., 15);
50 cogl_clip_push_from_path ();
52 /* Flip */
53 cogl_push_matrix ();
54 cogl_translate (width, 0, 0);
55 cogl_scale (-1, 1, 1);
57 clutter_actor_continue_paint (actor);
59 cogl_pop_matrix ();
60 cogl_clip_pop ();
63 static void
64 empathy_rounded_effect_init (EmpathyRoundedEffect *self)
68 static void
69 empathy_rounded_effect_class_init (EmpathyRoundedEffectClass *klass)
71 ClutterEffectClass *effect_class = CLUTTER_EFFECT_CLASS (klass);
73 effect_class->paint = empathy_rounded_effect_paint;
76 ClutterEffect *
77 empathy_rounded_effect_new (void)
79 return CLUTTER_EFFECT (
80 g_object_new (EMPATHY_TYPE_ROUNDED_EFFECT, NULL));