@@ -156,7 +156,7 @@ export default class CanvasDrawer extends Mixin {
156156 backgroundDecorationDispatcher [ 'background-custom' ] = drawCustomDecorationLambda
157157 frontDecorationDispatcher [ 'foreground-custom' ] = drawCustomDecorationLambda
158158
159- this . updateBackDecorationsLayer ( firstRow , lastRow , renderData , lineHeight , editorElement , decorations )
159+ updateBackDecorationsLayer ( this . backLayer , firstRow , lastRow , this . offscreenFirstRow , this . offscreenLastRow , this . pendingBackDecorationChanges , renderData , lineHeight , editorElement , decorations )
160160
161161 renderData . context = this . frontLayer . context
162162
@@ -180,58 +180,6 @@ export default class CanvasDrawer extends Mixin {
180180 this . offscreenLastRow = lastRow
181181 }
182182
183- /**
184- * Performs an update of the back decorations layer using the pending back
185- * decorations changes arrays.
186- *
187- * @param {number } firstRow firstRow the first row of the range to update
188- * @param {number } lastRow lastRow the last row of the range to update
189- *
190- * @param {Object } renderData
191- * @param {number } lineHeight this.minimap.getLineHeight() * devicePixelRatio
192- * @param {TextEditorElement } editorElement this.minimap.getTextEditorElement()
193- * @param {Array<Decoration> } decorations
194- * @access private
195- */
196- updateBackDecorationsLayer ( firstRow , lastRow , renderData , lineHeight , editorElement , decorations ) {
197- const intactRanges = computeIntactRanges ( firstRow , lastRow , this . pendingBackDecorationChanges , this . offscreenFirstRow , this . offscreenLastRow )
198-
199- // NOTE: this method is the hot function of Minimap. Do not refactor. The code is inlined delibarately.
200-
201- // redrawRangesOnLayer
202-
203- this . backLayer . clearCanvas ( )
204-
205- if ( intactRanges . length === 0 ) {
206- drawBackDecorationsForLines ( firstRow , lastRow , 0 , renderData , lineHeight , editorElement , decorations )
207- } else {
208- for ( let j = 0 , len = intactRanges . length ; j < len ; j ++ ) {
209- const intact = intactRanges [ j ]
210-
211- this . backLayer . copyPartFromOffscreen (
212- intact . offscreenRow * lineHeight ,
213- ( intact . start - firstRow ) * lineHeight ,
214- ( intact . end - intact . start ) * lineHeight
215- )
216- }
217- // drawLinesForRanges
218- let currentRow = firstRow
219- for ( let i = 0 , len = intactRanges . length ; i < len ; i ++ ) {
220- const range = intactRanges [ i ]
221-
222- drawBackDecorationsForLines ( currentRow , range . start , currentRow - firstRow , renderData , lineHeight , editorElement , decorations )
223-
224- currentRow = range . end
225- }
226- if ( currentRow <= lastRow ) {
227- drawBackDecorationsForLines ( currentRow , lastRow , currentRow - firstRow , renderData , lineHeight , editorElement , decorations )
228- }
229- }
230-
231- this . backLayer . resetOffscreenSize ( )
232- this . backLayer . copyToOffscreen ( )
233- }
234-
235183 /**
236184 * Performs an update of the front decorations layer using the pending front
237185 * decorations changes arrays.
@@ -421,6 +369,61 @@ function updateTokensLayer (tokensLayer, firstRow, lastRow, offscreenFirstRow, o
421369 tokensLayer . copyToOffscreen ( )
422370}
423371
372+ /**
373+ * Performs an update of the back decorations layer using the pending back
374+ * decorations changes arrays.
375+ * @param {CanvasLayer } backLayer
376+ * @param {number } firstRow firstRow the first row of the range to update
377+ * @param {number } lastRow lastRow the last row of the range to update
378+ *
379+ * @param {number } offscreenFirstRow
380+ * @param {number } offscreenLastRow
381+ * @param {Array<> } pendingBackDecorationChanges
382+ * @param {Object } renderData
383+ * @param {number } lineHeight this.minimap.getLineHeight() * devicePixelRatio
384+ * @param {TextEditorElement } editorElement this.minimap.getTextEditorElement()
385+ * @param {Array<Decoration> } decorations
386+ * @access private
387+ */
388+ function updateBackDecorationsLayer ( backLayer , firstRow , lastRow , offscreenFirstRow , offscreenLastRow , pendingBackDecorationChanges , renderData , lineHeight , editorElement , decorations ) {
389+ const intactRanges = computeIntactRanges ( firstRow , lastRow , pendingBackDecorationChanges , offscreenFirstRow , offscreenLastRow )
390+
391+ // NOTE: this method is the hot function of Minimap. Do not refactor. The code is inlined delibarately.
392+
393+ // redrawRangesOnLayer
394+
395+ backLayer . clearCanvas ( )
396+
397+ if ( intactRanges . length === 0 ) {
398+ drawBackDecorationsForLines ( firstRow , lastRow , 0 , renderData , lineHeight , editorElement , decorations )
399+ } else {
400+ for ( let j = 0 , len = intactRanges . length ; j < len ; j ++ ) {
401+ const intact = intactRanges [ j ]
402+
403+ backLayer . copyPartFromOffscreen (
404+ intact . offscreenRow * lineHeight ,
405+ ( intact . start - firstRow ) * lineHeight ,
406+ ( intact . end - intact . start ) * lineHeight
407+ )
408+ }
409+ // drawLinesForRanges
410+ let currentRow = firstRow
411+ for ( let i = 0 , len = intactRanges . length ; i < len ; i ++ ) {
412+ const range = intactRanges [ i ]
413+
414+ drawBackDecorationsForLines ( currentRow , range . start , currentRow - firstRow , renderData , lineHeight , editorElement , decorations )
415+
416+ currentRow = range . end
417+ }
418+ if ( currentRow <= lastRow ) {
419+ drawBackDecorationsForLines ( currentRow , lastRow , currentRow - firstRow , renderData , lineHeight , editorElement , decorations )
420+ }
421+ }
422+
423+ backLayer . resetOffscreenSize ( )
424+ backLayer . copyToOffscreen ( )
425+ }
426+
424427const whitespaceTokenRegex = / ^ \s + $ /
425428const oneOrMoreWhiteSpaceRegexp = / \s + /
426429
0 commit comments