-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1790 from Tyriar/webgl2
WebGL Renderer
- Loading branch information
Showing
34 changed files
with
3,363 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
lib | ||
node_modules |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
**/*.api.js | ||
**/*.api.ts | ||
tsconfig.json | ||
.yarnrc | ||
webpack.config.js |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
Copyright (c) 2018, The xterm.js authors (https://github.com/xtermjs/xterm.js) | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in | ||
all copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
THE SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
{ | ||
"name": "xterm-addon-webgl", | ||
"version": "0.1.0", | ||
"author": { | ||
"name": "The xterm.js authors", | ||
"url": "https://xtermjs.org/" | ||
}, | ||
"main": "lib/xterm-addon-webgl.js", | ||
"types": "typings/xterm-addon-webgl.d.ts", | ||
"license": "MIT", | ||
"scripts": { | ||
"build": "../../node_modules/.bin/tsc -p src", | ||
"prepackage": "npm run build", | ||
"package": "../../node_modules/.bin/webpack", | ||
"prepublishOnly": "npm run package" | ||
}, | ||
"peerDependencies": { | ||
"xterm": "^3.14.0" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
/** | ||
* Copyright (c) 2019 The xterm.js authors. All rights reserved. | ||
* @license MIT | ||
*/ | ||
|
||
import { CellData } from 'common/buffer/CellData'; | ||
import { FLAGS } from './Constants'; | ||
import { IBufferLine } from 'common/Types'; | ||
|
||
export function getCompatAttr(bufferLine: IBufferLine, index: number): number { | ||
// TODO: Need to move WebGL over to the new system and remove this block | ||
const cell = new CellData(); | ||
bufferLine.loadCell(index, cell); | ||
const oldBg = cell.getBgColor() === -1 ? 256 : cell.getBgColor(); | ||
const oldFg = cell.getFgColor() === -1 ? 256 : cell.getFgColor(); | ||
const oldAttr = | ||
(cell.isBold() ? FLAGS.BOLD : 0) | | ||
(cell.isUnderline() ? FLAGS.UNDERLINE : 0) | | ||
(cell.isBlink() ? FLAGS.BLINK : 0) | | ||
(cell.isInverse() ? FLAGS.INVERSE : 0) | | ||
(cell.isDim() ? FLAGS.DIM : 0) | | ||
(cell.isItalic() ? FLAGS.ITALIC : 0); | ||
const attrCompat = | ||
oldBg | | ||
(oldFg << 9) | | ||
(oldAttr << 18); | ||
return attrCompat; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
/** | ||
* @license MIT | ||
* Copyright (c) 2018 The xterm.js authors. All rights reserved. | ||
*/ | ||
|
||
import { IColor } from 'browser/Types'; | ||
|
||
export function getLuminance(color: IColor): number { | ||
// Coefficients taken from: https://www.w3.org/TR/AERT/#color-contrast | ||
const r = color.rgba >> 24 & 0xff; | ||
const g = color.rgba >> 16 & 0xff; | ||
const b = color.rgba >> 8 & 0xff; | ||
return (0.299 * r + 0.587 * g + 0.114 * b) / 255; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
/** | ||
* Copyright (c) 2019 The xterm.js authors. All rights reserved. | ||
* @license MIT | ||
*/ | ||
|
||
// TODO: Should be removed after chardata workaround is fixed | ||
export const enum FLAGS { | ||
BOLD = 1, | ||
UNDERLINE = 2, | ||
BLINK = 4, | ||
INVERSE = 8, | ||
INVISIBLE = 16, | ||
DIM = 32, | ||
ITALIC = 64 | ||
} |
Oops, something went wrong.