Fix conflicts in webgl renderer
This commit is contained in:
+1
-5
@@ -218,7 +218,7 @@ function initOptions(term: TerminalType): void {
|
|||||||
fontFamily: null,
|
fontFamily: null,
|
||||||
fontWeight: ['normal', 'bold', '100', '200', '300', '400', '500', '600', '700', '800', '900'],
|
fontWeight: ['normal', 'bold', '100', '200', '300', '400', '500', '600', '700', '800', '900'],
|
||||||
fontWeightBold: ['normal', 'bold', '100', '200', '300', '400', '500', '600', '700', '800', '900'],
|
fontWeightBold: ['normal', 'bold', '100', '200', '300', '400', '500', '600', '700', '800', '900'],
|
||||||
rendererType: ['dom', 'canvas', 'webgl']
|
rendererType: ['dom', 'canvas']
|
||||||
};
|
};
|
||||||
const options = Object.keys((<any>term)._core.options);
|
const options = Object.keys((<any>term)._core.options);
|
||||||
const booleanOptions = [];
|
const booleanOptions = [];
|
||||||
@@ -286,10 +286,6 @@ function initOptions(term: TerminalType): void {
|
|||||||
const input = <HTMLInputElement>document.getElementById(`opt-${o}`);
|
const input = <HTMLInputElement>document.getElementById(`opt-${o}`);
|
||||||
addDomListener(input, 'change', () => {
|
addDomListener(input, 'change', () => {
|
||||||
console.log('change', o, input.value);
|
console.log('change', o, input.value);
|
||||||
if (o === 'rendererType' && input.value === 'webgl') {
|
|
||||||
term.setOption('experimentalCharAtlas', 'webgl');
|
|
||||||
setTimeout(() => (<HTMLSelectElement>document.getElementById(`opt-experimentalCharAtlas`)).value = 'webgl', 0);
|
|
||||||
}
|
|
||||||
term.setOption(o, input.value);
|
term.setOption(o, input.value);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -182,9 +182,9 @@ export class GlyphRenderer {
|
|||||||
|
|
||||||
let rasterizedGlyph: IRasterizedGlyph;
|
let rasterizedGlyph: IRasterizedGlyph;
|
||||||
if (chars && chars.length > 1) {
|
if (chars && chars.length > 1) {
|
||||||
rasterizedGlyph = this._atlas.getRasterizedGlyphCombinedChar(chars, attr, bg, fg, this._terminal.getOption('enableBold'));
|
rasterizedGlyph = this._atlas.getRasterizedGlyphCombinedChar(chars, attr, bg, fg);
|
||||||
} else {
|
} else {
|
||||||
rasterizedGlyph = this._atlas.getRasterizedGlyph(code, attr, bg, fg, this._terminal.getOption('enableBold'));
|
rasterizedGlyph = this._atlas.getRasterizedGlyph(code, attr, bg, fg);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Fill empty if no glyph was found
|
// Fill empty if no glyph was found
|
||||||
|
|||||||
@@ -96,7 +96,7 @@ export default class WebglCharAtlas extends BaseCharAtlas {
|
|||||||
protected _doWarmUp(): void {
|
protected _doWarmUp(): void {
|
||||||
// Pre-fill with ASCII 33-126
|
// Pre-fill with ASCII 33-126
|
||||||
for (let i = 33; i < 126; i++) {
|
for (let i = 33; i < 126; i++) {
|
||||||
const rasterizedGlyph = this._drawToCache(i, DEFAULT_ATTR, DEFAULT_COLOR, DEFAULT_COLOR, true);
|
const rasterizedGlyph = this._drawToCache(i, DEFAULT_ATTR, DEFAULT_COLOR, DEFAULT_COLOR);
|
||||||
this._cacheMap[i] = {
|
this._cacheMap[i] = {
|
||||||
[DEFAULT_ATTR]: rasterizedGlyph
|
[DEFAULT_ATTR]: rasterizedGlyph
|
||||||
};
|
};
|
||||||
@@ -116,7 +116,7 @@ export default class WebglCharAtlas extends BaseCharAtlas {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public getRasterizedGlyphCombinedChar(chars: string, attr: number, bg: number, fg: number, enableBold: boolean): IRasterizedGlyph {
|
public getRasterizedGlyphCombinedChar(chars: string, attr: number, bg: number, fg: number): IRasterizedGlyph {
|
||||||
let rasterizedGlyphSet = this._cacheMapCombined[chars];
|
let rasterizedGlyphSet = this._cacheMapCombined[chars];
|
||||||
if (!rasterizedGlyphSet) {
|
if (!rasterizedGlyphSet) {
|
||||||
rasterizedGlyphSet = {};
|
rasterizedGlyphSet = {};
|
||||||
@@ -124,7 +124,7 @@ export default class WebglCharAtlas extends BaseCharAtlas {
|
|||||||
}
|
}
|
||||||
let rasterizedGlyph = rasterizedGlyphSet[attr];
|
let rasterizedGlyph = rasterizedGlyphSet[attr];
|
||||||
if (!rasterizedGlyph) {
|
if (!rasterizedGlyph) {
|
||||||
rasterizedGlyph = this._drawToCache(chars, attr, bg, fg, enableBold);
|
rasterizedGlyph = this._drawToCache(chars, attr, bg, fg);
|
||||||
rasterizedGlyphSet[attr] = rasterizedGlyph;
|
rasterizedGlyphSet[attr] = rasterizedGlyph;
|
||||||
}
|
}
|
||||||
return rasterizedGlyph;
|
return rasterizedGlyph;
|
||||||
@@ -133,7 +133,7 @@ export default class WebglCharAtlas extends BaseCharAtlas {
|
|||||||
/**
|
/**
|
||||||
* Gets the glyphs texture coords, drawing the texture if it's not already
|
* Gets the glyphs texture coords, drawing the texture if it's not already
|
||||||
*/
|
*/
|
||||||
public getRasterizedGlyph(code: number, attr: number, bg: number, fg: number, enableBold: boolean): IRasterizedGlyph {
|
public getRasterizedGlyph(code: number, attr: number, bg: number, fg: number): IRasterizedGlyph {
|
||||||
let rasterizedGlyphSet = this._cacheMap[code];
|
let rasterizedGlyphSet = this._cacheMap[code];
|
||||||
if (!rasterizedGlyphSet) {
|
if (!rasterizedGlyphSet) {
|
||||||
rasterizedGlyphSet = {};
|
rasterizedGlyphSet = {};
|
||||||
@@ -141,7 +141,7 @@ export default class WebglCharAtlas extends BaseCharAtlas {
|
|||||||
}
|
}
|
||||||
let rasterizedGlyph = rasterizedGlyphSet[attr];
|
let rasterizedGlyph = rasterizedGlyphSet[attr];
|
||||||
if (!rasterizedGlyph) {
|
if (!rasterizedGlyph) {
|
||||||
rasterizedGlyph = this._drawToCache(code, attr, bg, fg, enableBold);
|
rasterizedGlyph = this._drawToCache(code, attr, bg, fg);
|
||||||
rasterizedGlyphSet[attr] = rasterizedGlyph;
|
rasterizedGlyphSet[attr] = rasterizedGlyph;
|
||||||
}
|
}
|
||||||
return rasterizedGlyph;
|
return rasterizedGlyph;
|
||||||
@@ -186,16 +186,16 @@ export default class WebglCharAtlas extends BaseCharAtlas {
|
|||||||
return this._config.colors.foreground;
|
return this._config.colors.foreground;
|
||||||
}
|
}
|
||||||
|
|
||||||
private _drawToCache(code: number, attr: number, bg: number, fg: number, enableBold: boolean): IRasterizedGlyph;
|
private _drawToCache(code: number, attr: number, bg: number, fg: number): IRasterizedGlyph;
|
||||||
private _drawToCache(chars: string, attr: number, bg: number, fg: number, enableBold: boolean): IRasterizedGlyph;
|
private _drawToCache(chars: string, attr: number, bg: number, fg: number): IRasterizedGlyph;
|
||||||
private _drawToCache(codeOrChars: number | string, attr: number, bg: number, fg: number, enableBold: boolean): IRasterizedGlyph {
|
private _drawToCache(codeOrChars: number | string, attr: number, bg: number, fg: number): IRasterizedGlyph {
|
||||||
const chars = typeof codeOrChars === 'number' ? String.fromCharCode(codeOrChars) : codeOrChars;
|
const chars = typeof codeOrChars === 'number' ? String.fromCharCode(codeOrChars) : codeOrChars;
|
||||||
|
|
||||||
this.hasCanvasChanged = true;
|
this.hasCanvasChanged = true;
|
||||||
|
|
||||||
const flags = attr >> 18;
|
const flags = attr >> 18;
|
||||||
|
|
||||||
const bold = !!(flags & FLAGS.BOLD) && enableBold;
|
const bold = !!(flags & FLAGS.BOLD);
|
||||||
const dim = !!(flags & FLAGS.DIM);
|
const dim = !!(flags & FLAGS.DIM);
|
||||||
const italic = !!(flags & FLAGS.ITALIC);
|
const italic = !!(flags & FLAGS.ITALIC);
|
||||||
|
|
||||||
|
|||||||
@@ -287,7 +287,7 @@ export abstract class BaseRenderLayer implements IRenderLayer {
|
|||||||
this._currentGlyphIdentifier.code = cell.getCode() || WHITESPACE_CELL_CODE;
|
this._currentGlyphIdentifier.code = cell.getCode() || WHITESPACE_CELL_CODE;
|
||||||
this._currentGlyphIdentifier.bg = bg;
|
this._currentGlyphIdentifier.bg = bg;
|
||||||
this._currentGlyphIdentifier.fg = fg;
|
this._currentGlyphIdentifier.fg = fg;
|
||||||
this._currentGlyphIdentifier.bold = cell.isBold() && terminal.getOption('enableBold');
|
this._currentGlyphIdentifier.bold = !!cell.isBold();
|
||||||
this._currentGlyphIdentifier.dim = !!cell.isDim();
|
this._currentGlyphIdentifier.dim = !!cell.isDim();
|
||||||
this._currentGlyphIdentifier.italic = !!cell.isItalic();
|
this._currentGlyphIdentifier.italic = !!cell.isItalic();
|
||||||
const atlasDidDraw = this._charAtlas && this._charAtlas.draw(
|
const atlasDidDraw = this._charAtlas && this._charAtlas.draw(
|
||||||
@@ -315,7 +315,7 @@ export abstract class BaseRenderLayer implements IRenderLayer {
|
|||||||
*/
|
*/
|
||||||
private _drawUncachedChars(terminal: Terminal, cell: ICellData, x: number, y: number): void {
|
private _drawUncachedChars(terminal: Terminal, cell: ICellData, x: number, y: number): void {
|
||||||
this._ctx.save();
|
this._ctx.save();
|
||||||
this._ctx.font = this._getFont(terminal, cell.isBold() && terminal.getOption('enableBold'), !!cell.isItalic());
|
this._ctx.font = this._getFont(terminal, !!cell.isBold(), !!cell.isItalic());
|
||||||
this._ctx.textBaseline = 'middle';
|
this._ctx.textBaseline = 'middle';
|
||||||
|
|
||||||
if (cell.isInverse()) {
|
if (cell.isInverse()) {
|
||||||
|
|||||||
Reference in New Issue
Block a user