From 399afd123ff81f70bc5c3e4e653db8ed731acef4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Caol=C3=A1n=20McNamara?= Date: Wed, 8 May 2024 13:06:09 +0100 Subject: [PATCH] tile.canvas is always true after a successful _ensureContext(tile) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit _applyDelta returns early if the initial "ensureContext" of the tile fails. i.e. var ctx = this._ensureContext(tile); if (!ctx) // out of canvas / texture memory. return; and ensureContext already calls ensureCanvas, so tile.canvas is always true in the remainder of this function. The "defer constructing the image & applying these deltas until the tile is rendered via ensureCanvas." implied a sort of deliberate optimization to wait until render time to apply the delta which doesn't actually exist. Also move the stray "// 'Uint8Array' delta" comment back to where it originally came from as documentation of the type of the param, as in commit 4140bf87417f4aa99780fc3d6c0438d4d469a53a Date: Sat Nov 6 11:11:13 2021 +0000 Bring back the delta application JS from the 6.4 branch. ... _applyDelta: function(tile, delta) { // 'Uint8Array' delta ... Signed-off-by: Caolán McNamara Change-Id: If15a897c3251f28639c9f1112687e543421e457d --- browser/src/layer/tile/CanvasTileLayer.js | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/browser/src/layer/tile/CanvasTileLayer.js b/browser/src/layer/tile/CanvasTileLayer.js index 0b1fe5f779..f6695f02a3 100644 --- a/browser/src/layer/tile/CanvasTileLayer.js +++ b/browser/src/layer/tile/CanvasTileLayer.js @@ -6738,6 +6738,8 @@ L.CanvasTileLayer = L.Layer.extend({ }, _applyDelta: function(tile, rawDelta, isKeyframe, wireMessage) { + // 'Uint8Array' rawDelta + if (this._debugDeltas) window.app.console.log('Applying a raw ' + (isKeyframe ? 'keyframe' : 'delta') + ' of length ' + rawDelta.length + @@ -6803,14 +6805,6 @@ L.CanvasTileLayer = L.Layer.extend({ tile.rawDeltas = tmp; } - // 'Uint8Array' delta - if (!tile.canvas) - { - // defer constructing the image & applying these deltas - // until the tile is rendered via ensureCanvas. - return; - } - // apply potentially several deltas in turn. var i = 0; var offset = 0;