graph.update_parents (); int limit = 10; for (constauto& o : overflows)
{ if (!limit--) break; constauto& parent = graph.vertices_[o.parent]; constauto& child = graph.vertices_[o.child];
DEBUG_MSG (SUBSET_REPACK, nullptr, " overflow from " "%4u (%4u in, %4u out, space %2u) => " "%4u (%4u in, %4u out, space %2u)",
o.parent,
parent.incoming_edges (),
parent.obj.real_links.length + parent.obj.virtual_links.length,
graph.space_for (o.parent),
o.child,
child.incoming_edges (),
child.obj.real_links.length + child.obj.virtual_links.length,
graph.space_for (o.child));
} if (overflows.length > 10) {
DEBUG_MSG (SUBSET_REPACK, nullptr, " ... plus %u more overflows.", overflows.length - 10);
}
}
template <typename O> inlinevoid
serialize_link_of_type (const hb_serialize_context_t::object_t::link_t& link, char* head,
hb_serialize_context_t* c)
{
OT::Offset<O>* offset = reinterpret_cast<OT::Offset<O>*> (head + link.position);
*offset = 0;
c->add_link (*offset, // serializer has an extra nil object at the start of the // object array. So all id's are +1 of what our id's are.
link.objidx + 1,
(hb_serialize_context_t::whence_t) link.whence,
link.bias);
}
inline void serialize_link (const hb_serialize_context_t::object_t::link_t& link, char* head,
hb_serialize_context_t* c)
{ switch (link.width)
{ case 0: // Virtual links aren't serialized. return; case 4: if (link.is_signed)
{
serialize_link_of_type<OT::HBINT32> (link, head, c);
} else {
serialize_link_of_type<OT::HBUINT32> (link, head, c);
} return; case 2: if (link.is_signed)
{
serialize_link_of_type<OT::HBINT16> (link, head, c);
} else {
serialize_link_of_type<OT::HBUINT16> (link, head, c);
} return; case 3:
serialize_link_of_type<OT::HBUINT24> (link, head, c); return; default: // Unexpected link width.
assert (0);
}
}
if (!buffer.alloc (size)) {
DEBUG_MSG (SUBSET_REPACK, nullptr, "Unable to allocate output buffer."); return nullptr;
}
hb_serialize_context_t c((void *) buffer, size);
c.start_serialize<void> (); constauto& vertices = graph.vertices_; for (unsigned i = 0; i < vertices.length; i++) {
c.push ();
size_t size = vertices[i].obj.tail - vertices[i].obj.head; char* start = c.allocate_size <char> (size); if (!start) {
DEBUG_MSG (SUBSET_REPACK, nullptr, "Buffer out of space."); return nullptr;
}
hb_memcpy (start, vertices[i].obj.head, size);
// Only real links needs to be serialized. for (constauto& link : vertices[i].obj.real_links)
serialize_link (link, start, &c);
// All duplications are already encoded in the graph, so don't // enable sharing during packing.
c.pop_pack (false);
}
c.end_serialize ();
if (c.in_error ()) {
DEBUG_MSG (SUBSET_REPACK, nullptr, "Error during serialization. Err flag: %d",
c.errors); return nullptr;
}
return c.copy_blob ();
}
} // namespace graph
#endif// GRAPH_SERIALIZE_HH
Messung V0.5
¤ Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.0.12Bemerkung:
(vorverarbeitet)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.