From 7b199ac17f52146296fd30986a1996bb96258074 Mon Sep 17 00:00:00 2001 From: Daniel Imms Date: Mon, 4 Sep 2017 19:40:49 -0700 Subject: [PATCH] Some more documentation --- src/renderer/CharAtlas.ts | 10 ++++++++++ src/renderer/ColorManager.ts | 7 +++++++ 2 files changed, 17 insertions(+) diff --git a/src/renderer/CharAtlas.ts b/src/renderer/CharAtlas.ts index e25628730..b4264567a 100644 --- a/src/renderer/CharAtlas.ts +++ b/src/renderer/CharAtlas.ts @@ -20,6 +20,12 @@ interface ICharAtlasCacheEntry { let charAtlasCache: ICharAtlasCacheEntry[] = []; +/** + * Acquires a char atlas, either generating a new one or returning an existing + * one that is in use by another terminal. + * @param terminal The terminal. + * @param colors The colors to use. + */ export function acquireCharAtlas(terminal: ITerminal, colors: IColorSet): HTMLCanvasElement | Promise { const scaledCharWidth = terminal.charMeasure.width * window.devicePixelRatio; const scaledCharHeight = terminal.charMeasure.height * window.devicePixelRatio; @@ -95,6 +101,10 @@ function configEquals(a: ICharAtlasConfig, b: ICharAtlasConfig): boolean { let generator: CharAtlasGenerator; +/** + * Initializes the char atlas generator. + * @param document The document. + */ export function initialize(document: Document): void { if (!generator) { generator = new CharAtlasGenerator(document); diff --git a/src/renderer/ColorManager.ts b/src/renderer/ColorManager.ts index 2ae785dde..057292f77 100644 --- a/src/renderer/ColorManager.ts +++ b/src/renderer/ColorManager.ts @@ -26,6 +26,10 @@ export const DEFAULT_ANSI_COLORS = [ '#eeeeec' ]; +/** + * Fills an existing 16 length string with the remaining 240 ANSI colors. + * @param first16Colors The first 16 ANSI colors. + */ function generate256Colors(first16Colors: string[]): string[] { let colors = first16Colors.slice(); @@ -52,6 +56,9 @@ function toPaddedHex(c: number): string { return s.length < 2 ? '0' + s : s; } +/** + * Manages the source of truth for a terminal's colors. + */ export class ColorManager { public colors: IColorSet;