[retro-gtk/wip/aplazas/try-fix-tearing] cairo-display: Draw on tick callback



commit dbf6133052dc70d09060abef91151f82b2c2a8be
Author: Adrien Plazas <kekun plazas laposte net>
Date:   Wed May 17 05:58:17 2017 +0200

    cairo-display: Draw on tick callback

 retro-gtk/video/cairo-display.vala |   15 ++++++++++-----
 1 files changed, 10 insertions(+), 5 deletions(-)
---
diff --git a/retro-gtk/video/cairo-display.vala b/retro-gtk/video/cairo-display.vala
index ba1fb6b..1ddf323 100644
--- a/retro-gtk/video/cairo-display.vala
+++ b/retro-gtk/video/cairo-display.vala
@@ -17,8 +17,13 @@ public class Retro.CairoDisplay : Gtk.DrawingArea {
                filter = VideoFilter.SMOOTH;
                show_surface = true;
 
-               notify["sensitive"].connect (queue_draw);
-               notify["pixbuf"].connect (queue_draw);
+               add_tick_callback (() => {
+                       queue_draw ();
+
+                       return true;
+               });
+//             notify["sensitive"].connect (queue_draw);
+//             notify["pixbuf"].connect (queue_draw);
        }
 
        [CCode (cname = "gdk_pixbuf_new_from_video")]
@@ -34,7 +39,7 @@ public class Retro.CairoDisplay : Gtk.DrawingArea {
 
        public void set_filter (VideoFilter filter) {
                this.filter = filter;
-               queue_draw ();
+//             queue_draw ();
        }
 
        private void on_video_output (uint8[] data, uint width, uint height, size_t pitch, PixelFormat 
pixel_format, float aspect_ratio) {
@@ -51,12 +56,12 @@ public class Retro.CairoDisplay : Gtk.DrawingArea {
 
        public void show_video () {
                show_surface = true;
-               queue_draw ();
+//             queue_draw ();
        }
 
        public void hide_video () {
                show_surface = false;
-               queue_draw ();
+//             queue_draw ();
        }
 
        public override bool draw (Cairo.Context cr) {


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]