]> git.cworth.org Git - apitrace/blobdiff - glsnapshot.cpp
Add new "apitrace diff-state" command
[apitrace] / glsnapshot.cpp
index f06818b5a61ad5d6abb704eddc43cb306243ee4d..97bf77e8bf635057cd18ff4855c5dda33a97939d 100644 (file)
@@ -27,6 +27,7 @@
 #include <assert.h>
 #include <stdint.h>
 
+#include "os_path.hpp"
 #include "image.hpp"
 #include "glproc.hpp"
 #include "glsize.hpp"
@@ -63,7 +64,7 @@ namespace glsnapshot {
 /**
  * Get the contents of the current drawable into an image.
  */
-static Image::Image *
+static image::Image *
 getDrawableImage(void) {
 #if defined(_WIN32)
 
@@ -133,7 +134,7 @@ getDrawableImage(void) {
         return NULL;
     }
 
-    Image::Image *image = NULL;
+    image::Image *image = NULL;
 
     if (ximage->depth          == 24 &&
         ximage->bits_per_pixel == 32 &&
@@ -141,7 +142,7 @@ getDrawableImage(void) {
         ximage->green_mask     == 0x0000ff00 &&
         ximage->blue_mask      == 0x000000ff) {
 
-        image = new Image::Image(w, h, 4);
+        image = new image::Image(w, h, 4);
 
         if (image) {
             const uint32_t *src = (const uint32_t *)ximage->data;
@@ -160,7 +161,7 @@ getDrawableImage(void) {
             }
         }
     } else {
-        OS::DebugMessage("apitrace: unexpected XImage: "
+        os::log("apitrace: unexpected XImage: "
                          "bits_per_pixel = %i, "
                          "depth = %i, "
                          "red_mask = 0x%08lx, "
@@ -203,12 +204,11 @@ void snapshot(unsigned call_no) {
     ++frame_no;
 
     if (snapshot_prefix) {
-        Image::Image *src = getDrawableImage();
+        image::Image *src = getDrawableImage();
         if (src) {
-            char filename[PATH_MAX];
-            snprintf(filename, sizeof filename, "%s%010u.png", snapshot_prefix, call_no);
+            os::Path filename = os::Path::format("%s%010u.png", snapshot_prefix, call_no);
             if (src->writePNG(filename)) {
-                OS::DebugMessage("apitrace: wrote %s\n", filename);
+                os::log("apitrace: wrote %s\n", filename.str());
             }
 
             delete src;