Painting texture based on alpha issue

The bit that’s showing works fine:

What’s the problem?