[colr] Simplify sanitize

This commit is contained in:
Behdad Esfahbod 2021-11-10 10:15:38 -08:00
parent 64b29dbd59
commit 82a9f54410
1 changed files with 2 additions and 36 deletions

View File

@ -1067,45 +1067,11 @@ struct Paint
bool sanitize (hb_sanitize_context_t *c, Ts&&... ds) const bool sanitize (hb_sanitize_context_t *c, Ts&&... ds) const
{ {
TRACE_SANITIZE (this); TRACE_SANITIZE (this);
if (unlikely (!c->may_dispatch (this, &u.format))) return_trace (c->no_dispatch_return_value ());
if (unlikely (!c->check_start_recursion (HB_COLRV1_MAX_NESTING_LEVEL))) if (unlikely (!c->check_start_recursion (HB_COLRV1_MAX_NESTING_LEVEL)))
return_trace (c->no_dispatch_return_value ()); return_trace (c->no_dispatch_return_value ());
switch (u.format) { return_trace (c->end_recursion (this->dispatch (c, std::forward<Ts> (ds)...)));
case 1: return_trace (c->end_recursion (c->dispatch (u.paintformat1, std::forward<Ts> (ds)...)));
case 2: return_trace (c->end_recursion (c->dispatch (u.paintformat2, std::forward<Ts> (ds)...)));
case 3: return_trace (c->end_recursion (c->dispatch (u.paintformat3, std::forward<Ts> (ds)...)));
case 4: return_trace (c->end_recursion (c->dispatch (u.paintformat4, std::forward<Ts> (ds)...)));
case 5: return_trace (c->end_recursion (c->dispatch (u.paintformat5, std::forward<Ts> (ds)...)));
case 6: return_trace (c->end_recursion (c->dispatch (u.paintformat6, std::forward<Ts> (ds)...)));
case 7: return_trace (c->end_recursion (c->dispatch (u.paintformat7, std::forward<Ts> (ds)...)));
case 8: return_trace (c->end_recursion (c->dispatch (u.paintformat8, std::forward<Ts> (ds)...)));
case 9: return_trace (c->end_recursion (c->dispatch (u.paintformat9, std::forward<Ts> (ds)...)));
case 10: return_trace (c->end_recursion (c->dispatch (u.paintformat10, std::forward<Ts> (ds)...)));
case 11: return_trace (c->end_recursion (c->dispatch (u.paintformat11, std::forward<Ts> (ds)...)));
case 12: return_trace (c->end_recursion (c->dispatch (u.paintformat12, std::forward<Ts> (ds)...)));
case 13: return_trace (c->end_recursion (c->dispatch (u.paintformat13, std::forward<Ts> (ds)...)));
case 14: return_trace (c->end_recursion (c->dispatch (u.paintformat14, std::forward<Ts> (ds)...)));
case 15: return_trace (c->end_recursion (c->dispatch (u.paintformat15, std::forward<Ts> (ds)...)));
case 16: return_trace (c->end_recursion (c->dispatch (u.paintformat16, std::forward<Ts> (ds)...)));
case 17: return_trace (c->end_recursion (c->dispatch (u.paintformat17, std::forward<Ts> (ds)...)));
case 18: return_trace (c->end_recursion (c->dispatch (u.paintformat18, std::forward<Ts> (ds)...)));
case 19: return_trace (c->end_recursion (c->dispatch (u.paintformat19, std::forward<Ts> (ds)...)));
case 20: return_trace (c->end_recursion (c->dispatch (u.paintformat20, std::forward<Ts> (ds)...)));
case 21: return_trace (c->end_recursion (c->dispatch (u.paintformat21, std::forward<Ts> (ds)...)));
case 22: return_trace (c->end_recursion (c->dispatch (u.paintformat22, std::forward<Ts> (ds)...)));
case 23: return_trace (c->end_recursion (c->dispatch (u.paintformat23, std::forward<Ts> (ds)...)));
case 24: return_trace (c->end_recursion (c->dispatch (u.paintformat24, std::forward<Ts> (ds)...)));
case 25: return_trace (c->end_recursion (c->dispatch (u.paintformat25, std::forward<Ts> (ds)...)));
case 26: return_trace (c->end_recursion (c->dispatch (u.paintformat26, std::forward<Ts> (ds)...)));
case 27: return_trace (c->end_recursion (c->dispatch (u.paintformat27, std::forward<Ts> (ds)...)));
case 28: return_trace (c->end_recursion (c->dispatch (u.paintformat28, std::forward<Ts> (ds)...)));
case 29: return_trace (c->end_recursion (c->dispatch (u.paintformat29, std::forward<Ts> (ds)...)));
case 30: return_trace (c->end_recursion (c->dispatch (u.paintformat30, std::forward<Ts> (ds)...)));
case 31: return_trace (c->end_recursion (c->dispatch (u.paintformat31, std::forward<Ts> (ds)...)));
case 32: return_trace (c->end_recursion (c->dispatch (u.paintformat32, std::forward<Ts> (ds)...)));
default:return_trace (c->end_recursion (c->default_return_value ()));
}
} }
template <typename context_t, typename ...Ts> template <typename context_t, typename ...Ts>