Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
943992de
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,发现更多精彩内容 >>
提交
943992de
编写于
2月 15, 2017
作者:
A
Alex Dima
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Ship directly grayscale minimap font
上级
00b11318
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
603 addition
and
620 deletion
+603
-620
src/vs/editor/browser/viewParts/minimap/minimap.ts
src/vs/editor/browser/viewParts/minimap/minimap.ts
+2
-2
src/vs/editor/common/view/minimapCharRenderer.ts
src/vs/editor/common/view/minimapCharRenderer.ts
+3
-24
src/vs/editor/common/view/runtimeMinimapCharRenderer.ts
src/vs/editor/common/view/runtimeMinimapCharRenderer.ts
+573
-573
src/vs/editor/test/browser/view/minimapFontCreator.ts
src/vs/editor/test/browser/view/minimapFontCreator.ts
+4
-4
src/vs/editor/test/common/view/minimapCharRenderer.test.ts
src/vs/editor/test/common/view/minimapCharRenderer.test.ts
+3
-3
src/vs/editor/test/common/view/minimapCharRendererFactory.ts
src/vs/editor/test/common/view/minimapCharRendererFactory.ts
+18
-14
未找到文件。
src/vs/editor/browser/viewParts/minimap/minimap.ts
浏览文件 @
943992de
...
...
@@ -9,7 +9,7 @@ import 'vs/css!./minimap';
import
{
ViewPart
}
from
'
vs/editor/browser/view/viewPart
'
;
import
{
ViewContext
}
from
'
vs/editor/common/view/viewContext
'
;
import
{
IRenderingContext
,
IRestrictedRenderingContext
}
from
'
vs/editor/common/view/renderingContext
'
;
import
{
createMinimapCharRenderer
2
}
from
'
vs/editor/common/view/runtimeMinimapCharRenderer
'
;
import
{
createMinimapCharRenderer
}
from
'
vs/editor/common/view/runtimeMinimapCharRenderer
'
;
import
*
as
browser
from
'
vs/base/browser/browser
'
;
import
{
ParsedColor
,
MinimapTokensColorTracker
,
Constants
}
from
'
vs/editor/common/view/minimapCharRenderer
'
;
import
*
as
editorCommon
from
'
vs/editor/common/editorCommon
'
;
...
...
@@ -20,7 +20,7 @@ import { FastDomNode, createFastDomNode } from 'vs/base/browser/styleMutator';
import
{
IDisposable
}
from
'
vs/base/common/lifecycle
'
;
import
{
EditorScrollbar
}
from
'
vs/editor/browser/viewParts/editorScrollbar/editorScrollbar
'
;
let
charRenderer2
=
createMinimapCharRenderer
2
();
// TODO@minimap
let
charRenderer2
=
createMinimapCharRenderer
();
// TODO@minimap
const
enum
RenderMinimap
{
None
=
0
,
...
...
src/vs/editor/common/view/minimapCharRenderer.ts
浏览文件 @
943992de
...
...
@@ -138,33 +138,12 @@ export const enum Constants {
x1_CHAR_WIDTH
=
1
,
RGBA_CHANNELS_CNT
=
4
,
CA_CHANNELS_CNT
=
2
,
}
export
class
MinimapCharRenderer
2
{
export
class
MinimapCharRenderer
{
_minimapCharRendererBrand
:
void
;
public
static
create
(
x2CharData
:
Uint8ClampedArray
,
x1CharData
:
Uint8ClampedArray
):
MinimapCharRenderer2
{
let
_x2CharData
=
this
.
toGrayscale
(
x2CharData
);
let
_x1CharData
=
this
.
toGrayscale
(
x1CharData
);
return
new
MinimapCharRenderer2
(
_x2CharData
,
_x1CharData
);
}
private
static
toGrayscale
(
charData
:
Uint8ClampedArray
):
Uint8ClampedArray
{
let
newLength
=
charData
.
length
/
2
;
let
result
=
new
Uint8ClampedArray
(
newLength
);
let
sourceOffset
=
0
;
for
(
var
i
=
0
;
i
<
newLength
;
i
++
)
{
let
color
=
charData
[
sourceOffset
];
let
alpha
=
charData
[
sourceOffset
+
1
];
let
newColor
=
Math
.
round
((
color
*
alpha
)
/
255
);
result
[
i
]
=
newColor
;
sourceOffset
+=
2
;
}
return
result
;
}
public
readonly
x2charData
:
Uint8ClampedArray
;
public
readonly
x1charData
:
Uint8ClampedArray
;
...
...
@@ -194,7 +173,7 @@ export class MinimapCharRenderer2 {
return
;
}
const
x2CharData
=
this
.
x2charData
;
const
chIndex
=
MinimapCharRenderer
2
.
_getChIndex
(
chCode
);
const
chIndex
=
MinimapCharRenderer
.
_getChIndex
(
chCode
);
const
outWidth
=
target
.
width
*
Constants
.
RGBA_CHANNELS_CNT
;
...
...
@@ -271,7 +250,7 @@ export class MinimapCharRenderer2 {
return
;
}
const
x1CharData
=
this
.
x1charData
;
const
chIndex
=
MinimapCharRenderer
2
.
_getChIndex
(
chCode
);
const
chIndex
=
MinimapCharRenderer
.
_getChIndex
(
chCode
);
const
outWidth
=
target
.
width
*
Constants
.
RGBA_CHANNELS_CNT
;
...
...
src/vs/editor/common/view/runtimeMinimapCharRenderer.ts
浏览文件 @
943992de
...
...
@@ -4,7 +4,7 @@
*--------------------------------------------------------------------------------------------*/
'
use strict
'
;
import
{
MinimapCharRenderer
2
}
from
'
vs/editor/common/view/minimapCharRenderer
'
;
import
{
MinimapCharRenderer
}
from
'
vs/editor/common/view/minimapCharRenderer
'
;
function
toUint8ClampedArrat
(
arr
:
number
[]):
Uint8ClampedArray
{
let
r
=
new
Uint8ClampedArray
(
arr
.
length
);
...
...
@@ -27,965 +27,965 @@ function init(): void {
x2Data
=
null
;
}
export
function
createMinimapCharRenderer
2
():
MinimapCharRenderer2
{
export
function
createMinimapCharRenderer
():
MinimapCharRenderer
{
init
();
return
MinimapCharRenderer2
.
create
(
_x2Data
,
_x1Data
);
return
new
MinimapCharRenderer
(
_x2Data
,
_x1Data
);
}
var
x2Data
=
[
//
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
// !
128
,
78
,
64
,
55
,
128
,
77
,
64
,
5
4
,
85
,
43
,
42
,
29
,
128
,
58
,
64
,
41
,
39
,
14
,
39
,
1
4
,
14
,
5
,
29
,
10
,
// "
191
,
128
,
191
,
128
,
128
,
57
,
128
,
57
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
96
,
96
,
29
,
29
,
0
,
0
,
0
,
0
,
// #
128
,
98
,
234
,
12
3
,
255
,
195
,
25
5
,
214
,
2
55
,
227
,
234
,
181
,
255
,
135
,
128
,
84
,
49
,
11
3
,
19
5
,
214
,
2
27
,
166
,
135
,
42
,
// $
128
,
79
,
106
,
70
,
255
,
194
,
128
,
76
,
170
,
113
,
234
,
161
,
255
,
197
,
255
,
187
,
40
,
29
,
194
,
38
,
75
,
148
,
197
,
187
,
// %
255
,
145
,
21
,
2
,
255
,
160
,
212
,
73
,
234
,
82
,
25
5
,
143
,
42
,
13
,
255
,
183
,
145
,
0
,
160
,
61
,
7
5
,
143
,
2
,
183
,
// &
234
,
150
,
170
,
87
,
234
,
178
,
106
,
14
,
255
,
177
,
255
,
223
,
255
,
197
,
255
,
227
,
138
,
58
,
163
,
6
,
177
,
223
,
197
,
227
,
// '
128
,
76
,
64
,
52
,
85
,
34
,
42
,
23
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
38
,
13
,
11
,
4
,
0
,
0
,
0
,
0
,
// (
85
,
30
,
149
,
93
,
128
,
103
,
64
,
33
,
128
,
124
,
64
,
15
,
170
,
106
,
255
,
122
,
10
,
54
,
52
,
8
,
62
,
4
,
71
,
122
,
// )
170
,
109
,
42
,
15
,
85
,
56
,
128
,
8
0
,
64
,
39
,
128
,
10
0
,
255
,
155
,
128
,
72
,
73
,
2
,
19
,
4
0
,
10
,
5
0
,
155
,
36
,
// *
170
,
119
,
191
,
93
,
234
,
158
,
234
,
132
,
64
,
29
,
85
,
16
,
0
,
0
,
0
,
0
,
79
,
70
,
145
,
121
,
7
,
5
,
0
,
0
,
// +
42
,
15
,
21
,
10
,
128
,
71
,
64
,
48
,
2
55
,
204
,
234
,
181
,
85
,
47
,
42
,
32
,
2
,
1
,
36
,
12
,
2
04
,
166
,
16
,
5
,
// ,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
42
,
4
,
42
,
3
,
234
,
168
,
128
,
67
,
0
,
0
,
0
,
0
,
1
,
0
,
154
,
34
,
// -
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
191
,
128
,
191
,
111
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
96
,
83
,
0
,
0
,
// .
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
128
,
91
,
128
,
68
,
0
,
0
,
0
,
0
,
0
,
0
,
46
,
34
,
// /
0
,
0
,
191
,
110
,
42
,
14
,
149
,
95
,
149
,
91
,
42
,
19
,
255
,
146
,
0
,
0
,
0
,
82
,
2
,
56
,
53
,
3
,
146
,
0
,
// 0
234
,
159
,
212
,
143
,
234
,
166
,
212
,
159
,
234
,
166
,
212
,
158
,
234
,
158
,
212
,
143
,
146
,
119
,
152
,
132
,
152
,
131
,
145
,
119
,
// 1
255
,
170
,
128
,
83
,
64
,
61
,
128
,
83
,
64
,
61
,
128
,
83
,
255
,
172
,
255
,
194
,
170
,
42
,
15
,
42
,
15
,
42
,
172
,
194
,
// 2
212
,
157
,
234
,
144
,
21
,
2
,
234
,
152
,
191
,
107
,
128
,
56
,
2
55
,
227
,
255
,
143
,
131
,
132
,
0
,
139
,
80
,
28
,
2
27
,
143
,
// 3
255
,
159
,
234
,
147
,
85
,
44
,
212
,
142
,
64
,
42
,
212
,
151
,
255
,
171
,
234
,
157
,
159
,
135
,
15
,
118
,
11
,
126
,
171
,
144
,
// 4
106
,
49
,
191
,
166
,
191
,
117
,
191
,
142
,
2
55
,
217
,
234
,
214
,
0
,
0
,
191
,
142
,
20
,
124
,
88
,
106
,
2
17
,
196
,
0
,
106
,
// 5
255
,
189
,
191
,
123
,
234
,
183
,
128
,
86
,
85
,
14
,
212
,
156
,
255
,
164
,
234
,
145
,
189
,
92
,
168
,
43
,
5
,
130
,
164
,
133
,
// 6
234
,
142
,
234
,
12
5
,
234
,
199
,
149
,
112
,
212
,
161
,
212
,
144
,
234
,
154
,
234
,
154
,
130
,
11
5
,
183
,
65
,
134
,
120
,
141
,
141
,
// 7
255
,
170
,
255
,
196
,
42
,
10
,
191
,
141
,
106
,
74
,
106
,
76
,
1
91
,
140
,
42
,
11
,
170
,
196
,
2
,
106
,
31
,
32
,
1
05
,
2
,
// 8
234
,
158
,
234
,
142
,
212
,
140
,
212
,
137
,
212
,
159
,
234
,
147
,
212
,
166
,
234
,
153
,
145
,
130
,
116
,
114
,
132
,
135
,
138
,
140
,
// 9
212
,
166
,
212
,
136
,
255
,
147
,
212
,
165
,
170
,
122
,
255
,
183
,
234
,
141
,
191
,
126
,
138
,
113
,
147
,
137
,
81
,
183
,
129
,
94
,
// :
0
,
0
,
0
,
0
,
85
,
63
,
85
,
47
,
4
2
,
27
,
42
,
20
,
128
,
91
,
128
,
68
,
0
,
0
,
21
,
16
,
4
,
3
,
46
,
34
,
// ;
0
,
0
,
0
,
0
,
128
,
90
,
128
,
68
,
42
,
4
,
42
,
3
,
234
,
174
,
170
,
73
,
0
,
0
,
45
,
34
,
1
,
0
,
160
,
49
,
// <
0
,
0
,
21
,
1
,
149
,
74
,
234
,
156
,
2
55
,
203
,
128
,
45
,
42
,
9
,
170
,
114
,
0
,
0
,
43
,
143
,
2
03
,
23
,
1
,
76
,
// =
0
,
0
,
0
,
0
,
106
,
92
,
85
,
84
,
212
,
157
,
170
,
144
,
106
,
92
,
85
,
84
,
0
,
0
,
38
,
28
,
131
,
96
,
38
,
28
,
// >
42
,
1
,
0
,
0
,
255
,
168
,
128
,
62
,
128
,
57
,
255
,
191
,
212
,
118
,
21
,
5
,
0
,
0
,
168
,
31
,
29
,
191
,
98
,
0
,
// ?
234
,
129
,
234
,
151
,
64
,
18
,
212
,
136
,
128
,
89
,
85
,
40
,
128
,
74
,
64
,
25
,
118
,
139
,
5
,
113
,
45
,
13
,
37
,
6
,
// @
212
,
117
,
234
,
12
5
,
255
,
161
,
255
,
179
,
2
55
,
204
,
234
,
114
,
2
55
,
223
,
255
,
224
,
97
,
11
5
,
161
,
179
,
2
04
,
105
,
2
23
,
224
,
// A
170
,
124
,
128
,
104
,
212
,
133
,
191
,
134
,
234
,
200
,
255
,
186
,
212
,
144
,
234
,
144
,
83
,
52
,
111
,
100
,
184
,
186
,
120
,
132
,
// B
2
55
,
212
,
234
,
158
,
255
,
180
,
234
,
151
,
255
,
174
,
255
,
161
,
2
55
,
212
,
255
,
182
,
2
12
,
145
,
180
,
139
,
174
,
161
,
2
12
,
182
,
// C
1
91
,
139
,
255
,
162
,
212
,
158
,
2
1
,
0
,
212
,
158
,
2
1
,
0
,
1
91
,
139
,
255
,
161
,
1
04
,
162
,
13
1
,
0
,
13
1
,
0
,
1
04
,
161
,
// D
2
55
,
219
,
212
,
144
,
1
91
,
147
,
191
,
155
,
1
91
,
147
,
191
,
155
,
2
55
,
219
,
212
,
144
,
2
19
,
120
,
1
10
,
116
,
1
10
,
116
,
2
19
,
120
,
// E
2
55
,
207
,
255
,
154
,
234
,
178
,
149
,
68
,
212
,
177
,
85
,
66
,
2
55
,
207
,
255
,
154
,
2
07
,
154
,
163
,
40
,
147
,
22
,
2
07
,
154
,
// F
2
55
,
202
,
255
,
159
,
234
,
175
,
170
,
71
,
212
,
175
,
85
,
69
,
1
91
,
148
,
0
,
0
,
2
02
,
159
,
161
,
47
,
145
,
23
,
1
11
,
0
,
// G
234
,
151
,
255
,
154
,
234
,
157
,
106
,
73
,
234
,
157
,
212
,
162
,
234
,
151
,
255
,
187
,
139
,
154
,
144
,
30
,
144
,
135
,
139
,
187
,
// H
1
91
,
147
,
191
,
147
,
234
,
183
,
234
,
175
,
212
,
181
,
212
,
174
,
1
91
,
147
,
191
,
147
,
1
10
,
110
,
168
,
161
,
150
,
145
,
1
10
,
110
,
// I
255
,
185
,
25
5
,
162
,
128
,
85
,
64
,
62
,
128
,
85
,
64
,
62
,
255
,
185
,
25
5
,
162
,
18
5
,
162
,
43
,
16
,
43
,
16
,
18
5
,
162
,
// J
191
,
97
,
191
,
172
,
0
,
0
,
191
,
147
,
42
,
3
,
191
,
147
,
255
,
191
,
170
,
131
,
73
,
129
,
0
,
110
,
0
,
110
,
191
,
87
,
// K
255
,
149
,
234
,
162
,
2
55
,
236
,
149
,
82
,
255
,
195
,
170
,
137
,
255
,
146
,
234
,
162
,
149
,
149
,
2
36
,
48
,
195
,
91
,
146
,
149
,
// L
255
,
146
,
0
,
0
,
255
,
146
,
0
,
0
,
255
,
146
,
0
,
0
,
255
,
187
,
255
,
173
,
146
,
0
,
146
,
0
,
146
,
0
,
187
,
173
,
// M
2
55
,
200
,
255
,
201
,
2
55
,
222
,
255
,
215
,
255
,
172
,
234
,
160
,
191
,
127
,
191
,
127
,
2
00
,
201
,
2
22
,
215
,
172
,
147
,
95
,
95
,
// N
255
,
193
,
191
,
130
,
2
55
,
224
,
234
,
141
,
255
,
159
,
255
,
206
,
191
,
130
,
255
,
192
,
193
,
97
,
2
24
,
129
,
159
,
206
,
97
,
192
,
// O
234
,
169
,
234
,
152
,
255
,
153
,
191
,
153
,
255
,
153
,
191
,
153
,
234
,
170
,
234
,
153
,
155
,
139
,
153
,
115
,
153
,
115
,
156
,
140
,
// P
234
,
206
,
234
,
172
,
212
,
148
,
212
,
163
,
234
,
207
,
149
,
110
,
1
91
,
148
,
0
,
0
,
189
,
158
,
123
,
136
,
190
,
64
,
1
11
,
0
,
// Q
234
,
169
,
234
,
152
,
255
,
153
,
191
,
153
,
255
,
153
,
191
,
152
,
234
,
170
,
255
,
241
,
155
,
139
,
153
,
115
,
153
,
114
,
156
,
241
,
// R
234
,
215
,
234
,
161
,
212
,
180
,
234
,
166
,
234
,
185
,
212
,
139
,
1
91
,
147
,
255
,
157
,
197
,
148
,
150
,
152
,
170
,
116
,
1
10
,
157
,
// S
234
,
170
,
255
,
128
,
234
,
184
,
85
,
41
,
1
06
,
31
,
234
,
173
,
234
,
172
,
234
,
162
,
156
,
128
,
169
,
14
,
1
3
,
159
,
158
,
149
,
// T
2
55
,
212
,
255
,
189
,
128
,
85
,
64
,
62
,
128
,
85
,
64
,
62
,
128
,
85
,
64
,
62
,
2
12
,
189
,
43
,
16
,
43
,
16
,
43
,
16
,
// U
255
,
148
,
191
,
147
,
255
,
148
,
191
,
147
,
255
,
147
,
191
,
146
,
255
,
182
,
234
,
165
,
148
,
110
,
148
,
110
,
147
,
109
,
182
,
151
,
// V
234
,
145
,
212
,
146
,
1
91
,
141
,
212
,
142
,
212
,
137
,
191
,
138
,
170
,
133
,
149
,
113
,
133
,
121
,
1
06
,
118
,
114
,
103
,
89
,
66
,
// W
191
,
126
,
191
,
126
,
2
55
,
211
,
255
,
188
,
2
55
,
205
,
25
5
,
207
,
212
,
167
,
255
,
168
,
94
,
94
,
2
11
,
188
,
2
0
5
,
207
,
139
,
168
,
// X
255
,
151
,
255
,
152
,
170
,
131
,
170
,
114
,
1
91
,
135
,
170
,
11
9
,
255
,
151
,
255
,
152
,
151
,
152
,
87
,
76
,
1
01
,
7
9
,
151
,
152
,
// Y
212
,
156
,
255
,
156
,
212
,
150
,
212
,
139
,
128
,
93
,
106
,
70
,
128
,
85
,
64
,
62
,
130
,
156
,
125
,
116
,
47
,
29
,
43
,
16
,
// Z
255
,
169
,
255
,
228
,
85
,
34
,
191
,
138
,
212
,
144
,
64
,
24
,
2
55
,
230
,
255
,
176
,
169
,
228
,
11
,
103
,
120
,
6
,
2
30
,
176
,
// [
128
,
109
,
149
,
84
,
128
,
109
,
64
,
24
,
128
,
109
,
64
,
24
,
255
,
193
,
255
,
102
,
55
,
49
,
55
,
6
,
55
,
6
,
193
,
102
,
// \
212
,
111
,
0
,
0
,
170
,
106
,
21
,
4
,
85
,
38
,
106
,
73
,
0
,
0
,
255
,
147
,
92
,
0
,
71
,
0
,
13
,
30
,
0
,
147
,
// ]
149
,
107
,
128
,
86
,
64
,
47
,
128
,
86
,
64
,
47
,
128
,
86
,
255
,
142
,
255
,
152
,
63
,
43
,
12
,
43
,
12
,
43
,
142
,
152
,
// ^
170
,
107
,
149
,
91
,
170
,
91
,
170
,
92
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
71
,
53
,
61
,
61
,
0
,
0
,
0
,
0
,
// _
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
255
,
158
,
255
,
146
,
0
,
0
,
0
,
0
,
0
,
0
,
158
,
146
,
// `
106
,
61
,
42
,
14
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
25
,
2
,
0
,
0
,
0
,
0
,
0
,
0
,
// a
0
,
0
,
0
,
0
,
212
,
129
,
212
,
156
,
255
,
170
,
255
,
194
,
255
,
176
,
255
,
188
,
0
,
0
,
107
,
130
,
170
,
194
,
176
,
188
,
// b
1
91
,
146
,
0
,
0
,
2
55
,
203
,
234
,
173
,
1
91
,
151
,
191
,
148
,
2
55
,
202
,
234
,
172
,
1
09
,
0
,
2
03
,
159
,
1
13
,
111
,
2
02
,
158
,
// c
0
,
0
,
0
,
0
,
234
,
147
,
25
5
,
135
,
1
91
,
152
,
0
,
0
,
234
,
148
,
255
,
135
,
0
,
0
,
13
5
,
135
,
1
14
,
0
,
136
,
135
,
// d
0
,
0
,
191
,
146
,
255
,
187
,
255
,
190
,
255
,
148
,
212
,
151
,
255
,
177
,
255
,
187
,
0
,
109
,
187
,
190
,
148
,
126
,
177
,
187
,
// e
0
,
0
,
0
,
0
,
234
,
162
,
212
,
156
,
2
55
,
218
,
170
,
158
,
255
,
169
,
234
,
147
,
0
,
0
,
149
,
130
,
2
18
,
105
,
169
,
135
,
// f
128
,
74
,
191
,
151
,
212
,
176
,
191
,
151
,
128
,
97
,
64
,
50
,
128
,
97
,
64
,
50
,
37
,
113
,
146
,
113
,
49
,
13
,
49
,
13
,
// g
0
,
0
,
0
,
0
,
255
,
178
,
255
,
195
,
255
,
147
,
191
,
152
,
255
,
255
,
255
,
255
,
0
,
0
,
178
,
195
,
147
,
114
,
255
,
255
,
// h
1
91
,
146
,
0
,
0
,
255
,
193
,
234
,
162
,
1
91
,
147
,
191
,
146
,
1
91
,
146
,
191
,
146
,
1
09
,
0
,
193
,
149
,
1
10
,
109
,
1
09
,
109
,
// i
85
,
37
,
85
,
4
5
,
212
,
150
,
128
,
8
1
,
128
,
66
,
128
,
8
1
,
212
,
173
,
255
,
188
,
12
,
1
5
,
125
,
4
1
,
33
,
4
1
,
144
,
188
,
// j
21
,
14
,
42
,
35
,
149
,
128
,
128
,
105
,
64
,
41
,
128
,
105
,
2
55
,
210
,
234
,
175
,
1
,
6
,
75
,
53
,
10
,
53
,
2
10
,
161
,
// k
1
91
,
147
,
0
,
0
,
234
,
166
,
255
,
148
,
2
55
,
210
,
149
,
102
,
1
91
,
147
,
255
,
156
,
1
1
0
,
0
,
152
,
148
,
2
10
,
60
,
1
10
,
156
,
// l
2
55
,
213
,
64
,
20
,
128
,
126
,
64
,
20
,
128
,
126
,
64
,
20
,
128
,
90
,
191
,
148
,
2
13
,
5
,
63
,
5
,
63
,
5
,
45
,
111
,
// m
0
,
0
,
0
,
0
,
2
55
,
232
,
234
,
187
,
255
,
190
,
255
,
168
,
255
,
190
,
255
,
169
,
0
,
0
,
2
32
,
172
,
190
,
168
,
190
,
169
,
// n
0
,
0
,
0
,
0
,
255
,
190
,
234
,
157
,
1
91
,
146
,
191
,
146
,
1
91
,
146
,
191
,
146
,
0
,
0
,
190
,
144
,
1
09
,
109
,
1
09
,
109
,
// o
0
,
0
,
0
,
0
,
255
,
168
,
234
,
153
,
255
,
148
,
191
,
148
,
255
,
168
,
234
,
153
,
0
,
0
,
168
,
140
,
148
,
111
,
168
,
140
,
// p
0
,
0
,
0
,
0
,
2
55
,
200
,
234
,
165
,
1
91
,
151
,
191
,
147
,
255
,
255
,
234
,
172
,
0
,
0
,
2
00
,
151
,
1
13
,
110
,
255
,
158
,
// q
0
,
0
,
0
,
0
,
255
,
184
,
255
,
188
,
255
,
147
,
234
,
151
,
255
,
186
,
255
,
255
,
0
,
0
,
184
,
188
,
147
,
139
,
186
,
255
,
// r
0
,
0
,
0
,
0
,
1
91
,
163
,
212
,
156
,
1
91
,
148
,
0
,
0
,
1
91
,
146
,
0
,
0
,
0
,
0
,
1
22
,
130
,
1
11
,
0
,
1
09
,
0
,
// s
0
,
0
,
0
,
0
,
212
,
159
,
170
,
103
,
212
,
131
,
191
,
124
,
212
,
132
,
234
,
148
,
0
,
0
,
132
,
69
,
109
,
93
,
110
,
136
,
// t
128
,
101
,
64
,
21
,
2
55
,
205
,
191
,
138
,
128
,
121
,
64
,
25
,
128
,
93
,
191
,
141
,
51
,
5
,
2
05
,
103
,
61
,
6
,
47
,
106
,
// u
0
,
0
,
0
,
0
,
1
91
,
147
,
191
,
146
,
1
91
,
147
,
212
,
147
,
234
,
169
,
2
55
,
179
,
0
,
0
,
1
10
,
109
,
1
10
,
122
,
1
55
,
179
,
// v
0
,
0
,
0
,
0
,
234
,
144
,
212
,
144
,
212
,
136
,
212
,
137
,
170
,
126
,
149
,
108
,
0
,
0
,
132
,
120
,
113
,
114
,
84
,
63
,
// w
0
,
0
,
0
,
0
,
234
,
135
,
212
,
130
,
2
55
,
202
,
255
,
189
,
234
,
174
,
255
,
174
,
0
,
0
,
124
,
108
,
2
02
,
189
,
160
,
174
,
// x
0
,
0
,
0
,
0
,
234
,
157
,
234
,
155
,
170
,
118
,
149
,
9
7
,
255
,
159
,
234
,
159
,
0
,
0
,
144
,
142
,
79
,
5
7
,
159
,
146
,
// y
0
,
0
,
0
,
0
,
234
,
150
,
234
,
150
,
212
,
143
,
212
,
141
,
255
,
255
,
170
,
103
,
0
,
0
,
138
,
138
,
119
,
117
,
255
,
69
,
// z
0
,
0
,
0
,
0
,
191
,
130
,
255
,
198
,
128
,
93
,
128
,
75
,
2
55
,
208
,
170
,
126
,
0
,
0
,
97
,
198
,
47
,
38
,
2
08
,
84
,
// {
106
,
56
,
212
,
135
,
128
,
81
,
64
,
56
,
234
,
171
,
64
,
28
,
234
,
132
,
255
,
192
,
23
,
112
,
41
,
14
,
157
,
7
,
121
,
192
,
// |
128
,
69
,
64
,
45
,
128
,
69
,
64
,
45
,
128
,
69
,
64
,
45
,
255
,
160
,
149
,
105
,
35
,
11
,
35
,
11
,
35
,
11
,
160
,
61
,
// }
212
,
155
,
64
,
35
,
128
,
79
,
85
,
57
,
106
,
48
,
234
,
151
,
2
55
,
236
,
128
,
88
,
129
,
9
,
40
,
19
,
20
,
139
,
2
36
,
44
,
// ~
0
,
0
,
0
,
0
,
85
,
45
,
64
,
10
,
212
,
117
,
170
,
139
,
0
,
0
,
0
,
0
,
0
,
0
,
15
,
3
,
97
,
93
,
0
,
0
,
];
var
x1Data
=
[
//
0
,
0
,
0
,
0
,
0
,
0
,
// !
92
,
6
3
,
76
,
41
,
2
3
,
12
,
// "
153
,
89
,
0
,
0
,
53
,
0
,
// #
219
,
151
,
214
,
151
,
130
,
127
,
// $
148
,
100
,
240
,
158
,
58
,
149
,
// %
189
,
91
,
194
,
101
,
67
,
77
,
// &
178
,
103
,
255
,
198
,
72
,
198
,
// '
76
,
44
,
0
,
0
,
13
,
0
,
// (
102
,
62
,
148
,
88
,
25
,
51
,
// )
102
,
62
,
143
,
88
,
25
,
49
,
// *
199
,
120
,
36
,
11
,
94
,
2
,
// +
61
,
34
,
148
,
111
,
8
,
64
,
// ,
0
,
0
,
107
,
58
,
0
,
24
,
// -
0
,
0
,
92
,
57
,
0
,
21
,
// .
0
,
0
,
61
,
38
,
0
,
9
,
// /
92
,
53
,
112
,
61
,
19
,
27
,
// 0
214
,
150
,
214
,
150
,
126
,
126
,
// 1
138
,
95
,
168
,
122
,
51
,
80
,
// 2
168
,
109
,
209
,
128
,
72
,
105
,
// 3
189
,
118
,
199
,
125
,
87
,
98
,
// 4
163
,
114
,
173
,
137
,
73
,
93
,
// 5
1
94
,
139
,
189
,
11
5
,
1
06
,
8
5
,
// 6
204
,
139
,
214
,
147
,
111
,
123
,
// 7
178
,
124
,
107
,
72
,
87
,
30
,
// 8
214
,
138
,
214
,
150
,
116
,
126
,
// 9
214
,
147
,
204
,
137
,
123
,
110
,
// :
4
1
,
26
,
82
,
49
,
4
,
16
,
// ;
61
,
38
,
117
,
61
,
9
,
28
,
// <
97
,
55
,
153
,
89
,
21
,
53
,
// =
46
,
42
,
138
,
114
,
8
,
62
,
// >
107
,
55
,
148
,
89
,
23
,
52
,
// ?
178
,
104
,
97
,
55
,
73
,
21
,
// @
240
,
140
,
255
,
183
,
132
,
183
,
// A
168
,
119
,
224
,
16
2
,
78
,
14
2
,
// B
255
,
168
,
255
,
175
,
168
,
175
,
// C
163
,
11
0
,
163
,
11
0
,
7
0
,
7
0
,
// D
204
,
160
,
204
,
160
,
128
,
128
,
// E
214
,
146
,
1
94
,
145
,
123
,
1
10
,
// F
219
,
146
,
117
,
94
,
125
,
43
,
// G
1
99
,
128
,
224
,
158
,
1
00
,
139
,
// H
204
,
156
,
1
94
,
156
,
125
,
1
19
,
// I
168
,
119
,
168
,
119
,
78
,
78
,
// J
138
,
100
,
173
,
113
,
54
,
77
,
// K
235
,
151
,
230
,
154
,
139
,
139
,
// L
122
,
70
,
184
,
121
,
33
,
87
,
// M
2
55
,
2
01
,
214
,
140
,
201
,
117
,
// N
250
,
165
,
230
,
165
,
162
,
149
,
// O
219
,
151
,
219
,
151
,
130
,
130
,
// P
214
,
165
,
138
,
111
,
138
,
60
,
// Q
219
,
151
,
255
,
172
,
130
,
172
,
// R
219
,
173
,
214
,
151
,
149
,
127
,
// S
194
,
12
5
,
194
,
129
,
9
5
,
98
,
// T
184
,
131
,
92
,
70
,
95
,
25
,
// U
214
,
141
,
224
,
154
,
118
,
135
,
// V
204
,
138
,
173
,
12
5
,
110
,
8
5
,
// W
240
,
156
,
250
,
179
,
147
,
175
,
// X
204
,
131
,
209
,
134
,
105
,
110
,
// Y
214
,
144
,
102
,
75
,
121
,
30
,
// Z
1
89
,
136
,
209
,
138
,
1
01
,
113
,
// [
112
,
78
,
168
,
103
,
34
,
68
,
// \
97
,
53
,
107
,
62
,
20
,
26
,
// ]
112
,
78
,
168
,
103
,
34
,
68
,
// ^
158
,
91
,
0
,
0
,
56
,
0
,
// _
0
,
0
,
153
,
73
,
0
,
44
,
// `
3
6
,
18
,
0
,
0
,
3
,
0
,
// a
102
,
68
,
255
,
175
,
27
,
175
,
// b
163
,
125
,
209
,
162
,
80
,
133
,
// c
117
,
68
,
163
,
104
,
31
,
66
,
// d
173
,
12
5
,
235
,
159
,
8
5
,
147
,
// e
107
,
76
,
230
,
166
,
32
,
150
,
// f
173
,
133
,
92
,
70
,
90
,
25
,
// g
128
,
90
,
2
55
,
2
30
,
45
,
230
,
// h
163
,
120
,
1
84
,
140
,
77
,
1
01
,
// i
122
,
75
,
173
,
122
,
36
,
83
,
// j
82
,
68
,
168
,
127
,
22
,
84
,
// k
163
,
11
1
,
204
,
14
8
,
7
1
,
11
8
,
// l
122
,
91
,
122
,
92
,
44
,
44
,
// m
133
,
100
,
255
,
172
,
52
,
172
,
// n
117
,
83
,
1
84
,
140
,
38
,
1
01
,
// o
117
,
77
,
224
,
148
,
35
,
130
,
// p
117
,
88
,
255
,
197
,
40
,
197
,
// q
122
,
89
,
255
,
197
,
43
,
197
,
// r
97
,
76
,
92
,
71
,
29
,
26
,
// s
92
,
6
3
,
204
,
129
,
2
3
,
103
,
// t
153
,
111
,
122
,
91
,
67
,
44
,
// u
92
,
70
,
214
,
154
,
25
,
129
,
// v
107
,
6
9
,
178
,
122
,
2
9
,
85
,
// w
107
,
64
,
255
,
177
,
27
,
177
,
// x
112
,
75
,
194
,
128
,
33
,
97
,
// y
112
,
7
2
,
230
,
161
,
3
2
,
145
,
// z
107
,
79
,
163
,
121
,
33
,
77
,
// {
122
,
79
,
194
,
12
6
,
38
,
9
6
,
// |
92
,
55
,
153
,
91
,
20
,
55
,
// }
117
,
78
,
194
,
12
5
,
36
,
9
5
,
// ~
36
,
13
,
92
,
61
,
2
,
22
,
];
src/vs/editor/test/browser/view/minimapFontCreator.ts
浏览文件 @
943992de
...
...
@@ -4,9 +4,9 @@
*--------------------------------------------------------------------------------------------*/
'
use strict
'
;
import
{
Constants
,
MinimapCharRenderer
2
,
ParsedColor
}
from
'
vs/editor/common/view/minimapCharRenderer
'
;
import
{
Constants
,
MinimapCharRenderer
,
ParsedColor
}
from
'
vs/editor/common/view/minimapCharRenderer
'
;
import
{
MinimapCharRendererFactory
}
from
'
vs/editor/test/common/view/minimapCharRendererFactory
'
;
import
{
createMinimapCharRenderer
2
}
from
'
vs/editor/common/view/runtimeMinimapCharRenderer
'
;
import
{
createMinimapCharRenderer
}
from
'
vs/editor/common/view/runtimeMinimapCharRenderer
'
;
let
canvas
=
<
HTMLCanvasElement
>
document
.
getElementById
(
'
my-canvas
'
);
let
ctx
=
canvas
.
getContext
(
'
2d
'
);
...
...
@@ -28,7 +28,7 @@ let minimapCharRenderer = MinimapCharRendererFactory.create(sampleData.data);
renderImageData
(
sampleData
,
10
,
100
);
renderMinimapCharRenderer
(
minimapCharRenderer
,
400
);
renderMinimapCharRenderer
(
createMinimapCharRenderer
2
(),
600
);
renderMinimapCharRenderer
(
createMinimapCharRenderer
(),
600
);
function
createFakeImageData
(
width
:
number
,
height
:
number
):
ImageData
{
return
{
...
...
@@ -38,7 +38,7 @@ function createFakeImageData(width: number, height: number): ImageData {
};
}
function
renderMinimapCharRenderer
(
minimapCharRenderer
:
MinimapCharRenderer
2
,
y
:
number
):
void
{
function
renderMinimapCharRenderer
(
minimapCharRenderer
:
MinimapCharRenderer
,
y
:
number
):
void
{
let
background
=
new
ParsedColor
(
0
,
0
,
0
);
let
color
=
new
ParsedColor
(
255
,
255
,
255
);
...
...
src/vs/editor/test/common/view/minimapCharRenderer.test.ts
浏览文件 @
943992de
...
...
@@ -7,7 +7,7 @@
import
*
as
assert
from
'
assert
'
;
import
{
MinimapTokensColorTracker
,
ParsedColor
,
Constants
}
from
'
vs/editor/common/view/minimapCharRenderer
'
;
import
{
MinimapCharRendererFactory
}
from
'
vs/editor/test/common/view/minimapCharRendererFactory
'
;
import
{
createMinimapCharRenderer
2
}
from
'
vs/editor/common/view/runtimeMinimapCharRenderer
'
;
import
{
createMinimapCharRenderer
}
from
'
vs/editor/common/view/runtimeMinimapCharRenderer
'
;
suite
(
'
MinimapColors
'
,
()
=>
{
...
...
@@ -137,7 +137,7 @@ suite('MinimapCharRenderer', () => {
});
test
(
'
letter d @ 2x at runtime
'
,
()
=>
{
let
renderer
=
createMinimapCharRenderer
2
();
let
renderer
=
createMinimapCharRenderer
();
let
background
=
new
ParsedColor
(
0
,
0
,
0
);
let
color
=
new
ParsedColor
(
255
,
255
,
255
);
...
...
@@ -192,7 +192,7 @@ suite('MinimapCharRenderer', () => {
});
test
(
'
letter d @ 1x at runtime
'
,
()
=>
{
let
renderer
=
createMinimapCharRenderer
2
();
let
renderer
=
createMinimapCharRenderer
();
let
background
=
new
ParsedColor
(
0
,
0
,
0
);
let
color
=
new
ParsedColor
(
255
,
255
,
255
);
...
...
src/vs/editor/test/common/view/minimapCharRendererFactory.ts
浏览文件 @
943992de
...
...
@@ -4,11 +4,15 @@
*--------------------------------------------------------------------------------------------*/
'
use strict
'
;
import
{
Constants
,
MinimapCharRenderer2
}
from
'
vs/editor/common/view/minimapCharRenderer
'
;
import
{
Constants
,
MinimapCharRenderer
}
from
'
vs/editor/common/view/minimapCharRenderer
'
;
const
enum
InternalConstants
{
CA_CHANNELS_CNT
=
2
,
}
export
class
MinimapCharRendererFactory
{
public
static
create
(
source
:
Uint8ClampedArray
):
MinimapCharRenderer
2
{
public
static
create
(
source
:
Uint8ClampedArray
):
MinimapCharRenderer
{
const
expectedLength
=
(
Constants
.
SAMPLED_CHAR_HEIGHT
*
Constants
.
SAMPLED_CHAR_WIDTH
*
Constants
.
RGBA_CHANNELS_CNT
*
Constants
.
CHAR_COUNT
);
if
(
source
.
length
!==
expectedLength
)
{
throw
new
Error
(
'
Unexpected source in MinimapCharRenderer
'
);
...
...
@@ -16,7 +20,7 @@ export class MinimapCharRendererFactory {
let
x2CharData
=
this
.
toGrayscale
(
MinimapCharRendererFactory
.
_downsample2x
(
source
));
let
x1CharData
=
this
.
toGrayscale
(
MinimapCharRendererFactory
.
_downsample1x
(
source
));
return
new
MinimapCharRenderer
2
(
x2CharData
,
x1CharData
);
return
new
MinimapCharRenderer
(
x2CharData
,
x1CharData
);
}
private
static
toGrayscale
(
charData
:
Uint8ClampedArray
):
Uint8ClampedArray
{
...
...
@@ -52,7 +56,7 @@ export class MinimapCharRendererFactory {
private
static
_downsample2xChar
(
source
:
Uint8ClampedArray
,
dest
:
Uint8ClampedArray
):
void
{
// chars are 2 x 4px (width x height)
const
resultLen
=
Constants
.
x2_CHAR_HEIGHT
*
Constants
.
x2_CHAR_WIDTH
*
Constants
.
CA_CHANNELS_CNT
;
const
resultLen
=
Constants
.
x2_CHAR_HEIGHT
*
Constants
.
x2_CHAR_WIDTH
*
Internal
Constants
.
CA_CHANNELS_CNT
;
const
result
=
new
Uint16Array
(
resultLen
);
for
(
let
i
=
0
;
i
<
resultLen
;
i
++
)
{
result
[
i
]
=
0
;
...
...
@@ -72,7 +76,7 @@ export class MinimapCharRendererFactory {
}
result
[
outputOffset
]
+=
color
;
result
[
outputOffset
+
1
]
+=
alpha
;
outputOffset
+=
Constants
.
CA_CHANNELS_CNT
;
outputOffset
+=
Internal
Constants
.
CA_CHANNELS_CNT
;
color
=
0
;
alpha
=
0
;
...
...
@@ -83,7 +87,7 @@ export class MinimapCharRendererFactory {
}
result
[
outputOffset
]
+=
color
;
result
[
outputOffset
+
1
]
+=
alpha
;
outputOffset
+=
Constants
.
CA_CHANNELS_CNT
;
outputOffset
+=
Internal
Constants
.
CA_CHANNELS_CNT
;
if
(
i
===
2
||
i
===
5
||
i
===
8
)
{
globalOutputOffset
=
outputOffset
;
...
...
@@ -96,16 +100,16 @@ export class MinimapCharRendererFactory {
}
private
static
_downsample2x
(
data
:
Uint8ClampedArray
):
Uint8ClampedArray
{
const
resultLen
=
Constants
.
x2_CHAR_HEIGHT
*
Constants
.
x2_CHAR_WIDTH
*
Constants
.
CA_CHANNELS_CNT
*
Constants
.
CHAR_COUNT
;
const
resultLen
=
Constants
.
x2_CHAR_HEIGHT
*
Constants
.
x2_CHAR_WIDTH
*
Internal
Constants
.
CA_CHANNELS_CNT
*
Constants
.
CHAR_COUNT
;
const
result
=
new
Uint8ClampedArray
(
resultLen
);
const
sampledChar
=
new
Uint8ClampedArray
(
Constants
.
SAMPLED_CHAR_HEIGHT
*
Constants
.
SAMPLED_CHAR_WIDTH
*
Constants
.
RGBA_CHANNELS_CNT
);
const
downsampledChar
=
new
Uint8ClampedArray
(
Constants
.
x2_CHAR_HEIGHT
*
Constants
.
x2_CHAR_WIDTH
*
Constants
.
CA_CHANNELS_CNT
);
const
downsampledChar
=
new
Uint8ClampedArray
(
Constants
.
x2_CHAR_HEIGHT
*
Constants
.
x2_CHAR_WIDTH
*
Internal
Constants
.
CA_CHANNELS_CNT
);
for
(
let
charIndex
=
0
;
charIndex
<
Constants
.
CHAR_COUNT
;
charIndex
++
)
{
this
.
_extractSampledChar
(
data
,
charIndex
,
sampledChar
);
this
.
_downsample2xChar
(
sampledChar
,
downsampledChar
);
let
resultOffset
=
(
Constants
.
x2_CHAR_HEIGHT
*
Constants
.
x2_CHAR_WIDTH
*
Constants
.
CA_CHANNELS_CNT
*
charIndex
);
let
resultOffset
=
(
Constants
.
x2_CHAR_HEIGHT
*
Constants
.
x2_CHAR_WIDTH
*
Internal
Constants
.
CA_CHANNELS_CNT
*
charIndex
);
for
(
let
i
=
0
;
i
<
downsampledChar
.
length
;
i
++
)
{
result
[
resultOffset
+
i
]
=
downsampledChar
[
i
];
}
...
...
@@ -116,7 +120,7 @@ export class MinimapCharRendererFactory {
private
static
_downsample1xChar
(
source
:
Uint8ClampedArray
,
dest
:
Uint8ClampedArray
):
void
{
// chars are 1 x 2px (width x height)
const
resultLen
=
Constants
.
x1_CHAR_HEIGHT
*
Constants
.
x1_CHAR_WIDTH
*
Constants
.
CA_CHANNELS_CNT
;
const
resultLen
=
Constants
.
x1_CHAR_HEIGHT
*
Constants
.
x1_CHAR_WIDTH
*
Internal
Constants
.
CA_CHANNELS_CNT
;
const
result
=
new
Uint16Array
(
resultLen
);
for
(
let
i
=
0
;
i
<
resultLen
;
i
++
)
{
result
[
i
]
=
0
;
...
...
@@ -136,7 +140,7 @@ export class MinimapCharRendererFactory {
}
result
[
outputOffset
]
+=
color
;
result
[
outputOffset
+
1
]
+=
alpha
;
outputOffset
+=
Constants
.
CA_CHANNELS_CNT
;
outputOffset
+=
Internal
Constants
.
CA_CHANNELS_CNT
;
if
(
i
===
5
)
{
globalOutputOffset
=
outputOffset
;
...
...
@@ -149,16 +153,16 @@ export class MinimapCharRendererFactory {
}
private
static
_downsample1x
(
data
:
Uint8ClampedArray
):
Uint8ClampedArray
{
const
resultLen
=
Constants
.
x1_CHAR_HEIGHT
*
Constants
.
x1_CHAR_WIDTH
*
Constants
.
CA_CHANNELS_CNT
*
Constants
.
CHAR_COUNT
;
const
resultLen
=
Constants
.
x1_CHAR_HEIGHT
*
Constants
.
x1_CHAR_WIDTH
*
Internal
Constants
.
CA_CHANNELS_CNT
*
Constants
.
CHAR_COUNT
;
const
result
=
new
Uint8ClampedArray
(
resultLen
);
const
sampledChar
=
new
Uint8ClampedArray
(
Constants
.
SAMPLED_CHAR_HEIGHT
*
Constants
.
SAMPLED_CHAR_WIDTH
*
Constants
.
RGBA_CHANNELS_CNT
);
const
downsampledChar
=
new
Uint8ClampedArray
(
Constants
.
x1_CHAR_HEIGHT
*
Constants
.
x1_CHAR_WIDTH
*
Constants
.
CA_CHANNELS_CNT
);
const
downsampledChar
=
new
Uint8ClampedArray
(
Constants
.
x1_CHAR_HEIGHT
*
Constants
.
x1_CHAR_WIDTH
*
Internal
Constants
.
CA_CHANNELS_CNT
);
for
(
let
charIndex
=
0
;
charIndex
<
Constants
.
CHAR_COUNT
;
charIndex
++
)
{
this
.
_extractSampledChar
(
data
,
charIndex
,
sampledChar
);
this
.
_downsample1xChar
(
sampledChar
,
downsampledChar
);
let
resultOffset
=
(
Constants
.
x1_CHAR_HEIGHT
*
Constants
.
x1_CHAR_WIDTH
*
Constants
.
CA_CHANNELS_CNT
*
charIndex
);
let
resultOffset
=
(
Constants
.
x1_CHAR_HEIGHT
*
Constants
.
x1_CHAR_WIDTH
*
Internal
Constants
.
CA_CHANNELS_CNT
*
charIndex
);
for
(
let
i
=
0
;
i
<
downsampledChar
.
length
;
i
++
)
{
result
[
resultOffset
+
i
]
=
downsampledChar
[
i
];
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录