X-Git-Url: http://git.cascardo.eti.br/?a=blobdiff_plain;f=gdk.c;h=d364a279d8a318876a804a8475447d502019c105;hb=dacb100ef24f4c8ad4de8de0d7368c0d9e32cabb;hp=541fbe51f9c22b25b7f2c2810ae406fea4c1665c;hpb=043f2ad468fbdfb5b4ccbcb09f6bc2e430947fae;p=cascardo%2Fmovie.git diff --git a/gdk.c b/gdk.c index 541fbe5..d364a27 100644 --- a/gdk.c +++ b/gdk.c @@ -50,7 +50,9 @@ expose (GtkWidget *widget, GdkEventExpose *event, gpointer data) GdkPixbuf *screen; struct ctx *ctx; Point point; + int w, h; ctx = (struct ctx *) data; + gdk_drawable_get_size (GDK_DRAWABLE (event->window), &w, &h); if (ctx->move) ctx->i = (ctx->i >= ctx->points->len) ? 0 : ctx->i + 1; point = g_array_index (ctx->points, Point, ctx->i); @@ -58,23 +60,30 @@ expose (GtkWidget *widget, GdkEventExpose *event, gpointer data) event->area.width, event->area.height); gdk_pixbuf_scale (ctx->picture, screen, 0, 0, event->area.width, event->area.height, - -point.x + event->area.width/2, -point.y + event->area.height/2, - 1.0, 1.0, GDK_INTERP_HYPER); - gdk_draw_pixbuf (widget->window, NULL, screen, 0, 0, 0, 0, -1, -1, + -point.x + w/2 - event->area.x, + -point.y + h/2 - event->area.y, + point.rx, point.ry, GDK_INTERP_BILINEAR); + gdk_draw_pixbuf (widget->window, NULL, screen, 0, 0, + event->area.x, event->area.y, + event->area.width, event->area.height, GDK_RGB_DITHER_NONE, 0, 0); gdk_pixbuf_unref (screen); if (point.name) { - g_timeout_add (3000, queue, ctx); + if (ctx->move) + g_timeout_add (3000, queue, ctx); } else { - g_timeout_add (10, queue, ctx); + if (ctx->move) + g_timeout_add (10, queue, ctx); } ctx->move = FALSE; return FALSE; } +#define FPF 40 + int main (int argc, char **argv) { @@ -91,6 +100,8 @@ main (int argc, char **argv) else filename = argv[1]; ctx.points = ReadPoints ("pro-gnu"); + ctx.points = drop_dup_frames (ctx.points, FPF); + rescale_points (ctx.points, get_scales (FPF)); ctx.picture = gdk_pixbuf_new_from_file (filename, NULL); ctx.i = ctx.points->len; colorspace = gdk_pixbuf_get_colorspace (ctx.picture);