Mercurial > hg > orthanc
comparison Core/Images/ImageAccessor.cpp @ 1916:5bcf721bde4f
IImageWriter
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Tue, 09 Feb 2016 15:26:37 +0100 |
parents | b1291df2f780 |
children | 369897749653 |
comparison
equal
deleted
inserted
replaced
1915:7454019be8f3 | 1916:5bcf721bde4f |
---|---|
174 width_ = width; | 174 width_ = width; |
175 height_ = height; | 175 height_ = height; |
176 pitch_ = pitch; | 176 pitch_ = pitch; |
177 buffer_ = const_cast<void*>(buffer); | 177 buffer_ = const_cast<void*>(buffer); |
178 | 178 |
179 assert(GetBytesPerPixel() * width_ <= pitch_); | 179 if (GetBytesPerPixel() * width_ > pitch_) |
180 { | |
181 throw OrthancException(ErrorCode_ParameterOutOfRange); | |
182 } | |
180 } | 183 } |
181 | 184 |
182 | 185 |
183 void ImageAccessor::AssignWritable(PixelFormat format, | 186 void ImageAccessor::AssignWritable(PixelFormat format, |
184 unsigned int width, | 187 unsigned int width, |
191 width_ = width; | 194 width_ = width; |
192 height_ = height; | 195 height_ = height; |
193 pitch_ = pitch; | 196 pitch_ = pitch; |
194 buffer_ = buffer; | 197 buffer_ = buffer; |
195 | 198 |
196 assert(GetBytesPerPixel() * width_ <= pitch_); | 199 if (GetBytesPerPixel() * width_ > pitch_) |
200 { | |
201 throw OrthancException(ErrorCode_ParameterOutOfRange); | |
202 } | |
197 } | 203 } |
198 | 204 |
199 | 205 |
200 void ImageAccessor::ToMatlabString(std::string& target) const | 206 void ImageAccessor::ToMatlabString(std::string& target) const |
201 { | 207 { |