diff Core/ImageFormats/ImageBuffer.h @ 863:3c0d0836f704 jpeg

refactoring
author Sebastien Jodogne <s.jodogne@gmail.com>
date Tue, 10 Jun 2014 17:20:33 +0200
parents 839be3022203
children 6e7e5ed91c2d
line wrap: on
line diff
--- a/Core/ImageFormats/ImageBuffer.h	Sat Jun 07 10:51:28 2014 +0200
+++ b/Core/ImageFormats/ImageBuffer.h	Tue Jun 10 17:20:33 2014 +0200
@@ -36,26 +36,28 @@
 
 #include <vector>
 #include <stdint.h>
+#include <boost/noncopyable.hpp>
 
 namespace Orthanc
 {
-  class ImageBuffer
+  class ImageBuffer : public boost::noncopyable
   {
   private:
     bool changed_;
-    std::vector<uint8_t> data_;
 
     bool forceMinimalPitch_;  // Currently unused
     PixelFormat format_;
     unsigned int width_;
     unsigned int height_;
     unsigned int pitch_;
-    uint8_t *buffer_;
+    void *buffer_;
 
     void Initialize();
     
     void Allocate();
 
+    void Deallocate();
+
   public:
     ImageBuffer(unsigned int width,
                 unsigned int height,
@@ -66,6 +68,11 @@
       Initialize();
     }
 
+    ~ImageBuffer()
+    {
+      Deallocate();
+    }
+
     PixelFormat GetFormat() const
     {
       return format_;
@@ -102,5 +109,7 @@
     }
 
     void SetMinimalPitchForced(bool force);
+
+    void AcquireOwnership(ImageBuffer& other);
   };
 }