Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Editor GPU: Ignore token foreground color when there is a decoration with a foreground color #234472

Open
Tyriar opened this issue Nov 23, 2024 · 0 comments
Assignees
Labels
editor-gpu Editor GPU rendering related issues plan-item VS Code - planned item for upcoming
Milestone

Comments

@Tyriar
Copy link
Member

Tyriar commented Nov 23, 2024

With #234127 there is a new charMetadata that is passed along to the rasterizer and used as a key for the glyph:

if (charMetadata) {
this._ctx.fillStyle = `#${charMetadata.toString(16).padStart(8, '0')}`;
} else {
this._ctx.fillStyle = colorMap[TokenMetadata.getForeground(metadata)];
}

this._glyphMap.set(chars, tokenMetadata, charMetadata, rasterizer.cacheKey, glyph);

A problem with this immediately is that the tokenMetadata's color becomes redundant as it's foreground color is overridden by charMetadata (inline decorations). Meaning for different tokens with the same decoration, or even just same decoration color, the glyph will be duplicated in the atlas.

I think the best way forward here is to delete the portion of tokenMetadata if there is a decoration foreground color, similar to what we do here:

// Ignore metadata that doesn't affect the glyph
tokenMetadata &= ~(MetadataConsts.LANGUAGEID_MASK | MetadataConsts.TOKEN_TYPE_MASK | MetadataConsts.BALANCED_BRACKETS_MASK);

Note that I think this also applies to partially transparent colors as it replaces the original color, not layers on top of it.

@Tyriar Tyriar added editor-gpu Editor GPU rendering related issues plan-item VS Code - planned item for upcoming labels Nov 23, 2024
@Tyriar Tyriar self-assigned this Nov 23, 2024
@Tyriar Tyriar added this to the November 2024 milestone Nov 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
editor-gpu Editor GPU rendering related issues plan-item VS Code - planned item for upcoming
Projects
Status: Todo
Development

No branches or pull requests

1 participant