提交 f47c5da0 编写于 作者: B Behdad Esfahbod

[arrays] Use hb_array_t<> in all places with sub_array()

上级 3246a8eb
......@@ -52,10 +52,10 @@ struct lcar
const OffsetTo<LigCaretClassEntry>* entry_offset = lookup.get_value (glyph,
font->face->get_num_glyphs ());
const LigCaretClassEntry& array = entry_offset ? this+*entry_offset : Null (LigCaretClassEntry);
if (caret_count && *caret_count)
if (caret_count)
{
const HBINT16 *arr = array.sub_array (start_offset, caret_count);
unsigned int count = *caret_count;
hb_array_t<const HBINT16> arr = array.sub_array (start_offset, caret_count);
unsigned int count = arr.len;
for (unsigned int i = 0; i < count; ++i)
switch (format)
{
......
......@@ -61,9 +61,10 @@ struct AttachList
const AttachPoint &points = this+attachPoint[index];
if (point_count) {
const HBUINT16 *array = points.sub_array (start_offset, point_count);
unsigned int count = *point_count;
if (point_count)
{
hb_array_t<const HBUINT16> array = points.sub_array (start_offset, point_count);
unsigned int count = array.len;
for (unsigned int i = 0; i < count; i++)
point_array[i] = array[i];
}
......@@ -216,9 +217,10 @@ struct LigGlyph
unsigned int *caret_count /* IN/OUT */,
hb_position_t *caret_array /* OUT */) const
{
if (caret_count) {
const OffsetTo<CaretValue> *array = carets.sub_array (start_offset, caret_count);
unsigned int count = *caret_count;
if (caret_count)
{
hb_array_t <const OffsetTo<CaretValue> > array = carets.sub_array (start_offset, caret_count);
unsigned int count = array.len;
for (unsigned int i = 0; i < count; i++)
caret_array[i] = (this+array[i]).get_caret_value (font, direction, glyph_id, var_store);
}
......
......@@ -509,9 +509,8 @@ struct MathGlyphAssembly
if (parts_count)
{
int scale = font->dir_scale (direction);
const MathGlyphPartRecord *arr =
partRecords.sub_array (start_offset, parts_count);
unsigned int count = *parts_count;
hb_array_t<const MathGlyphPartRecord> arr = partRecords.sub_array (start_offset, parts_count);
unsigned int count = arr.len;
for (unsigned int i = 0; i < count; i++)
arr[i].extract (parts[i], scale, font);
}
......@@ -556,9 +555,8 @@ struct MathGlyphConstruction
if (variants_count)
{
int scale = font->dir_scale (direction);
const MathGlyphVariantRecord *arr =
mathGlyphVariantRecord.sub_array (start_offset, variants_count);
unsigned int count = *variants_count;
hb_array_t<const MathGlyphVariantRecord> arr = mathGlyphVariantRecord.sub_array (start_offset, variants_count);
unsigned int count = arr.len;
for (unsigned int i = 0; i < count; i++)
{
variants[i].glyph = arr[i].variantGlyph;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册