summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authordon bright <hugh.m.bright@gmail.com>2013-01-26 21:43:06 (GMT)
committerdon bright <hugh.m.bright@gmail.com>2013-01-26 21:43:06 (GMT)
commitfc72c861859feec3f0cf365392cfc60550a4c45a (patch)
tree455a0a0958c141a35bb45e35b43664c6a23a5d18 /src
parentd4c15a8fc428b88b52eb1e5c180999725e1cfb2b (diff)
windows needs binary-mode set for exporting png
Diffstat (limited to 'src')
-rw-r--r--src/OffscreenContext.h1
-rw-r--r--src/OffscreenContextAll.hpp6
-rw-r--r--src/OffscreenContextCGL.mm2
-rw-r--r--src/OffscreenContextGLX.cc1
-rw-r--r--src/imageutils-macosx.cc1
-rw-r--r--src/imageutils.cc2
-rw-r--r--src/openscad.cc2
7 files changed, 7 insertions, 8 deletions
diff --git a/src/OffscreenContext.h b/src/OffscreenContext.h
index 0c700b6..3fd8921 100644
--- a/src/OffscreenContext.h
+++ b/src/OffscreenContext.h
@@ -5,7 +5,6 @@
// Objective-C with C++, it is a bit different than what's found in a textbook.
#include <iostream>
-#include <fstream>
#include <string>
#include "fbo.h"
diff --git a/src/OffscreenContextAll.hpp b/src/OffscreenContextAll.hpp
index 1c73b73..b0df83d 100644
--- a/src/OffscreenContextAll.hpp
+++ b/src/OffscreenContextAll.hpp
@@ -1,5 +1,5 @@
-// Functions shared by OffscreenContext[platform].cc (or .mm)
-// #include directly after definition of struct OffscreenContext.
+// Functions shared by OffscreenContext[platform].cc
+// #include this directly after definition of struct OffscreenContext.
void bind_offscreen_context(OffscreenContext *ctx)
{
@@ -11,7 +11,7 @@ void bind_offscreen_context(OffscreenContext *ctx)
*/
bool save_framebuffer(OffscreenContext *ctx, const char *filename)
{
- std::ofstream fstream(filename);
+ std::ofstream fstream(filename,std::ios::out|std::ios::binary);
if (!fstream.is_open()) {
std::cerr << "Can't open file " << filename << " for writing";
return false;
diff --git a/src/OffscreenContextCGL.mm b/src/OffscreenContextCGL.mm
index c6d76ab..ab3cc1b 100644
--- a/src/OffscreenContextCGL.mm
+++ b/src/OffscreenContextCGL.mm
@@ -113,7 +113,7 @@ bool teardown_offscreen_context(OffscreenContext *ctx)
*/
bool save_framebuffer(OffscreenContext *ctx, const char *filename)
{
- std::ofstream fstream(filename);
+ std::ofstream fstream(filename,std::ios::out|std::ios::binary);
if (!fstream.is_open()) {
PRINTB("Can't open file \"%s\" for writing", filename);
return false;
diff --git a/src/OffscreenContextGLX.cc b/src/OffscreenContextGLX.cc
index ef26ce7..84bcf0e 100644
--- a/src/OffscreenContextGLX.cc
+++ b/src/OffscreenContextGLX.cc
@@ -45,7 +45,6 @@ See Also
#include <GL/glx.h>
#include <assert.h>
-#include <fstream>
#include <sstream>
#include <sys/utsname.h> // for uname
diff --git a/src/imageutils-macosx.cc b/src/imageutils-macosx.cc
index 5236b76..2fcdb93 100644
--- a/src/imageutils-macosx.cc
+++ b/src/imageutils-macosx.cc
@@ -1,6 +1,7 @@
#include <ApplicationServices/ApplicationServices.h>
#include <CGDataConsumer.h>
#include "imageutils.h"
+#include <assert.h>
CGDataConsumerCallbacks dc_callbacks;
diff --git a/src/imageutils.cc b/src/imageutils.cc
index eaab3b7..133eaf1 100644
--- a/src/imageutils.cc
+++ b/src/imageutils.cc
@@ -11,7 +11,7 @@ void flip_image(const unsigned char *src, unsigned char *dst, size_t pixelsize,
}
bool write_png(const char *filename, unsigned char *pixels, int width, int height) {
- std::ofstream fstream( filename );
+ std::ofstream fstream( filename, std::ios::binary );
if (fstream.is_open()) {
write_png( fstream, pixels, width, height );
fstream.close();
diff --git a/src/openscad.cc b/src/openscad.cc
index f796136..0770558 100644
--- a/src/openscad.cc
+++ b/src/openscad.cc
@@ -386,7 +386,7 @@ int main(int argc, char **argv)
}
if (png_output_file) {
- std::ofstream fstream(png_output_file);
+ std::ofstream fstream(png_output_file,std::ios::out|std::ios::binary);
if (!fstream.is_open()) {
PRINTB("Can't open file \"%s\" for export", png_output_file);
}
contact: Jan Huwald // Impressum