Simplify color generation code

This commit is contained in:
Daniel Imms
2017-08-31 21:18:55 -07:00
parent 1998675dc0
commit c88824155f
3 changed files with 46 additions and 28 deletions
+2 -1
View File
@@ -6,6 +6,7 @@ export abstract class BaseRenderLayer implements IRenderLayer {
protected _canvas: HTMLCanvasElement;
protected _ctx: CanvasRenderingContext2D;
// TODO: This will apply to all terminals, should it be per-terminal?
protected static _charAtlas: ImageBitmap;
private static _charAtlasCharWidth: number;
private static _charAtlasCharHeight: number;
@@ -29,7 +30,7 @@ export abstract class BaseRenderLayer implements IRenderLayer {
this._canvas.height = canvasHeight * window.devicePixelRatio;
this._canvas.style.width = `${canvasWidth}px`;
this._canvas.style.height = `${canvasHeight}px`;
// Only update the char atlas if the char size changed
if (charSizeChanged) {
// Only update the char atlas if an update for the right dimensions is not
// already in progress