[Libreoffice-commits] online.git: 2 commits - loleaflet/src

Michael Meeks (via logerrit) logerrit at kemper.freedesktop.org
Thu Sep 17 19:35:10 UTC 2020


 loleaflet/src/layer/tile/CanvasTileLayer.js |   24 ++++++++++++++++++------
 1 file changed, 18 insertions(+), 6 deletions(-)

New commits:
commit 058835d0dcd71fc6aca066e7c6e9facedde83f61
Author:     Michael Meeks <michael.meeks at collabora.com>
AuthorDate: Wed Sep 16 16:58:57 2020 +0100
Commit:     Jan Holesovsky <kendy at collabora.com>
CommitDate: Thu Sep 17 21:35:00 2020 +0200

    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
    Reviewed-on: https://gerrit.libreoffice.org/c/online/+/102954
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>
    Reviewed-by: Jan Holesovsky <kendy at collabora.com>

diff --git a/loleaflet/src/layer/tile/CanvasTileLayer.js b/loleaflet/src/layer/tile/CanvasTileLayer.js
index 435525793..15d813939 100644
--- a/loleaflet/src/layer/tile/CanvasTileLayer.js
+++ b/loleaflet/src/layer/tile/CanvasTileLayer.js
@@ -902,6 +902,7 @@ L.CanvasTileLayer = L.TileLayer.extend({
 
 			var tilePositionsX = '';
 			var tilePositionsY = '';
+			var tileWids = '';
 
 			for (i = 0; i < queue.length; i++) {
 				coords = queue[i];
@@ -946,6 +947,7 @@ L.CanvasTileLayer = L.TileLayer.extend({
 				}
 			}
 
+			// FIXME console.debug('Crass code duplication here in _updateOnChangePart');
 			if (tilePositionsX !== '' && tilePositionsY !== '') {
 				var message = 'tilecombine ' +
 					'nviewid=0 ' +
@@ -954,8 +956,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, '');
 			}
@@ -1039,6 +1042,7 @@ L.CanvasTileLayer = L.TileLayer.extend({
 					// save tile in cache
 					this._tiles[key] = {
 						el: tile,
+						wid: 0,
 						coords: coords,
 						current: true
 					};
@@ -1130,19 +1134,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);
@@ -1153,6 +1163,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, '');
@@ -1363,6 +1374,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);
 
commit 869bee93cf948e06f9c1f3d0d2ec4736f818a670
Author:     Michael Meeks <michael.meeks at collabora.com>
AuthorDate: Wed Sep 16 15:40:49 2020 +0100
Commit:     Jan Holesovsky <kendy at collabora.com>
CommitDate: Thu Sep 17 21:34:51 2020 +0200

    calc canvas: use the right canvas size in core pixels to clear.
    
    Change-Id: I058cabd4daa51eb7da1f1ee33e59464692f00331
    Reviewed-on: https://gerrit.libreoffice.org/c/online/+/102953
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>
    Reviewed-by: Jan Holesovsky <kendy at collabora.com>

diff --git a/loleaflet/src/layer/tile/CanvasTileLayer.js b/loleaflet/src/layer/tile/CanvasTileLayer.js
index b9700987c..435525793 100644
--- a/loleaflet/src/layer/tile/CanvasTileLayer.js
+++ b/loleaflet/src/layer/tile/CanvasTileLayer.js
@@ -135,7 +135,7 @@ L.CanvasTilePainter = L.Class.extend({
 			this._canvasCtx.fillStyle = 'rgba(255, 0, 0, 0.5)';
 		else
 			this._canvasCtx.fillStyle = 'white';
-		this._canvasCtx.fillRect(0, 0, this._width, this._height);
+		this._canvasCtx.fillRect(0, 0, this._pixWidth, this._pixHeight);
 	},
 
 	// Details of tile areas to render


More information about the Libreoffice-commits mailing list