diff --git a/src/renderer/webgl/GlyphRenderer.ts b/src/renderer/webgl/GlyphRenderer.ts index b6e4066db..b431aec78 100644 --- a/src/renderer/webgl/GlyphRenderer.ts +++ b/src/renderer/webgl/GlyphRenderer.ts @@ -11,6 +11,7 @@ import WebglCharAtlas from './WebglCharAtlas'; import { IWebGL2RenderingContext, IWebGLVertexArrayObject, IRenderModel, IRasterizedGlyph } from './Types'; import { INDICIES_PER_CELL } from './WebglRenderer'; import { COMBINED_CHAR_BIT_MASK } from './RenderModel'; +import { fill } from '../../core/TypedArrayUtils'; interface IVertices { attributes: Float32Array; @@ -169,7 +170,7 @@ export class GlyphRenderer { // Exit early if this is a null/space character if (code === NULL_CELL_CODE || code === undefined/* This is used for the right side of wide chars */) { - array.fill(0, i, i + INDICES_PER_CELL - 1); + fill(array, 0, i, i + INDICES_PER_CELL - 1); return; } @@ -182,7 +183,7 @@ export class GlyphRenderer { // Fill empty if no glyph was found if (!rasterizedGlyph) { - array.fill(0, i, i + INDICES_PER_CELL - 1); + fill(array, 0, i, i + INDICES_PER_CELL - 1); return; } @@ -203,7 +204,7 @@ export class GlyphRenderer { public updateLineEnd(x: number, y: number): void { // Clears all cells to the right of the line end const i = (y * this._terminal.cols + x + 1) * INDICES_PER_CELL; - this._vertices.attributes.fill(0, i, i + (this._terminal.cols - this._lineLengths[y]) * INDICES_PER_CELL - 1); + fill(this._vertices.attributes, 0, i, i + (this._terminal.cols - this._lineLengths[y]) * INDICES_PER_CELL - 1); } public updateSelection(model: IRenderModel, columnSelectMode: boolean): void { diff --git a/src/renderer/webgl/RectangleRenderer.ts b/src/renderer/webgl/RectangleRenderer.ts index eca89b3ac..2642ec737 100644 --- a/src/renderer/webgl/RectangleRenderer.ts +++ b/src/renderer/webgl/RectangleRenderer.ts @@ -9,6 +9,7 @@ import { createProgram, expandFloat32Array, PROJECTION_MATRIX } from './WebglUti import { IColor } from '../../shared/Types'; import { IRenderModel, IWebGLVertexArrayObject, IWebGL2RenderingContext, ISelectionRenderModel } from './Types'; import { RENDER_INVERTED_DEFAULT_COLOR } from './RenderModel'; +import { fill } from '../../core/TypedArrayUtils'; const enum VertexAttribLocations { POSITION = 0, @@ -173,7 +174,7 @@ export class RectangleRenderer { const terminal = this._terminal; if (!model.hasSelection) { - this._vertices.selection.fill(0, 0); + fill(this._vertices.selection, 0, 0); return; } @@ -190,7 +191,7 @@ export class RectangleRenderer { height * this._dimensions.scaledCellHeight, this._selectionFloat ); - this._vertices.selection.fill(0, INDICES_PER_RECTANGLE); + fill(this._vertices.selection, 0, INDICES_PER_RECTANGLE); } else { // Draw first row const startCol = model.viewportStartRow === model.viewportCappedStartRow ? model.startCol : 0; @@ -231,7 +232,7 @@ export class RectangleRenderer { this._selectionFloat ); } else { - this._vertices.selection.fill(0, INDICES_PER_RECTANGLE * 2); + fill(this._vertices.selection, 0, INDICES_PER_RECTANGLE * 2); } } } diff --git a/src/renderer/webgl/RenderModel.ts b/src/renderer/webgl/RenderModel.ts index a14616c28..a3b2b2c9a 100644 --- a/src/renderer/webgl/RenderModel.ts +++ b/src/renderer/webgl/RenderModel.ts @@ -4,6 +4,7 @@ */ import { IRenderModel, ISelectionRenderModel } from './Types'; +import { fill } from '../../core/TypedArrayUtils'; export const RENDER_MODEL_INDICIES_PER_CELL = 4; @@ -42,8 +43,8 @@ export class RenderModel implements IRenderModel { } public clear(): void { - this.cells.fill(0, 0); - this.lineLengths.fill(0, 0); + fill(this.cells, 0, 0); + fill(this.lineLengths, 0, 0); this.clearSelection(); }