33 * @license MIT
44 */
55
6+ import { ReadonlyColorSet } from 'browser/Types' ;
7+ import { CellColorResolver } from 'browser/renderer/shared/CellColorResolver' ;
68import { acquireTextureAtlas } from 'browser/renderer/shared/CharAtlasCache' ;
79import { TEXT_BASELINE } from 'browser/renderer/shared/Constants' ;
810import { tryDrawCustomChar } from 'browser/renderer/shared/CustomGlyphs' ;
911import { throwIfFalsy } from 'browser/renderer/shared/RendererUtils' ;
10- import { IRasterizedGlyph , IRenderDimensions , ISelectionRenderModel , ITextureAtlas } from 'browser/renderer/shared/Types' ;
1112import { createSelectionRenderModel } from 'browser/renderer/shared/SelectionRenderModel' ;
13+ import { IRasterizedGlyph , IRenderDimensions , ISelectionRenderModel , ITextureAtlas } from 'browser/renderer/shared/Types' ;
1214import { ICoreBrowserService , IThemeService } from 'browser/services/Services' ;
13- import { ReadonlyColorSet } from 'browser/Types' ;
15+ import { EventEmitter , forwardEvent } from 'common/EventEmitter' ;
16+ import { Disposable , MutableDisposable , toDisposable } from 'common/Lifecycle' ;
17+ import { isSafari } from 'common/Platform' ;
18+ import { ICellData } from 'common/Types' ;
1419import { CellData } from 'common/buffer/CellData' ;
1520import { WHITESPACE_CELL_CODE } from 'common/buffer/Constants' ;
1621import { IBufferService , IDecorationService , IOptionsService } from 'common/services/Services' ;
17- import { ICellData , IDisposable } from 'common/Types' ;
1822import { Terminal } from 'xterm' ;
1923import { IRenderLayer } from './Types' ;
20- import { CellColorResolver } from 'browser/renderer/shared/CellColorResolver' ;
21- import { Disposable , toDisposable } from 'common/Lifecycle' ;
22- import { isSafari } from 'common/Platform' ;
23- import { EventEmitter , forwardEvent } from 'common/EventEmitter' ;
2424
2525export abstract class BaseRenderLayer extends Disposable implements IRenderLayer {
2626 private _canvas : HTMLCanvasElement ;
@@ -37,7 +37,7 @@ export abstract class BaseRenderLayer extends Disposable implements IRenderLayer
3737 private _bitmapGenerator : ( BitmapGenerator | undefined ) [ ] = [ ] ;
3838
3939 protected _charAtlas ! : ITextureAtlas ;
40- private _charAtlasDisposable ?: IDisposable ;
40+ protected _charAtlasDisposable = this . register ( new MutableDisposable ( ) ) ;
4141
4242 public get canvas ( ) : HTMLCanvasElement { return this . _canvas ; }
4343 public get cacheCanvas ( ) : HTMLCanvasElement { return this . _charAtlas ?. pages [ 0 ] . canvas ! ; }
@@ -122,9 +122,8 @@ export abstract class BaseRenderLayer extends Disposable implements IRenderLayer
122122 if ( this . _deviceCharWidth <= 0 && this . _deviceCharHeight <= 0 ) {
123123 return ;
124124 }
125- this . _charAtlasDisposable ?. dispose ( ) ;
126125 this . _charAtlas = acquireTextureAtlas ( this . _terminal , this . _optionsService . rawOptions , colorSet , this . _deviceCellWidth , this . _deviceCellHeight , this . _deviceCharWidth , this . _deviceCharHeight , this . _coreBrowserService . dpr ) ;
127- this . _charAtlasDisposable = forwardEvent ( this . _charAtlas . onAddTextureAtlasCanvas , this . _onAddTextureAtlasCanvas ) ;
126+ this . _charAtlasDisposable . value = forwardEvent ( this . _charAtlas . onAddTextureAtlasCanvas , this . _onAddTextureAtlasCanvas ) ;
128127 this . _charAtlas . warmUp ( ) ;
129128 for ( let i = 0 ; i < this . _charAtlas . pages . length ; i ++ ) {
130129 this . _bitmapGenerator [ i ] = new BitmapGenerator ( this . _charAtlas . pages [ i ] . canvas ) ;
0 commit comments