Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Third Party Harfbuzz
提交
69010909
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看板
提交
69010909
编写于
8月 12, 2018
作者:
B
Behdad Esfahbod
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[lazy] Make hb_lazy_loader_t<> more usable
上级
bb905e9a
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
37 addition
and
27 deletion
+37
-27
src/hb-ft.cc
src/hb-ft.cc
+3
-4
src/hb-machinery-private.hh
src/hb-machinery-private.hh
+34
-23
未找到文件。
src/hb-ft.cc
浏览文件 @
69010909
...
...
@@ -685,9 +685,8 @@ hb_ft_font_create_referenced (FT_Face ft_face)
static
void
free_static_ft_library
(
void
);
static
struct
hb_ft_library_lazy_loader_t
:
hb_lazy_loader_t
<
hb_ft_library_lazy_loader_t
,
void
,
0
,
hb_remove_ptr_t
<
FT_Library
>::
value
>
static
struct
hb_ft_library_lazy_loader_t
:
hb_lazy_loader_t
<
hb_remove_ptr_t
<
FT_Library
>::
value
,
hb_ft_library_lazy_loader_t
>
{
static
inline
FT_Library
create
(
void
)
{
...
...
@@ -705,7 +704,7 @@ static struct hb_ft_library_lazy_loader_t : hb_lazy_loader_t<hb_ft_library_lazy_
{
FT_Done_FreeType
(
l
);
}
static
inline
const
FT_Library
get_null
(
void
)
static
inline
FT_Library
get_null
(
void
)
{
return
nullptr
;
}
...
...
src/hb-machinery-private.hh
浏览文件 @
69010909
...
...
@@ -610,20 +610,27 @@ struct hb_data_wrapper_t
template
<
>
struct
hb_data_wrapper_t
<
void
,
0
>
{
template
<
typename
Stored
,
typename
Subclas
s
>
template
<
typename
Stored
,
typename
Func
s
>
inline
Stored
*
call_create
(
void
)
const
{
return
Subclas
s
::
create
();
return
Func
s
::
create
();
}
};
template
<
typename
Subclass
,
typename
Data
,
unsigned
int
WheresData
,
typename
Returned
,
template
<
typename
T1
,
typename
T2
>
struct
hb_non_void_t
{
typedef
T1
value
;
};
template
<
typename
T2
>
struct
hb_non_void_t
<
void
,
T2
>
{
typedef
T2
value
;
};
template
<
typename
Returned
,
typename
Subclass
=
void
,
typename
Data
=
void
,
unsigned
int
WheresData
=
0
,
typename
Stored
=
Returned
>
struct
hb_lazy_loader_t
:
hb_data_wrapper_t
<
Data
,
WheresData
>
{
typedef
typename
hb_non_void_t
<
Subclass
,
hb_lazy_loader_t
<
Returned
,
Subclass
,
Data
,
WheresData
,
Stored
>
>::
value
Funcs
;
inline
void
init0
(
void
)
{}
/* Init, when memory is already set to 0. No-op for us. */
inline
void
init
(
void
)
{
instance
.
set_relaxed
(
nullptr
);
}
inline
void
fini
(
void
)
...
...
@@ -641,15 +648,15 @@ struct hb_lazy_loader_t : hb_data_wrapper_t<Data, WheresData>
inline
Stored
*
do_create
(
void
)
const
{
Stored
*
p
=
this
->
template
call_create
<
Stored
,
Subclas
s
>
();
Stored
*
p
=
this
->
template
call_create
<
Stored
,
Func
s
>
();
if
(
unlikely
(
!
p
))
p
=
const_cast
<
Stored
*>
(
Subclas
s
::
get_null
());
p
=
const_cast
<
Stored
*>
(
Func
s
::
get_null
());
return
p
;
}
static
inline
void
do_destroy
(
Stored
*
p
)
{
if
(
p
&&
p
!=
Subclas
s
::
get_null
())
Subclas
s
::
destroy
(
p
);
if
(
p
&&
p
!=
Func
s
::
get_null
())
Func
s
::
destroy
(
p
);
}
inline
const
Returned
*
operator
->
(
void
)
const
{
return
get
();
}
...
...
@@ -687,8 +694,8 @@ struct hb_lazy_loader_t : hb_data_wrapper_t<Data, WheresData>
do_destroy
(
p
);
}
inline
const
Returned
*
get
(
void
)
const
{
return
Subclas
s
::
convert
(
get_stored
());
}
inline
Returned
*
get_unconst
(
void
)
const
{
return
const_cast
<
Returned
*>
(
Subclas
s
::
convert
(
get_stored
()));
}
inline
const
Returned
*
get
(
void
)
const
{
return
Func
s
::
convert
(
get_stored
());
}
inline
Returned
*
get_unconst
(
void
)
const
{
return
const_cast
<
Returned
*>
(
Func
s
::
convert
(
get_stored
()));
}
/* To be possibly overloaded by subclasses. */
static
inline
const
Returned
*
convert
(
const
Stored
*
p
)
{
return
p
;
}
...
...
@@ -703,6 +710,13 @@ struct hb_lazy_loader_t : hb_data_wrapper_t<Data, WheresData>
p
->
init
(
data
);
return
p
;
}
static
inline
Stored
*
create
(
void
)
{
Stored
*
p
=
(
Stored
*
)
calloc
(
1
,
sizeof
(
Stored
));
if
(
likely
(
p
))
p
->
init
();
return
p
;
}
static
inline
void
destroy
(
Stored
*
p
)
{
p
->
fini
();
...
...
@@ -717,14 +731,15 @@ struct hb_lazy_loader_t : hb_data_wrapper_t<Data, WheresData>
/* Specializations. */
template
<
unsigned
int
WheresFace
,
typename
T
>
struct
hb_face_lazy_loader_t
:
hb_lazy_loader_t
<
hb_face_lazy_loader_t
<
WheresFace
,
T
>
,
hb_face_t
,
WheresFace
,
T
>
{};
struct
hb_face_lazy_loader_t
:
hb_lazy_loader_t
<
T
,
hb_face_lazy_loader_t
<
WheresFace
,
T
>
,
hb_face_t
,
WheresFace
>
{};
template
<
typename
T
,
unsigned
int
WheresFace
>
struct
hb_table_lazy_loader_t
:
hb_lazy_loader_t
<
hb_table_lazy_loader_t
<
T
,
WheresFace
>
,
struct
hb_table_lazy_loader_t
:
hb_lazy_loader_t
<
T
,
hb_table_lazy_loader_t
<
T
,
WheresFace
>
,
hb_face_t
,
WheresFace
,
T
,
hb_blob_t
>
hb_blob_t
>
{
static
inline
hb_blob_t
*
create
(
hb_face_t
*
face
)
{
...
...
@@ -750,9 +765,7 @@ struct hb_table_lazy_loader_t : hb_lazy_loader_t<hb_table_lazy_loader_t<T, Where
};
template
<
typename
Subclass
>
struct
hb_font_funcs_lazy_loader_t
:
hb_lazy_loader_t
<
Subclass
,
void
,
0
,
hb_font_funcs_t
>
struct
hb_font_funcs_lazy_loader_t
:
hb_lazy_loader_t
<
hb_font_funcs_t
,
Subclass
>
{
static
inline
void
destroy
(
hb_font_funcs_t
*
p
)
{
...
...
@@ -764,9 +777,7 @@ struct hb_font_funcs_lazy_loader_t : hb_lazy_loader_t<Subclass,
}
};
template
<
typename
Subclass
>
struct
hb_unicode_funcs_lazy_loader_t
:
hb_lazy_loader_t
<
Subclass
,
void
,
0
,
hb_unicode_funcs_t
>
struct
hb_unicode_funcs_lazy_loader_t
:
hb_lazy_loader_t
<
hb_unicode_funcs_t
,
Subclass
>
{
static
inline
void
destroy
(
hb_unicode_funcs_t
*
p
)
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录