Commit c3d1f94e authored by Maksim Shabunin's avatar Maksim Shabunin

Merge pull request #6446 from kevin-coder:bugfix_6445

parents 764a1f59 94a9e169
...@@ -190,7 +190,6 @@ bool PxMDecoder::readData( Mat& img ) ...@@ -190,7 +190,6 @@ bool PxMDecoder::readData( Mat& img )
{ {
int color = img.channels() > 1; int color = img.channels() > 1;
uchar* data = img.ptr(); uchar* data = img.ptr();
int step = (int)img.step;
PaletteEntry palette[256]; PaletteEntry palette[256];
bool result = false; bool result = false;
int bit_depth = CV_ELEM_SIZE1(m_type)*8; int bit_depth = CV_ELEM_SIZE1(m_type)*8;
...@@ -229,7 +228,7 @@ bool PxMDecoder::readData( Mat& img ) ...@@ -229,7 +228,7 @@ bool PxMDecoder::readData( Mat& img )
case 1: case 1:
if( !m_binary ) if( !m_binary )
{ {
for( y = 0; y < m_height; y++, data += step ) for( y = 0; y < m_height; y++, data += img.step )
{ {
for( x = 0; x < m_width; x++ ) for( x = 0; x < m_width; x++ )
src[x] = ReadNumber( m_strm, 1 ) != 0; src[x] = ReadNumber( m_strm, 1 ) != 0;
...@@ -242,7 +241,7 @@ bool PxMDecoder::readData( Mat& img ) ...@@ -242,7 +241,7 @@ bool PxMDecoder::readData( Mat& img )
} }
else else
{ {
for( y = 0; y < m_height; y++, data += step ) for( y = 0; y < m_height; y++, data += img.step )
{ {
m_strm.getBytes( src, src_pitch ); m_strm.getBytes( src, src_pitch );
...@@ -258,7 +257,7 @@ bool PxMDecoder::readData( Mat& img ) ...@@ -258,7 +257,7 @@ bool PxMDecoder::readData( Mat& img )
////////////////////////// 8 BPP ///////////////////////// ////////////////////////// 8 BPP /////////////////////////
case 8: case 8:
case 24: case 24:
for( y = 0; y < m_height; y++, data += step ) for( y = 0; y < m_height; y++, data += img.step )
{ {
if( !m_binary ) if( !m_binary )
{ {
...@@ -310,7 +309,7 @@ bool PxMDecoder::readData( Mat& img ) ...@@ -310,7 +309,7 @@ bool PxMDecoder::readData( Mat& img )
} }
} }
else else
memcpy( data, src, m_width*(bit_depth/8) ); memcpy( data, src, m_width);
} }
else else
{ {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment