Refactoring of seamless cloning

This pull request brings several improvement to the seamless cloning routine in the photo module.

First, a number of unnecessary allocations have been removed, lowering the overall memory footprint of the methods.

Secondly, a number of method were re-written in order to improve the overall performances, resulting in a significant speed-up (at least x2)

Finally, a number of cosmetic improvements are brought in order to better comply with the coding guidelines.

Please note that this PR also contains the bug fix already proposed in PR #3283, but not merged yet.
it's also very slow. I suggest you to move `patchGradientX.ptr<float>(i)` outside the inner loop, e.g. it can be moved exactly after `for(int i=0;i < h; i++)`.

Example:
```
    for (int y = 0; y < rows; ++y)
        for (int x = 0; x < cols; ++x)
            mat.ptr<float>(y)[x] = ..;
```
But it's better:
```
    for (int y = 0; y < rows; ++y)
    {
        float * ptr = mat.ptr<float>(y);
        for (int x = 0; x < cols; ++x)
             ptr[x] = ..;
    }
```