DynamicCharAtlas -> CanvasCharAtlas
This commit is contained in:
@@ -20,7 +20,7 @@ import { channels, color, rgba } from 'common/Color';
|
|||||||
import { removeElementFromParent } from 'browser/Dom';
|
import { removeElementFromParent } from 'browser/Dom';
|
||||||
import { tryDrawCustomChar } from 'browser/renderer/shared/CustomGlyphs';
|
import { tryDrawCustomChar } from 'browser/renderer/shared/CustomGlyphs';
|
||||||
import { Terminal } from 'xterm';
|
import { Terminal } from 'xterm';
|
||||||
import { DynamicCharAtlas } from 'atlas/DynamicCharAtlas';
|
import { CanvasCharAtlas } from 'atlas/CanvasCharAtlas';
|
||||||
|
|
||||||
export abstract class BaseRenderLayer implements IRenderLayer {
|
export abstract class BaseRenderLayer implements IRenderLayer {
|
||||||
private _canvas: HTMLCanvasElement;
|
private _canvas: HTMLCanvasElement;
|
||||||
@@ -36,7 +36,7 @@ export abstract class BaseRenderLayer implements IRenderLayer {
|
|||||||
protected _selectionEnd: [number, number] | undefined;
|
protected _selectionEnd: [number, number] | undefined;
|
||||||
protected _columnSelectMode: boolean = false;
|
protected _columnSelectMode: boolean = false;
|
||||||
|
|
||||||
protected _charAtlas: DynamicCharAtlas | undefined;
|
protected _charAtlas: CanvasCharAtlas | undefined;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* An object that's reused when drawing glyphs in order to reduce GC.
|
* An object that's reused when drawing glyphs in order to reduce GC.
|
||||||
|
|||||||
+1
-1
@@ -51,7 +51,7 @@ export function getGlyphCacheKey(glyph: IGlyphIdentifier): number {
|
|||||||
return glyph.code << 21 | glyph.bg << 12 | glyph.fg << 3 | (glyph.bold ? 0 : 4) + (glyph.dim ? 0 : 2) + (glyph.italic ? 0 : 1);
|
return glyph.code << 21 | glyph.bg << 12 | glyph.fg << 3 | (glyph.bold ? 0 : 4) + (glyph.dim ? 0 : 2) + (glyph.italic ? 0 : 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
export class DynamicCharAtlas {
|
export class CanvasCharAtlas {
|
||||||
// An ordered map that we're using to keep track of where each glyph is in the atlas texture.
|
// An ordered map that we're using to keep track of where each glyph is in the atlas texture.
|
||||||
// It's ordered so that we can determine when to remove the old entries.
|
// It's ordered so that we can determine when to remove the old entries.
|
||||||
private _cacheMap: LRUMap<IGlyphCacheValue>;
|
private _cacheMap: LRUMap<IGlyphCacheValue>;
|
||||||
@@ -4,13 +4,13 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import { generateConfig, configEquals } from 'browser/renderer/shared/CharAtlasUtils';
|
import { generateConfig, configEquals } from 'browser/renderer/shared/CharAtlasUtils';
|
||||||
import { DynamicCharAtlas } from './DynamicCharAtlas';
|
import { CanvasCharAtlas } from './CanvasCharAtlas';
|
||||||
import { IColorSet } from 'browser/Types';
|
import { IColorSet } from 'browser/Types';
|
||||||
import { Terminal } from 'xterm';
|
import { Terminal } from 'xterm';
|
||||||
import { ICharAtlasConfig } from 'browser/renderer/shared/Types';
|
import { ICharAtlasConfig } from 'browser/renderer/shared/Types';
|
||||||
|
|
||||||
interface ICharAtlasCacheEntry {
|
interface ICharAtlasCacheEntry {
|
||||||
atlas: DynamicCharAtlas;
|
atlas: CanvasCharAtlas;
|
||||||
config: ICharAtlasConfig;
|
config: ICharAtlasConfig;
|
||||||
// N.B. This implementation potentially holds onto copies of the terminal forever, so
|
// N.B. This implementation potentially holds onto copies of the terminal forever, so
|
||||||
// this may cause memory leaks.
|
// this may cause memory leaks.
|
||||||
@@ -31,7 +31,7 @@ export function acquireCharAtlas(
|
|||||||
scaledCharWidth: number,
|
scaledCharWidth: number,
|
||||||
scaledCharHeight: number,
|
scaledCharHeight: number,
|
||||||
devicePixelRatio: number
|
devicePixelRatio: number
|
||||||
): DynamicCharAtlas {
|
): CanvasCharAtlas {
|
||||||
const newConfig = generateConfig(scaledCellWidth, scaledCellHeight, scaledCharWidth, scaledCharHeight, terminal, colors, devicePixelRatio);
|
const newConfig = generateConfig(scaledCellWidth, scaledCellHeight, scaledCharWidth, scaledCharHeight, terminal, colors, devicePixelRatio);
|
||||||
|
|
||||||
// Check to see if the renderer already owns this config
|
// Check to see if the renderer already owns this config
|
||||||
@@ -64,7 +64,7 @@ export function acquireCharAtlas(
|
|||||||
}
|
}
|
||||||
|
|
||||||
const newEntry: ICharAtlasCacheEntry = {
|
const newEntry: ICharAtlasCacheEntry = {
|
||||||
atlas: new DynamicCharAtlas(
|
atlas: new CanvasCharAtlas(
|
||||||
document,
|
document,
|
||||||
newConfig
|
newConfig
|
||||||
),
|
),
|
||||||
|
|||||||
Reference in New Issue
Block a user