Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Third Party Harfbuzz
提交
6418ae4e
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看板
提交
6418ae4e
编写于
3月 14, 2018
作者:
B
Behdad Esfahbod
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[color/COLR] Clean up
上级
150c53ee
变更
3
显示空白变更内容
内联
并排
Showing
3 changed file
with
99 addition
and
99 deletion
+99
-99
src/hb-aat-layout-common-private.hh
src/hb-aat-layout-common-private.hh
+0
-84
src/hb-open-type-private.hh
src/hb-open-type-private.hh
+84
-0
src/hb-ot-color-colr-table.hh
src/hb-ot-color-colr-table.hh
+15
-15
未找到文件。
src/hb-aat-layout-common-private.hh
浏览文件 @
6418ae4e
...
@@ -140,90 +140,6 @@ struct BinSearchArrayOf
...
@@ -140,90 +140,6 @@ struct BinSearchArrayOf
};
};
/* TODO Move this to hb-open-type-private.hh and use it in ArrayOf, HeadlessArrayOf,
* and other places around the code base?? */
template
<
typename
Type
>
struct
UnsizedArrayOf
{
inline
const
Type
&
operator
[]
(
unsigned
int
i
)
const
{
return
arrayZ
[
i
];
}
inline
Type
&
operator
[]
(
unsigned
int
i
)
{
return
arrayZ
[
i
];
}
inline
bool
sanitize
(
hb_sanitize_context_t
*
c
,
unsigned
int
count
)
const
{
TRACE_SANITIZE
(
this
);
if
(
unlikely
(
!
sanitize_shallow
(
c
,
count
)))
return_trace
(
false
);
/* Note: for structs that do not reference other structs,
* we do not need to call their sanitize() as we already did
* a bound check on the aggregate array size. We just include
* a small unreachable expression to make sure the structs
* pointed to do have a simple sanitize(), ie. they do not
* reference other structs via offsets.
*/
(
void
)
(
false
&&
arrayZ
[
0
].
sanitize
(
c
));
return_trace
(
true
);
}
inline
bool
sanitize
(
hb_sanitize_context_t
*
c
,
unsigned
int
count
,
const
void
*
base
)
const
{
TRACE_SANITIZE
(
this
);
if
(
unlikely
(
!
sanitize_shallow
(
c
,
count
)))
return_trace
(
false
);
for
(
unsigned
int
i
=
0
;
i
<
count
;
i
++
)
if
(
unlikely
(
!
arrayZ
[
i
].
sanitize
(
c
,
base
)))
return_trace
(
false
);
return_trace
(
true
);
}
template
<
typename
T
>
inline
bool
sanitize
(
hb_sanitize_context_t
*
c
,
unsigned
int
count
,
const
void
*
base
,
T
user_data
)
const
{
TRACE_SANITIZE
(
this
);
if
(
unlikely
(
!
sanitize_shallow
(
c
,
count
)))
return_trace
(
false
);
for
(
unsigned
int
i
=
0
;
i
<
count
;
i
++
)
if
(
unlikely
(
!
arrayZ
[
i
].
sanitize
(
c
,
base
,
user_data
)))
return_trace
(
false
);
return_trace
(
true
);
}
private:
inline
bool
sanitize_shallow
(
hb_sanitize_context_t
*
c
,
unsigned
int
count
)
const
{
TRACE_SANITIZE
(
this
);
return_trace
(
c
->
check_array
(
arrayZ
,
arrayZ
[
0
].
static_size
,
count
));
}
public:
Type
arrayZ
[
VAR
];
public:
DEFINE_SIZE_ARRAY
(
0
,
arrayZ
);
};
/* Unsized array of offset's */
template
<
typename
Type
,
typename
OffsetType
>
struct
UnsizedOffsetArrayOf
:
UnsizedArrayOf
<
OffsetTo
<
Type
,
OffsetType
>
>
{};
/* Unsized array of offsets relative to the beginning of the array itself. */
template
<
typename
Type
,
typename
OffsetType
>
struct
UnsizedOffsetListOf
:
UnsizedOffsetArrayOf
<
Type
,
OffsetType
>
{
inline
const
Type
&
operator
[]
(
unsigned
int
i
)
const
{
return
this
+
this
->
arrayZ
[
i
];
}
inline
bool
sanitize
(
hb_sanitize_context_t
*
c
,
unsigned
int
count
)
const
{
TRACE_SANITIZE
(
this
);
return_trace
((
UnsizedOffsetArrayOf
<
Type
,
OffsetType
>::
sanitize
(
c
,
count
,
this
)));
}
template
<
typename
T
>
inline
bool
sanitize
(
hb_sanitize_context_t
*
c
,
unsigned
int
count
,
T
user_data
)
const
{
TRACE_SANITIZE
(
this
);
return_trace
((
UnsizedOffsetArrayOf
<
Type
,
OffsetType
>::
sanitize
(
c
,
count
,
this
,
user_data
)));
}
};
/*
/*
* Lookup Table
* Lookup Table
*/
*/
...
...
src/hb-open-type-private.hh
浏览文件 @
6418ae4e
...
@@ -862,6 +862,90 @@ static inline Type& operator + (Base &base, OffsetTo<Type, OffsetType> &offset)
...
@@ -862,6 +862,90 @@ static inline Type& operator + (Base &base, OffsetTo<Type, OffsetType> &offset)
* Array Types
* Array Types
*/
*/
/* TODO Use it in ArrayOf, HeadlessArrayOf, and other places around the code base?? */
template
<
typename
Type
>
struct
UnsizedArrayOf
{
inline
const
Type
&
operator
[]
(
unsigned
int
i
)
const
{
return
arrayZ
[
i
];
}
inline
Type
&
operator
[]
(
unsigned
int
i
)
{
return
arrayZ
[
i
];
}
inline
bool
sanitize
(
hb_sanitize_context_t
*
c
,
unsigned
int
count
)
const
{
TRACE_SANITIZE
(
this
);
if
(
unlikely
(
!
sanitize_shallow
(
c
,
count
)))
return_trace
(
false
);
/* Note: for structs that do not reference other structs,
* we do not need to call their sanitize() as we already did
* a bound check on the aggregate array size. We just include
* a small unreachable expression to make sure the structs
* pointed to do have a simple sanitize(), ie. they do not
* reference other structs via offsets.
*/
(
void
)
(
false
&&
arrayZ
[
0
].
sanitize
(
c
));
return_trace
(
true
);
}
inline
bool
sanitize
(
hb_sanitize_context_t
*
c
,
unsigned
int
count
,
const
void
*
base
)
const
{
TRACE_SANITIZE
(
this
);
if
(
unlikely
(
!
sanitize_shallow
(
c
,
count
)))
return_trace
(
false
);
for
(
unsigned
int
i
=
0
;
i
<
count
;
i
++
)
if
(
unlikely
(
!
arrayZ
[
i
].
sanitize
(
c
,
base
)))
return_trace
(
false
);
return_trace
(
true
);
}
template
<
typename
T
>
inline
bool
sanitize
(
hb_sanitize_context_t
*
c
,
unsigned
int
count
,
const
void
*
base
,
T
user_data
)
const
{
TRACE_SANITIZE
(
this
);
if
(
unlikely
(
!
sanitize_shallow
(
c
,
count
)))
return_trace
(
false
);
for
(
unsigned
int
i
=
0
;
i
<
count
;
i
++
)
if
(
unlikely
(
!
arrayZ
[
i
].
sanitize
(
c
,
base
,
user_data
)))
return_trace
(
false
);
return_trace
(
true
);
}
private:
inline
bool
sanitize_shallow
(
hb_sanitize_context_t
*
c
,
unsigned
int
count
)
const
{
TRACE_SANITIZE
(
this
);
return_trace
(
c
->
check_array
(
arrayZ
,
arrayZ
[
0
].
static_size
,
count
));
}
public:
Type
arrayZ
[
VAR
];
public:
DEFINE_SIZE_ARRAY
(
0
,
arrayZ
);
};
/* Unsized array of offset's */
template
<
typename
Type
,
typename
OffsetType
>
struct
UnsizedOffsetArrayOf
:
UnsizedArrayOf
<
OffsetTo
<
Type
,
OffsetType
>
>
{};
/* Unsized array of offsets relative to the beginning of the array itself. */
template
<
typename
Type
,
typename
OffsetType
>
struct
UnsizedOffsetListOf
:
UnsizedOffsetArrayOf
<
Type
,
OffsetType
>
{
inline
const
Type
&
operator
[]
(
unsigned
int
i
)
const
{
return
this
+
this
->
arrayZ
[
i
];
}
inline
bool
sanitize
(
hb_sanitize_context_t
*
c
,
unsigned
int
count
)
const
{
TRACE_SANITIZE
(
this
);
return_trace
((
UnsizedOffsetArrayOf
<
Type
,
OffsetType
>::
sanitize
(
c
,
count
,
this
)));
}
template
<
typename
T
>
inline
bool
sanitize
(
hb_sanitize_context_t
*
c
,
unsigned
int
count
,
T
user_data
)
const
{
TRACE_SANITIZE
(
this
);
return_trace
((
UnsizedOffsetArrayOf
<
Type
,
OffsetType
>::
sanitize
(
c
,
count
,
this
,
user_data
)));
}
};
/* An array with a number of elements. */
/* An array with a number of elements. */
template
<
typename
Type
,
typename
LenType
=
HBUINT16
>
template
<
typename
Type
,
typename
LenType
=
HBUINT16
>
struct
ArrayOf
struct
ArrayOf
...
...
src/hb-ot-color-colr-table.hh
浏览文件 @
6418ae4e
...
@@ -80,14 +80,14 @@ struct COLR
...
@@ -80,14 +80,14 @@ struct COLR
{
{
TRACE_SANITIZE
(
this
);
TRACE_SANITIZE
(
this
);
if
(
!
(
c
->
check_struct
(
this
)
&&
if
(
!
(
c
->
check_struct
(
this
)
&&
c
->
check_array
(
&
(
this
+
layer
RecordsOffsetZ
),
sizeof
(
LayerRecord
),
numLayerRecord
s
)
&&
c
->
check_array
(
&
(
this
+
layer
s
),
sizeof
(
LayerRecord
),
numLayer
s
)
&&
c
->
check_array
(
&
(
this
+
baseGlyph
RecordsZ
),
sizeof
(
BaseGlyphRecord
),
numBaseGlyphRecord
s
)))
c
->
check_array
(
&
(
this
+
baseGlyph
s
),
sizeof
(
BaseGlyphRecord
),
numBaseGlyph
s
)))
return_trace
(
false
);
return_trace
(
false
);
const
BaseGlyphRecord
*
base_glyph_records
=
&
baseGlyphRecordsZ
(
this
)
;
const
BaseGlyphRecord
*
base_glyph_records
=
(
this
+
baseGlyphs
).
arrayZ
;
for
(
unsigned
int
i
=
0
;
i
<
numBaseGlyph
Record
s
;
++
i
)
for
(
unsigned
int
i
=
0
;
i
<
numBaseGlyphs
;
++
i
)
if
(
base_glyph_records
[
i
].
firstLayerIdx
+
if
(
base_glyph_records
[
i
].
firstLayerIdx
+
base_glyph_records
[
i
].
numLayers
>
numLayer
Record
s
)
base_glyph_records
[
i
].
numLayers
>
numLayers
)
return_trace
(
false
);
return_trace
(
false
);
return_trace
(
true
);
return_trace
(
true
);
...
@@ -97,8 +97,8 @@ struct COLR
...
@@ -97,8 +97,8 @@ struct COLR
unsigned
int
&
first_layer
,
unsigned
int
&
first_layer
,
unsigned
int
&
num_layers
)
const
unsigned
int
&
num_layers
)
const
{
{
const
BaseGlyphRecord
*
base_glyph_records
=
&
baseGlyphRecordsZ
(
this
)
;
const
BaseGlyphRecord
*
base_glyph_records
=
(
this
+
baseGlyphs
).
arrayZ
;
unsigned
int
min
=
0
,
max
=
numBaseGlyph
Record
s
-
1
;
unsigned
int
min
=
0
,
max
=
numBaseGlyphs
-
1
;
while
(
min
<=
max
)
while
(
min
<=
max
)
{
{
unsigned
int
mid
=
(
min
+
max
)
/
2
;
unsigned
int
mid
=
(
min
+
max
)
/
2
;
...
@@ -121,19 +121,19 @@ struct COLR
...
@@ -121,19 +121,19 @@ struct COLR
hb_codepoint_t
&
glyph_id
,
hb_codepoint_t
&
glyph_id
,
unsigned
int
&
palette_index
)
const
unsigned
int
&
palette_index
)
const
{
{
const
LayerRecord
*
records
=
&
layerRecordsOffsetZ
(
this
)
;
const
LayerRecord
*
records
=
(
this
+
layers
).
arrayZ
;
glyph_id
=
records
[
layer
].
glyphid
;
glyph_id
=
records
[
layer
].
glyphid
;
palette_index
=
records
[
layer
].
colorIdx
;
palette_index
=
records
[
layer
].
colorIdx
;
}
}
protected:
protected:
HBUINT16
version
;
/* Table version number */
HBUINT16
version
;
/* Table version number */
HBUINT16
numBaseGlyph
Record
s
;
/* Number of Base Glyph Records */
HBUINT16
numBaseGlyphs
;
/* Number of Base Glyph Records */
LOffsetTo
<
BaseGlyphRecord
>
LOffsetTo
<
UnsizedArrayOf
<
BaseGlyphRecord
>
>
baseGlyph
RecordsZ
;
/* Offset to Base Glyph records. */
baseGlyph
s
;
/* Offset to Base Glyph records. */
LOffsetTo
<
LayerRecord
>
LOffsetTo
<
UnsizedArrayOf
<
LayerRecord
>
>
layer
RecordsOffsetZ
;
/* Offset to Layer Records */
layer
s
;
/* Offset to Layer Records */
HBUINT16
numLayer
Record
s
;
/* Number of Layer Records */
HBUINT16
numLayers
;
/* Number of Layer Records */
public:
public:
DEFINE_SIZE_STATIC
(
14
);
DEFINE_SIZE_STATIC
(
14
);
};
};
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录