Move Renderer to browser

This commit is contained in:
Daniel Imms
2019-11-07 18:45:13 -08:00
parent 873de2b127
commit 3f7238d9dc
2 changed files with 19 additions and 19 deletions
+2 -2
View File
@@ -28,7 +28,7 @@ import { Viewport } from 'browser/Viewport';
import { rightClickHandler, moveTextAreaUnderMouseCursor, handlePasteEvent, copyHandler, paste } from 'browser/Clipboard'; import { rightClickHandler, moveTextAreaUnderMouseCursor, handlePasteEvent, copyHandler, paste } from 'browser/Clipboard';
import { C0 } from 'common/data/EscapeSequences'; import { C0 } from 'common/data/EscapeSequences';
import { InputHandler } from './InputHandler'; import { InputHandler } from './InputHandler';
import { Renderer } from './renderer/Renderer'; import { Renderer } from 'browser/renderer/Renderer';
import { Linkifier } from 'browser/Linkifier'; import { Linkifier } from 'browser/Linkifier';
import { SelectionService } from 'browser/services/SelectionService'; import { SelectionService } from 'browser/services/SelectionService';
import * as Browser from 'common/Platform'; import * as Browser from 'common/Platform';
@@ -631,7 +631,7 @@ export class Terminal extends Disposable implements ITerminal, IDisposable, IInp
private _createRenderer(): IRenderer { private _createRenderer(): IRenderer {
switch (this.options.rendererType) { switch (this.options.rendererType) {
case 'canvas': return new Renderer(this._colorManager.colors, this.screenElement, this.linkifier, this._bufferService, this._charSizeService, this.optionsService, this._coreService, this._coreBrowserService); case 'canvas': return this._instantiationService.createInstance(Renderer, this._colorManager.colors, this.screenElement, this.linkifier);
case 'dom': return this._instantiationService.createInstance(DomRenderer, this._colorManager.colors, this.element, this.screenElement, this._viewportElement, this.linkifier); case 'dom': return this._instantiationService.createInstance(DomRenderer, this._colorManager.colors, this.element, this.screenElement, this._viewportElement, this.linkifier);
default: throw new Error(`Unrecognized rendererType "${this.options.rendererType}"`); default: throw new Error(`Unrecognized rendererType "${this.options.rendererType}"`);
} }
@@ -34,11 +34,11 @@ export class Renderer extends Disposable implements IRenderer {
private _colors: IColorSet, private _colors: IColorSet,
private readonly _screenElement: HTMLElement, private readonly _screenElement: HTMLElement,
private readonly _linkifier: ILinkifier, private readonly _linkifier: ILinkifier,
private readonly _bufferService: IBufferService, @IBufferService private readonly _bufferService: IBufferService,
private readonly _charSizeService: ICharSizeService, @ICharSizeService private readonly _charSizeService: ICharSizeService,
private readonly _optionsService: IOptionsService, @IOptionsService private readonly _optionsService: IOptionsService,
readonly coreService: ICoreService, @ICoreService readonly coreService: ICoreService,
readonly coreBrowserService: ICoreBrowserService @ICoreBrowserService readonly coreBrowserService: ICoreBrowserService
) { ) {
super(); super();
const allowTransparency = this._optionsService.options.allowTransparency; const allowTransparency = this._optionsService.options.allowTransparency;
@@ -51,18 +51,18 @@ export class Renderer extends Disposable implements IRenderer {
new CursorRenderLayer(this._screenElement, 3, this._colors, this._id, this._onRequestRefreshRows, this._bufferService, _optionsService, coreService, coreBrowserService) new CursorRenderLayer(this._screenElement, 3, this._colors, this._id, this._onRequestRefreshRows, this._bufferService, _optionsService, coreService, coreBrowserService)
]; ];
this.dimensions = { this.dimensions = {
scaledCharWidth: null, scaledCharWidth: 0,
scaledCharHeight: null, scaledCharHeight: 0,
scaledCellWidth: null, scaledCellWidth: 0,
scaledCellHeight: null, scaledCellHeight: 0,
scaledCharLeft: null, scaledCharLeft: 0,
scaledCharTop: null, scaledCharTop: 0,
scaledCanvasWidth: null, scaledCanvasWidth: 0,
scaledCanvasHeight: null, scaledCanvasHeight: 0,
canvasWidth: null, canvasWidth: 0,
canvasHeight: null, canvasHeight: 0,
actualCellWidth: null, actualCellWidth: 0,
actualCellHeight: null actualCellHeight: 0
}; };
this._devicePixelRatio = window.devicePixelRatio; this._devicePixelRatio = window.devicePixelRatio;
this._updateDimensions(); this._updateDimensions();