Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Third Party Harfbuzz
提交
85846b3d
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,发现更多精彩内容 >>
提交
85846b3d
编写于
9月 01, 2015
作者:
B
Behdad Esfahbod
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Use insertion-sort instead of bubble-sort
Needed for upcoming merge-clusters fix.
上级
fad26748
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
34 addition
and
42 deletion
+34
-42
src/hb-buffer.cc
src/hb-buffer.cc
+2
-2
src/hb-ot-shape-complex-arabic-fallback.hh
src/hb-ot-shape-complex-arabic-fallback.hh
+3
-3
src/hb-ot-shape-complex-indic.cc
src/hb-ot-shape-complex-indic.cc
+1
-1
src/hb-ot-shape-complex-myanmar.cc
src/hb-ot-shape-complex-myanmar.cc
+1
-1
src/hb-ot-shape-normalize.cc
src/hb-ot-shape-normalize.cc
+2
-4
src/hb-private.hh
src/hb-private.hh
+25
-31
未找到文件。
src/hb-buffer.cc
浏览文件 @
85846b3d
...
...
@@ -1636,7 +1636,7 @@ normalize_glyphs_cluster (hb_buffer_t *buffer,
pos
[
end
-
1
].
x_advance
=
total_x_advance
;
pos
[
end
-
1
].
y_advance
=
total_y_advance
;
hb_
bub
ble_sort
(
buffer
->
info
+
start
,
end
-
start
-
1
,
compare_info_codepoint
,
buffer
->
pos
+
start
);
hb_
sta
ble_sort
(
buffer
->
info
+
start
,
end
-
start
-
1
,
compare_info_codepoint
,
buffer
->
pos
+
start
);
}
else
{
/* Transfer all cluster advance to the first glyph. */
pos
[
start
].
x_advance
+=
total_x_advance
;
...
...
@@ -1645,7 +1645,7 @@ normalize_glyphs_cluster (hb_buffer_t *buffer,
pos
[
i
].
x_offset
-=
total_x_advance
;
pos
[
i
].
y_offset
-=
total_y_advance
;
}
hb_
bub
ble_sort
(
buffer
->
info
+
start
+
1
,
end
-
start
-
1
,
compare_info_codepoint
,
buffer
->
pos
+
start
+
1
);
hb_
sta
ble_sort
(
buffer
->
info
+
start
+
1
,
end
-
start
-
1
,
compare_info_codepoint
,
buffer
->
pos
+
start
+
1
);
}
}
...
...
src/hb-ot-shape-complex-arabic-fallback.hh
浏览文件 @
85846b3d
...
...
@@ -75,9 +75,9 @@ arabic_fallback_synthesize_lookup_single (const hb_ot_shape_plan_t *plan HB_UNUS
if
(
!
num_glyphs
)
return
NULL
;
/* Bubble-sort!
/* Bubble-sort
or something equally good
!
* May not be good-enough for presidential candidate interviews, but good-enough for us... */
hb_
bub
ble_sort
(
&
glyphs
[
0
],
num_glyphs
,
OT
::
GlyphID
::
cmp
,
&
substitutes
[
0
]);
hb_
sta
ble_sort
(
&
glyphs
[
0
],
num_glyphs
,
OT
::
GlyphID
::
cmp
,
&
substitutes
[
0
]);
OT
::
Supplier
<
OT
::
GlyphID
>
glyphs_supplier
(
glyphs
,
num_glyphs
);
OT
::
Supplier
<
OT
::
GlyphID
>
substitutes_supplier
(
substitutes
,
num_glyphs
);
...
...
@@ -126,7 +126,7 @@ arabic_fallback_synthesize_lookup_ligature (const hb_ot_shape_plan_t *plan HB_UN
first_glyphs_indirection
[
num_first_glyphs
]
=
first_glyph_idx
;
num_first_glyphs
++
;
}
hb_
bub
ble_sort
(
&
first_glyphs
[
0
],
num_first_glyphs
,
OT
::
GlyphID
::
cmp
,
&
first_glyphs_indirection
[
0
]);
hb_
sta
ble_sort
(
&
first_glyphs
[
0
],
num_first_glyphs
,
OT
::
GlyphID
::
cmp
,
&
first_glyphs_indirection
[
0
]);
/* Now that the first-glyphs are sorted, walk again, populate ligatures. */
for
(
unsigned
int
i
=
0
;
i
<
num_first_glyphs
;
i
++
)
...
...
src/hb-ot-shape-complex-indic.cc
浏览文件 @
85846b3d
...
...
@@ -1012,7 +1012,7 @@ initial_reordering_consonant_syllable (const hb_ot_shape_plan_t *plan,
info
[
i
].
syllable
()
=
i
-
start
;
/* Sit tight, rock 'n roll! */
hb_
bub
ble_sort
(
info
+
start
,
end
-
start
,
compare_indic_order
);
hb_
sta
ble_sort
(
info
+
start
,
end
-
start
,
compare_indic_order
);
/* Find base again */
base
=
end
;
for
(
unsigned
int
i
=
start
;
i
<
end
;
i
++
)
...
...
src/hb-ot-shape-complex-myanmar.cc
浏览文件 @
85846b3d
...
...
@@ -393,7 +393,7 @@ initial_reordering_consonant_syllable (hb_buffer_t *buffer,
buffer
->
merge_clusters
(
start
,
end
);
/* Sit tight, rock 'n roll! */
hb_
bub
ble_sort
(
info
+
start
,
end
-
start
,
compare_myanmar_order
);
hb_
sta
ble_sort
(
info
+
start
,
end
-
start
,
compare_myanmar_order
);
}
static
void
...
...
src/hb-ot-shape-normalize.cc
浏览文件 @
85846b3d
...
...
@@ -344,15 +344,13 @@ _hb_ot_shape_normalize (const hb_ot_shape_plan_t *plan,
if
(
_hb_glyph_info_get_modified_combining_class
(
&
buffer
->
info
[
end
])
==
0
)
break
;
/* We are going to do a bubble-sort. Only do this if the
* sequence is short. Doing it on long sequences can result
* in an O(n^2) DoS. */
/* We are going to do a O(n^2). Only do this if the sequence is short. */
if
(
end
-
i
>
10
)
{
i
=
end
;
continue
;
}
hb_
bub
ble_sort
(
buffer
->
info
+
i
,
end
-
i
,
compare_combining_class
);
hb_
sta
ble_sort
(
buffer
->
info
+
i
,
end
-
i
,
compare_combining_class
);
i
=
end
;
}
...
...
src/hb-private.hh
浏览文件 @
85846b3d
...
...
@@ -855,42 +855,36 @@ hb_in_ranges (T u, T lo1, T hi1, T lo2, T hi2, T lo3, T hi3)
template
<
typename
T
,
typename
T2
>
static
inline
void
hb_
bub
ble_sort
(
T
*
array
,
unsigned
int
len
,
int
(
*
compar
)(
const
T
*
,
const
T
*
),
T2
*
array2
)
hb_
sta
ble_sort
(
T
*
array
,
unsigned
int
len
,
int
(
*
compar
)(
const
T
*
,
const
T
*
),
T2
*
array2
)
{
if
(
unlikely
(
!
len
))
return
;
unsigned
int
k
=
len
-
1
;
do
{
unsigned
int
new_k
=
0
;
for
(
unsigned
int
j
=
0
;
j
<
k
;
j
++
)
if
(
compar
(
&
array
[
j
],
&
array
[
j
+
1
])
>
0
)
{
{
T
t
;
t
=
array
[
j
];
array
[
j
]
=
array
[
j
+
1
];
array
[
j
+
1
]
=
t
;
}
if
(
array2
)
{
T2
t
;
t
=
array2
[
j
];
array2
[
j
]
=
array2
[
j
+
1
];
array2
[
j
+
1
]
=
t
;
}
new_k
=
j
;
}
k
=
new_k
;
}
while
(
k
);
for
(
unsigned
int
i
=
1
;
i
<
len
;
i
++
)
{
unsigned
int
j
=
i
;
while
(
j
&&
compar
(
&
array
[
j
-
1
],
&
array
[
i
])
>
0
)
j
--
;
if
(
i
==
j
)
continue
;
/* Move item i to occupy place for item j, shift what's in between. */
{
T
t
;
t
=
array
[
i
];
memmove
(
&
array
[
j
+
1
],
&
array
[
j
],
(
i
-
j
)
*
sizeof
(
T
));
array
[
j
]
=
t
;
}
if
(
array2
)
{
T2
t
;
t
=
array2
[
i
];
memmove
(
&
array2
[
j
+
1
],
&
array2
[
j
],
(
i
-
j
)
*
sizeof
(
T2
));
array2
[
j
]
=
t
;
}
}
}
template
<
typename
T
>
static
inline
void
hb_
bub
ble_sort
(
T
*
array
,
unsigned
int
len
,
int
(
*
compar
)(
const
T
*
,
const
T
*
))
hb_
sta
ble_sort
(
T
*
array
,
unsigned
int
len
,
int
(
*
compar
)(
const
T
*
,
const
T
*
))
{
hb_
bub
ble_sort
(
array
,
len
,
compar
,
(
int
*
)
NULL
);
hb_
sta
ble_sort
(
array
,
len
,
compar
,
(
int
*
)
NULL
);
}
static
inline
hb_bool_t
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录