Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Third Party Harfbuzz
提交
69ab72e4
T
Third Party Harfbuzz
项目概览
OpenHarmony
/
Third Party Harfbuzz
接近 2 年 前同步成功
通知
1
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看板
提交
69ab72e4
编写于
10月 22, 2018
作者:
B
Behdad Esfahbod
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[color] More CPAL rename
上级
0befb06c
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
54 addition
and
56 deletion
+54
-56
src/hb-ot-color-cpal-table.hh
src/hb-ot-color-cpal-table.hh
+51
-53
src/hb-ot-color.cc
src/hb-ot-color.cc
+3
-3
未找到文件。
src/hb-ot-color-cpal-table.hh
浏览文件 @
69ab72e4
...
...
@@ -47,46 +47,49 @@ struct CPALV1Tail
{
friend
struct
CPAL
;
inline
bool
sanitize
(
hb_sanitize_context_t
*
c
,
const
void
*
base
,
unsigned
int
palette_count
,
unsigned
int
color_count
)
const
{
TRACE_SANITIZE
(
this
);
return_trace
(
c
->
check_struct
(
this
)
&&
(
base
+
paletteFlagsZ
).
sanitize
(
c
,
palette_count
)
&&
(
base
+
paletteLabelZ
).
sanitize
(
c
,
palette_count
)
&&
(
base
+
paletteEntryLabelZ
).
sanitize
(
c
,
color_count
));
}
private:
inline
hb_ot_color_palette_flags_t
get_palette_flags
(
const
void
*
base
,
unsigned
int
palette_index
,
unsigned
int
palettes_count
)
const
get_palette_flags
(
const
void
*
base
,
unsigned
int
palette_index
,
unsigned
int
palette_count
)
const
{
if
(
unlikely
(
palette_index
>=
palette
s
_count
))
if
(
unlikely
(
palette_index
>=
palette_count
))
return
HB_OT_COLOR_PALETTE_FLAG_DEFAULT
;
return
(
hb_ot_color_palette_flags_t
)
(
uint32_t
)
(
base
+
paletteFlagsZ
)[
palette_index
];
}
inline
unsigned
int
get_palette_name_id
(
const
void
*
base
,
unsigned
int
palette_index
,
unsigned
int
palettes_count
)
const
get_palette_name_id
(
const
void
*
base
,
unsigned
int
palette_index
,
unsigned
int
palette_count
)
const
{
if
(
unlikely
(
palette_index
>=
palette
s
_count
))
if
(
unlikely
(
palette_index
>=
palette_count
))
return
HB_NAME_ID_INVALID
;
return
(
base
+
paletteLabelZ
)[
palette_index
];
}
inline
unsigned
int
get_palette_entry_name_id
(
const
void
*
base
,
unsigned
int
palette_entry
,
unsigned
int
palettes_entries_count
)
const
get_color_name_id
(
const
void
*
base
,
unsigned
int
color_index
,
unsigned
int
color_count
)
const
{
if
(
unlikely
(
palette_entry
>=
palettes_entries
_count
))
if
(
unlikely
(
color_index
>=
color
_count
))
return
HB_NAME_ID_INVALID
;
return
(
base
+
paletteEntryLabelZ
)[
palette_entry
];
return
(
base
+
paletteEntryLabelZ
)[
color_index
];
}
public:
inline
bool
sanitize
(
hb_sanitize_context_t
*
c
,
const
void
*
base
,
unsigned
int
palette_count
,
unsigned
int
color_count
)
const
{
TRACE_SANITIZE
(
this
);
return_trace
(
c
->
check_struct
(
this
)
&&
(
base
+
paletteFlagsZ
).
sanitize
(
c
,
palette_count
)
&&
(
base
+
paletteLabelZ
).
sanitize
(
c
,
palette_count
)
&&
(
base
+
paletteEntryLabelZ
).
sanitize
(
c
,
color_count
));
}
protected:
...
...
@@ -114,31 +117,11 @@ struct CPAL
inline
bool
has_data
(
void
)
const
{
return
numPalettes
;
}
inline
bool
sanitize
(
hb_sanitize_context_t
*
c
)
const
{
TRACE_SANITIZE
(
this
);
if
(
unlikely
(
!
(
c
->
check_struct
(
this
)
&&
/* it checks colorRecordIndices also
* See #get_size */
(
this
+
colorRecordsZ
).
sanitize
(
c
,
numColorRecords
))))
return_trace
(
false
);
/* Check for indices sanity so no need for doing it runtime */
for
(
unsigned
int
i
=
0
;
i
<
numPalettes
;
++
i
)
if
(
unlikely
(
colorRecordIndicesZ
[
i
]
+
numColors
>
numColorRecords
))
return_trace
(
false
);
/* If version is zero, we are done here; otherwise we need to check tail also */
if
(
version
==
0
)
return_trace
(
true
);
const
CPALV1Tail
&
v1
=
StructAfter
<
CPALV1Tail
>
(
*
this
);
return_trace
(
likely
(
v1
.
sanitize
(
c
,
this
,
numPalettes
,
numColors
)));
}
inline
unsigned
int
get_size
(
void
)
const
{
return
min_size
+
numPalettes
*
sizeof
(
HBUINT16
);
}
{
return
min_size
+
numPalettes
*
sizeof
(
colorRecordIndicesZ
[
0
]);
}
inline
unsigned
int
get_palette_count
()
const
{
return
numPalettes
;
}
inline
unsigned
int
get_color_count
()
const
{
return
numColors
;
}
inline
hb_ot_color_palette_flags_t
get_palette_flags
(
unsigned
int
palette_index
)
const
{
...
...
@@ -158,21 +141,15 @@ struct CPAL
return
cpal1
.
get_palette_name_id
(
this
,
palette_index
,
numPalettes
);
}
inline
unsigned
int
get_
palette_entry_name_id
(
unsigned
int
palette_entry
)
const
inline
unsigned
int
get_
color_name_id
(
unsigned
int
color_index
)
const
{
if
(
unlikely
(
version
==
0
))
return
HB_NAME_ID_INVALID
;
const
CPALV1Tail
&
cpal1
=
StructAfter
<
CPALV1Tail
>
(
*
this
);
return
cpal1
.
get_
palette_entry_name_id
(
this
,
palette_entry
,
numColors
);
return
cpal1
.
get_
color_name_id
(
this
,
color_index
,
numColors
);
}
inline
unsigned
int
get_palette_count
()
const
{
return
numPalettes
;
}
inline
unsigned
int
get_palette_entries_count
()
const
{
return
numColors
;
}
bool
get_color_record_argb
(
unsigned
int
color_index
,
unsigned
int
palette_index
,
hb_color_t
*
color
)
const
{
...
...
@@ -186,6 +163,27 @@ struct CPAL
return
true
;
}
inline
bool
sanitize
(
hb_sanitize_context_t
*
c
)
const
{
TRACE_SANITIZE
(
this
);
if
(
unlikely
(
!
(
c
->
check_struct
(
this
)
&&
/* it checks colorRecordIndices also
* See #get_size */
(
this
+
colorRecordsZ
).
sanitize
(
c
,
numColorRecords
))))
return_trace
(
false
);
/* Check for indices sanity so no need for doing it runtime */
for
(
unsigned
int
i
=
0
;
i
<
numPalettes
;
++
i
)
if
(
unlikely
(
colorRecordIndicesZ
[
i
]
+
numColors
>
numColorRecords
))
return_trace
(
false
);
/* If version is zero, we are done here; otherwise we need to check tail also */
if
(
version
==
0
)
return_trace
(
true
);
const
CPALV1Tail
&
v1
=
StructAfter
<
CPALV1Tail
>
(
*
this
);
return_trace
(
likely
(
v1
.
sanitize
(
c
,
this
,
numPalettes
,
numColors
)));
}
protected:
HBUINT16
version
;
/* Table version number */
/* Version 0 */
...
...
src/hb-ot-color.cc
浏览文件 @
69ab72e4
...
...
@@ -145,7 +145,7 @@ hb_name_id_t
hb_ot_color_palette_color_get_name_id
(
hb_face_t
*
face
,
unsigned
int
color_index
)
{
return
_get_cpal
(
face
).
get_
palette_entry
_name_id
(
color_index
);
return
_get_cpal
(
face
).
get_
color
_name_id
(
color_index
);
}
/**
...
...
@@ -208,7 +208,7 @@ hb_ot_color_palette_get_colors (hb_face_t *face,
{
unsigned
int
platte_count
;
platte_count
=
MIN
<
unsigned
int
>
(
*
colors_count
,
cpal
.
get_
palette_entries
_count
()
-
start_offset
);
cpal
.
get_
color
_count
()
-
start_offset
);
for
(
unsigned
int
i
=
0
;
i
<
platte_count
;
i
++
)
{
if
(
cpal
.
get_color_record_argb
(
start_offset
+
i
,
palette_index
,
&
colors
[
num_results
]))
...
...
@@ -217,7 +217,7 @@ hb_ot_color_palette_get_colors (hb_face_t *face,
}
if
(
likely
(
colors_count
))
*
colors_count
=
num_results
;
return
cpal
.
get_
palette_entries
_count
();
return
cpal
.
get_
color
_count
();
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录