The rule I use.... if the creator made it first then paint it first. Background sky, grass etc, then the objects added later trees, people, flowers, animals etc. You then have little to worry about like painting a background up to the edge of an object.