xterm-addon-webgl
Advanced tools
Comparing version
{ | ||
"name": "xterm-addon-webgl", | ||
"version": "0.16.0-beta.37", | ||
"version": "0.16.0", | ||
"author": { | ||
@@ -5,0 +5,0 @@ "name": "The xterm.js authors", |
@@ -52,3 +52,2 @@ /** | ||
this._canvas.remove(); | ||
this._charAtlas?.dispose(); | ||
})); | ||
@@ -55,0 +54,0 @@ } |
@@ -23,3 +23,3 @@ /** | ||
import { ICoreService, IDecorationService, IOptionsService } from 'common/services/Services'; | ||
import { IDisposable, Terminal } from 'xterm'; | ||
import { Terminal } from 'xterm'; | ||
import { GlyphRenderer } from './GlyphRenderer'; | ||
@@ -35,3 +35,3 @@ import { RectangleRenderer } from './RectangleRenderer'; | ||
private _cursorBlinkStateManager: MutableDisposable<CursorBlinkStateManager> = new MutableDisposable(); | ||
private _charAtlasDisposable: IDisposable | undefined; | ||
private _charAtlasDisposable = this.register(new MutableDisposable()); | ||
private _charAtlas: ITextureAtlas | undefined; | ||
@@ -46,4 +46,4 @@ private _devicePixelRatio: number; | ||
private _gl: IWebGL2RenderingContext; | ||
private _rectangleRenderer?: RectangleRenderer; | ||
private _glyphRenderer?: GlyphRenderer; | ||
private _rectangleRenderer: MutableDisposable<RectangleRenderer> = this.register(new MutableDisposable()); | ||
private _glyphRenderer: MutableDisposable<GlyphRenderer> = this.register(new MutableDisposable()); | ||
@@ -134,3 +134,3 @@ public readonly dimensions: IRenderDimensions; | ||
[this._rectangleRenderer, this._glyphRenderer] = this._initializeWebGLState(); | ||
[this._rectangleRenderer.value, this._glyphRenderer.value] = this._initializeWebGLState(); | ||
@@ -189,6 +189,6 @@ this._isAttached = this._coreBrowserService.window.document.body.contains(this._core.screenElement!); | ||
this._rectangleRenderer?.setDimensions(this.dimensions); | ||
this._rectangleRenderer?.handleResize(); | ||
this._glyphRenderer?.setDimensions(this.dimensions); | ||
this._glyphRenderer?.handleResize(); | ||
this._rectangleRenderer.value?.setDimensions(this.dimensions); | ||
this._rectangleRenderer.value?.handleResize(); | ||
this._glyphRenderer.value?.setDimensions(this.dimensions); | ||
this._glyphRenderer.value?.handleResize(); | ||
@@ -249,13 +249,9 @@ this._refreshCharAtlas(); | ||
private _initializeWebGLState(): [RectangleRenderer, GlyphRenderer] { | ||
// Dispose any previous rectangle and glyph renderers before creating new ones. | ||
this._rectangleRenderer?.dispose(); | ||
this._glyphRenderer?.dispose(); | ||
this._rectangleRenderer.value = new RectangleRenderer(this._terminal, this._gl, this.dimensions, this._themeService); | ||
this._glyphRenderer.value = new GlyphRenderer(this._terminal, this._gl, this.dimensions); | ||
this._rectangleRenderer = this.register(new RectangleRenderer(this._terminal, this._gl, this.dimensions, this._themeService)); | ||
this._glyphRenderer = this.register(new GlyphRenderer(this._terminal, this._gl, this.dimensions)); | ||
// Update dimensions and acquire char atlas | ||
this.handleCharSizeChanged(); | ||
return [this._rectangleRenderer, this._glyphRenderer]; | ||
return [this._rectangleRenderer.value, this._glyphRenderer.value]; | ||
} | ||
@@ -284,5 +280,4 @@ | ||
if (this._charAtlas !== atlas) { | ||
this._charAtlasDisposable?.dispose(); | ||
this._onChangeTextureAtlas.fire(atlas.pages[0].canvas); | ||
this._charAtlasDisposable = getDisposeArrayDisposable([ | ||
this._charAtlasDisposable.value = getDisposeArrayDisposable([ | ||
forwardEvent(atlas.onAddTextureAtlasCanvas, this._onAddTextureAtlasCanvas), | ||
@@ -294,3 +289,3 @@ forwardEvent(atlas.onRemoveTextureAtlasCanvas, this._onRemoveTextureAtlasCanvas) | ||
this._charAtlas.warmUp(); | ||
this._glyphRenderer?.setAtlas(this._charAtlas); | ||
this._glyphRenderer.value?.setAtlas(this._charAtlas); | ||
} | ||
@@ -306,3 +301,3 @@ | ||
if (clearGlyphRenderer) { | ||
this._glyphRenderer?.clear(); | ||
this._glyphRenderer.value?.clear(); | ||
} | ||
@@ -352,3 +347,3 @@ } | ||
if (!this._glyphRenderer || !this._rectangleRenderer) { | ||
if (!this._glyphRenderer.value || !this._rectangleRenderer.value) { | ||
return; | ||
@@ -360,3 +355,3 @@ } | ||
// (also triggered by an atlas page merge, part of #4480) | ||
if (this._glyphRenderer.beginFrame()) { | ||
if (this._glyphRenderer.value.beginFrame()) { | ||
this._clearModel(true); | ||
@@ -370,6 +365,6 @@ this._updateModel(0, this._terminal.rows - 1); | ||
// Render | ||
this._rectangleRenderer?.renderBackgrounds(); | ||
this._glyphRenderer?.render(this._model); | ||
this._rectangleRenderer.value.renderBackgrounds(); | ||
this._glyphRenderer.value.render(this._model); | ||
if (!this._cursorBlinkStateManager.value || this._cursorBlinkStateManager.value.isCursorVisible) { | ||
this._rectangleRenderer?.renderCursor(); | ||
this._rectangleRenderer.value.renderCursor(); | ||
} | ||
@@ -517,3 +512,3 @@ } | ||
this._glyphRenderer!.updateCell(x, y, code, this._cellColorResolver.result.bg, this._cellColorResolver.result.fg, this._cellColorResolver.result.ext, chars, lastBg); | ||
this._glyphRenderer.value!.updateCell(x, y, code, this._cellColorResolver.result.bg, this._cellColorResolver.result.fg, this._cellColorResolver.result.ext, chars, lastBg); | ||
@@ -527,3 +522,3 @@ if (isJoined) { | ||
j = ((y * terminal.cols) + x) * RENDER_MODEL_INDICIES_PER_CELL; | ||
this._glyphRenderer!.updateCell(x, y, NULL_CELL_CODE, 0, 0, 0, NULL_CELL_CHAR, 0); | ||
this._glyphRenderer.value!.updateCell(x, y, NULL_CELL_CODE, 0, 0, 0, NULL_CELL_CHAR, 0); | ||
this._model.cells[j] = NULL_CELL_CODE; | ||
@@ -538,5 +533,5 @@ this._model.cells[j + RENDER_MODEL_BG_OFFSET] = this._cellColorResolver.result.bg; | ||
if (modelUpdated) { | ||
this._rectangleRenderer!.updateBackgrounds(this._model); | ||
this._rectangleRenderer.value!.updateBackgrounds(this._model); | ||
} | ||
this._rectangleRenderer!.updateCursor(this._model); | ||
this._rectangleRenderer.value!.updateCursor(this._model); | ||
} | ||
@@ -543,0 +538,0 @@ |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
556454
0.03%2175
-0.23%