diff options
author | Michael Meeks <michael.meeks@collabora.com> | 2020-09-16 16:58:57 +0100 |
---|---|---|
committer | Michael Meeks <michael.meeks@collabora.com> | 2020-09-16 16:58:57 +0100 |
commit | 5992dd776f7510912d290763786ca552dd791ac0 (patch) | |
tree | 5275be9249f84792c7204027896286c3619112e1 | |
parent | 3bd84922ecf9ab86179b23168866e214baa240da (diff) |
tilecombine: should pass back oldwid to save bandwidth.feature/calc-canvas2
Don't re-send un-changed tiles that we can detect easily.
Also avoids some PNG compression / CPU overhead server-side.
Change-Id: Ieca05680d9194e0bfc177b8db338010e5ffafe75
-rw-r--r-- | loleaflet/src/layer/tile/CanvasTileLayer.js | 22 |
1 files changed, 17 insertions, 5 deletions
diff --git a/loleaflet/src/layer/tile/CanvasTileLayer.js b/loleaflet/src/layer/tile/CanvasTileLayer.js index e814acaec..aa4222562 100644 --- a/loleaflet/src/layer/tile/CanvasTileLayer.js +++ b/loleaflet/src/layer/tile/CanvasTileLayer.js @@ -834,6 +834,7 @@ L.CanvasTileLayer = L.TileLayer.extend({ var tilePositionsX = ''; var tilePositionsY = ''; + var tileWids = ''; for (i = 0; i < queue.length; i++) { coords = queue[i]; @@ -878,6 +879,7 @@ L.CanvasTileLayer = L.TileLayer.extend({ } } + console.debug('Crass code duplication here in _updateOnChangePart'); // FIXME. if (tilePositionsX !== '' && tilePositionsY !== '') { var message = 'tilecombine ' + 'nviewid=0 ' + @@ -886,8 +888,9 @@ L.CanvasTileLayer = L.TileLayer.extend({ 'height=' + this._tileHeightPx + ' ' + 'tileposx=' + tilePositionsX + ' ' + 'tileposy=' + tilePositionsY + ' ' + + 'wid=' + tileWids + ' ' + 'tilewidth=' + this._tileWidthTwips + ' ' + - 'tileheight=' + this._tileHeightTwips; + 'tileheight=' + this._tileHeightTwips; this._map._socket.sendMessage(message, ''); } @@ -971,6 +974,7 @@ L.CanvasTileLayer = L.TileLayer.extend({ // save tile in cache this._tiles[key] = { el: tile, + wid: 0, coords: coords, current: true }; @@ -1062,19 +1066,25 @@ L.CanvasTileLayer = L.TileLayer.extend({ rectQueue = rectangles[r]; var tilePositionsX = ''; var tilePositionsY = ''; + var tileWids = ''; for (i = 0; i < rectQueue.length; i++) { coords = rectQueue[i]; + key = this._tileCoordsToKey(coords); + twips = this._coordsToTwips(coords); - if (tilePositionsX !== '') { + if (tilePositionsX !== '') tilePositionsX += ','; - } tilePositionsX += twips.x; - if (tilePositionsY !== '') { + if (tilePositionsY !== '') tilePositionsY += ','; - } tilePositionsY += twips.y; + + tile = this._tiles[this._tileCoordsToKey(coords)]; + if (tileWids !== '') + tileWids += ','; + tileWids += tile && tile.wireId !== undefined ? tile.wireId : 0; } twips = this._coordsToTwips(coords); @@ -1085,6 +1095,7 @@ L.CanvasTileLayer = L.TileLayer.extend({ 'height=' + this._tileHeightPx + ' ' + 'tileposx=' + tilePositionsX + ' ' + 'tileposy=' + tilePositionsY + ' ' + + 'oldwid=' + tileWids + ' ' + 'tilewidth=' + this._tileWidthTwips + ' ' + 'tileheight=' + this._tileHeightTwips; this._map._socket.sendMessage(msg, ''); @@ -1295,6 +1306,7 @@ L.CanvasTileLayer = L.TileLayer.extend({ this._tiles[key]._invalidCount -= 1; } tile.el.src = img; + tile.wireId = tileMsgObj.wireId; } L.Log.log(textMsg, 'INCOMING', key); |