[Libreoffice-commits] online.git: Branch 'feature/calc-canvas2' - loleaflet/src

Michael Meeks (via logerrit) logerrit at kemper.freedesktop.org
Wed Sep 16 15:59:56 UTC 2020


 loleaflet/src/layer/tile/CanvasTileLayer.js |   22 +++++++++++++++++-----
 1 file changed, 17 insertions(+), 5 deletions(-)

New commits:
commit 5992dd776f7510912d290763786ca552dd791ac0
Author:     Michael Meeks <michael.meeks at collabora.com>
AuthorDate: Wed Sep 16 16:58:57 2020 +0100
Commit:     Michael Meeks <michael.meeks at collabora.com>
CommitDate: Wed Sep 16 16:58:57 2020 +0100

    tilecombine: should pass back oldwid to save bandwidth.
    
    Don't re-send un-changed tiles that we can detect easily.
    Also avoids some PNG compression / CPU overhead server-side.
    
    Change-Id: Ieca05680d9194e0bfc177b8db338010e5ffafe75

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);
 


More information about the Libreoffice-commits mailing list