When painting a mask is generated that only changes when some parameters
changes. Currently this mask was recreated every time the cache was
updated.
This patch checks if the mask should be regenerated. Although this was
marked in the comment I am not 100% confident that the comment is
accurate. So when testing please take into account that there might have
been a reason why the mask was recreated.
Found when doing some performance analysis.
{F11796495}
Looking at the code some brush settings also changes the mask. We should add these as well:
* Brush number of aa samples
* Brush curve.
##TODO
* Check other settings
* Cache previous used settings and check against them