Skip to content

Commit 9a778f0

Browse files
committed
Move back to CellColorResolver
1 parent 93c1650 commit 9a778f0

2 files changed

Lines changed: 7 additions & 9 deletions

File tree

addons/addon-webgl/src/CellColorResolver.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import { ICellData } from 'common/Types';
77
import { Terminal } from '@xterm/xterm';
88
import { rgba } from 'common/Color';
99
import { treatGlyphAsBackgroundColor } from 'browser/renderer/shared/RendererUtils';
10+
import { blockPatternCodepoints } from './customGlyphs/CustomGlyphDefinitions';
1011

1112
// Work variables to avoid garbage collection
1213
let $fg = 0;
@@ -42,7 +43,7 @@ export class CellColorResolver {
4243
* Resolves colors for the cell, putting the result into the shared {@link result}. This resolves
4344
* overrides, inverse and selection for the cell which can then be used to feed into the renderer.
4445
*/
45-
public resolve(cell: ICellData, x: number, y: number, deviceCellWidth: number): void {
46+
public resolve(cell: ICellData, x: number, y: number, deviceCellWidth: number, deviceCellHeight: number): void {
4647
this.result.bg = cell.bg;
4748
this.result.fg = cell.fg;
4849
this.result.ext = cell.bg & BgFlags.HAS_EXTENDED ? cell.extended.ext : 0;
@@ -63,6 +64,9 @@ export class CellColorResolver {
6364
const lineWidth = Math.max(1, Math.floor(this._optionService.rawOptions.fontSize * this._coreBrowserService.dpr / 15));
6465
$variantOffset = x * deviceCellWidth % (Math.round(lineWidth) * 2);
6566
}
67+
if ($variantOffset === 0 && blockPatternCodepoints.has(code)) {
68+
$variantOffset = ((x * deviceCellWidth) % 2) * 2 + ((y * deviceCellHeight) % 2);
69+
}
6670
// Apply decorations on the bottom layer
6771
this._decorationService.forEachDecorationAtCell(x, y, 'bottom', d => {
6872
if (d.backgroundColorRGB) {

addons/addon-webgl/src/WebglRenderer.ts

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import { ICharSizeService, ICharacterJoinerService, ICoreBrowserService, IThemeS
1313
import { CharData, IBufferLine, ICellData } from 'common/Types';
1414
import { AttributeData } from 'common/buffer/AttributeData';
1515
import { CellData } from 'common/buffer/CellData';
16-
import { Attributes, Content, ExtFlags, NULL_CELL_CHAR, NULL_CELL_CODE } from 'common/buffer/Constants';
16+
import { Attributes, Content, NULL_CELL_CHAR, NULL_CELL_CODE } from 'common/buffer/Constants';
1717
import { ICoreService, IDecorationService, IOptionsService } from 'common/services/Services';
1818
import { Terminal } from '@xterm/xterm';
1919
import { GlyphRenderer } from './GlyphRenderer';
@@ -26,7 +26,6 @@ import { Emitter, EventUtils } from 'common/Event';
2626
import { addDisposableListener } from 'vs/base/browser/dom';
2727
import { combinedDisposable, Disposable, MutableDisposable, toDisposable } from 'common/Lifecycle';
2828
import { createRenderDimensions } from 'browser/renderer/shared/RendererUtils';
29-
import { blockPatternCodepoints } from './customGlyphs/CustomGlyphDefinitions';
3029

3130
export class WebglRenderer extends Disposable implements IRenderer {
3231
private _renderLayers: IRenderLayer[];
@@ -479,12 +478,7 @@ export class WebglRenderer extends Disposable implements IRenderer {
479478
i = ((y * terminal.cols) + x) * RENDER_MODEL_INDICIES_PER_CELL;
480479

481480
// Load colors/resolve overrides into work colors
482-
this._cellColorResolver.resolve(cell, x, row, this.dimensions.device.cell.width);
483-
if ((this._cellColorResolver.result.ext & ExtFlags.VARIANT_OFFSET) === 0 && blockPatternCodepoints.has(code)) {
484-
const variantOffset = ((x * this.dimensions.device.cell.width) % 2) * 2 + ((row * this.dimensions.device.cell.height) % 2);
485-
this._cellColorResolver.result.ext &= ~ExtFlags.VARIANT_OFFSET;
486-
this._cellColorResolver.result.ext |= (variantOffset << 29) & ExtFlags.VARIANT_OFFSET;
487-
}
481+
this._cellColorResolver.resolve(cell, x, row, this.dimensions.device.cell.width, this.dimensions.device.cell.height);
488482

489483
// Override colors for cursor cell
490484
if (isCursorVisible && row === cursorY) {

0 commit comments

Comments
 (0)