From Pjotr Svetachov, "Here is a small fix for a overflow when editing large 3d volume data."

git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14329 16af8721-9629-0410-8352-f15c8da7e697
This commit is contained in:
Robert Osfield 2014-06-30 08:46:54 +00:00
parent 1581699022
commit 5fb078b4f1

View File

@ -316,13 +316,13 @@ class OSG_EXPORT Image : public BufferData
* take care to access the data per row rather than treating the whole data as a single block. */ * take care to access the data per row rather than treating the whole data as a single block. */
inline const unsigned char* data() const { return _data; } inline const unsigned char* data() const { return _data; }
inline unsigned char* data(int column, int row=0,int image=0) inline unsigned char* data(unsigned int column, unsigned int row = 0, unsigned int image = 0)
{ {
if (!_data) return NULL; if (!_data) return NULL;
return _data+(column*getPixelSizeInBits())/8+row*getRowStepInBytes()+image*getImageSizeInBytes(); return _data+(column*getPixelSizeInBits())/8+row*getRowStepInBytes()+image*getImageSizeInBytes();
} }
inline const unsigned char* data(int column, int row=0,int image=0) const inline const unsigned char* data(unsigned int column, unsigned int row = 0, unsigned int image = 0) const
{ {
if (!_data) return NULL; if (!_data) return NULL;
return _data+(column*getPixelSizeInBits())/8+row*getRowStepInBytes()+image*getImageSizeInBytes(); return _data+(column*getPixelSizeInBits())/8+row*getRowStepInBytes()+image*getImageSizeInBytes();