]> git.cworth.org Git - apitrace/blobdiff - image/image_pnm.cpp
image: Yet another fix for the PFM dumping.
[apitrace] / image / image_pnm.cpp
index 79db1c6e78249e945b9b5a6c2f45fb89b3dc7788..0473ac64025150269beac1001718518ba9867d86 100644 (file)
@@ -99,7 +99,7 @@ Image::writePNM(std::ostream &os, const char *comment) const
          * Need to add/remove channels, one pixel at a time.
          */
 
-        unsigned char *tmp = new unsigned char[width*bytesPerPixel];
+        unsigned char *tmp = new unsigned char[width*outChannels*bytesPerChannel];
 
         if (channelType == TYPE_UNORM8) {
             /*
@@ -174,7 +174,7 @@ Image::writePNM(std::ostream &os, const char *comment) const
                         *dst++ = 0;
                     }
                 }
-                os.write((const char *)tmp, width*bytesPerPixel);
+                os.write((const char *)tmp, width*outChannels*bytesPerChannel);
             }
         }