Skip to content

Commit d70f2a4

Browse files
committed
Move webgl-specific shared code into addon
Never got moved when canvas addon was removed
1 parent dce403a commit d70f2a4

14 files changed

Lines changed: 29 additions & 26 deletions
File renamed without changes.

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

Lines changed: 2 additions & 2 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';
99
import { ICharAtlasConfig, ITextureAtlas } from 'browser/renderer/shared/Types';
10-
import { generateConfig, configEquals } from 'browser/renderer/shared/CharAtlasUtils';
10+
import { generateConfig, configEquals } from 'CharAtlasUtils';
1111

1212
interface ITextureAtlasCacheEntry {
1313
atlas: ITextureAtlas;

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

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

6-
import { ICharAtlasConfig } from './Types';
6+
import { ICharAtlasConfig } from '../../../src/browser/renderer/shared/Types';
77
import { Attributes } from 'common/buffer/Constants';
88
import { ITerminalOptions } from '@xterm/xterm';
99
import { IColorSet, ReadonlyColorSet } from 'browser/Types';
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';
File renamed without changes.
File renamed without changes.
File renamed without changes.

addons/addon-webgl/src/GlyphRenderer.ts

Lines changed: 2 additions & 3 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';
5+
import { TextureAtlas } from 'TextureAtlas';
86
import { IRasterizedGlyph, IRenderDimensions, ITextureAtlas } 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';
1210
import { IRenderModel, IWebGL2RenderingContext, IWebGLVertexArrayObject } 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: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
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';
1010
import { IBoundingBox, ICharAtlasConfig, IRasterizedGlyph, ITextureAtlas } from 'browser/renderer/shared/Types';
1111
import { NULL_COLOR, channels, color, rgba } from 'common/Color';

0 commit comments

Comments
 (0)