Okay, if it can help someone, here is the reason and its solution.
Importing PNG from Photoshop make them automatically using AlphaPreMultiplied mode...
To convert an ARGB value to the good expected premultiplied values, here's the part of code to change :
after the line
int r,g,b,a;
add :
float multiplier;
Then change the content of the portion code running inside the "if" with this :
Code:
if (r==0 && g==0 && b==0 && a>0) {
multiplier = (float)a/255.0f;
pixels[index+0] = MAX(0,MIN(255,(int)(toRed*multiplier)));
pixels[index+1] = MAX(0,MIN(255,(int)(toGreen*multiplier)));
pixels[index+2] = MAX(0,MIN(255,(int)(toBlue*multiplier)));
}
So if you understand, the multiplier value is the alpha value divided by 255 (in float), then you must multiply your color with this value, and ensure it'll not goes beyond the limits (0-255).
Bests.
Laurent.