未验证 提交 9931bab3 编写于 作者: A Alex Dima

Improve rendering for minimap blocks

上级 9fde1ae0
......@@ -1666,6 +1666,7 @@ class InnerMinimap extends Disposable {
const content = lineData.content;
const tokens = lineData.tokens;
const maxDx = target.width - charWidth;
const force1pxHeight = (minimapLineHeight === 1);
let dx = MINIMAP_GUTTER_WIDTH;
let charIndex = 0;
......@@ -1697,9 +1698,9 @@ class InnerMinimap extends Disposable {
for (let i = 0; i < count; i++) {
if (renderMinimap === RenderMinimap.Blocks) {
minimapCharRenderer.blockRenderChar(target, dx, dy + innerLinePadding, tokenColor, backgroundColor, useLighterFont);
minimapCharRenderer.blockRenderChar(target, dx, dy + innerLinePadding, tokenColor, backgroundColor, useLighterFont, force1pxHeight);
} else { // RenderMinimap.Text
minimapCharRenderer.renderChar(target, dx, dy + innerLinePadding, charCode, tokenColor, backgroundColor, fontScale, useLighterFont, minimapLineHeight === 1);
minimapCharRenderer.renderChar(target, dx, dy + innerLinePadding, charCode, tokenColor, backgroundColor, fontScale, useLighterFont, force1pxHeight);
}
dx += charWidth;
......
......@@ -82,11 +82,13 @@ export class MinimapCharRenderer {
dy: number,
color: RGBA8,
backgroundColor: RGBA8,
useLighterFont: boolean
useLighterFont: boolean,
force1pxHeight: boolean
): void {
const charWidth = Constants.BASE_CHAR_WIDTH * this.scale;
const charHeight = Constants.BASE_CHAR_HEIGHT * this.scale;
if (dx + charWidth > target.width || dy + charHeight > target.height) {
const renderHeight = (force1pxHeight ? 1 : charHeight);
if (dx + charWidth > target.width || dy + renderHeight > target.height) {
console.warn('bad render request outside image data');
return;
}
......@@ -110,7 +112,7 @@ export class MinimapCharRenderer {
const dest = target.data;
let row = dy * destWidth + dx * Constants.RGBA_CHANNELS_CNT;
for (let y = 0; y < charHeight; y++) {
for (let y = 0; y < renderHeight; y++) {
let column = row;
for (let x = 0; x < charWidth; x++) {
dest[column++] = colorR;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册