So, I'm in the midst of PS4 resize, and while I know I'm still figuring out an array of different things, when i currently perform the resize (even if I "resize" it to the same size) it seems to be picking and assigning RANDOM colors to the output file.
This is what it does to "smiley.bmp". I just don't get where it would be pulling these colors FROM.
// iterate over infile's scanlines
for (int i = 0, biHeight = abs(bi.biHeight); i < biHeight; i++)
{
// iterate over multipled rows in new file
for (int j = (i * n); j < ((i * n) + n); j++)
{
//GO BACK TO BEGINNING OF SCANLINE
fseek(inptr, (i * bi.biWidth), SEEK_SET);
// iterate over pixels in scanline
for (int p = 0; p < bi.biWidth; p++)
{
// temporary storage
RGBTRIPLE triple;
// read RGB triple from infile
fread(&triple, sizeof(RGBTRIPLE), 1, inptr);
// write RGB triple to outfile
for (int w = (p * n); w < ((p * n) + n); w++)
{
fwrite(&triple, sizeof(RGBTRIPLE), 1, outptr);
}
}
// skip over padding, if any
fseek(inptr, padding, SEEK_CUR);
// then add it back (to demonstrate how)
for (int k = 0; k < padding; k++)
{
fputc(0x00, outptr);
}
}
for (int j = (i * n); j < ((i * n) + n); j++)
Isn't this the same as sayingfor (int j = 0 ; j < n ; j++)
? Since j is only used for the loop index, nothing else depends on it.(i*n)
complexity. counting from(i * n)
to(i * n) +n
is the same as counting from 0 to n. Unless there is a dependency within the loop for j starting at i*n, then there's no apparent purpose. There's an old saying in programming - keep it simple.