Fix #35317: crash with boolean modifier using an object whose library linked
mesh datablock went missing.

git-svn-id: https://svn.blender.org/svnroot/bf-blender/trunk/blender@56698 954f8c5b-7b00-dc11-b283-0030488c597c
Image paint: 2D painting now supports texture masks and does masking more
consistent with projection painting.

Also did some refactoring of this code, moving the brush image creation code
out of brush.c and making it consistent with image updating code.

git-svn-id: https://svn.blender.org/svnroot/bf-blender/trunk/blender@56699 954f8c5b-7b00-dc11-b283-0030488c597c