comparison 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
comparison
equal deleted inserted replaced
862:5a125d587810 863:3c0d0836f704
34 34
35 #include "ImageAccessor.h" 35 #include "ImageAccessor.h"
36 36
37 #include <vector> 37 #include <vector>
38 #include <stdint.h> 38 #include <stdint.h>
39 #include <boost/noncopyable.hpp>
39 40
40 namespace Orthanc 41 namespace Orthanc
41 { 42 {
42 class ImageBuffer 43 class ImageBuffer : public boost::noncopyable
43 { 44 {
44 private: 45 private:
45 bool changed_; 46 bool changed_;
46 std::vector<uint8_t> data_;
47 47
48 bool forceMinimalPitch_; // Currently unused 48 bool forceMinimalPitch_; // Currently unused
49 PixelFormat format_; 49 PixelFormat format_;
50 unsigned int width_; 50 unsigned int width_;
51 unsigned int height_; 51 unsigned int height_;
52 unsigned int pitch_; 52 unsigned int pitch_;
53 uint8_t *buffer_; 53 void *buffer_;
54 54
55 void Initialize(); 55 void Initialize();
56 56
57 void Allocate(); 57 void Allocate();
58
59 void Deallocate();
58 60
59 public: 61 public:
60 ImageBuffer(unsigned int width, 62 ImageBuffer(unsigned int width,
61 unsigned int height, 63 unsigned int height,
62 PixelFormat format); 64 PixelFormat format);
63 65
64 ImageBuffer() 66 ImageBuffer()
65 { 67 {
66 Initialize(); 68 Initialize();
69 }
70
71 ~ImageBuffer()
72 {
73 Deallocate();
67 } 74 }
68 75
69 PixelFormat GetFormat() const 76 PixelFormat GetFormat() const
70 { 77 {
71 return format_; 78 return format_;
100 { 107 {
101 return forceMinimalPitch_; 108 return forceMinimalPitch_;
102 } 109 }
103 110
104 void SetMinimalPitchForced(bool force); 111 void SetMinimalPitchForced(bool force);
112
113 void AcquireOwnership(ImageBuffer& other);
105 }; 114 };
106 } 115 }