Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Third Party Harfbuzz
提交
fca368c4
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,发现更多精彩内容 >>
提交
fca368c4
编写于
4月 21, 2011
作者:
B
Behdad Esfahbod
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add hb_object_header_t which is the common part of all objects
Makes way for adding arbitrary user_data support.
上级
a9f24c80
变更
13
隐藏空白更改
内联
并排
Showing
13 changed file
with
82 addition
and
66 deletion
+82
-66
src/hb-blob-private.hh
src/hb-blob-private.hh
+2
-1
src/hb-blob.cc
src/hb-blob.cc
+1
-1
src/hb-buffer-private.hh
src/hb-buffer-private.hh
+5
-4
src/hb-buffer.cc
src/hb-buffer.cc
+1
-1
src/hb-font-private.hh
src/hb-font-private.hh
+4
-3
src/hb-font.cc
src/hb-font.cc
+4
-3
src/hb-ft.cc
src/hb-ft.cc
+2
-1
src/hb-glib.cc
src/hb-glib.cc
+2
-1
src/hb-icu.cc
src/hb-icu.cc
+2
-1
src/hb-object-private.hh
src/hb-object-private.hh
+52
-43
src/hb-private.hh
src/hb-private.hh
+1
-4
src/hb-unicode-private.hh
src/hb-unicode-private.hh
+4
-2
src/hb-unicode.cc
src/hb-unicode.cc
+2
-1
未找到文件。
src/hb-blob-private.hh
浏览文件 @
fca368c4
...
@@ -30,12 +30,13 @@
...
@@ -30,12 +30,13 @@
#include "hb-private.hh"
#include "hb-private.hh"
#include "hb-blob.h"
#include "hb-blob.h"
#include "hb-object-private.hh"
HB_BEGIN_DECLS
HB_BEGIN_DECLS
struct
_hb_blob_t
{
struct
_hb_blob_t
{
hb_
reference_count_t
ref_count
;
hb_
object_header_t
header
;
unsigned
int
length
;
unsigned
int
length
;
...
...
src/hb-blob.cc
浏览文件 @
fca368c4
...
@@ -46,7 +46,7 @@ HB_BEGIN_DECLS
...
@@ -46,7 +46,7 @@ HB_BEGIN_DECLS
#endif
#endif
hb_blob_t
_hb_blob_nil
=
{
hb_blob_t
_hb_blob_nil
=
{
HB_
REFERENCE_COUNT_INVALID
,
/* ref_count */
HB_
OBJECT_HEADER_STATIC
,
0
,
/* length */
0
,
/* length */
...
...
src/hb-buffer-private.hh
浏览文件 @
fca368c4
...
@@ -30,6 +30,7 @@
...
@@ -30,6 +30,7 @@
#include "hb-private.hh"
#include "hb-private.hh"
#include "hb-buffer.h"
#include "hb-buffer.h"
#include "hb-object-private.hh"
#include "hb-unicode-private.hh"
#include "hb-unicode-private.hh"
HB_BEGIN_DECLS
HB_BEGIN_DECLS
...
@@ -85,7 +86,7 @@ _hb_buffer_set_masks (hb_buffer_t *buffer,
...
@@ -85,7 +86,7 @@ _hb_buffer_set_masks (hb_buffer_t *buffer,
struct
_hb_buffer_t
{
struct
_hb_buffer_t
{
hb_
reference_count_t
ref_count
;
hb_
object_header_t
header
;
/* Information about how the text in the buffer should be treated */
/* Information about how the text in the buffer should be treated */
...
@@ -94,9 +95,9 @@ struct _hb_buffer_t {
...
@@ -94,9 +95,9 @@ struct _hb_buffer_t {
/* Buffer contents */
/* Buffer contents */
hb_bool_t
have_output
;
/* Whether we have an output buffer going on */
bool
have_output
;
/* Whether we have an output buffer going on */
hb_bool_t
have_positions
;
/* Whether we have positions */
bool
have_positions
;
/* Whether we have positions */
hb_bool_t
in_error
;
/* Allocation failed */
bool
in_error
;
/* Allocation failed */
unsigned
int
i
;
/* Cursor into ->info and ->pos arrays */
unsigned
int
i
;
/* Cursor into ->info and ->pos arrays */
unsigned
int
len
;
/* Length of ->info and ->pos arrays */
unsigned
int
len
;
/* Length of ->info and ->pos arrays */
...
...
src/hb-buffer.cc
浏览文件 @
fca368c4
...
@@ -35,7 +35,7 @@ HB_BEGIN_DECLS
...
@@ -35,7 +35,7 @@ HB_BEGIN_DECLS
static
hb_buffer_t
_hb_buffer_nil
=
{
static
hb_buffer_t
_hb_buffer_nil
=
{
HB_
REFERENCE_COUNT_INVALID
,
/* ref_count */
HB_
OBJECT_HEADER_STATIC
,
&
_hb_unicode_funcs_nil
,
/* unicode */
&
_hb_unicode_funcs_nil
,
/* unicode */
{
{
...
...
src/hb-font-private.hh
浏览文件 @
fca368c4
...
@@ -32,6 +32,7 @@
...
@@ -32,6 +32,7 @@
#include "hb-private.hh"
#include "hb-private.hh"
#include "hb-font.h"
#include "hb-font.h"
#include "hb-object-private.hh"
HB_BEGIN_DECLS
HB_BEGIN_DECLS
...
@@ -41,7 +42,7 @@ HB_BEGIN_DECLS
...
@@ -41,7 +42,7 @@ HB_BEGIN_DECLS
*/
*/
struct
_hb_font_funcs_t
{
struct
_hb_font_funcs_t
{
hb_
reference_count_t
ref_count
;
hb_
object_header_t
header
;
hb_bool_t
immutable
;
hb_bool_t
immutable
;
...
@@ -62,7 +63,7 @@ extern HB_INTERNAL hb_font_funcs_t _hb_font_funcs_nil;
...
@@ -62,7 +63,7 @@ extern HB_INTERNAL hb_font_funcs_t _hb_font_funcs_nil;
*/
*/
struct
_hb_face_t
{
struct
_hb_face_t
{
hb_
reference_count_t
ref_count
;
hb_
object_header_t
header
;
hb_get_table_func_t
get_table
;
hb_get_table_func_t
get_table
;
void
*
user_data
;
void
*
user_data
;
...
@@ -80,7 +81,7 @@ struct _hb_face_t {
...
@@ -80,7 +81,7 @@ struct _hb_face_t {
*/
*/
struct
_hb_font_t
{
struct
_hb_font_t
{
hb_
reference_count_t
ref_count
;
hb_
object_header_t
header
;
unsigned
int
x_scale
;
unsigned
int
x_scale
;
unsigned
int
y_scale
;
unsigned
int
y_scale
;
...
...
src/hb-font.cc
浏览文件 @
fca368c4
...
@@ -85,7 +85,8 @@ hb_font_get_kerning_nil (hb_font_t *font HB_UNUSED,
...
@@ -85,7 +85,8 @@ hb_font_get_kerning_nil (hb_font_t *font HB_UNUSED,
{
return
0
;
}
{
return
0
;
}
hb_font_funcs_t
_hb_font_funcs_nil
=
{
hb_font_funcs_t
_hb_font_funcs_nil
=
{
HB_REFERENCE_COUNT_INVALID
,
/* ref_count */
HB_OBJECT_HEADER_STATIC
,
TRUE
,
/* immutable */
TRUE
,
/* immutable */
{
{
hb_font_get_glyph_nil
,
hb_font_get_glyph_nil
,
...
@@ -287,7 +288,7 @@ hb_font_get_kerning (hb_font_t *font, hb_face_t *face,
...
@@ -287,7 +288,7 @@ hb_font_get_kerning (hb_font_t *font, hb_face_t *face,
*/
*/
static
hb_face_t
_hb_face_nil
=
{
static
hb_face_t
_hb_face_nil
=
{
HB_
REFERENCE_COUNT_INVALID
,
/* ref_count */
HB_
OBJECT_HEADER_STATIC
,
NULL
,
/* get_table */
NULL
,
/* get_table */
NULL
,
/* user_data */
NULL
,
/* user_data */
...
@@ -435,7 +436,7 @@ hb_face_get_upem (hb_face_t *face)
...
@@ -435,7 +436,7 @@ hb_face_get_upem (hb_face_t *face)
*/
*/
static
hb_font_t
_hb_font_nil
=
{
static
hb_font_t
_hb_font_nil
=
{
HB_
REFERENCE_COUNT_INVALID
,
/* ref_count */
HB_
OBJECT_HEADER_STATIC
,
0
,
/* x_scale */
0
,
/* x_scale */
0
,
/* y_scale */
0
,
/* y_scale */
...
...
src/hb-ft.cc
浏览文件 @
fca368c4
...
@@ -145,7 +145,8 @@ hb_ft_get_kerning (hb_font_t *font HB_UNUSED,
...
@@ -145,7 +145,8 @@ hb_ft_get_kerning (hb_font_t *font HB_UNUSED,
}
}
static
hb_font_funcs_t
ft_ffuncs
=
{
static
hb_font_funcs_t
ft_ffuncs
=
{
HB_REFERENCE_COUNT_INVALID
,
/* ref_count */
HB_OBJECT_HEADER_STATIC
,
TRUE
,
/* immutable */
TRUE
,
/* immutable */
{
{
hb_ft_get_glyph
,
hb_ft_get_glyph
,
...
...
src/hb-glib.cc
浏览文件 @
fca368c4
...
@@ -221,7 +221,8 @@ hb_glib_get_script (hb_unicode_funcs_t *ufuncs,
...
@@ -221,7 +221,8 @@ hb_glib_get_script (hb_unicode_funcs_t *ufuncs,
}
}
static
hb_unicode_funcs_t
glib_ufuncs
=
{
static
hb_unicode_funcs_t
glib_ufuncs
=
{
HB_REFERENCE_COUNT_INVALID
,
/* ref_count */
HB_OBJECT_HEADER_STATIC
,
NULL
,
/* parent */
NULL
,
/* parent */
TRUE
,
/* immutable */
TRUE
,
/* immutable */
{
{
...
...
src/hb-icu.cc
浏览文件 @
fca368c4
...
@@ -161,7 +161,8 @@ hb_icu_get_script (hb_unicode_funcs_t *ufuncs,
...
@@ -161,7 +161,8 @@ hb_icu_get_script (hb_unicode_funcs_t *ufuncs,
}
}
static
hb_unicode_funcs_t
icu_ufuncs
=
{
static
hb_unicode_funcs_t
icu_ufuncs
=
{
HB_REFERENCE_COUNT_INVALID
,
/* ref_count */
HB_OBJECT_HEADER_STATIC
,
NULL
,
/* parent */
NULL
,
/* parent */
TRUE
,
/* immutable */
TRUE
,
/* immutable */
{
{
...
...
src/hb-object-private.hh
浏览文件 @
fca368c4
...
@@ -37,75 +37,84 @@
...
@@ -37,75 +37,84 @@
HB_BEGIN_DECLS
HB_BEGIN_DECLS
/* Debug */
/* Debug */
#ifndef HB_DEBUG_OBJECT
#ifndef HB_DEBUG_OBJECT
#define HB_DEBUG_OBJECT (HB_DEBUG+0)
#define HB_DEBUG_OBJECT (HB_DEBUG+0)
#endif
#endif
static
inline
void
_hb_trace_object
(
const
void
*
obj
,
hb_reference_count_t
*
ref_count
,
const
char
*
function
)
{
(
void
)
(
HB_DEBUG_OBJECT
&&
fprintf
(
stderr
,
"OBJECT(%p) refcount=%d %s
\n
"
,
obj
,
ref_count
->
get
(),
function
));
}
#define TRACE_OBJECT(obj) _hb_trace_object (obj, &obj->ref_count, __FUNCTION__)
typedef
struct
_hb_object_header_t
hb_object_header_t
;
struct
_hb_object_header_t
{
hb_reference_count_t
ref_count
;
#define HB_OBJECT_HEADER_STATIC {HB_REFERENCE_COUNT_INVALID}
/* Object allocation and lifecycle manamgement macros */
static
inline
void
*
create
(
unsigned
int
size
)
{
hb_object_header_t
*
obj
=
(
hb_object_header_t
*
)
calloc
(
1
,
size
);
#define HB_OBJECT_IS_INERT(obj) \
if
(
likely
(
obj
))
(unlikely ((obj)->ref_count.is_invalid ()))
obj
->
init
();
#define HB_OBJECT_DO_INIT_EXPR(obj) \
return
obj
;
obj->ref_count.init (1)
}
#define HB_OBJECT_DO_INIT(obj) \
inline
void
init
(
void
)
{
HB_STMT_START { \
ref_count
.
init
(
1
);
HB_OBJECT_DO_INIT_EXPR (obj); \
}
} HB_STMT_END
inline
bool
is_inert
(
void
)
const
{
return
unlikely
(
ref_count
.
is_invalid
());
}
inline
void
reference
(
void
)
{
if
(
unlikely
(
!
this
||
this
->
is_inert
()))
return
;
ref_count
.
inc
();
}
inline
bool
destroy
(
void
)
{
if
(
unlikely
(
!
this
||
this
->
is_inert
()))
return
false
;
return
ref_count
.
dec
()
==
1
;
}
inline
void
trace
(
const
char
*
function
)
const
{
(
void
)
(
HB_DEBUG_OBJECT
&&
fprintf
(
stderr
,
"OBJECT(%p) refcount=%d %s
\n
"
,
this
,
this
?
ref_count
.
get
()
:
0
,
function
));
}
};
/* Object allocation and lifecycle manamgement macros */
#define TRACE_OBJECT(obj) \
obj->header.trace (__FUNCTION__)
#define HB_OBJECT_IS_INERT(obj) \
(unlikely ((obj)->header.is_inert ()))
#define HB_OBJECT_DO_CREATE(Type, obj) \
#define HB_OBJECT_DO_CREATE(Type, obj) \
likely (( \
likely (( \
(void) ( \
((obj) = (Type *) hb_object_header_t::create (sizeof (Type))), \
((obj) = (Type *) calloc (1, sizeof (Type))) && \
TRACE_OBJECT (obj), \
( \
(obj) \
HB_OBJECT_DO_INIT_EXPR (obj), \
))
TRACE_OBJECT (obj), \
TRUE \
) \
), \
(obj) \
))
#define HB_OBJECT_DO_REFERENCE(obj) \
#define HB_OBJECT_DO_REFERENCE(obj) \
HB_STMT_START { \
HB_STMT_START { \
int old_count; \
if (unlikely (!(obj) || HB_OBJECT_IS_INERT (obj))) \
return obj; \
TRACE_OBJECT (obj); \
TRACE_OBJECT (obj); \
old_count = obj->ref_count.inc (); \
obj->header.reference (); \
assert (old_count > 0); \
return obj; \
return obj; \
} HB_STMT_END
} HB_STMT_END
#define HB_OBJECT_DO_DESTROY(obj) \
#define HB_OBJECT_DO_DESTROY(obj) \
HB_STMT_START { \
HB_STMT_START { \
int old_count; \
if (unlikely (!(obj) || HB_OBJECT_IS_INERT (obj))) \
return; \
TRACE_OBJECT (obj); \
TRACE_OBJECT (obj); \
old_count = obj->ref_count.dec (); \
if (!obj->header.destroy ()) \
assert (old_count > 0); \
if (old_count != 1) \
return; \
return; \
} HB_STMT_END
} HB_STMT_END
...
...
src/hb-private.hh
浏览文件 @
fca368c4
...
@@ -305,7 +305,7 @@ typedef struct {
...
@@ -305,7 +305,7 @@ typedef struct {
#define HB_DEBUG 0
#define HB_DEBUG 0
#endif
#endif
static
inline
hb_bool_t
/* always returns TRUE */
static
inline
bool
/* always returns TRUE */
_hb_trace
(
const
char
*
what
,
_hb_trace
(
const
char
*
what
,
const
char
*
function
,
const
char
*
function
,
const
void
*
obj
,
const
void
*
obj
,
...
@@ -317,9 +317,6 @@ _hb_trace (const char *what,
...
@@ -317,9 +317,6 @@ _hb_trace (const char *what,
}
}
#include "hb-object-private.hh"
HB_END_DECLS
HB_END_DECLS
#endif
/* HB_PRIVATE_HH */
#endif
/* HB_PRIVATE_HH */
src/hb-unicode-private.hh
浏览文件 @
fca368c4
...
@@ -34,6 +34,7 @@
...
@@ -34,6 +34,7 @@
#include "hb-private.hh"
#include "hb-private.hh"
#include "hb-unicode.h"
#include "hb-unicode.h"
#include "hb-object-private.hh"
HB_BEGIN_DECLS
HB_BEGIN_DECLS
...
@@ -43,10 +44,11 @@ HB_BEGIN_DECLS
...
@@ -43,10 +44,11 @@ HB_BEGIN_DECLS
*/
*/
struct
_hb_unicode_funcs_t
{
struct
_hb_unicode_funcs_t
{
hb_reference_count_t
ref_count
;
hb_object_header_t
header
;
hb_unicode_funcs_t
*
parent
;
hb_unicode_funcs_t
*
parent
;
hb_bool_t
immutable
;
bool
immutable
;
#define IMPLEMENT(return_type, name) \
#define IMPLEMENT(return_type, name) \
inline return_type \
inline return_type \
...
...
src/hb-unicode.cc
浏览文件 @
fca368c4
...
@@ -81,7 +81,8 @@ hb_unicode_get_script_nil (hb_unicode_funcs_t *ufuncs HB_UNUSED,
...
@@ -81,7 +81,8 @@ hb_unicode_get_script_nil (hb_unicode_funcs_t *ufuncs HB_UNUSED,
hb_unicode_funcs_t
_hb_unicode_funcs_nil
=
{
hb_unicode_funcs_t
_hb_unicode_funcs_nil
=
{
HB_REFERENCE_COUNT_INVALID
,
/* ref_count */
HB_OBJECT_HEADER_STATIC
,
NULL
,
/* parent */
NULL
,
/* parent */
TRUE
,
/* immutable */
TRUE
,
/* immutable */
{
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录