Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Third Party Harfbuzz
提交
5570c87f
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看板
体验新版 GitCode,发现更多精彩内容 >>
提交
5570c87f
编写于
11月 03, 2018
作者:
B
Behdad Esfahbod
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Port objects to use header.writable instead of immutable
Saves 4 or 8 bytes per object on 64bit archs.
上级
ee351a38
变更
10
隐藏空白更改
内联
并排
Showing
10 changed file
with
42 addition
and
66 deletion
+42
-66
src/hb-blob.cc
src/hb-blob.cc
+4
-8
src/hb-blob.hh
src/hb-blob.hh
+0
-2
src/hb-face.cc
src/hb-face.cc
+6
-10
src/hb-face.hh
src/hb-face.hh
+0
-2
src/hb-font.cc
src/hb-font.cc
+19
-27
src/hb-font.hh
src/hb-font.hh
+0
-4
src/hb-ft.cc
src/hb-ft.cc
+1
-1
src/hb-object.hh
src/hb-object.hh
+8
-3
src/hb-unicode.cc
src/hb-unicode.cc
+4
-7
src/hb-unicode.hh
src/hb-unicode.hh
+0
-2
未找到文件。
src/hb-blob.cc
浏览文件 @
5570c87f
...
...
@@ -57,8 +57,6 @@ DEFINE_NULL_INSTANCE (hb_blob_t) =
{
HB_OBJECT_HEADER_STATIC
,
true
,
/* immutable */
nullptr
,
/* data */
0
,
/* length */
HB_MEMORY_MODE_READONLY
,
/* mode */
...
...
@@ -299,12 +297,10 @@ hb_blob_get_user_data (hb_blob_t *blob,
void
hb_blob_make_immutable
(
hb_blob_t
*
blob
)
{
if
(
hb_object_is_inert
(
blob
))
return
;
if
(
blob
->
immutable
)
if
(
hb_object_is_immutable
(
blob
))
return
;
blob
->
immutable
=
true
;
hb_object_make_immutable
(
blob
)
;
}
/**
...
...
@@ -320,7 +316,7 @@ hb_blob_make_immutable (hb_blob_t *blob)
hb_bool_t
hb_blob_is_immutable
(
hb_blob_t
*
blob
)
{
return
blob
->
immutable
;
return
hb_object_is_immutable
(
blob
)
;
}
...
...
@@ -454,7 +450,7 @@ hb_blob_t::try_make_writable_inplace (void)
bool
hb_blob_t
::
try_make_writable
(
void
)
{
if
(
this
->
immutable
)
if
(
hb_object_is_immutable
(
this
)
)
return
false
;
if
(
this
->
mode
==
HB_MEMORY_MODE_WRITABLE
)
...
...
src/hb-blob.hh
浏览文件 @
5570c87f
...
...
@@ -70,8 +70,6 @@ struct hb_blob_t
public:
hb_object_header_t
header
;
bool
immutable
;
const
char
*
data
;
unsigned
int
length
;
hb_memory_mode_t
mode
;
...
...
src/hb-face.cc
浏览文件 @
5570c87f
...
...
@@ -82,8 +82,6 @@ DEFINE_NULL_INSTANCE (hb_face_t) =
{
HB_OBJECT_HEADER_STATIC
,
true
,
/* immutable */
nullptr
,
/* reference_table_func */
nullptr
,
/* user_data */
nullptr
,
/* destroy */
...
...
@@ -336,12 +334,10 @@ hb_face_get_user_data (const hb_face_t *face,
void
hb_face_make_immutable
(
hb_face_t
*
face
)
{
if
(
unlikely
(
hb_object_is_inert
(
face
)))
return
;
if
(
face
->
immutable
)
if
(
hb_object_is_immutable
(
face
))
return
;
face
->
immutable
=
true
;
hb_object_make_immutable
(
face
)
;
}
/**
...
...
@@ -357,7 +353,7 @@ hb_face_make_immutable (hb_face_t *face)
hb_bool_t
hb_face_is_immutable
(
const
hb_face_t
*
face
)
{
return
face
->
immutable
;
return
hb_object_is_immutable
(
face
)
;
}
...
...
@@ -408,7 +404,7 @@ void
hb_face_set_index
(
hb_face_t
*
face
,
unsigned
int
index
)
{
if
(
face
->
immutable
)
if
(
hb_object_is_immutable
(
face
)
)
return
;
face
->
index
=
index
;
...
...
@@ -443,7 +439,7 @@ void
hb_face_set_upem
(
hb_face_t
*
face
,
unsigned
int
upem
)
{
if
(
face
->
immutable
)
if
(
hb_object_is_immutable
(
face
)
)
return
;
face
->
upem
=
upem
;
...
...
@@ -478,7 +474,7 @@ void
hb_face_set_glyph_count
(
hb_face_t
*
face
,
unsigned
int
glyph_count
)
{
if
(
face
->
immutable
)
if
(
hb_object_is_immutable
(
face
)
)
return
;
face
->
num_glyphs
=
glyph_count
;
...
...
src/hb-face.hh
浏览文件 @
5570c87f
...
...
@@ -43,8 +43,6 @@ struct hb_face_t
{
hb_object_header_t
header
;
hb_bool_t
immutable
;
hb_reference_table_func_t
reference_table_func
;
void
*
user_data
;
hb_destroy_func_t
destroy
;
...
...
src/hb-font.cc
浏览文件 @
5570c87f
...
...
@@ -471,8 +471,6 @@ DEFINE_NULL_INSTANCE (hb_font_funcs_t) =
{
HB_OBJECT_HEADER_STATIC
,
true
,
/* immutable */
{
#define HB_FONT_FUNC_IMPLEMENT(name) nullptr,
HB_FONT_FUNCS_IMPLEMENT_CALLBACKS
...
...
@@ -495,8 +493,6 @@ DEFINE_NULL_INSTANCE (hb_font_funcs_t) =
static
const
hb_font_funcs_t
_hb_font_funcs_default
=
{
HB_OBJECT_HEADER_STATIC
,
true
,
/* immutable */
{
#define HB_FONT_FUNC_IMPLEMENT(name) nullptr,
HB_FONT_FUNCS_IMPLEMENT_CALLBACKS
...
...
@@ -645,12 +641,10 @@ hb_font_funcs_get_user_data (hb_font_funcs_t *ffuncs,
void
hb_font_funcs_make_immutable
(
hb_font_funcs_t
*
ffuncs
)
{
if
(
unlikely
(
hb_object_is_inert
(
ffuncs
)))
return
;
if
(
ffuncs
->
immutable
)
if
(
hb_object_is_immutable
(
ffuncs
))
return
;
ffuncs
->
immutable
=
true
;
hb_object_make_immutable
(
ffuncs
)
;
}
/**
...
...
@@ -666,7 +660,7 @@ hb_font_funcs_make_immutable (hb_font_funcs_t *ffuncs)
hb_bool_t
hb_font_funcs_is_immutable
(
hb_font_funcs_t
*
ffuncs
)
{
return
ffuncs
->
immutable
;
return
hb_object_is_immutable
(
ffuncs
)
;
}
...
...
@@ -678,7 +672,7 @@ hb_font_funcs_set_##name##_func (hb_font_funcs_t *ffuncs, \
void *user_data, \
hb_destroy_func_t destroy) \
{ \
if (
ffuncs->immutable) {
\
if (
hb_object_is_immutable (ffuncs)) {
\
if (destroy) \
destroy (user_data); \
return; \
...
...
@@ -1299,8 +1293,6 @@ DEFINE_NULL_INSTANCE (hb_font_t) =
{
HB_OBJECT_HEADER_STATIC
,
true
,
/* immutable */
nullptr
,
/* parent */
const_cast
<
hb_face_t
*>
(
&
_hb_Null_hb_face_t
),
...
...
@@ -1525,15 +1517,13 @@ hb_font_get_user_data (hb_font_t *font,
void
hb_font_make_immutable
(
hb_font_t
*
font
)
{
if
(
unlikely
(
hb_object_is_inert
(
font
)))
return
;
if
(
font
->
immutable
)
if
(
hb_object_is_immutable
(
font
))
return
;
if
(
font
->
parent
)
hb_font_make_immutable
(
font
->
parent
);
font
->
immutable
=
true
;
hb_object_make_immutable
(
font
)
;
}
/**
...
...
@@ -1549,7 +1539,7 @@ hb_font_make_immutable (hb_font_t *font)
hb_bool_t
hb_font_is_immutable
(
hb_font_t
*
font
)
{
return
font
->
immutable
;
return
hb_object_is_immutable
(
font
)
;
}
/**
...
...
@@ -1565,7 +1555,7 @@ void
hb_font_set_parent
(
hb_font_t
*
font
,
hb_font_t
*
parent
)
{
if
(
font
->
immutable
)
if
(
hb_object_is_immutable
(
font
)
)
return
;
if
(
!
parent
)
...
...
@@ -1607,7 +1597,7 @@ void
hb_font_set_face
(
hb_font_t
*
font
,
hb_face_t
*
face
)
{
if
(
font
->
immutable
)
if
(
hb_object_is_immutable
(
font
)
)
return
;
if
(
unlikely
(
!
face
))
...
...
@@ -1654,7 +1644,8 @@ hb_font_set_funcs (hb_font_t *font,
void
*
font_data
,
hb_destroy_func_t
destroy
)
{
if
(
font
->
immutable
)
{
if
(
hb_object_is_immutable
(
font
))
{
if
(
destroy
)
destroy
(
font_data
);
return
;
...
...
@@ -1689,7 +1680,8 @@ hb_font_set_funcs_data (hb_font_t *font,
hb_destroy_func_t
destroy
)
{
/* Destroy user_data? */
if
(
font
->
immutable
)
{
if
(
hb_object_is_immutable
(
font
))
{
if
(
destroy
)
destroy
(
font_data
);
return
;
...
...
@@ -1718,7 +1710,7 @@ hb_font_set_scale (hb_font_t *font,
int
x_scale
,
int
y_scale
)
{
if
(
font
->
immutable
)
if
(
hb_object_is_immutable
(
font
)
)
return
;
font
->
x_scale
=
x_scale
;
...
...
@@ -1759,7 +1751,7 @@ hb_font_set_ppem (hb_font_t *font,
unsigned
int
x_ppem
,
unsigned
int
y_ppem
)
{
if
(
font
->
immutable
)
if
(
hb_object_is_immutable
(
font
)
)
return
;
font
->
x_ppem
=
x_ppem
;
...
...
@@ -1799,7 +1791,7 @@ hb_font_get_ppem (hb_font_t *font,
void
hb_font_set_ptem
(
hb_font_t
*
font
,
float
ptem
)
{
if
(
font
->
immutable
)
if
(
hb_object_is_immutable
(
font
)
)
return
;
font
->
ptem
=
ptem
;
...
...
@@ -1846,7 +1838,7 @@ hb_font_set_variations (hb_font_t *font,
const
hb_variation_t
*
variations
,
unsigned
int
variations_length
)
{
if
(
font
->
immutable
)
if
(
hb_object_is_immutable
(
font
)
)
return
;
if
(
!
variations_length
)
...
...
@@ -1877,7 +1869,7 @@ hb_font_set_var_coords_design (hb_font_t *font,
const
float
*
coords
,
unsigned
int
coords_length
)
{
if
(
font
->
immutable
)
if
(
hb_object_is_immutable
(
font
)
)
return
;
int
*
normalized
=
coords_length
?
(
int
*
)
calloc
(
coords_length
,
sizeof
(
int
))
:
nullptr
;
...
...
@@ -1898,7 +1890,7 @@ hb_font_set_var_coords_normalized (hb_font_t *font,
const
int
*
coords
,
/* 2.14 normalized */
unsigned
int
coords_length
)
{
if
(
font
->
immutable
)
if
(
hb_object_is_immutable
(
font
)
)
return
;
int
*
copy
=
coords_length
?
(
int
*
)
calloc
(
coords_length
,
sizeof
(
coords
[
0
]))
:
nullptr
;
...
...
src/hb-font.hh
浏览文件 @
5570c87f
...
...
@@ -63,8 +63,6 @@ struct hb_font_funcs_t
{
hb_object_header_t
header
;
hb_bool_t
immutable
;
struct
{
#define HB_FONT_FUNC_IMPLEMENT(name) void *name;
HB_FONT_FUNCS_IMPLEMENT_CALLBACKS
...
...
@@ -102,8 +100,6 @@ struct hb_font_t
{
hb_object_header_t
header
;
hb_bool_t
immutable
;
hb_font_t
*
parent
;
hb_face_t
*
face
;
...
...
src/hb-ft.cc
浏览文件 @
5570c87f
...
...
@@ -135,7 +135,7 @@ _hb_ft_font_destroy (void *data)
void
hb_ft_font_set_load_flags
(
hb_font_t
*
font
,
int
load_flags
)
{
if
(
font
->
immutable
)
if
(
hb_object_is_immutable
(
font
)
)
return
;
if
(
font
->
destroy
!=
(
hb_destroy_func_t
)
_hb_ft_font_destroy
)
...
...
src/hb-object.hh
浏览文件 @
5570c87f
...
...
@@ -197,7 +197,12 @@ struct hb_object_header_t
hb_atomic_int_t
writable
;
hb_atomic_ptr_t
<
hb_user_data_array_t
>
user_data
;
};
#define HB_OBJECT_HEADER_STATIC {HB_REFERENCE_COUNT_INIT, HB_ATOMIC_INT_INIT (0), HB_ATOMIC_PTR_INIT (nullptr)}
#define HB_OBJECT_HEADER_STATIC \
{ \
HB_REFERENCE_COUNT_INIT, \
HB_ATOMIC_INT_INIT (false), \
HB_ATOMIC_PTR_INIT (nullptr) \
}
/*
...
...
@@ -248,9 +253,9 @@ static inline bool hb_object_is_immutable (const Type *obj)
return
!
obj
->
header
.
writable
.
get_relaxed
();
}
template
<
typename
Type
>
static
inline
bool
hb_object_make_immutable
(
const
Type
*
obj
)
static
inline
void
hb_object_make_immutable
(
const
Type
*
obj
)
{
return
!
obj
->
header
.
writable
.
set_relaxed
(
false
);
obj
->
header
.
writable
.
set_relaxed
(
false
);
}
template
<
typename
Type
>
static
inline
Type
*
hb_object_reference
(
Type
*
obj
)
...
...
src/hb-unicode.cc
浏览文件 @
5570c87f
...
...
@@ -187,7 +187,6 @@ DEFINE_NULL_INSTANCE (hb_unicode_funcs_t) =
HB_OBJECT_HEADER_STATIC
,
nullptr
,
/* parent */
true
,
/* immutable */
{
#define HB_UNICODE_FUNC_IMPLEMENT(name) hb_unicode_##name##_nil,
HB_UNICODE_FUNCS_IMPLEMENT_CALLBACKS
...
...
@@ -303,12 +302,10 @@ hb_unicode_funcs_get_user_data (hb_unicode_funcs_t *ufuncs,
void
hb_unicode_funcs_make_immutable
(
hb_unicode_funcs_t
*
ufuncs
)
{
if
(
unlikely
(
hb_object_is_inert
(
ufuncs
)))
return
;
if
(
ufuncs
->
immutable
)
if
(
hb_object_is_immutable
(
ufuncs
))
return
;
ufuncs
->
immutable
=
true
;
hb_object_make_immutable
(
ufuncs
)
;
}
/**
...
...
@@ -324,7 +321,7 @@ hb_unicode_funcs_make_immutable (hb_unicode_funcs_t *ufuncs)
hb_bool_t
hb_unicode_funcs_is_immutable
(
hb_unicode_funcs_t
*
ufuncs
)
{
return
ufuncs
->
immutable
;
return
hb_object_is_immutable
(
ufuncs
)
;
}
/**
...
...
@@ -352,7 +349,7 @@ hb_unicode_funcs_set_##name##_func (hb_unicode_funcs_t *ufuncs, \
void *user_data, \
hb_destroy_func_t destroy) \
{ \
if (
ufuncs->immutable)
\
if (
hb_object_is_immutable (ufuncs))
\
return; \
\
if (ufuncs->destroy.name) \
...
...
src/hb-unicode.hh
浏览文件 @
5570c87f
...
...
@@ -66,8 +66,6 @@ struct hb_unicode_funcs_t
hb_unicode_funcs_t
*
parent
;
bool
immutable
;
#define HB_UNICODE_FUNC_IMPLEMENT(return_type, name) \
inline return_type name (hb_codepoint_t unicode) { return func.name (this, unicode, user_data.name); }
HB_UNICODE_FUNCS_IMPLEMENT_CALLBACKS_SIMPLE
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录