Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Third Party Harfbuzz
提交
3567b87c
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看板
提交
3567b87c
编写于
5月 14, 2010
作者:
B
Behdad Esfahbod
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add an inline version of hb_buffer_ensure()
上级
a6a79df5
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
63 addition
and
54 deletion
+63
-54
src/hb-buffer.cc
src/hb-buffer.cc
+63
-54
未找到文件。
src/hb-buffer.cc
浏览文件 @
3567b87c
...
...
@@ -55,12 +55,51 @@ static hb_buffer_t _hb_buffer_nil = {
*/
/* Internal API */
static
hb_bool_t
_hb_buffer_enlarge
(
hb_buffer_t
*
buffer
,
unsigned
int
size
)
{
if
(
unlikely
(
buffer
->
in_error
))
return
FALSE
;
unsigned
int
new_allocated
=
buffer
->
allocated
;
hb_internal_glyph_position_t
*
new_pos
;
hb_internal_glyph_info_t
*
new_info
;
bool
separate_out
;
separate_out
=
buffer
->
out_info
!=
buffer
->
info
;
while
(
size
>
new_allocated
)
new_allocated
+=
(
new_allocated
>>
1
)
+
8
;
new_pos
=
(
hb_internal_glyph_position_t
*
)
realloc
(
buffer
->
pos
,
new_allocated
*
sizeof
(
buffer
->
pos
[
0
]));
new_info
=
(
hb_internal_glyph_info_t
*
)
realloc
(
buffer
->
info
,
new_allocated
*
sizeof
(
buffer
->
info
[
0
]));
if
(
unlikely
(
!
new_pos
||
!
new_info
))
buffer
->
in_error
=
TRUE
;
if
(
likely
(
new_pos
))
buffer
->
pos
=
new_pos
;
if
(
likely
(
new_info
))
buffer
->
info
=
new_info
;
buffer
->
out_info
=
separate_out
?
(
hb_internal_glyph_info_t
*
)
buffer
->
pos
:
buffer
->
info
;
if
(
likely
(
!
buffer
->
in_error
))
buffer
->
allocated
=
new_allocated
;
return
likely
(
!
buffer
->
in_error
);
}
static
inline
hb_bool_t
_hb_buffer_ensure
(
hb_buffer_t
*
buffer
,
unsigned
int
size
)
{
return
likely
(
size
<=
buffer
->
allocated
)
?
TRUE
:
_hb_buffer_enlarge
(
buffer
,
size
);
}
static
hb_bool_t
hb_buffer_ensure_separate
(
hb_buffer_t
*
buffer
,
unsigned
int
size
)
_
hb_buffer_ensure_separate
(
hb_buffer_t
*
buffer
,
unsigned
int
size
)
{
if
(
unlikely
(
!
hb_buffer_ensure
(
buffer
,
size
)))
return
FALSE
;
if
(
unlikely
(
!
_
hb_buffer_ensure
(
buffer
,
size
)))
return
FALSE
;
if
(
buffer
->
out_info
==
buffer
->
info
)
{
...
...
@@ -73,6 +112,7 @@ hb_buffer_ensure_separate (hb_buffer_t *buffer, unsigned int size)
return
TRUE
;
}
/* Public API */
hb_buffer_t
*
...
...
@@ -84,7 +124,7 @@ hb_buffer_create (unsigned int pre_alloc_size)
return
&
_hb_buffer_nil
;
if
(
pre_alloc_size
)
hb_buffer_ensure
(
buffer
,
pre_alloc_size
);
_
hb_buffer_ensure
(
buffer
,
pre_alloc_size
);
buffer
->
unicode
=
&
_hb_unicode_funcs_nil
;
...
...
@@ -192,39 +232,7 @@ hb_buffer_clear (hb_buffer_t *buffer)
hb_bool_t
hb_buffer_ensure
(
hb_buffer_t
*
buffer
,
unsigned
int
size
)
{
if
(
unlikely
(
size
>
buffer
->
allocated
))
{
if
(
unlikely
(
buffer
->
in_error
))
return
FALSE
;
unsigned
int
new_allocated
=
buffer
->
allocated
;
hb_internal_glyph_position_t
*
new_pos
;
hb_internal_glyph_info_t
*
new_info
;
bool
separate_out
;
separate_out
=
buffer
->
out_info
!=
buffer
->
info
;
while
(
size
>
new_allocated
)
new_allocated
+=
(
new_allocated
>>
1
)
+
8
;
new_pos
=
(
hb_internal_glyph_position_t
*
)
realloc
(
buffer
->
pos
,
new_allocated
*
sizeof
(
buffer
->
pos
[
0
]));
new_info
=
(
hb_internal_glyph_info_t
*
)
realloc
(
buffer
->
info
,
new_allocated
*
sizeof
(
buffer
->
info
[
0
]));
if
(
unlikely
(
!
new_pos
||
!
new_info
))
buffer
->
in_error
=
TRUE
;
if
(
likely
(
new_pos
))
buffer
->
pos
=
new_pos
;
if
(
likely
(
new_info
))
buffer
->
info
=
new_info
;
buffer
->
out_info
=
separate_out
?
(
hb_internal_glyph_info_t
*
)
buffer
->
pos
:
buffer
->
info
;
if
(
likely
(
!
buffer
->
in_error
))
buffer
->
allocated
=
new_allocated
;
}
return
likely
(
!
buffer
->
in_error
);
return
_hb_buffer_ensure
(
buffer
,
size
);
}
void
...
...
@@ -235,7 +243,7 @@ hb_buffer_add_glyph (hb_buffer_t *buffer,
{
hb_internal_glyph_info_t
*
glyph
;
if
(
unlikely
(
!
hb_buffer_ensure
(
buffer
,
buffer
->
len
+
1
)))
return
;
if
(
unlikely
(
!
_
hb_buffer_ensure
(
buffer
,
buffer
->
len
+
1
)))
return
;
glyph
=
&
buffer
->
info
[
buffer
->
len
];
glyph
->
codepoint
=
codepoint
;
...
...
@@ -248,18 +256,6 @@ hb_buffer_add_glyph (hb_buffer_t *buffer,
buffer
->
len
++
;
}
/* HarfBuzz-Internal API */
void
_hb_buffer_clear_output
(
hb_buffer_t
*
buffer
)
{
buffer
->
have_output
=
TRUE
;
buffer
->
have_positions
=
FALSE
;
buffer
->
out_len
=
0
;
buffer
->
out_info
=
buffer
->
info
;
}
void
hb_buffer_clear_positions
(
hb_buffer_t
*
buffer
)
{
...
...
@@ -276,6 +272,17 @@ hb_buffer_clear_positions (hb_buffer_t *buffer)
memset
(
buffer
->
pos
,
0
,
sizeof
(
buffer
->
pos
[
0
])
*
buffer
->
len
);
}
/* HarfBuzz-Internal API */
void
_hb_buffer_clear_output
(
hb_buffer_t
*
buffer
)
{
buffer
->
have_output
=
TRUE
;
buffer
->
have_positions
=
FALSE
;
buffer
->
out_len
=
0
;
buffer
->
out_info
=
buffer
->
info
;
}
void
_hb_buffer_swap
(
hb_buffer_t
*
buffer
)
{
...
...
@@ -336,7 +343,7 @@ _hb_buffer_add_output_glyphs (hb_buffer_t *buffer,
if
(
buffer
->
out_info
!=
buffer
->
info
||
buffer
->
out_len
+
num_out
>
buffer
->
i
+
num_in
)
{
if
(
unlikely
(
!
hb_buffer_ensure_separate
(
buffer
,
buffer
->
out_len
+
num_out
)))
if
(
unlikely
(
!
_
hb_buffer_ensure_separate
(
buffer
,
buffer
->
out_len
+
num_out
)))
return
;
}
...
...
@@ -377,7 +384,7 @@ _hb_buffer_add_output_glyphs_be16 (hb_buffer_t *buffer,
if
(
buffer
->
out_info
!=
buffer
->
info
||
buffer
->
out_len
+
num_out
>
buffer
->
i
+
num_in
)
{
if
(
unlikely
(
!
hb_buffer_ensure_separate
(
buffer
,
buffer
->
out_len
+
num_out
)))
if
(
unlikely
(
!
_
hb_buffer_ensure_separate
(
buffer
,
buffer
->
out_len
+
num_out
)))
return
;
}
...
...
@@ -413,7 +420,7 @@ _hb_buffer_add_output_glyph (hb_buffer_t *buffer,
if
(
buffer
->
out_info
!=
buffer
->
info
)
{
if
(
unlikely
(
!
hb_buffer_ensure
(
buffer
,
buffer
->
out_len
+
1
)))
return
;
if
(
unlikely
(
!
_
hb_buffer_ensure
(
buffer
,
buffer
->
out_len
+
1
)))
return
;
buffer
->
out_info
[
buffer
->
out_len
]
=
buffer
->
info
[
buffer
->
i
];
}
else
if
(
buffer
->
out_len
!=
buffer
->
i
)
...
...
@@ -438,7 +445,7 @@ _hb_buffer_next_glyph (hb_buffer_t *buffer)
{
if
(
buffer
->
out_info
!=
buffer
->
info
)
{
if
(
unlikely
(
!
hb_buffer_ensure
(
buffer
,
buffer
->
out_len
+
1
)))
return
;
if
(
unlikely
(
!
_
hb_buffer_ensure
(
buffer
,
buffer
->
out_len
+
1
)))
return
;
buffer
->
out_info
[
buffer
->
out_len
]
=
buffer
->
info
[
buffer
->
i
];
}
else
if
(
buffer
->
out_len
!=
buffer
->
i
)
...
...
@@ -451,6 +458,8 @@ _hb_buffer_next_glyph (hb_buffer_t *buffer)
}
/* Public API again */
unsigned
int
hb_buffer_get_length
(
hb_buffer_t
*
buffer
)
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录