Implement floodFill in C++, probably better performance