Skip to content

Commit 0692d48

Browse files
authored
Merge pull request #5286 from Tyriar/webgl_only_from_shared
Move WebGL addon-specific code into addon
2 parents dce403a + cfc1071 commit 0692d48

17 files changed

+133
-126
lines changed

src/browser/renderer/shared/CharAtlasCache.ts renamed to addons/addon-webgl/src/CharAtlasCache.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@
33
* @license MIT
44
*/
55

6-
import { TextureAtlas } from 'browser/renderer/shared/TextureAtlas';
6+
import { TextureAtlas } from './TextureAtlas';
77
import { ITerminalOptions, Terminal } from '@xterm/xterm';
88
import { ITerminal, ReadonlyColorSet } from 'browser/Types';
9-
import { ICharAtlasConfig, ITextureAtlas } from 'browser/renderer/shared/Types';
10-
import { generateConfig, configEquals } from 'browser/renderer/shared/CharAtlasUtils';
9+
import { ICharAtlasConfig, ITextureAtlas } from './Types';
10+
import { generateConfig, configEquals } from './CharAtlasUtils';
1111

1212
interface ITextureAtlasCacheEntry {
1313
atlas: ITextureAtlas;

addons/addon-webgl/src/Constants.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
/**
2+
* Copyright (c) 2017 The xterm.js authors. All rights reserved.
3+
* @license MIT
4+
*/
5+
6+
import { isFirefox, isLegacyEdge } from 'common/Platform';
7+
8+
export const DIM_OPACITY = 0.5;
9+
// The text baseline is set conditionally by browser. Using 'ideographic' for Firefox or Legacy Edge
10+
// would result in truncated text (Issue 3353). Using 'bottom' for Chrome would result in slightly
11+
// unaligned Powerline fonts (PR 3356#issuecomment-850928179).
12+
export const TEXT_BASELINE: CanvasTextBaseline = isFirefox || isLegacyEdge ? 'bottom' : 'ideographic';

addons/addon-webgl/src/GlyphRenderer.ts

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,15 @@
22
* Copyright (c) 2018 The xterm.js authors. All rights reserved.
33
* @license MIT
44
*/
5-
6-
import { allowRescaling, throwIfFalsy } from 'browser/renderer/shared/RendererUtils';
7-
import { TextureAtlas } from 'browser/renderer/shared/TextureAtlas';
8-
import { IRasterizedGlyph, IRenderDimensions, ITextureAtlas } from 'browser/renderer/shared/Types';
5+
import { TextureAtlas } from './TextureAtlas';
6+
import { IRenderDimensions } from 'browser/renderer/shared/Types';
97
import { NULL_CELL_CODE } from 'common/buffer/Constants';
108
import { Disposable, toDisposable } from 'vs/base/common/lifecycle';
119
import { Terminal } from '@xterm/xterm';
12-
import { IRenderModel, IWebGL2RenderingContext, IWebGLVertexArrayObject } from './Types';
10+
import { IRenderModel, IWebGL2RenderingContext, IWebGLVertexArrayObject, type IRasterizedGlyph, type ITextureAtlas } from './Types';
1311
import { createProgram, GLTexture, PROJECTION_MATRIX } from './WebglUtils';
1412
import type { IOptionsService } from 'common/services/Services';
13+
import { allowRescaling, throwIfFalsy } from 'browser/renderer/shared/RendererUtils';
1514

1615
interface IVertices {
1716
attributes: Float32Array;

addons/addon-webgl/src/RectangleRenderer.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
* @license MIT
44
*/
55

6-
import { throwIfFalsy } from 'browser/renderer/shared/RendererUtils';
76
import { IRenderDimensions } from 'browser/renderer/shared/Types';
87
import { IThemeService } from 'browser/services/Services';
98
import { ReadonlyColorSet } from 'browser/Types';
@@ -14,6 +13,7 @@ import { Terminal } from '@xterm/xterm';
1413
import { RENDER_MODEL_BG_OFFSET, RENDER_MODEL_FG_OFFSET, RENDER_MODEL_INDICIES_PER_CELL } from './RenderModel';
1514
import { IRenderModel, IWebGL2RenderingContext, IWebGLVertexArrayObject } from './Types';
1615
import { createProgram, expandFloat32Array, PROJECTION_MATRIX } from './WebglUtils';
16+
import { throwIfFalsy } from 'browser/renderer/shared/RendererUtils';
1717

1818
const enum VertexAttribLocations {
1919
POSITION = 0,

src/browser/renderer/shared/TextureAtlas.ts renamed to addons/addon-webgl/src/TextureAtlas.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@
44
*/
55

66
import { IColorContrastCache } from 'browser/Types';
7-
import { DIM_OPACITY, TEXT_BASELINE } from 'browser/renderer/shared/Constants';
8-
import { tryDrawCustomChar } from 'browser/renderer/shared/CustomGlyphs';
7+
import { DIM_OPACITY, TEXT_BASELINE } from './Constants';
8+
import { tryDrawCustomChar } from './CustomGlyphs';
99
import { computeNextVariantOffset, treatGlyphAsBackgroundColor, isPowerlineGlyph, isRestrictedPowerlineGlyph, throwIfFalsy } from 'browser/renderer/shared/RendererUtils';
10-
import { IBoundingBox, ICharAtlasConfig, IRasterizedGlyph, ITextureAtlas } from 'browser/renderer/shared/Types';
10+
import { IBoundingBox, ICharAtlasConfig, IRasterizedGlyph, ITextureAtlas } from './Types';
1111
import { NULL_COLOR, channels, color, rgba } from 'common/Color';
1212
import { FourKeyMap } from 'common/MultiKeyMap';
1313
import { IdleTaskQueue } from 'common/TaskQueue';

0 commit comments

Comments
 (0)