comparison Core/ImageFormats/ImageAccessor.cpp @ 860:80c7e53a69b5 jpeg

bugfix
author Sebastien Jodogne <s.jodogne@gmail.com>
date Sat, 07 Jun 2014 10:32:15 +0200
parents a811bdf8b8eb
children a546b05a43da
comparison
equal deleted inserted replaced
859:610a9a1ed855 860:80c7e53a69b5
34 #include "ImageAccessor.h" 34 #include "ImageAccessor.h"
35 35
36 #include "../OrthancException.h" 36 #include "../OrthancException.h"
37 37
38 #include <stdint.h> 38 #include <stdint.h>
39 #include <cassert>
39 40
40 namespace Orthanc 41 namespace Orthanc
41 { 42 {
42 void* ImageAccessor::GetBuffer() const 43 void* ImageAccessor::GetBuffer() const
43 { 44 {
102 format_ = format; 103 format_ = format;
103 width_ = width; 104 width_ = width;
104 height_ = height; 105 height_ = height;
105 pitch_ = pitch; 106 pitch_ = pitch;
106 buffer_ = const_cast<void*>(buffer); 107 buffer_ = const_cast<void*>(buffer);
108
109 assert(GetBytesPerPixel(format_) * width_ <= pitch_);
107 } 110 }
108 111
109 112
110 void ImageAccessor::AssignWritable(PixelFormat format, 113 void ImageAccessor::AssignWritable(PixelFormat format,
111 unsigned int width, 114 unsigned int width,
117 format_ = format; 120 format_ = format;
118 width_ = width; 121 width_ = width;
119 height_ = height; 122 height_ = height;
120 pitch_ = pitch; 123 pitch_ = pitch;
121 buffer_ = buffer; 124 buffer_ = buffer;
125
126 assert(GetBytesPerPixel(format_) * width_ <= pitch_);
122 } 127 }
123 } 128 }