Limit maximum number of IVs on a shape
Create SHAPE_MAX_NUM_IVS (currently 50) and limit all shapes to that number of IVs. When a shape has more than 50 IVs, fallback to the obj_too_complex shape which uses hash lookup for ivs.
This commit is contained in:
parent
5e1e5af2e7
commit
78fcc9847a
Notes:
git
2023-01-25 19:48:47 +00:00
2
shape.c
2
shape.c
@ -139,7 +139,7 @@ get_next_shape_internal(rb_shape_t * shape, ID id, enum shape_type shape_type, b
|
|||||||
|
|
||||||
*variation_created = false;
|
*variation_created = false;
|
||||||
|
|
||||||
if (new_shapes_allowed) {
|
if (new_shapes_allowed && shape->next_iv_index < SHAPE_MAX_NUM_IVS) {
|
||||||
RB_VM_LOCK_ENTER();
|
RB_VM_LOCK_ENTER();
|
||||||
{
|
{
|
||||||
bool had_edges = !!shape->edges;
|
bool had_edges = !!shape->edges;
|
||||||
|
1
shape.h
1
shape.h
@ -31,6 +31,7 @@ typedef uint16_t shape_id_t;
|
|||||||
# define SHAPE_BITMAP_SIZE 16384
|
# define SHAPE_BITMAP_SIZE 16384
|
||||||
|
|
||||||
# define SHAPE_MAX_VARIATIONS 8
|
# define SHAPE_MAX_VARIATIONS 8
|
||||||
|
# define SHAPE_MAX_NUM_IVS 50
|
||||||
|
|
||||||
# define MAX_SHAPE_ID (SHAPE_MASK - 1)
|
# define MAX_SHAPE_ID (SHAPE_MASK - 1)
|
||||||
# define INVALID_SHAPE_ID SHAPE_MASK
|
# define INVALID_SHAPE_ID SHAPE_MASK
|
||||||
|
Loading…
x
Reference in New Issue
Block a user