提交 8ff0d754 编写于 作者: V Victor Erukhimov

Adding back MatConstIterator_::pos implementation

上级 a44629d4
......@@ -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; }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册