Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Third Party Harfbuzz
提交
bd5f918e
T
Third Party Harfbuzz
项目概览
OpenHarmony
/
Third Party Harfbuzz
12 个月 前同步成功
通知
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看板
体验新版 GitCode,发现更多精彩内容 >>
提交
bd5f918e
编写于
5月 01, 2018
作者:
B
Behdad Esfahbod
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[set] Cache population
Part of
https://github.com/harfbuzz/harfbuzz/issues/1017
上级
93b03119
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
24 addition
and
1 deletion
+24
-1
src/hb-set-private.hh
src/hb-set-private.hh
+23
-1
src/hb-set.cc
src/hb-set.cc
+1
-0
未找到文件。
src/hb-set-private.hh
浏览文件 @
bd5f918e
...
...
@@ -189,12 +189,14 @@ struct hb_set_t
hb_object_header_t
header
;
ASSERT_POD
();
bool
in_error
;
mutable
unsigned
int
population
;
hb_prealloced_array_t
<
page_map_t
,
8
>
page_map
;
hb_prealloced_array_t
<
page_t
,
1
>
pages
;
inline
void
init
(
void
)
{
in_error
=
false
;
population
=
0
;
page_map
.
init
();
pages
.
init
();
}
...
...
@@ -220,6 +222,7 @@ struct hb_set_t
if
(
unlikely
(
hb_object_is_inert
(
this
)))
return
;
in_error
=
false
;
population
=
0
;
page_map
.
resize
(
0
);
pages
.
resize
(
0
);
}
...
...
@@ -231,10 +234,13 @@ struct hb_set_t
return
true
;
}
inline
void
dirty
(
void
)
{
population
=
(
unsigned
int
)
-
1
;
}
inline
void
add
(
hb_codepoint_t
g
)
{
if
(
unlikely
(
in_error
))
return
;
if
(
unlikely
(
g
==
INVALID
))
return
;
dirty
();
page_t
*
page
=
page_for_insert
(
g
);
if
(
unlikely
(
!
page
))
return
;
page
->
add
(
g
);
}
...
...
@@ -242,6 +248,7 @@ struct hb_set_t
{
if
(
unlikely
(
in_error
))
return
true
;
/* https://github.com/harfbuzz/harfbuzz/issues/657 */
if
(
unlikely
(
a
>
b
||
a
==
INVALID
||
b
==
INVALID
))
return
false
;
dirty
();
unsigned
int
ma
=
get_major
(
a
);
unsigned
int
mb
=
get_major
(
b
);
if
(
ma
==
mb
)
...
...
@@ -271,6 +278,7 @@ struct hb_set_t
{
if
(
unlikely
(
in_error
))
return
;
if
(
!
count
)
return
;
dirty
();
hb_codepoint_t
g
=
*
array
;
while
(
count
)
{
...
...
@@ -296,6 +304,7 @@ struct hb_set_t
{
if
(
unlikely
(
in_error
))
return
true
;
/* https://github.com/harfbuzz/harfbuzz/issues/657 */
if
(
!
count
)
return
true
;
dirty
();
hb_codepoint_t
g
=
*
array
;
hb_codepoint_t
last_g
=
g
;
while
(
count
)
...
...
@@ -325,6 +334,7 @@ struct hb_set_t
page_t
*
p
=
page_for
(
g
);
if
(
!
p
)
return
;
dirty
();
p
->
del
(
g
);
}
inline
void
del_range
(
hb_codepoint_t
a
,
hb_codepoint_t
b
)
...
...
@@ -353,13 +363,18 @@ struct hb_set_t
unsigned
int
count
=
other
->
pages
.
len
;
if
(
!
resize
(
count
))
return
;
population
=
other
->
population
;
memcpy
(
pages
.
array
,
other
->
pages
.
array
,
count
*
sizeof
(
pages
.
array
[
0
]));
memcpy
(
page_map
.
array
,
other
->
page_map
.
array
,
count
*
sizeof
(
page_map
.
array
[
0
]));
}
inline
bool
is_equal
(
const
hb_set_t
*
other
)
const
{
if
(
population
!=
(
unsigned
int
)
-
1
&&
other
->
population
!=
(
unsigned
int
)
-
1
&&
population
!=
other
->
population
)
return
false
;
unsigned
int
na
=
pages
.
len
;
unsigned
int
nb
=
other
->
pages
.
len
;
...
...
@@ -387,6 +402,8 @@ struct hb_set_t
{
if
(
unlikely
(
in_error
))
return
;
dirty
();
unsigned
int
na
=
pages
.
len
;
unsigned
int
nb
=
other
->
pages
.
len
;
unsigned
int
next_page
=
na
;
...
...
@@ -592,10 +609,15 @@ struct hb_set_t
inline
unsigned
int
get_population
(
void
)
const
{
if
(
population
!=
(
unsigned
int
)
-
1
)
return
population
;
unsigned
int
pop
=
0
;
unsigned
int
count
=
pages
.
len
;
for
(
unsigned
int
i
=
0
;
i
<
count
;
i
++
)
pop
+=
pages
[
i
].
get_population
();
population
=
pop
;
return
pop
;
}
inline
hb_codepoint_t
get_min
(
void
)
const
...
...
src/hb-set.cc
浏览文件 @
bd5f918e
...
...
@@ -53,6 +53,7 @@ hb_set_create (void)
static
const
hb_set_t
_hb_set_nil
=
{
HB_OBJECT_HEADER_STATIC
,
true
,
/* in_error */
0
,
/* population */
{
0
}
/* elts */
};
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录