xpra icon
Bug tracker and wiki

This bug tracker and wiki are being discontinued
please use https://github.com/Xpra-org/xpra instead.


Ticket #1637: html5-debug-paint.patch

File html5-debug-paint.patch, 3.5 KB (added by Antoine Martin, 4 years ago)

patch to debug paint / draw functions and make the whole process synchronous

  • html5/js/Client.js

     
    10331033                "encoding.client_options"       : true,
    10341034                "encoding.csc_atoms"            : true,
    10351035                "encoding.scrolling"            : true,
    1036                 "encoding.scrolling.min-percent" : 65,
     1036                "encoding.scrolling.min-percent" : 0,
    10371037                "encoding.color-gamut"          : Utilities.getColorGamut(),
    1038                 "encoding.non-scroll"           : ["rgb32"],
     1038                //"encoding.non-scroll"         : ["rgb32", "png", "jpeg"],
     1039                "encoding.non-scroll"           : ["png"],
    10391040                //video stuff:
    10401041                "encoding.video_scaling"        : true,
    10411042                "encoding.full_csc_modes"       : {
     
    19821983
    19831984XpraClient.prototype.request_redraw = function(win) {
    19841985        // request that drawing to screen takes place at next available opportunity if possible
    1985         this._debug("request_redraw for", win);
     1986        console.log("request_redraw for", win, "draw_pending=", this.draw_pending);
    19861987        win.swap_buffers();
    19871988        if(window.requestAnimationFrame) {
    19881989                if (!this.redraw_windows.includes(win)) {
     
    19921993                if (this.draw_pending==0) {
    19931994                        var now = Utilities.monotonicTime();
    19941995                        this.draw_pending = now;
     1996                        for (var i in this.redraw_windows) {
     1997                                //block paints until we redraw:
     1998                                this.redraw_windows[i].paint_pending = now;
     1999                        }
    19952000                        var me = this;
    19962001                        window.requestAnimationFrame(function() {
    1997                                 me._debug("animation frame:", me.redraw_windows.length, "windows to paint");
     2002                                console.log("XZanimation frame:", me.redraw_windows.length, "windows to paint:", me.redraw_windows);
    19982003                                me.draw_pending = 0;
    19992004                                // draw all the windows in the list:
    20002005                                while (me.redraw_windows.length>0) {
    20012006                                        var w = me.redraw_windows.shift();
    20022007                                        w.draw();
     2008                                        w.paint_pending = 0;
    20032009                                }
    20042010                        });
    20052011                }
  • html5/js/Window.js

     
    4343        //enclosing div in page DOM
    4444        this.div = jQuery("#" + String(wid));
    4545
     46        this.counter = 0;
     47       
    4648        //callbacks start null until we finish init:
    4749        this.geometry_cb = null;
    4850        this.mouse_move_cb = null;
     
    11591161 * if we're not already in the process of painting something.
    11601162 */
    11611163XpraWindow.prototype.may_paint_now = function paint() {
    1162         this._debug("may_paint_now() paint pending=", this.paint_pending, ", paint queue length=", this.paint_queue.length);
     1164        console.log("may_paint_now() paint pending=", this.paint_pending, ", paint queue length=", this.paint_queue.length);
    11631165        var now = Utilities.monotonicTime();
    11641166        while ((this.paint_pending==0 || (now-this.paint_pending)>=2000) && this.paint_queue.length>0) {
    11651167                this.paint_pending = now;
     
    11851187        }
    11861188
    11871189XpraWindow.prototype.do_paint = function paint(x, y, width, height, coding, img_data, packet_sequence, rowstride, options, decode_callback) {
    1188         this._debug("do_paint(", img_data.length, " bytes of ", ("zlib" in options?"zlib ":""), coding, " data ", width, "x", height, " at ", x, ",", y, ") focused=", this.focused);
     1190        var counter = this.counter;
     1191        this.counter += 1;
     1192        console.log("do_paint(", img_data.length, " bytes of ", ("zlib" in options?"zlib ":""), coding, " data ", width, "x", height, " at ", x, ",", y, ") focused=", this.focused, ", counter=", counter);
    11891193        var me = this;
    11901194
    11911195        var enc_width = width;
     
    12641268                                        paint_error("invalid image size: "+j.width+"x"+j.height);
    12651269                                }
    12661270                                else {
     1271                                        console.log("loaded", coding, ", for counter=", counter);
    12671272                                        me.offscreen_canvas_ctx.drawImage(j, x, y);
    12681273                                        painted();
    12691274                                }