@@ -169,11 +169,11 @@ export class GlyphRenderer extends Disposable {
|
|||||||
return this._atlas ? this._atlas.beginFrame() : true;
|
return this._atlas ? this._atlas.beginFrame() : true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public updateCell(x: number, y: number, code: number, bg: number, fg: number, chars: string): void {
|
public updateCell(x: number, y: number, code: number, bg: number, fg: number, chars: string, lastBg: number): void {
|
||||||
this._updateCell(this._vertices.attributes, x, y, code, bg, fg, chars);
|
this._updateCell(this._vertices.attributes, x, y, code, bg, fg, chars, lastBg);
|
||||||
}
|
}
|
||||||
|
|
||||||
private _updateCell(array: Float32Array, x: number, y: number, code: number | undefined, bg: number, fg: number, chars?: string): void {
|
private _updateCell(array: Float32Array, x: number, y: number, code: number | undefined, bg: number, fg: number, chars: string, lastBg: number): void {
|
||||||
const terminal = this._terminal;
|
const terminal = this._terminal;
|
||||||
|
|
||||||
const i = (y * terminal.cols + x) * INDICES_PER_CELL;
|
const i = (y * terminal.cols + x) * INDICES_PER_CELL;
|
||||||
@@ -203,18 +203,34 @@ export class GlyphRenderer extends Disposable {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// a_origin
|
if (bg !== lastBg && rasterizedGlyph.offset.x > 0) {
|
||||||
array[i ] = -rasterizedGlyph.offset.x + this._dimensions.scaledCharLeft;
|
const clippedPixels = rasterizedGlyph.offset.x;
|
||||||
array[i + 1] = -rasterizedGlyph.offset.y + this._dimensions.scaledCharTop;
|
// a_origin
|
||||||
// a_size
|
array[i ] = this._dimensions.scaledCharLeft;
|
||||||
array[i + 2] = rasterizedGlyph.size.x / this._dimensions.scaledCanvasWidth;
|
array[i + 1] = -rasterizedGlyph.offset.y + this._dimensions.scaledCharTop;
|
||||||
array[i + 3] = rasterizedGlyph.size.y / this._dimensions.scaledCanvasHeight;
|
// a_size
|
||||||
// a_texcoord
|
array[i + 2] = (rasterizedGlyph.size.x - clippedPixels) / this._dimensions.scaledCanvasWidth;
|
||||||
array[i + 4] = rasterizedGlyph.texturePositionClipSpace.x;
|
array[i + 3] = rasterizedGlyph.size.y / this._dimensions.scaledCanvasHeight;
|
||||||
array[i + 5] = rasterizedGlyph.texturePositionClipSpace.y;
|
// a_texcoord
|
||||||
// a_texsize
|
array[i + 4] = rasterizedGlyph.texturePositionClipSpace.x + clippedPixels / this._atlas.cacheCanvas.width;
|
||||||
array[i + 6] = rasterizedGlyph.sizeClipSpace.x;
|
array[i + 5] = rasterizedGlyph.texturePositionClipSpace.y;
|
||||||
array[i + 7] = rasterizedGlyph.sizeClipSpace.y;
|
// a_texsize
|
||||||
|
array[i + 6] = rasterizedGlyph.sizeClipSpace.x - clippedPixels / this._atlas.cacheCanvas.width;
|
||||||
|
array[i + 7] = rasterizedGlyph.sizeClipSpace.y;
|
||||||
|
} else {
|
||||||
|
// a_origin
|
||||||
|
array[i ] = -rasterizedGlyph.offset.x + this._dimensions.scaledCharLeft;
|
||||||
|
array[i + 1] = -rasterizedGlyph.offset.y + this._dimensions.scaledCharTop;
|
||||||
|
// a_size
|
||||||
|
array[i + 2] = rasterizedGlyph.size.x / this._dimensions.scaledCanvasWidth;
|
||||||
|
array[i + 3] = rasterizedGlyph.size.y / this._dimensions.scaledCanvasHeight;
|
||||||
|
// a_texcoord
|
||||||
|
array[i + 4] = rasterizedGlyph.texturePositionClipSpace.x;
|
||||||
|
array[i + 5] = rasterizedGlyph.texturePositionClipSpace.y;
|
||||||
|
// a_texsize
|
||||||
|
array[i + 6] = rasterizedGlyph.sizeClipSpace.x;
|
||||||
|
array[i + 7] = rasterizedGlyph.sizeClipSpace.y;
|
||||||
|
}
|
||||||
// a_cellpos only changes on resize
|
// a_cellpos only changes on resize
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -291,6 +291,7 @@ export class WebglRenderer extends Disposable implements IRenderer {
|
|||||||
private _updateModel(start: number, end: number): void {
|
private _updateModel(start: number, end: number): void {
|
||||||
const terminal = this._core;
|
const terminal = this._core;
|
||||||
let cell: ICellData = this._workCell;
|
let cell: ICellData = this._workCell;
|
||||||
|
let lastBg: number = 0;
|
||||||
|
|
||||||
for (let y = start; y <= end; y++) {
|
for (let y = start; y <= end; y++) {
|
||||||
const row = y + terminal.buffer.ydisp;
|
const row = y + terminal.buffer.ydisp;
|
||||||
@@ -298,8 +299,13 @@ export class WebglRenderer extends Disposable implements IRenderer {
|
|||||||
this._model.lineLengths[y] = 0;
|
this._model.lineLengths[y] = 0;
|
||||||
const joinedRanges = this._characterJoinerService.getJoinedCharacters(row);
|
const joinedRanges = this._characterJoinerService.getJoinedCharacters(row);
|
||||||
for (let x = 0; x < terminal.cols; x++) {
|
for (let x = 0; x < terminal.cols; x++) {
|
||||||
|
lastBg = this._workColors.bg;
|
||||||
line.loadCell(x, cell);
|
line.loadCell(x, cell);
|
||||||
|
|
||||||
|
if (x === 0) {
|
||||||
|
lastBg = this._workColors.bg;
|
||||||
|
}
|
||||||
|
|
||||||
// If true, indicates that the current character(s) to draw were joined.
|
// If true, indicates that the current character(s) to draw were joined.
|
||||||
let isJoined = false;
|
let isJoined = false;
|
||||||
let lastCharX = x;
|
let lastCharX = x;
|
||||||
@@ -351,7 +357,7 @@ export class WebglRenderer extends Disposable implements IRenderer {
|
|||||||
this._model.cells[i + RENDER_MODEL_BG_OFFSET] = this._workColors.bg;
|
this._model.cells[i + RENDER_MODEL_BG_OFFSET] = this._workColors.bg;
|
||||||
this._model.cells[i + RENDER_MODEL_FG_OFFSET] = this._workColors.fg;
|
this._model.cells[i + RENDER_MODEL_FG_OFFSET] = this._workColors.fg;
|
||||||
|
|
||||||
this._glyphRenderer.updateCell(x, y, code, this._workColors.bg, this._workColors.fg, chars);
|
this._glyphRenderer.updateCell(x, y, code, this._workColors.bg, this._workColors.fg, chars, lastBg);
|
||||||
|
|
||||||
if (isJoined) {
|
if (isJoined) {
|
||||||
// Restore work cell
|
// Restore work cell
|
||||||
@@ -360,7 +366,7 @@ export class WebglRenderer extends Disposable implements IRenderer {
|
|||||||
// Null out non-first cells
|
// Null out non-first cells
|
||||||
for (x++; x < lastCharX; x++) {
|
for (x++; x < lastCharX; x++) {
|
||||||
const j = ((y * terminal.cols) + x) * RENDER_MODEL_INDICIES_PER_CELL;
|
const j = ((y * terminal.cols) + x) * RENDER_MODEL_INDICIES_PER_CELL;
|
||||||
this._glyphRenderer.updateCell(x, y, NULL_CELL_CODE, 0, 0, NULL_CELL_CHAR);
|
this._glyphRenderer.updateCell(x, y, NULL_CELL_CODE, 0, 0, NULL_CELL_CHAR, 0);
|
||||||
this._model.cells[j] = NULL_CELL_CODE;
|
this._model.cells[j] = NULL_CELL_CODE;
|
||||||
this._model.cells[j + RENDER_MODEL_BG_OFFSET] = this._workColors.bg;
|
this._model.cells[j + RENDER_MODEL_BG_OFFSET] = this._workColors.bg;
|
||||||
this._model.cells[j + RENDER_MODEL_FG_OFFSET] = this._workColors.fg;
|
this._model.cells[j + RENDER_MODEL_FG_OFFSET] = this._workColors.fg;
|
||||||
|
|||||||
Reference in New Issue
Block a user