xterm-addon-webgl
Advanced tools
Comparing version 0.14.0-beta.35 to 0.14.0-beta.36
{ | ||
"name": "xterm-addon-webgl", | ||
"version": "0.14.0-beta.35", | ||
"version": "0.14.0-beta.36", | ||
"author": { | ||
@@ -5,0 +5,0 @@ "name": "The xterm.js authors", |
@@ -13,2 +13,3 @@ /** | ||
import { throwIfFalsy } from 'browser/renderer/shared/RendererUtils'; | ||
import { TextureAtlas } from 'browser/renderer/shared/TextureAtlas'; | ||
@@ -111,4 +112,2 @@ interface IVertices { | ||
private static _maxAtlasPages: number | undefined; | ||
constructor( | ||
@@ -123,7 +122,10 @@ private readonly _terminal: Terminal, | ||
if (GlyphRenderer._maxAtlasPages === undefined) { | ||
GlyphRenderer._maxAtlasPages = throwIfFalsy(gl.getParameter(gl.MAX_TEXTURE_IMAGE_UNITS) as number | null); | ||
if (TextureAtlas.maxAtlasPages === undefined) { | ||
// Typically 8 or 16 | ||
TextureAtlas.maxAtlasPages = throwIfFalsy(gl.getParameter(gl.MAX_TEXTURE_IMAGE_UNITS) as number | null); | ||
// Almost all clients will support >= 4096 | ||
TextureAtlas.maxTextureSize = throwIfFalsy(gl.getParameter(gl.MAX_TEXTURE_SIZE) as number | null); | ||
} | ||
this._program = throwIfFalsy(createProgram(gl, vertexShaderSource, createFragmentShaderSource(GlyphRenderer._maxAtlasPages))); | ||
this._program = throwIfFalsy(createProgram(gl, vertexShaderSource, createFragmentShaderSource(TextureAtlas.maxAtlasPages))); | ||
this.register(toDisposable(() => gl.deleteProgram(this._program))); | ||
@@ -183,4 +185,4 @@ | ||
gl.useProgram(this._program); | ||
const textureUnits = new Int32Array(GlyphRenderer._maxAtlasPages); | ||
for (let i = 0; i < GlyphRenderer._maxAtlasPages; i++) { | ||
const textureUnits = new Int32Array(TextureAtlas.maxAtlasPages); | ||
for (let i = 0; i < TextureAtlas.maxAtlasPages; i++) { | ||
textureUnits[i] = i; | ||
@@ -194,3 +196,3 @@ } | ||
this._atlasTextures = []; | ||
for (let i = 0; i < GlyphRenderer._maxAtlasPages; i++) { | ||
for (let i = 0; i < TextureAtlas.maxAtlasPages; i++) { | ||
const texture = throwIfFalsy(gl.createTexture()); | ||
@@ -197,0 +199,0 @@ this.register(toDisposable(() => gl.deleteTexture(texture))); |
@@ -24,2 +24,4 @@ /** | ||
public readonly onAddTextureAtlasCanvas = this._onAddTextureAtlasCanvas.event; | ||
private readonly _onRemoveTextureAtlasCanvas = this.register(new EventEmitter<HTMLCanvasElement>()); | ||
public readonly onRemoveTextureAtlasCanvas = this._onRemoveTextureAtlasCanvas.event; | ||
private readonly _onContextLoss = this.register(new EventEmitter<void>()); | ||
@@ -71,2 +73,3 @@ public readonly onContextLoss = this._onContextLoss.event; | ||
this.register(forwardEvent(this._renderer.onAddTextureAtlasCanvas, this._onAddTextureAtlasCanvas)); | ||
this.register(forwardEvent(this._renderer.onRemoveTextureAtlasCanvas, this._onRemoveTextureAtlasCanvas)); | ||
renderService.setRenderer(this._renderer); | ||
@@ -73,0 +76,0 @@ |
@@ -19,3 +19,3 @@ /** | ||
import { EventEmitter, forwardEvent } from 'common/EventEmitter'; | ||
import { Disposable, toDisposable } from 'common/Lifecycle'; | ||
import { Disposable, getDisposeArrayDisposable, toDisposable } from 'common/Lifecycle'; | ||
import { ICoreService, IDecorationService, IOptionsService } from 'common/services/Services'; | ||
@@ -57,2 +57,4 @@ import { CharData, IBufferLine, ICellData } from 'common/Types'; | ||
public readonly onAddTextureAtlasCanvas = this._onAddTextureAtlasCanvas.event; | ||
private readonly _onRemoveTextureAtlasCanvas = this.register(new EventEmitter<HTMLCanvasElement>()); | ||
public readonly onRemoveTextureAtlasCanvas = this._onRemoveTextureAtlasCanvas.event; | ||
private readonly _onRequestRedraw = this.register(new EventEmitter<IRequestRedrawEvent>()); | ||
@@ -273,3 +275,6 @@ public readonly onRequestRedraw = this._onRequestRedraw.event; | ||
this._onChangeTextureAtlas.fire(atlas.pages[0].canvas); | ||
this._charAtlasDisposable = forwardEvent(atlas.onAddTextureAtlasCanvas, this._onAddTextureAtlasCanvas); | ||
this._charAtlasDisposable = getDisposeArrayDisposable([ | ||
forwardEvent(atlas.onAddTextureAtlasCanvas, this._onAddTextureAtlasCanvas), | ||
forwardEvent(atlas.onRemoveTextureAtlasCanvas, this._onRemoveTextureAtlasCanvas) | ||
]); | ||
} | ||
@@ -333,3 +338,2 @@ this._charAtlas = atlas; | ||
this._clearModel(true); | ||
this._model.selection.clear(); | ||
} | ||
@@ -336,0 +340,0 @@ |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
530747
2354