mirror of
https://github.com/wavetermdev/xterm.js.git
synced 2026-08-05 13:43:48 -07:00
DynamicCharAtlas -> CanvasCharAtlas
This commit is contained in:
@@ -20,7 +20,7 @@ import { channels, color, rgba } from 'common/Color';
|
||||
import { removeElementFromParent } from 'browser/Dom';
|
||||
import { tryDrawCustomChar } from 'browser/renderer/shared/CustomGlyphs';
|
||||
import { Terminal } from 'xterm';
|
||||
import { DynamicCharAtlas } from 'atlas/DynamicCharAtlas';
|
||||
import { CanvasCharAtlas } from 'atlas/CanvasCharAtlas';
|
||||
|
||||
export abstract class BaseRenderLayer implements IRenderLayer {
|
||||
private _canvas: HTMLCanvasElement;
|
||||
@@ -36,7 +36,7 @@ export abstract class BaseRenderLayer implements IRenderLayer {
|
||||
protected _selectionEnd: [number, number] | undefined;
|
||||
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.
|
||||
|
||||
+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);
|
||||
}
|
||||
|
||||
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.
|
||||
// It's ordered so that we can determine when to remove the old entries.
|
||||
private _cacheMap: LRUMap<IGlyphCacheValue>;
|
||||
@@ -4,13 +4,13 @@
|
||||
*/
|
||||
|
||||
import { generateConfig, configEquals } from 'browser/renderer/shared/CharAtlasUtils';
|
||||
import { DynamicCharAtlas } from './DynamicCharAtlas';
|
||||
import { CanvasCharAtlas } from './CanvasCharAtlas';
|
||||
import { IColorSet } from 'browser/Types';
|
||||
import { Terminal } from 'xterm';
|
||||
import { ICharAtlasConfig } from 'browser/renderer/shared/Types';
|
||||
|
||||
interface ICharAtlasCacheEntry {
|
||||
atlas: DynamicCharAtlas;
|
||||
atlas: CanvasCharAtlas;
|
||||
config: ICharAtlasConfig;
|
||||
// N.B. This implementation potentially holds onto copies of the terminal forever, so
|
||||
// this may cause memory leaks.
|
||||
@@ -31,7 +31,7 @@ export function acquireCharAtlas(
|
||||
scaledCharWidth: number,
|
||||
scaledCharHeight: number,
|
||||
devicePixelRatio: number
|
||||
): DynamicCharAtlas {
|
||||
): CanvasCharAtlas {
|
||||
const newConfig = generateConfig(scaledCellWidth, scaledCellHeight, scaledCharWidth, scaledCharHeight, terminal, colors, devicePixelRatio);
|
||||
|
||||
// Check to see if the renderer already owns this config
|
||||
@@ -64,7 +64,7 @@ export function acquireCharAtlas(
|
||||
}
|
||||
|
||||
const newEntry: ICharAtlasCacheEntry = {
|
||||
atlas: new DynamicCharAtlas(
|
||||
atlas: new CanvasCharAtlas(
|
||||
document,
|
||||
newConfig
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user