Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Third Party Harfbuzz
提交
16f175cb
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,发现更多精彩内容 >>
提交
16f175cb
编写于
11月 12, 2013
作者:
B
Behdad Esfahbod
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fix scratch-buffer alignment warnings
上级
c7c4ccf8
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
53 addition
and
35 deletion
+53
-35
src/hb-buffer-private.hh
src/hb-buffer-private.hh
+1
-1
src/hb-buffer.cc
src/hb-buffer.cc
+5
-4
src/hb-coretext.cc
src/hb-coretext.cc
+10
-7
src/hb-graphite2.cc
src/hb-graphite2.cc
+17
-11
src/hb-private.hh
src/hb-private.hh
+3
-0
src/hb-uniscribe.cc
src/hb-uniscribe.cc
+17
-12
未找到文件。
src/hb-buffer-private.hh
浏览文件 @
16f175cb
...
...
@@ -186,7 +186,7 @@ struct hb_buffer_t {
HB_INTERNAL
bool
make_room_for
(
unsigned
int
num_in
,
unsigned
int
num_out
);
HB_INTERNAL
bool
shift_forward
(
unsigned
int
count
);
HB_INTERNAL
void
*
get_scratch_buffer
(
unsigned
int
*
size
);
HB_INTERNAL
int
*
get_scratch_buffer
(
unsigned
int
*
int_
size
);
inline
void
clear_context
(
unsigned
int
side
)
{
context_len
[
side
]
=
0
;
}
};
...
...
src/hb-buffer.cc
浏览文件 @
16f175cb
...
...
@@ -152,8 +152,8 @@ hb_buffer_t::shift_forward (unsigned int count)
return
true
;
}
void
*
hb_buffer_t
::
get_scratch_buffer
(
unsigned
int
*
size
)
int
*
hb_buffer_t
::
get_scratch_buffer
(
unsigned
int
*
int_
size
)
{
have_output
=
false
;
have_positions
=
false
;
...
...
@@ -161,8 +161,9 @@ hb_buffer_t::get_scratch_buffer (unsigned int *size)
out_len
=
0
;
out_info
=
info
;
*
size
=
allocated
*
sizeof
(
pos
[
0
]);
return
pos
;
ASSERT_STATIC
(
sizeof
(
pos
[
0
])
%
sizeof
(
int
)
==
0
);
*
int_size
=
allocated
*
(
sizeof
(
pos
[
0
])
/
sizeof
(
int
));
return
(
int
*
)
pos
;
}
...
...
src/hb-coretext.cc
浏览文件 @
16f175cb
...
...
@@ -647,17 +647,20 @@ _hb_coretext_shape (hb_shape_plan_t *shape_plan,
buffer
->
ensure
(
buffer
->
len
+
num_glyphs
);
/* Testing indicates that CTRunGetGlyphsPtr (almost?) always succeeds,
* and so copying data to our own buffer with CTRunGetGlyphs will be
* extremely rare. */
unsigned
int
scratch_size
;
char
*
scratch
=
(
char
*
)
buffer
->
get_scratch_buffer
(
&
scratch_size
);
int
*
scratch
=
buffer
->
get_scratch_buffer
(
&
scratch_size
);
#define ALLOCATE_ARRAY(Type, name, len) \
Type *name = (Type *) scratch; \
scratch += (len) * sizeof ((name)[0]); \
scratch_size -= (len) * sizeof ((name)[0]);
{ \
unsigned int _consumed = DIV_CEIL ((len) * sizeof (Type), sizeof (*scratch)); \
assert (_consumed <= scratch_size); \
scratch += _consumed; \
scratch_size -= _consumed; \
}
/* Testing indicates that CTRunGetGlyphsPtr, etc (almost?) always
* succeed, and so copying data to our own buffer will be rare. */
const
CGGlyph
*
glyphs
=
CTRunGetGlyphsPtr
(
run
);
if
(
!
glyphs
)
{
...
...
src/hb-graphite2.cc
浏览文件 @
16f175cb
...
...
@@ -243,14 +243,9 @@ _hb_graphite2_shape (hb_shape_plan_t *shape_plan,
float
curradvx
=
0.
,
curradvy
=
0.
;
unsigned
int
scratch_size
;
char
*
scratch
=
(
char
*
)
buffer
->
get_scratch_buffer
(
&
scratch_size
);
int
*
scratch
=
buffer
->
get_scratch_buffer
(
&
scratch_size
);
#define ALLOCATE_ARRAY(Type, name, len) \
Type *name = (Type *) scratch; \
scratch += (len) * sizeof ((name)[0]); \
scratch_size -= (len) * sizeof ((name)[0]);
ALLOCATE_ARRAY
(
uint32_t
,
chars
,
buffer
->
len
);
uint32_t
*
chars
=
(
uint32_t
*
)
scratch
;
for
(
unsigned
int
i
=
0
;
i
<
buffer
->
len
;
++
i
)
chars
[
i
]
=
buffer
->
info
[
i
].
codepoint
;
...
...
@@ -276,9 +271,9 @@ _hb_graphite2_shape (hb_shape_plan_t *shape_plan,
return
false
;
}
scratch
=
(
char
*
)
buffer
->
get_scratch_buffer
(
&
scratch_size
);
while
((
sizeof
(
hb_graphite2_cluster_t
)
*
buffer
->
len
+
sizeof
(
hb_codepoint_t
)
*
glyph_count
)
>
scratch_size
)
scratch
=
buffer
->
get_scratch_buffer
(
&
scratch_size
);
while
((
DIV_CEIL
(
sizeof
(
hb_graphite2_cluster_t
)
*
buffer
->
len
,
sizeof
(
*
scratch
))
+
DIV_CEIL
(
sizeof
(
hb_codepoint_t
)
*
glyph_count
,
sizeof
(
*
scratch
))
)
>
scratch_size
)
{
buffer
->
ensure
(
buffer
->
allocated
*
2
);
if
(
unlikely
(
buffer
->
in_error
))
{
...
...
@@ -286,12 +281,23 @@ _hb_graphite2_shape (hb_shape_plan_t *shape_plan,
gr_seg_destroy
(
seg
);
return
false
;
}
scratch
=
(
char
*
)
buffer
->
get_scratch_buffer
(
&
scratch_size
);
scratch
=
buffer
->
get_scratch_buffer
(
&
scratch_size
);
}
#define ALLOCATE_ARRAY(Type, name, len) \
Type *name = (Type *) scratch; \
{ \
unsigned int _consumed = DIV_CEIL ((len) * sizeof (Type), sizeof (*scratch)); \
assert (_consumed <= scratch_size); \
scratch += _consumed; \
scratch_size -= _consumed; \
}
ALLOCATE_ARRAY
(
hb_graphite2_cluster_t
,
clusters
,
buffer
->
len
);
ALLOCATE_ARRAY
(
hb_codepoint_t
,
gids
,
glyph_count
);
#undef ALLOCATE_ARRAY
memset
(
clusters
,
0
,
sizeof
(
clusters
[
0
])
*
buffer
->
len
);
hb_codepoint_t
*
pg
=
gids
;
...
...
src/hb-private.hh
浏览文件 @
16f175cb
...
...
@@ -79,6 +79,9 @@ static inline Type MIN (const Type &a, const Type &b) { return a < b ? a : b; }
template
<
typename
Type
>
static
inline
Type
MAX
(
const
Type
&
a
,
const
Type
&
b
)
{
return
a
>
b
?
a
:
b
;
}
static
inline
unsigned
int
DIV_CEIL
(
const
unsigned
int
a
,
unsigned
int
b
)
{
return
(
a
+
(
b
-
1
))
/
b
;
}
#undef ARRAY_LENGTH
template
<
typename
Type
,
unsigned
int
n
>
...
...
src/hb-uniscribe.cc
浏览文件 @
16f175cb
...
...
@@ -729,15 +729,10 @@ _hb_uniscribe_shape (hb_shape_plan_t *shape_plan,
retry:
unsigned
int
scratch_size
;
char
*
scratch
=
(
char
*
)
buffer
->
get_scratch_buffer
(
&
scratch_size
);
int
*
scratch
=
buffer
->
get_scratch_buffer
(
&
scratch_size
);
/* Allocate char buffers; they all fit */
#define ALLOCATE_ARRAY(Type, name, len) \
Type *name = (Type *) scratch; \
scratch += (len) * sizeof ((name)[0]); \
scratch_size -= (len) * sizeof ((name)[0]);
#define utf16_index() var1.u32
WCHAR
*
pchars
=
(
WCHAR
*
)
scratch
;
...
...
@@ -756,6 +751,15 @@ retry:
}
}
#define ALLOCATE_ARRAY(Type, name, len) \
Type *name = (Type *) scratch; \
{ \
unsigned int _consumed = DIV_CEIL ((len) * sizeof (Type), sizeof (*scratch)); \
assert (_consumed <= scratch_size); \
scratch += _consumed; \
scratch_size -= _consumed; \
}
ALLOCATE_ARRAY
(
WCHAR
,
wchars
,
chars_len
);
ALLOCATE_ARRAY
(
WORD
,
log_clusters
,
chars_len
);
ALLOCATE_ARRAY
(
SCRIPT_CHARPROP
,
char_props
,
chars_len
);
...
...
@@ -774,12 +778,13 @@ retry:
}
}
/* On Windows, we don't care about alignment...*/
unsigned
int
glyphs_size
=
scratch_size
/
(
sizeof
(
WORD
)
+
sizeof
(
SCRIPT_GLYPHPROP
)
+
sizeof
(
int
)
+
sizeof
(
GOFFSET
)
+
sizeof
(
uint32_t
));
/* All the following types are sized in multiples of sizeof(int). */
unsigned
int
glyphs_size
=
scratch_size
/
((
sizeof
(
WORD
)
+
sizeof
(
SCRIPT_GLYPHPROP
)
+
sizeof
(
int
)
+
sizeof
(
GOFFSET
)
+
sizeof
(
uint32_t
))
/
sizeof
(
int
));
ALLOCATE_ARRAY
(
WORD
,
glyphs
,
glyphs_size
);
ALLOCATE_ARRAY
(
SCRIPT_GLYPHPROP
,
glyph_props
,
glyphs_size
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录