aboutsummaryrefslogtreecommitdiff
path: root/src/layout.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/layout.c')
-rw-r--r--src/layout.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/src/layout.c b/src/layout.c
index 92e6469..3ebbcce 100644
--- a/src/layout.c
+++ b/src/layout.c
@@ -5,6 +5,7 @@
#include "any_log.h"
#include "layout.h"
+#include "effect.h"
void layout_init(layout_t *layout, block_t *block, layout_info_t info)
{
@@ -73,6 +74,22 @@ void layout_init(layout_t *layout, block_t *block, layout_info_t info)
void layout_render(layout_t *layout, cairo_t *cr)
{
+ effect_t *effect = layout->block->effect;
+ if (effect != NULL) {
+ struct timespec now;
+ timespec_get(&now, TIME_UTC);
+
+ if (timespec_zero(effect->start))
+ effect->start = now;
+ else if (timespec_greater(now, timespec_add(effect->start, effect->duration)))
+ layout->block->effect = NULL;
+ }
+
+ // Pre-processing effects
+ if (effect != NULL && effect->pre != NULL) {
+ effect->pre(effect, layout, cr);
+ }
+
double degree = M_PI / 180.0;
int radius = layout->height / 2 - layout->y_padding;
int line_radius = radius - layout->block->line_width / 2;
@@ -117,6 +134,14 @@ void layout_render(layout_t *layout, cairo_t *cr)
pango_cairo_update_layout(cr, layout->pl);
pango_cairo_show_layout(cr, layout->pl);
}
+
+ // Post-processing effects
+ if (effect != NULL && effect->post != NULL) {
+ effect->post(effect, layout, cr);
+ }
+
+ if (layout->block->effect == NULL && effect != NULL)
+ effect_free(effect);
}
void layout_free(layout_t *layout)