summaryrefslogtreecommitdiff
path: root/base/gsequivc.c
diff options
context:
space:
mode:
authorRobin Watts <Robin.Watts@artifex.com>2022-04-06 18:47:08 +0100
committerRobin Watts <Robin.Watts@artifex.com>2022-04-07 18:25:04 +0100
commitb7b40987730375a571f817ffb75db663734753f3 (patch)
tree9f1578a923eb226019dba1e197c10a7fd397df5d /base/gsequivc.c
parentdb5f053a2838f6fdb69b387e0f8ef70daca59a96 (diff)
downloadghostpdl-b7b40987730375a571f817ffb75db663734753f3.tar.gz
Update pattern cache to cope with hash collision for 2 'locked' tiles.
Currently, the pattern cache has a table of possible entries, 'num_entries' in size. For any given pattern A, it will go into the tile[A.id % num_entries]. This works fine while we're only ever using 1 pattern at a time. If 2 patterns collide, then the first is just evicted. Sadly, with fill_strokes using patterns, we can now need 2 at a time. To ensure that pattern A is not evicted to keep the pattern cache small enough when pattern N is introduced, we allow pattern A to be locked. At worst we'll have 2 locked patterns at once, and we'll only ever insert a new pattern while 1 pattern there might be locked. This works fine, until we have A.id and B.id both mapping to the same place in the table. With the current code there is no way for both A and B to live in the table at the same time. We therefore tweak the pattern cache so that A can go into 2 places in the cache. Either at tile[A.id % num_entries] or tile[(A.id+1) % num_entries]. We provide a helper function to lookup an appropriate location for A tile, allowing for whether an existing tile is locked or not, and use that.
Diffstat (limited to 'base/gsequivc.c')
0 files changed, 0 insertions, 0 deletions