Adding back MatConstIterator_::pos implementation

pull/13383/head
Victor Erukhimov 14 years ago
parent a44629d46f
commit 8ff0d754ac
  1. 19
      modules/core/include/opencv2/core/mat.hpp

@ -1804,6 +1804,25 @@ template<typename _Tp> inline MatIterator_<_Tp> MatIterator_<_Tp>::operator ++(i
return b;
}
// Fixing a back compatibility problem -- to be reviewed by Vadim
template<typename _Tp> inline Point MatConstIterator_<_Tp>::pos() const
{
if( !m )
return Point();
if( m->isContinuous() )
{
ptrdiff_t ofs = ptr - (_Tp*)m->data;
int y = (int)(ofs / m->cols), x = (int)(ofs - (ptrdiff_t)y*m->cols);
return Point(x, y);
}
else
{
ptrdiff_t ofs = (uchar*)ptr - m->data;
int y = (int)(ofs / m->step), x = (int)((ofs - y*m->step)/sizeof(_Tp));
return Point(x, y);
}
}
static inline bool
operator == (const MatConstIterator& a, const MatConstIterator& b)
{ return a.m == b.m && a.ptr == b.ptr; }

Loading…
Cancel
Save