Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Third Party Harfbuzz
提交
48ed15a2
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看板
未验证
提交
48ed15a2
编写于
3月 03, 2018
作者:
E
Ebrahim Byagowi
提交者:
GitHub
3月 03, 2018
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[COLR/CPAL] Provide enough helper for rasterization (#855)
上级
432758a7
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
59 addition
and
6 deletion
+59
-6
src/hb-ot-colr-table.hh
src/hb-ot-colr-table.hh
+44
-3
src/hb-ot-cpal-table.hh
src/hb-ot-cpal-table.hh
+15
-3
未找到文件。
src/hb-ot-colr-table.hh
浏览文件 @
48ed15a2
...
...
@@ -39,12 +39,15 @@ namespace OT {
struct
LayerRecord
{
friend
struct
COLR
;
inline
bool
sanitize
(
hb_sanitize_context_t
*
c
)
const
{
TRACE_SANITIZE
(
this
);
return_trace
(
c
->
check_struct
(
this
));
}
protected:
GlyphID
gID
;
/* Glyph ID of layer glyph */
HBUINT16
paletteIndex
;
/* Index value to use with a selected color palette */
public:
...
...
@@ -53,12 +56,15 @@ struct LayerRecord
struct
BaseGlyphRecord
{
friend
struct
COLR
;
inline
bool
sanitize
(
hb_sanitize_context_t
*
c
)
const
{
TRACE_SANITIZE
(
this
);
return_trace
(
c
->
check_struct
(
this
));
}
protected:
GlyphID
gID
;
/* Glyph ID of reference glyph */
HBUINT16
firstLayerIndex
;
/* Index to the layer record */
HBUINT16
numLayers
;
/* Number of color layers associated with this glyph */
...
...
@@ -73,9 +79,44 @@ struct COLR
inline
bool
sanitize
(
hb_sanitize_context_t
*
c
)
const
{
TRACE_SANITIZE
(
this
);
return_trace
(
c
->
check_struct
(
this
)
&&
c
->
check_array
((
const
void
*
)
&
layerRecordsOffset
,
sizeof
(
LayerRecord
),
numLayerRecords
)
&&
c
->
check_array
((
const
void
*
)
&
baseGlyphRecords
,
sizeof
(
BaseGlyphRecord
),
numBaseGlyphRecords
));
if
(
!
(
c
->
check_struct
(
this
)
&&
c
->
check_array
((
const
void
*
)
&
layerRecordsOffset
,
sizeof
(
LayerRecord
),
numLayerRecords
)
&&
c
->
check_array
((
const
void
*
)
&
baseGlyphRecords
,
sizeof
(
BaseGlyphRecord
),
numBaseGlyphRecords
)))
return_trace
(
false
);
const
BaseGlyphRecord
*
base_glyph_records
=
&
baseGlyphRecords
(
this
);
for
(
unsigned
int
i
=
0
;
i
<
numBaseGlyphRecords
;
++
i
)
if
(
base_glyph_records
[
i
].
firstLayerIndex
+
base_glyph_records
[
i
].
numLayers
>
numLayerRecords
)
return_trace
(
false
);
/* XXX values of LayerRecord structs should be sanitized */
return_trace
(
true
);
}
inline
const
bool
get_base_glyph_record
(
hb_codepoint_t
glyph_id
,
unsigned
int
&
first_layer
,
unsigned
int
&
num_layers
)
const
{
/* TODO replace with bsearch */
const
BaseGlyphRecord
*
base_glyph_records
=
&
baseGlyphRecords
(
this
);
unsigned
int
records
=
numBaseGlyphRecords
;
for
(
unsigned
int
i
=
0
;
i
<
records
;
++
i
)
if
(
base_glyph_records
[
i
].
gID
==
glyph_id
)
{
first_layer
=
base_glyph_records
[
i
].
firstLayerIndex
;
num_layers
=
base_glyph_records
[
i
].
numLayers
;
return
true
;
}
return
false
;
}
inline
void
get_layer_record
(
int
layer
,
hb_codepoint_t
&
glyph_id
,
unsigned
int
&
palette_index
)
const
{
const
LayerRecord
*
records
=
&
layerRecordsOffset
(
this
);
glyph_id
=
records
[
layer
].
gID
;
palette_index
=
records
[
layer
].
paletteIndex
;
}
protected:
...
...
src/hb-ot-cpal-table.hh
浏览文件 @
48ed15a2
...
...
@@ -42,12 +42,15 @@ namespace OT {
struct
ColorRecord
{
friend
struct
CPAL
;
inline
bool
sanitize
(
hb_sanitize_context_t
*
c
)
const
{
TRACE_SANITIZE
(
this
);
return_trace
(
true
);
}
protected:
HBUINT8
blue
;
HBUINT8
green
;
HBUINT8
red
;
...
...
@@ -74,14 +77,14 @@ struct CPALV1Tail
inline
hb_ot_color_palette_flags_t
get_palette_flags
(
const
void
*
base
,
unsigned
int
palette
)
const
{
const
HBUINT32
*
flags
=
(
const
HBUINT32
*
)
(
const
void
*
)
&
paletteFlags
(
base
);
const
HBUINT32
*
flags
=
&
paletteFlags
(
base
);
return
(
hb_ot_color_palette_flags_t
)
(
uint32_t
)
flags
[
palette
];
}
inline
unsigned
int
get_palette_name_id
(
const
void
*
base
,
unsigned
int
palette
)
const
{
const
HBUINT16
*
name_ids
=
(
const
HBUINT16
*
)
(
const
void
*
)
&
paletteLabel
(
base
);
const
HBUINT16
*
name_ids
=
&
paletteLabel
(
base
);
return
name_ids
[
palette
];
}
...
...
@@ -148,9 +151,18 @@ struct CPAL
return
numPalettes
;
}
inline
void
get_color_record
(
int
palette_index
,
uint8_t
&
r
,
uint8_t
&
g
,
uint8_t
&
b
,
uint8_t
&
a
)
const
{
// We should check if palette_index is in range as it is not done on COLR sanitization
r
=
colorRecords
[
palette_index
].
red
;
g
=
colorRecords
[
palette_index
].
green
;
b
=
colorRecords
[
palette_index
].
blue
;
a
=
colorRecords
[
palette_index
].
alpha
;
}
protected:
HBUINT16
version
;
/* Version 0 */
HBUINT16
numPaletteEntries
;
HBUINT16
numPalettes
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录