Hi Blauelf!
Thanks for your help!!!! You are right - when I have rewritten the code using if condition - it works but only visually. But when I proceed check50 it doesnt(
Now it looks like:
if (t<1) { int s=lroundf(1/t); // iterate over the rows in the scanline for (int i = 0; i < biHeight_old; i++) { //take only every s-th row if (i%s==0) { int counter =0; // iterate over pixel in scanline for (int j = 0; j < biWidth_old; j++) { // temporary storage RGBTRIPLE triple;
// read RGB triple from infile
fread(&triple, sizeof(RGBTRIPLE), 1, inptr);
//take only every s-th element
if (j%s==0)
{
// storing pixels in memory
buffer[counter] = triple;
counter++;
}
// skip over every not-s-th element in the row i
else
{
fseek(inptr, s-1, SEEK_CUR);
}
}
// skip over padding, if any
fseek(inptr, padding_old, SEEK_CUR);
// write new pixels to outfile
fwrite(buffer, sizeof(RGBTRIPLE), bi.biWidth, outptr);
// add padding to output
for (int k = 0; k < padding; k++)
{
fputc(0x00,outptr);
}
}
// skip over every not-s-th row
else
{
fseek(inptr, (s-1)*biWidth_old, SEEK_CUR);
}
}
}
Do you think that it is possible to make changes to this code in order to pass the check50 tests or just try totaly another way?