Bug 704154: Fix OSS-Fuzz found leak in fz_paint_shade.
Bug 704154: Fix OSS-Fuzz found leak in fz_paint_shade.

The cache used for painting shades has 2 parts. Depending on the
nature of the shade given, we may or may not use either part of
the cache.

For each part, if we have the correct prerequestites, then we check
to see if we 'hit' the cache. If we do, we pull stuff out and use it.
If we 'miss' it, then we throw away the stuff in the cache in the
knowledge that we will refill it with the current stuff in a minute.
Then in the always case we refill it.

Unfortunately, the 'refill' code was then filling the cache even
in some situations when it hadn't been emptied (because the
prerequestites for emptying it were not reflected in the refilling
it case).

This resulted in valid cache entries being overwritten repeatedly
meaning that the reference counting went wrong.

The fix, implemented here, is to keep track of whether we should
refill or not based upon whether we emptied.

ccxvii/mupdf,ArtifexSoftware/mupdf,ArtifexSoftware/mupdf,ccxvii/mupdf,TamirEvan/mupdf,ArtifexSoftware/mupdf,ccxvii/mupdf,ArtifexSoftware/mupdf,ArtifexSoftware/mupdf,TamirEvan/mupdf,ccxvii/mupdf,TamirEvan/mupdf,TamirEvan/mupdf,ArtifexSoftware/mupdf,ArtifexSoftware/mupdf,TamirEvan/mupdf,TamirEvan/mupdf,TamirEvan/mupdf,ccxvii/mupdf,TamirEvan/mupdf,ArtifexSoftware/mupdf,ccxvii/mupdf