summaryrefslogtreecommitdiffstats
path: root/flower.c
diff options
context:
space:
mode:
authorKristian Høgsberg <krh@sasori.boston.redhat.com>2009-01-15 12:45:49 -0500
committerKristian Høgsberg <krh@sasori.boston.redhat.com>2009-01-16 06:38:25 -0500
commit3b94998f6ac3c7fdace3a7369beb555dbf81f75c (patch)
treeb1a532d8de1828b0bc8d081cf4b6d4390e883ca7 /flower.c
parentaa68fe346a01c394c90e246dd647e6d0947850f8 (diff)
downloadwayland-3b94998f6ac3c7fdace3a7369beb555dbf81f75c.tar.gz
wayland-3b94998f6ac3c7fdace3a7369beb555dbf81f75c.tar.xz
wayland-3b94998f6ac3c7fdace3a7369beb555dbf81f75c.zip
Randomize flower offset again.
Diffstat (limited to 'flower.c')
-rw-r--r--flower.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/flower.c b/flower.c
index d3a21df..e55433d 100644
--- a/flower.c
+++ b/flower.c
@@ -106,8 +106,8 @@ draw_stuff(int width, int height)
struct flower {
struct wl_compositor *compositor;
struct wl_surface *surface;
- int i;
int x, y, width, height;
+ int offset;
};
static void
@@ -125,8 +125,8 @@ handle_frame(void *data,
struct flower *flower = data;
wl_surface_map(flower->surface,
- flower->x + cos(timestamp / 400.0) * 400 - flower->width / 2,
- flower->y + sin(timestamp / 320.0) * 300 - flower->height / 2,
+ flower->x + cos((flower->offset + timestamp) / 400.0) * 400 - flower->width / 2,
+ flower->y + sin((flower->offset + timestamp) / 320.0) * 300 - flower->height / 2,
flower->width, flower->height);
wl_compositor_commit(flower->compositor, 0);
}
@@ -174,7 +174,7 @@ int main(int argc, char *argv[])
clock_gettime(CLOCK_MONOTONIC, &ts);
srandom(ts.tv_nsec);
- flower.i = ts.tv_nsec;
+ flower.offset = random();
s = draw_stuff(flower.width, flower.height);
buffer = buffer_create_from_cairo_surface(fd, s);