Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Third Party Harfbuzz
提交
6843569d
T
Third Party Harfbuzz
项目概览
OpenHarmony
/
Third Party Harfbuzz
1 年多 前同步成功
通知
0
Star
18
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
Third Party Harfbuzz
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
6843569d
编写于
5月 05, 2011
作者:
B
Behdad Esfahbod
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Replace fixed-size feature_maps array with hb_array_t
上级
44b0a4d2
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
39 addition
and
27 deletion
+39
-27
src/hb-ot-map-private.hh
src/hb-ot-map-private.hh
+3
-7
src/hb-ot-map.cc
src/hb-ot-map.cc
+6
-6
src/hb-ot-shape.cc
src/hb-ot-shape.cc
+1
-1
src/hb-private.hh
src/hb-private.hh
+29
-13
未找到文件。
src/hb-ot-map-private.hh
浏览文件 @
6843569d
...
...
@@ -82,8 +82,6 @@ struct hb_ot_map_t {
public:
hb_ot_map_t
(
void
)
:
feature_count
(
0
)
{}
void
add_feature
(
hb_tag_t
tag
,
unsigned
int
value
,
bool
global
)
{
feature_info_t
*
info
=
feature_infos
.
push
();
...
...
@@ -104,13 +102,13 @@ struct hb_ot_map_t {
inline
hb_mask_t
get_global_mask
(
void
)
const
{
return
global_mask
;
}
inline
hb_mask_t
get_mask
(
hb_tag_t
tag
,
unsigned
int
*
shift
=
NULL
)
const
{
const
feature_map_t
*
map
=
(
const
feature_map_t
*
)
bsearch
(
&
tag
,
feature_maps
,
feature_count
,
sizeof
(
feature_maps
[
0
]),
(
hb_compare_func_t
)
feature_map_t
::
cmp
);
const
feature_map_t
*
map
=
feature_maps
.
bsearch
(
&
tag
);
if
(
shift
)
*
shift
=
map
?
map
->
shift
:
0
;
return
map
?
map
->
mask
:
0
;
}
inline
hb_mask_t
get_1_mask
(
hb_tag_t
tag
)
const
{
const
feature_map_t
*
map
=
(
const
feature_map_t
*
)
bsearch
(
&
tag
,
feature_maps
,
feature_count
,
sizeof
(
feature_maps
[
0
]),
(
hb_compare_func_t
)
feature_map_t
::
cmp
);
const
feature_map_t
*
map
=
feature_maps
.
bsearch
(
&
tag
);
return
map
?
map
->
_1_mask
:
0
;
}
...
...
@@ -128,10 +126,8 @@ struct hb_ot_map_t {
hb_mask_t
global_mask
;
unsigned
int
feature_count
;
hb_prealloced_array_t
<
feature_info_t
,
16
>
feature_infos
;
/* used before compile() only */
#define MAX_FEATURES 100
feature_map_t
feature_maps
[
MAX_FEATURES
];
hb_prealloced_array_t
<
feature_map_t
,
16
>
feature_maps
;
lookup_map_t
lookup_maps
[
2
][
MAX_LOOKUPS
];
/* GSUB/GPOS */
unsigned
int
lookup_count
[
2
];
...
...
src/hb-ot-map.cc
浏览文件 @
6843569d
...
...
@@ -106,10 +106,8 @@ hb_ot_map_t::compile (hb_face_t *face,
/* Allocate bits now */
feature_count
=
feature_infos
.
len
;
unsigned
int
next_bit
=
1
;
j
=
0
;
for
(
unsigned
int
i
=
0
;
i
<
feature_count
;
i
++
)
{
for
(
unsigned
int
i
=
0
;
i
<
feature_infos
.
len
;
i
++
)
{
const
feature_info_t
*
info
=
&
feature_infos
[
i
];
unsigned
int
bits_needed
;
...
...
@@ -137,7 +135,9 @@ hb_ot_map_t::compile (hb_face_t *face,
continue
;
feature_map_t
*
map
=
&
feature_maps
[
j
++
];
feature_map_t
*
map
=
feature_maps
.
push
();
if
(
unlikely
(
!
map
))
break
;
map
->
tag
=
info
->
tag
;
map
->
index
[
0
]
=
feature_index
[
0
];
...
...
@@ -156,7 +156,7 @@ hb_ot_map_t::compile (hb_face_t *face,
map
->
_1_mask
=
(
1
<<
map
->
shift
)
&
map
->
mask
;
}
feature_
count
=
j
;
feature_
infos
.
shrink
(
0
);
/* Done with these */
for
(
unsigned
int
table_index
=
0
;
table_index
<
2
;
table_index
++
)
{
...
...
@@ -172,7 +172,7 @@ hb_ot_map_t::compile (hb_face_t *face,
&
required_feature_index
))
add_lookups
(
face
,
table_index
,
required_feature_index
,
1
);
for
(
unsigned
i
=
0
;
i
<
feature_
count
;
i
++
)
for
(
unsigned
i
=
0
;
i
<
feature_
maps
.
len
;
i
++
)
add_lookups
(
face
,
table_index
,
feature_maps
[
i
].
index
[
table_index
],
feature_maps
[
i
].
mask
);
/* Sort lookups and merge duplicates */
...
...
src/hb-ot-shape.cc
浏览文件 @
6843569d
...
...
@@ -370,7 +370,7 @@ hb_ot_shape (hb_font_t *font,
const
hb_feature_t
*
features
,
unsigned
int
num_features
)
{
hb_ot_shape_plan_t
plan
;
hb_ot_shape_plan_t
plan
=
hb_ot_shape_plan_t
()
;
hb_ot_shape_plan_internal
(
&
plan
,
font
->
face
,
&
buffer
->
props
,
features
,
num_features
);
hb_ot_shape_execute
(
&
plan
,
font
,
buffer
,
features
,
num_features
);
...
...
src/hb-private.hh
浏览文件 @
6843569d
...
...
@@ -285,10 +285,36 @@ struct hb_prealloced_array_t {
/* TODO: shrink array if needed */
}
template
<
typename
T
>
inline
Type
*
find
(
T
v
)
{
for
(
unsigned
int
i
=
0
;
i
<
len
;
i
++
)
if
(
array
[
i
]
==
v
)
return
&
array
[
i
];
return
NULL
;
}
template
<
typename
T
>
inline
const
Type
*
find
(
T
v
)
const
{
for
(
unsigned
int
i
=
0
;
i
<
len
;
i
++
)
if
(
array
[
i
]
==
v
)
return
&
array
[
i
];
return
NULL
;
}
inline
void
sort
(
void
)
{
qsort
(
array
,
len
,
sizeof
(
Type
),
(
hb_compare_func_t
)
Type
::
cmp
);
}
template
<
typename
T
>
inline
Type
*
bsearch
(
T
*
key
)
{
return
(
Type
*
)
::
bsearch
(
key
,
array
,
len
,
sizeof
(
Type
),
(
hb_compare_func_t
)
Type
::
cmp
);
}
template
<
typename
T
>
inline
const
Type
*
bsearch
(
T
*
key
)
const
{
return
(
const
Type
*
)
::
bsearch
(
key
,
array
,
len
,
sizeof
(
Type
),
(
hb_compare_func_t
)
Type
::
cmp
);
}
};
template
<
typename
Type
>
...
...
@@ -300,22 +326,12 @@ struct hb_set_t
{
hb_array_t
<
item_t
>
items
;
private:
template
<
typename
T
>
inline
item_t
*
find
(
T
v
)
{
for
(
unsigned
int
i
=
0
;
i
<
items
.
len
;
i
++
)
if
(
items
[
i
]
==
v
)
return
&
items
[
i
];
return
NULL
;
}
public:
template
<
typename
T
>
inline
bool
insert
(
T
v
)
{
item_t
*
item
=
find
(
v
);
item_t
*
item
=
items
.
find
(
v
);
if
(
item
)
item
->
finish
();
else
...
...
@@ -328,7 +344,7 @@ struct hb_set_t
template
<
typename
T
>
inline
void
remove
(
T
v
)
{
item_t
*
item
=
find
(
v
);
item_t
*
item
=
items
.
find
(
v
);
if
(
!
item
)
return
;
item
->
finish
();
...
...
@@ -339,7 +355,7 @@ struct hb_set_t
template
<
typename
T
>
inline
item_t
*
get
(
T
v
)
{
return
find
(
v
);
return
items
.
find
(
v
);
}
void
finish
(
void
)
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录