diff --git a/test.cpp b/test.cpp new file mode 100644 index 0000000..ef3dba0 --- /dev/null +++ b/test.cpp @@ -0,0 +1,9 @@ +#include +#include +using namespace std; + +int main(){ + int a = 9; + cout << floor(a/4) << endl; + return 0; +} \ No newline at end of file diff --git a/test.exe b/test.exe new file mode 100644 index 0000000..c47e78a Binary files /dev/null and b/test.exe differ diff --git a/zoom.cpp b/zoom.cpp index 9950cbe..efa3700 100644 --- a/zoom.cpp +++ b/zoom.cpp @@ -24,7 +24,8 @@ int main(int argc, char ** argv) pColorTableSize = 1024; unsigned char *pBmpBuf; - int lineByte = (width*biCount / 8 + 3) / 4 * 4; + int lineByte = width*floor(biCount/8); + while(lineByte % 4 != 0){lineByte += 1;} pBmpBuf = new unsigned char[lineByte*height]; fread(pBmpBuf, lineByte*height, 1, fp); fclose(fp); @@ -38,7 +39,8 @@ int main(int argc, char ** argv) scanf("%f", &k); int dstWidth = round(double(k*width)); int dstHeight = round(double(k*height)); - int lineByte2 = (dstWidth*biCount / 8 + 3) / 4 * 4; + int lineByte2 = dstWidth*floor(biCount/8); + while(lineByte2 % 4 != 0){lineByte2 += 1;} unsigned char*pBmpBuf2; pBmpBuf2 = new unsigned char[lineByte2*dstHeight]; diff --git a/zoom.exe b/zoom.exe index 12bbca9..f870574 100644 Binary files a/zoom.exe and b/zoom.exe differ