@xterm/addon-webgl 0.20.0-beta.287 → 0.20.0-beta.288
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/addon-webgl.js +1 -1
- package/lib/addon-webgl.js.map +1 -1
- package/lib/addon-webgl.mjs +2 -2
- package/lib/addon-webgl.mjs.map +3 -3
- package/package.json +3 -3
- package/src/GlyphRenderer.ts +14 -1
- package/src/TextureAtlas.ts +4 -8
- package/src/Types.ts +5 -3
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xterm/addon-webgl",
|
|
3
|
-
"version": "0.20.0-beta.
|
|
3
|
+
"version": "0.20.0-beta.288",
|
|
4
4
|
"author": {
|
|
5
5
|
"name": "The xterm.js authors",
|
|
6
6
|
"url": "https://xtermjs.org/"
|
|
@@ -23,8 +23,8 @@
|
|
|
23
23
|
"prepublishOnly": "npm run package",
|
|
24
24
|
"start": "node ../../demo/start"
|
|
25
25
|
},
|
|
26
|
-
"commit": "
|
|
26
|
+
"commit": "b1aee19ac6d6f4e4d11e4a10a3731b852956bdb7",
|
|
27
27
|
"peerDependencies": {
|
|
28
|
-
"@xterm/xterm": "^6.1.0-beta.
|
|
28
|
+
"@xterm/xterm": "^6.1.0-beta.289"
|
|
29
29
|
}
|
|
30
30
|
}
|
package/src/GlyphRenderer.ts
CHANGED
|
@@ -100,6 +100,7 @@ export class GlyphRenderer extends Disposable {
|
|
|
100
100
|
private readonly _attributesBuffer: WebGLBuffer;
|
|
101
101
|
|
|
102
102
|
private _atlas: ITextureAtlas | undefined;
|
|
103
|
+
private _lastSeenPageLayoutVersion: number = -1;
|
|
103
104
|
private _activeBuffer: number = 0;
|
|
104
105
|
private readonly _vertices: IVertices = {
|
|
105
106
|
count: 0,
|
|
@@ -213,8 +214,19 @@ export class GlyphRenderer extends Disposable {
|
|
|
213
214
|
this.handleResize();
|
|
214
215
|
}
|
|
215
216
|
|
|
217
|
+
/**
|
|
218
|
+
* Call when a frame is being drawn. Returns whether the full model must be rebuilt before
|
|
219
|
+
* rendering this frame because the atlas page layout changed since this renderer last drew.
|
|
220
|
+
*/
|
|
216
221
|
public beginFrame(): boolean {
|
|
217
|
-
|
|
222
|
+
if (!this._atlas) {
|
|
223
|
+
return true;
|
|
224
|
+
}
|
|
225
|
+
if (this._atlas.pageLayoutVersion !== this._lastSeenPageLayoutVersion) {
|
|
226
|
+
this._lastSeenPageLayoutVersion = this._atlas.pageLayoutVersion;
|
|
227
|
+
return true;
|
|
228
|
+
}
|
|
229
|
+
return false;
|
|
218
230
|
}
|
|
219
231
|
|
|
220
232
|
public updateCell(x: number, y: number, code: number, bg: number, fg: number, ext: number, chars: string, width: number, lastBg: number): void {
|
|
@@ -375,6 +387,7 @@ export class GlyphRenderer extends Disposable {
|
|
|
375
387
|
|
|
376
388
|
public setAtlas(atlas: ITextureAtlas): void {
|
|
377
389
|
this._atlas = atlas;
|
|
390
|
+
this._lastSeenPageLayoutVersion = -1;
|
|
378
391
|
this.invalidateAtlasTextures();
|
|
379
392
|
}
|
|
380
393
|
|
package/src/TextureAtlas.ts
CHANGED
|
@@ -132,12 +132,8 @@ export class TextureAtlas implements ITextureAtlas {
|
|
|
132
132
|
}
|
|
133
133
|
}
|
|
134
134
|
|
|
135
|
-
private
|
|
136
|
-
public
|
|
137
|
-
const result = this._requestClearModel;
|
|
138
|
-
this._requestClearModel = false;
|
|
139
|
-
return result;
|
|
140
|
-
}
|
|
135
|
+
private _pageLayoutVersion = 0;
|
|
136
|
+
public get pageLayoutVersion(): number { return this._pageLayoutVersion; }
|
|
141
137
|
|
|
142
138
|
public clearTexture(): void {
|
|
143
139
|
if (this._pages[0].currentRow.x === 0 && this._pages[0].currentRow.y === 0) {
|
|
@@ -207,7 +203,7 @@ export class TextureAtlas implements ITextureAtlas {
|
|
|
207
203
|
this.pages.push(mergedPage);
|
|
208
204
|
|
|
209
205
|
// Request the model to be cleared to refresh all texture pages.
|
|
210
|
-
this.
|
|
206
|
+
this._pageLayoutVersion++;
|
|
211
207
|
this._onAddTextureAtlasCanvas.fire(mergedPage.canvas);
|
|
212
208
|
}
|
|
213
209
|
|
|
@@ -819,7 +815,7 @@ export class TextureAtlas implements ITextureAtlas {
|
|
|
819
815
|
this.pages.push(this._overflowSizePage);
|
|
820
816
|
|
|
821
817
|
// Request the model to be cleared to refresh all texture pages.
|
|
822
|
-
this.
|
|
818
|
+
this._pageLayoutVersion++;
|
|
823
819
|
this._onAddTextureAtlasCanvas.fire(this._overflowSizePage.canvas);
|
|
824
820
|
}
|
|
825
821
|
activePage = this._overflowSizePage;
|
package/src/Types.ts
CHANGED
|
@@ -68,10 +68,12 @@ export interface ITextureAtlas extends IDisposable {
|
|
|
68
68
|
warmUp(): void;
|
|
69
69
|
|
|
70
70
|
/**
|
|
71
|
-
*
|
|
72
|
-
*
|
|
71
|
+
* Incremented whenever cached glyph texture page mappings may be stale, such as after atlas page
|
|
72
|
+
* merges or overflow page creation. Renderers compare this against their own last-seen value and
|
|
73
|
+
* rebuild their model when it changes; a shared atlas can have many renderers, so this must not
|
|
74
|
+
* be a consume-once flag.
|
|
73
75
|
*/
|
|
74
|
-
|
|
76
|
+
readonly pageLayoutVersion: number;
|
|
75
77
|
|
|
76
78
|
/**
|
|
77
79
|
* Clear all glyphs from the texture atlas.
|