Commit 8ff0d754 authored by Victor Erukhimov's avatar Victor Erukhimov

Adding back MatConstIterator_::pos implementation

parent a44629d4
...@@ -1804,6 +1804,25 @@ template<typename _Tp> inline MatIterator_<_Tp> MatIterator_<_Tp>::operator ++(i ...@@ -1804,6 +1804,25 @@ template<typename _Tp> inline MatIterator_<_Tp> MatIterator_<_Tp>::operator ++(i
return b; 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 static inline bool
operator == (const MatConstIterator& a, const MatConstIterator& b) operator == (const MatConstIterator& a, const MatConstIterator& b)
{ return a.m == b.m && a.ptr == b.ptr; } { return a.m == b.m && a.ptr == b.ptr; }
......
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