diff options
author | don bright <hugh.m.bright@gmail.com> | 2013-01-26 22:18:31 (GMT) |
---|---|---|
committer | don bright <hugh.m.bright@gmail.com> | 2013-01-26 22:19:14 (GMT) |
commit | f17a282220903d7bb494deae046d3e786ef6b1ca (patch) | |
tree | d27af52db52fec9c931caf049cfd212ce576e620 /src/imageutils-lodepng.cc | |
parent | c133ae3b7d7f780d440b74dabe36cff355d9e30c (diff) |
cleanups. and restore accidentally deleted old system-gl.h
Diffstat (limited to 'src/imageutils-lodepng.cc')
-rw-r--r-- | src/imageutils-lodepng.cc | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/imageutils-lodepng.cc b/src/imageutils-lodepng.cc index fab1cd9..a034702 100644 --- a/src/imageutils-lodepng.cc +++ b/src/imageutils-lodepng.cc @@ -8,17 +8,19 @@ bool write_png(std::ostream &output, unsigned char *pixels, int width, int heigh //encoder.settings.zlibsettings.windowSize = 2048; //LodePNG_Text_add(&encoder.infoPng.text, "Comment", "Created with LodePNG"); size_t dataout_size = -1; + bool result = false; unsigned char *dataout = (unsigned char *)malloc(width*height*4); if (!dataout) { perror("Error allocating memory while writing png\n"); - return false; + return result; } LodePNG_encode(&dataout, &dataout_size, pixels, width, height, LCT_RGBA, 8); try { output.write( reinterpret_cast<const char*>(dataout), dataout_size ); + result = true; } catch (const std::ios_base::failure &e) { std::cerr << "Error writing to ostream:" << e.what() << "\n"; } free( dataout ); - return true; + return result; } |