[arrays] Remove need of stride in Supplier<>
This commit is contained in:
parent
dcfa4a8d71
commit
0d0fe9df46
|
@ -647,12 +647,10 @@ _hb_face_builder_data_reference_blob (hb_face_builder_data_t *data)
|
||||||
bool is_cff = data->tables.lsearch (HB_TAG ('C','F','F',' ')) || data->tables.lsearch (HB_TAG ('C','F','F','2'));
|
bool is_cff = data->tables.lsearch (HB_TAG ('C','F','F',' ')) || data->tables.lsearch (HB_TAG ('C','F','F','2'));
|
||||||
hb_tag_t sfnt_tag = is_cff ? OT::OpenTypeFontFile::CFFTag : OT::OpenTypeFontFile::TrueTypeTag;
|
hb_tag_t sfnt_tag = is_cff ? OT::OpenTypeFontFile::CFFTag : OT::OpenTypeFontFile::TrueTypeTag;
|
||||||
|
|
||||||
Supplier<hb_tag_t> tags_supplier (&data->tables[0].tag, table_count, data->tables.item_size);
|
Supplier<hb_face_builder_data_t::table_entry_t> supplier (data->tables);
|
||||||
Supplier<hb_blob_t *> blobs_supplier (&data->tables[0].blob, table_count, data->tables.item_size);
|
|
||||||
bool ret = f->serialize_single (&c,
|
bool ret = f->serialize_single (&c,
|
||||||
sfnt_tag,
|
sfnt_tag,
|
||||||
tags_supplier,
|
supplier,
|
||||||
blobs_supplier,
|
|
||||||
table_count);
|
table_count);
|
||||||
|
|
||||||
c.end_serialize ();
|
c.end_serialize ();
|
||||||
|
|
|
@ -122,10 +122,10 @@ typedef struct OffsetTable
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
template <typename item_t>
|
||||||
bool serialize (hb_serialize_context_t *c,
|
bool serialize (hb_serialize_context_t *c,
|
||||||
hb_tag_t sfnt_tag,
|
hb_tag_t sfnt_tag,
|
||||||
Supplier<hb_tag_t> &tags,
|
Supplier<item_t> &items,
|
||||||
Supplier<hb_blob_t *> &blobs,
|
|
||||||
unsigned int table_count)
|
unsigned int table_count)
|
||||||
{
|
{
|
||||||
TRACE_SERIALIZE (this);
|
TRACE_SERIALIZE (this);
|
||||||
|
@ -144,8 +144,8 @@ typedef struct OffsetTable
|
||||||
for (unsigned int i = 0; i < table_count; i++)
|
for (unsigned int i = 0; i < table_count; i++)
|
||||||
{
|
{
|
||||||
TableRecord &rec = tables.arrayZ[i];
|
TableRecord &rec = tables.arrayZ[i];
|
||||||
hb_blob_t *blob = blobs[i];
|
hb_blob_t *blob = items[i].blob;
|
||||||
rec.tag.set (tags[i]);
|
rec.tag.set (items[i].tag);
|
||||||
rec.length.set (hb_blob_get_length (blob));
|
rec.length.set (hb_blob_get_length (blob));
|
||||||
rec.offset.serialize (c, this);
|
rec.offset.serialize (c, this);
|
||||||
|
|
||||||
|
@ -159,7 +159,7 @@ typedef struct OffsetTable
|
||||||
c->align (4);
|
c->align (4);
|
||||||
const char *end = (const char *) c->head;
|
const char *end = (const char *) c->head;
|
||||||
|
|
||||||
if (tags[i] == HB_OT_TAG_head && end - start >= head::static_size)
|
if (items[i].tag == HB_OT_TAG_head && end - start >= head::static_size)
|
||||||
{
|
{
|
||||||
head *h = (head *) start;
|
head *h = (head *) start;
|
||||||
checksum_adjustment = &h->checkSumAdjustment;
|
checksum_adjustment = &h->checkSumAdjustment;
|
||||||
|
@ -168,8 +168,7 @@ typedef struct OffsetTable
|
||||||
|
|
||||||
rec.checkSum.set_for_data (start, end - start);
|
rec.checkSum.set_for_data (start, end - start);
|
||||||
}
|
}
|
||||||
tags += table_count;
|
items += table_count;
|
||||||
blobs += table_count;
|
|
||||||
|
|
||||||
tables.qsort ();
|
tables.qsort ();
|
||||||
|
|
||||||
|
@ -489,16 +488,16 @@ struct OpenTypeFontFile
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template <typename item_t>
|
||||||
bool serialize_single (hb_serialize_context_t *c,
|
bool serialize_single (hb_serialize_context_t *c,
|
||||||
hb_tag_t sfnt_tag,
|
hb_tag_t sfnt_tag,
|
||||||
Supplier<hb_tag_t> &tags,
|
Supplier<item_t> &items,
|
||||||
Supplier<hb_blob_t *> &blobs,
|
|
||||||
unsigned int table_count)
|
unsigned int table_count)
|
||||||
{
|
{
|
||||||
TRACE_SERIALIZE (this);
|
TRACE_SERIALIZE (this);
|
||||||
assert (sfnt_tag != TTCTag);
|
assert (sfnt_tag != TTCTag);
|
||||||
if (unlikely (!c->extend_min (*this))) return_trace (false);
|
if (unlikely (!c->extend_min (*this))) return_trace (false);
|
||||||
return_trace (u.fontFace.serialize (c, sfnt_tag, tags, blobs, table_count));
|
return_trace (u.fontFace.serialize (c, sfnt_tag, items, table_count));
|
||||||
}
|
}
|
||||||
|
|
||||||
bool sanitize (hb_sanitize_context_t *c) const
|
bool sanitize (hb_sanitize_context_t *c) const
|
||||||
|
|
|
@ -122,7 +122,7 @@ struct hb_vector_t
|
||||||
template <typename T> explicit_operator T * (void) { return arrayZ(); }
|
template <typename T> explicit_operator T * (void) { return arrayZ(); }
|
||||||
template <typename T> explicit_operator const T * (void) const { return arrayZ(); }
|
template <typename T> explicit_operator const T * (void) const { return arrayZ(); }
|
||||||
operator hb_array_t<Type> (void) { return as_array (); }
|
operator hb_array_t<Type> (void) { return as_array (); }
|
||||||
operator hb_array_t<const Type> (void) const { as_array (); }
|
operator hb_array_t<const Type> (void) const { return as_array (); }
|
||||||
|
|
||||||
Type * operator + (unsigned int i) { return arrayZ() + i; }
|
Type * operator + (unsigned int i) { return arrayZ() + i; }
|
||||||
const Type * operator + (unsigned int i) const { return arrayZ() + i; }
|
const Type * operator + (unsigned int i) const { return arrayZ() + i; }
|
||||||
|
|
Loading…
Reference in New Issue