diff --git a/source/src/jpegenc.h b/source/src/jpegenc.h index eb5e4ed3..dbf881ba 100644 --- a/source/src/jpegenc.h +++ b/source/src/jpegenc.h @@ -832,9 +832,6 @@ int jpegenc::encode(const char *filename, colorRGB *pixels, int iw, int ih, int fp_jpeg_stream = fopen(filename,"wb"); if(!fp_jpeg_stream) { - //free(RGB_buffer); - free(category_alloc); - free(bitcode_alloc); return -1; } diff --git a/source/src/main.cpp b/source/src/main.cpp index 680c140e..2978b3b3 100644 --- a/source/src/main.cpp +++ b/source/src/main.cpp @@ -192,6 +192,11 @@ void bmp_screenshot(const char *imagepath, bool mapshot = false) conoutf("no mapshot prepared!"); return; } + loopi(th) + { + memcpy(dst, &tmp[3*tw*i], 3*tw); + dst += image->pitch; + } } else { @@ -204,11 +209,11 @@ void bmp_screenshot(const char *imagepath, bool mapshot = false) delete[] buf; } else glReadPixels(0, 0, tw, th, GL_RGB, GL_UNSIGNED_BYTE, tmp); - } - loopi(th) - { - memcpy(dst, &tmp[3*tw*(th-i-1)], 3*tw); - dst += image->pitch; + loopi(th) + { + memcpy(dst, &tmp[3*tw*(th-i-1)], 3*tw); + dst += image->pitch; + } } entropy_add_block(tmp, tmpsize); delete[] tmp; @@ -420,6 +425,11 @@ void png_screenshot(const char *imagepath, bool mapshot = false) conoutf("no mapshot prepared!"); return; } + loopi(th) + { + memcpy(dst, &tmp[3*tw*i], 3*tw); + dst += image->pitch; + } } else { @@ -432,11 +442,11 @@ void png_screenshot(const char *imagepath, bool mapshot = false) delete[] buf; } else glReadPixels(0, 0, tw, th, GL_RGB, GL_UNSIGNED_BYTE, tmp); - } - loopi(th) - { - memcpy(dst, &tmp[3*tw*(th-i-1)], 3*tw); - dst += image->pitch; + loopi(th) + { + memcpy(dst, &tmp[3*tw*(th-i-1)], 3*tw); + dst += image->pitch; + } } entropy_add_block(tmp, tmpsize); delete[] tmp; @@ -475,7 +485,7 @@ COMMAND(screenshot, "s"); void mapshot() { - defformatstring(buf)("screenshots/mapshot_%s_%s%s", behindpath(getclientmap()), timestring(), getscrext()); + defformatstring(buf)("screenshots" PATHDIVS "mapshot_%s_%s%s", behindpath(getclientmap()), timestring(), getscrext()); switch(screenshottype) { case 2: png_screenshot(buf,true); break;