I send array int Vetor[33];
by parameter for the function MontaVetorVerticalOtimizado(x, y, Vetor)
, inside this the array is filled, the problem is that after filling the array all the variables of the function OtimizaVerticalDentina()
are signed with the value of the array, it seems confusing, so I added images while debugging to make it more understandable:
First function:
void OtimizaVerticalDentina() {
int Vetor[33];
int x, y;
for (x = 1; x < NewImage.SizeX() - 1; x++)
{
for (y = 10; y < NewImage.SizeY() - 10; y++)
{
MontaVetorVerticalOtimizado(x, y, Vetor);
VerificaIntensidadeVetorVerticalOtimizado(Vetor);
if (bPreenche) {
NewImage.DrawPixel(x, y, 255, 255, 255);
} else {
NewImage.DrawPixel(x, y, 0, 0, 0);
bPreenche = true;
}
}
}
}
Second function:
void MontaVetorVerticalOtimizado(int Px, int Py, int Vetor[33])
{
int x, y;
int i = 0;
unsigned char r, g, b;
for(x = Px - 1; x <= Px + 1; x++)
{
for(y = Py - 10; y <= Py + 10; y++)
{
NewImage.ReadPixel(x, y, r, g, b);
Vetor[i] = r;
i++;
}
}
}
Note:
ImageClass NewImage; // global
Before filling the array variables are with their normal value
After populating the array the variables are with another value (the value that was added in the vector)
*I have created other variables in the first method to test and they have also changed, does anyone have any idea what might be happening?