From 7797d56436068b54cb3617f85f8e1c19920b9c8d Mon Sep 17 00:00:00 2001 From: Pascal Terjan Date: Mon, 7 Dec 2009 17:06:04 +0000 Subject: [PATCH] * Bind dirty rectangle functions --- ruby/caca-canvas.c | 56 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) diff --git a/ruby/caca-canvas.c b/ruby/caca-canvas.c index f46985f..61fef0c 100644 --- a/ruby/caca-canvas.c +++ b/ruby/caca-canvas.c @@ -633,6 +633,52 @@ get_singleton_double_list(import) /****/ +simple_func(disable_dirty_rect) +simple_func(enable_dirty_rect) +get_int(dirty_rect_count) + +static VALUE dirty_rect(VALUE self, VALUE n) +{ + int x, y, width, height; + VALUE ary; + ary = rb_ary_new(); + caca_get_dirty_rect(_SELF, NUM2INT(n), &x, &y, &width, &height); + rb_ary_push(ary, INT2NUM(x)); + rb_ary_push(ary, INT2NUM(y)); + rb_ary_push(ary, INT2NUM(width)); + rb_ary_push(ary, INT2NUM(height)); + return ary; +} + +static VALUE dirty_rects(VALUE self) +{ + int n = caca_get_dirty_rect_count(_SELF), i; + VALUE ary; + ary = rb_ary_new(); + for(i=0; i