force alpha to 1 when using background color as inverted foreground color.

This commit is contained in:
ivanwonder
2019-11-11 11:01:32 +08:00
parent 03fe1677b6
commit 5bc80fdf67
4 changed files with 38 additions and 3 deletions
@@ -11,6 +11,7 @@ import { LRUMap } from 'browser/renderer/atlas/LRUMap';
import { isFirefox, isSafari } from 'common/Platform';
import { IColor } from 'browser/Types';
import { throwIfFalsy } from 'browser/renderer/RendererUtils';
import { fromRgba, toCss } from 'browser/Color';
// In practice we're probably never going to exhaust a texture this large. For debugging purposes,
// however, it can be useful to set this to a really tiny value, to verify that LRU eviction works.
@@ -253,7 +254,13 @@ export class DynamicCharAtlas extends BaseCharAtlas {
`${fontStyle} ${fontWeight} ${this._config.fontSize * this._config.devicePixelRatio}px ${this._config.fontFamily}`;
this._tmpCtx.textBaseline = 'middle';
this._tmpCtx.fillStyle = this._getForegroundColor(glyph).css;
const fgColor = this._getForegroundColor(glyph);
this._tmpCtx.fillStyle = fgColor.css;
if (glyph.fg === INVERTED_DEFAULT_COLOR) {
const rgba = fromRgba(fgColor.rgba);
this._tmpCtx.fillStyle = toCss(rgba[0], rgba[1], rgba[2]);
}
// Apply alpha to dim the character
if (glyph.dim) {