diff options
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/OffscreenContext.mm | 15 | ||||
| -rw-r--r-- | tests/opencsgtest.cc | 6 | 
2 files changed, 14 insertions, 7 deletions
| diff --git a/tests/OffscreenContext.mm b/tests/OffscreenContext.mm index c8d0df7..9a6a5e2 100644 --- a/tests/OffscreenContext.mm +++ b/tests/OffscreenContext.mm @@ -166,14 +166,16 @@ bool save_framebuffer(OffscreenContext *ctx, const char *filename)      std::cerr << "Unable to create file URL ref.";      return false;    } +  CGDataConsumerRef dataconsumer = CGDataConsumerCreateWithURL(fileURL); +    CFIndex                 fileImageIndex = 1;    CFMutableDictionaryRef  fileDict       = NULL; -  CFStringRef             fileUTType     = kUTTypeJPEG; +  CFStringRef             fileUTType     = kUTTypePNG;    // Create an image destination opaque reference for authoring an image file -  CGImageDestinationRef imageDest = CGImageDestinationCreateWithURL(fileURL,  -                                                                    fileUTType,  -                                                                    fileImageIndex,  -                                                                    fileDict); +  CGImageDestinationRef imageDest = CGImageDestinationCreateWithDataConsumer(dataconsumer, +                                                                             fileUTType,  +                                                                             fileImageIndex,  +                                                                             fileDict);    if (!imageDest) {      std::cerr <<  "Unable to create CGImageDestinationRef.";      return false; @@ -190,10 +192,11 @@ bool save_framebuffer(OffscreenContext *ctx, const char *filename)    free(flippedBuffer);    free(bufferData);    CFRelease(imageDest); +  CFRelease(dataconsumer);    CFRelease(fileURL);    CFRelease(fname);    CFRelease(imageProps); -  CGColorSpaceRelease( colorSpace ); +  CGColorSpaceRelease(colorSpace);    CGImageRelease(imageRef);    return true;  } diff --git a/tests/opencsgtest.cc b/tests/opencsgtest.cc index 7da15e8..30a5ffc 100644 --- a/tests/opencsgtest.cc +++ b/tests/opencsgtest.cc @@ -30,6 +30,8 @@ QString librarydir;  QSet<QString> dependencies;  const char *make_command = NULL; +//#define DEBUG +  void handle_dep(QString filename)  {  	if (filename.startsWith("/")) @@ -211,6 +213,7 @@ int main(int argc, char *argv[])  	csgInfo.glview = new OffscreenView(512,512);  	glewInit(); +#ifdef DEBUG  	cout << "GLEW version " << glewGetString(GLEW_VERSION) << "\n";  	cout << (const char *)glGetString(GL_RENDERER) << "(" << (const char *)glGetString(GL_VENDOR) << ")\n"  			 << "OpenGL version " << (const char *)glGetString(GL_VERSION) << "\n"; @@ -226,6 +229,7 @@ int main(int argc, char *argv[])  	if (GLEW_EXT_packed_depth_stencil) {  		cout << "EXT_packed_depth_stencil\n";  	} +#endif  	OpenCSGRenderer opencsgRenderer(csgInfo.root_chain, csgInfo.highlights_chain, csgInfo.background_chain, csgInfo.glview->shaderinfo);  	ThrownTogetherRenderer thrownTogetherRenderer(csgInfo.root_chain, csgInfo.highlights_chain, csgInfo.background_chain); @@ -234,7 +238,7 @@ int main(int argc, char *argv[])  	csgInfo.glview->paintGL(); -	csgInfo.glview->save("out.png"); +	csgInfo.glview->save("/dev/stdout");  	destroy_builtin_functions();  	destroy_builtin_modules(); | 
