Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
5133f110
V
vscode
项目概览
xxadev
/
vscode
与 Fork 源项目一致
从无法访问的项目Fork
通知
2
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
V
vscode
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
5133f110
编写于
2月 07, 2020
作者:
A
Alex Dima
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fix tests on webkit by using custom clamping to uint8 (#90063)
上级
0ebabc2b
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
21 addition
and
27 deletion
+21
-27
src/vs/editor/browser/viewParts/minimap/minimapCharRenderer.ts
...s/editor/browser/viewParts/minimap/minimapCharRenderer.ts
+2
-1
src/vs/editor/browser/viewParts/minimap/minimapCharRendererFactory.ts
...r/browser/viewParts/minimap/minimapCharRendererFactory.ts
+2
-1
src/vs/editor/test/browser/view/minimapCharRenderer.test.ts
src/vs/editor/test/browser/view/minimapCharRenderer.test.ts
+17
-25
未找到文件。
src/vs/editor/browser/viewParts/minimap/minimapCharRenderer.ts
浏览文件 @
5133f110
...
@@ -5,6 +5,7 @@
...
@@ -5,6 +5,7 @@
import
{
RGBA8
}
from
'
vs/editor/common/core/rgba
'
;
import
{
RGBA8
}
from
'
vs/editor/common/core/rgba
'
;
import
{
Constants
,
getCharIndex
}
from
'
./minimapCharSheet
'
;
import
{
Constants
,
getCharIndex
}
from
'
./minimapCharSheet
'
;
import
{
toUint8
}
from
'
vs/base/common/uint
'
;
export
class
MinimapCharRenderer
{
export
class
MinimapCharRenderer
{
_minimapCharRendererBrand
:
void
;
_minimapCharRendererBrand
:
void
;
...
@@ -20,7 +21,7 @@ export class MinimapCharRenderer {
...
@@ -20,7 +21,7 @@ export class MinimapCharRenderer {
private
static
soften
(
input
:
Uint8ClampedArray
,
ratio
:
number
):
Uint8ClampedArray
{
private
static
soften
(
input
:
Uint8ClampedArray
,
ratio
:
number
):
Uint8ClampedArray
{
let
result
=
new
Uint8ClampedArray
(
input
.
length
);
let
result
=
new
Uint8ClampedArray
(
input
.
length
);
for
(
let
i
=
0
,
len
=
input
.
length
;
i
<
len
;
i
++
)
{
for
(
let
i
=
0
,
len
=
input
.
length
;
i
<
len
;
i
++
)
{
result
[
i
]
=
input
[
i
]
*
ratio
;
result
[
i
]
=
toUint8
(
input
[
i
]
*
ratio
)
;
}
}
return
result
;
return
result
;
}
}
...
...
src/vs/editor/browser/viewParts/minimap/minimapCharRendererFactory.ts
浏览文件 @
5133f110
...
@@ -7,6 +7,7 @@ import { MinimapCharRenderer } from 'vs/editor/browser/viewParts/minimap/minimap
...
@@ -7,6 +7,7 @@ import { MinimapCharRenderer } from 'vs/editor/browser/viewParts/minimap/minimap
import
{
allCharCodes
}
from
'
vs/editor/browser/viewParts/minimap/minimapCharSheet
'
;
import
{
allCharCodes
}
from
'
vs/editor/browser/viewParts/minimap/minimapCharSheet
'
;
import
{
prebakedMiniMaps
}
from
'
vs/editor/browser/viewParts/minimap/minimapPreBaked
'
;
import
{
prebakedMiniMaps
}
from
'
vs/editor/browser/viewParts/minimap/minimapPreBaked
'
;
import
{
Constants
}
from
'
./minimapCharSheet
'
;
import
{
Constants
}
from
'
./minimapCharSheet
'
;
import
{
toUint8
}
from
'
vs/base/common/uint
'
;
/**
/**
* Creates character renderers. It takes a 'scale' that determines how large
* Creates character renderers. It takes a 'scale' that determines how large
...
@@ -135,7 +136,7 @@ export class MinimapCharRendererFactory {
...
@@ -135,7 +136,7 @@ export class MinimapCharRendererFactory {
const
final
=
value
/
samples
;
const
final
=
value
/
samples
;
brightest
=
Math
.
max
(
brightest
,
final
);
brightest
=
Math
.
max
(
brightest
,
final
);
dest
[
targetIndex
++
]
=
final
;
dest
[
targetIndex
++
]
=
toUint8
(
final
)
;
}
}
}
}
...
...
src/vs/editor/test/browser/view/minimapCharRenderer.test.ts
浏览文件 @
5133f110
...
@@ -10,22 +10,6 @@ import { MinimapCharRendererFactory } from 'vs/editor/browser/viewParts/minimap/
...
@@ -10,22 +10,6 @@ import { MinimapCharRendererFactory } from 'vs/editor/browser/viewParts/minimap/
suite
(
'
MinimapCharRenderer
'
,
()
=>
{
suite
(
'
MinimapCharRenderer
'
,
()
=>
{
let
sampleData
:
Uint8ClampedArray
|
null
=
null
;
suiteSetup
(()
=>
{
sampleData
=
new
Uint8ClampedArray
(
Constants
.
SAMPLED_CHAR_HEIGHT
*
Constants
.
SAMPLED_CHAR_WIDTH
*
Constants
.
RGBA_CHANNELS_CNT
*
Constants
.
CHAR_COUNT
);
});
suiteTeardown
(()
=>
{
sampleData
=
null
;
});
setup
(()
=>
{
for
(
let
i
=
0
;
i
<
sampleData
!
.
length
;
i
++
)
{
sampleData
!
[
i
]
=
0
;
}
});
const
sampleD
=
[
const
sampleD
=
[
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0xFF
,
0xFF
,
0xFF
,
0xD0
,
0xFF
,
0xFF
,
0xFF
,
0xFF
,
0xFF
,
0xFF
,
0xFF
,
0x78
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0xFF
,
0xFF
,
0xFF
,
0xD0
,
0xFF
,
0xFF
,
0xFF
,
0xFF
,
0xFF
,
0xFF
,
0xFF
,
0x78
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0xFF
,
0xFF
,
0xFF
,
0xD0
,
0xFF
,
0xFF
,
0xFF
,
0xFF
,
0xFF
,
0xFF
,
0xFF
,
0x78
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0xFF
,
0xFF
,
0xFF
,
0xD0
,
0xFF
,
0xFF
,
0xFF
,
0xFF
,
0xFF
,
0xFF
,
0xFF
,
0x78
,
0x00
,
0x00
,
0x00
,
0x00
,
...
@@ -45,7 +29,13 @@ suite('MinimapCharRenderer', () => {
...
@@ -45,7 +29,13 @@ suite('MinimapCharRenderer', () => {
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
];
];
function
setSampleData
(
charCode
:
number
,
data
:
number
[])
{
function
getSampleData
()
{
const
charCode
=
'
d
'
.
charCodeAt
(
0
);
const
result
=
new
Uint8ClampedArray
(
Constants
.
SAMPLED_CHAR_HEIGHT
*
Constants
.
SAMPLED_CHAR_WIDTH
*
Constants
.
RGBA_CHANNELS_CNT
*
Constants
.
CHAR_COUNT
);
for
(
let
i
=
0
;
i
<
result
.
length
;
i
++
)
{
result
[
i
]
=
0
;
}
const
rowWidth
=
Constants
.
SAMPLED_CHAR_WIDTH
*
Constants
.
RGBA_CHANNELS_CNT
*
Constants
.
CHAR_COUNT
;
const
rowWidth
=
Constants
.
SAMPLED_CHAR_WIDTH
*
Constants
.
RGBA_CHANNELS_CNT
*
Constants
.
CHAR_COUNT
;
let
chIndex
=
charCode
-
Constants
.
START_CH_CODE
;
let
chIndex
=
charCode
-
Constants
.
START_CH_CODE
;
...
@@ -55,13 +45,15 @@ suite('MinimapCharRenderer', () => {
...
@@ -55,13 +45,15 @@ suite('MinimapCharRenderer', () => {
let
outputOffset
=
globalOutputOffset
;
let
outputOffset
=
globalOutputOffset
;
for
(
let
j
=
0
;
j
<
Constants
.
SAMPLED_CHAR_WIDTH
;
j
++
)
{
for
(
let
j
=
0
;
j
<
Constants
.
SAMPLED_CHAR_WIDTH
;
j
++
)
{
for
(
let
channel
=
0
;
channel
<
Constants
.
RGBA_CHANNELS_CNT
;
channel
++
)
{
for
(
let
channel
=
0
;
channel
<
Constants
.
RGBA_CHANNELS_CNT
;
channel
++
)
{
sampleData
!
[
outputOffset
]
=
data
[
inputOffset
];
result
[
outputOffset
]
=
sampleD
[
inputOffset
];
inputOffset
++
;
inputOffset
++
;
outputOffset
++
;
outputOffset
++
;
}
}
}
}
globalOutputOffset
+=
rowWidth
;
globalOutputOffset
+=
rowWidth
;
}
}
return
result
;
}
}
function
createFakeImageData
(
width
:
number
,
height
:
number
):
ImageData
{
function
createFakeImageData
(
width
:
number
,
height
:
number
):
ImageData
{
...
@@ -73,8 +65,8 @@ suite('MinimapCharRenderer', () => {
...
@@ -73,8 +65,8 @@ suite('MinimapCharRenderer', () => {
}
}
test
(
'
letter d @ 2x
'
,
()
=>
{
test
(
'
letter d @ 2x
'
,
()
=>
{
setSampleData
(
'
d
'
.
charCodeAt
(
0
),
sampleD
);
const
sampleData
=
getSampleData
(
);
let
renderer
=
MinimapCharRendererFactory
.
createFromSampleData
(
sampleData
!
,
2
);
let
renderer
=
MinimapCharRendererFactory
.
createFromSampleData
(
sampleData
,
2
);
let
background
=
new
RGBA8
(
0
,
0
,
0
,
255
);
let
background
=
new
RGBA8
(
0
,
0
,
0
,
255
);
let
color
=
new
RGBA8
(
255
,
255
,
255
,
255
);
let
color
=
new
RGBA8
(
255
,
255
,
255
,
255
);
...
@@ -94,16 +86,16 @@ suite('MinimapCharRenderer', () => {
...
@@ -94,16 +86,16 @@ suite('MinimapCharRenderer', () => {
}
}
assert
.
deepEqual
(
actual
,
[
assert
.
deepEqual
(
actual
,
[
0x2
E
,
0x2E
,
0x2E
,
0xFF
,
0xAD
,
0xAD
,
0xAD
,
0xFF
,
0x2
D
,
0x2D
,
0x2D
,
0xFF
,
0xAC
,
0xAC
,
0xAC
,
0xFF
,
0xC6
,
0xC6
,
0xC6
,
0xFF
,
0xC8
,
0xC8
,
0xC8
,
0xFF
,
0xC6
,
0xC6
,
0xC6
,
0xFF
,
0xC8
,
0xC8
,
0xC8
,
0xFF
,
0xC
1
,
0xC1
,
0xC1
,
0xFF
,
0xCC
,
0xCC
,
0xCC
,
0xFF
,
0xC
0
,
0xC0
,
0xC0
,
0xFF
,
0xCB
,
0xCB
,
0xCB
,
0xFF
,
0x00
,
0x00
,
0x00
,
0xFF
,
0x00
,
0x00
,
0x00
,
0xFF
,
0x00
,
0x00
,
0x00
,
0xFF
,
0x00
,
0x00
,
0x00
,
0xFF
,
]);
]);
});
});
test
(
'
letter d @ 1x
'
,
()
=>
{
test
(
'
letter d @ 1x
'
,
()
=>
{
setSampleData
(
'
d
'
.
charCodeAt
(
0
),
sampleD
);
const
sampleData
=
getSampleData
(
);
let
renderer
=
MinimapCharRendererFactory
.
createFromSampleData
(
sampleData
!
,
1
);
let
renderer
=
MinimapCharRendererFactory
.
createFromSampleData
(
sampleData
,
1
);
let
background
=
new
RGBA8
(
0
,
0
,
0
,
255
);
let
background
=
new
RGBA8
(
0
,
0
,
0
,
255
);
let
color
=
new
RGBA8
(
255
,
255
,
255
,
255
);
let
color
=
new
RGBA8
(
255
,
255
,
255
,
255
);
...
@@ -125,7 +117,7 @@ suite('MinimapCharRenderer', () => {
...
@@ -125,7 +117,7 @@ suite('MinimapCharRenderer', () => {
assert
.
deepEqual
(
actual
,
[
assert
.
deepEqual
(
actual
,
[
0xCB
,
0xCB
,
0xCB
,
0xFF
,
0xCB
,
0xCB
,
0xCB
,
0xFF
,
0x8
2
,
0x82
,
0x82
,
0xFF
,
0x8
1
,
0x81
,
0x81
,
0xFF
,
]);
]);
});
});
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录