1
0
mirror of https://github.com/opencv/opencv.git synced 2026-07-29 15:23:05 +04:00

don't use constructors for C API structures

This commit is contained in:
Alexander Alekhin
2018-09-06 14:34:16 +03:00
parent ad146e5a6b
commit 8a3c394d6a
70 changed files with 547 additions and 578 deletions
+8 -17
View File
@@ -2479,7 +2479,7 @@ void cv::drawContours( InputOutputArray _image, InputArrayOfArrays _contours,
CV_INSTRUMENT_REGION()
Mat image = _image.getMat(), hierarchy = _hierarchy.getMat();
CvMat _cimage = image;
CvMat _cimage = cvMat(image);
size_t ncontours = _contours.total();
size_t i = 0, first = 0, last = ncontours;
@@ -2548,8 +2548,8 @@ void cv::drawContours( InputOutputArray _image, InputArrayOfArrays _contours,
}
}
cvDrawContours( &_cimage, &seq[first], color, color, contourIdx >= 0 ?
-maxLevel : maxLevel, thickness, lineType, offset );
cvDrawContours( &_cimage, &seq[first], cvScalar(color), cvScalar(color), contourIdx >= 0 ?
-maxLevel : maxLevel, thickness, lineType, cvPoint(offset) );
}
@@ -2560,11 +2560,6 @@ static const int CodeDeltas[8][2] =
#define CV_ADJUST_EDGE_COUNT( count, seq ) \
((count) -= ((count) == (seq)->total && !CV_IS_SEQ_CLOSED(seq)))
#if defined __GNUC__ && __GNUC__ >= 8
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wclass-memaccess"
#endif
CV_IMPL void
cvDrawContours( void* _img, CvSeq* contour,
CvScalar _externalColor, CvScalar _holeColor,
@@ -2658,14 +2653,14 @@ cvDrawContours( void* _img, CvSeq* contour,
int shift = 0;
count -= !CV_IS_SEQ_CLOSED(contour);
CV_READ_SEQ_ELEM( pt1, reader );
{ CvPoint pt_ = CV_STRUCT_INITIALIZER; CV_READ_SEQ_ELEM(pt_, reader); pt1 = pt_; }
pt1 += offset;
if( thickness < 0 )
pts.push_back(pt1);
for( i = 0; i < count; i++ )
{
CV_READ_SEQ_ELEM( pt2, reader );
{ CvPoint pt_ = CV_STRUCT_INITIALIZER; CV_READ_SEQ_ELEM(pt_, reader); pt2 = pt_; }
pt2 += offset;
if( thickness >= 0 )
cv::ThickLine( img, pt1, pt2, clr, thickness, line_type, 2, shift );
@@ -2707,7 +2702,7 @@ cvEllipse2Poly( CvPoint center, CvSize axes, int angle,
CV_IMPL CvScalar
cvColorToScalar( double packed_color, int type )
{
CvScalar scalar;
cv::Scalar scalar;
if( CV_MAT_DEPTH( type ) == CV_8U )
{
@@ -2765,7 +2760,7 @@ cvColorToScalar( double packed_color, int type )
}
}
return scalar;
return cvScalar(scalar);
}
CV_IMPL int
@@ -2893,11 +2888,7 @@ cvGetTextSize( const char *text, const CvFont *_font, CvSize *_size, int *_base_
cv::Size size = cv::getTextSize( text, _font->font_face, (_font->hscale + _font->vscale)*0.5,
_font->thickness, _base_line );
if( _size )
*_size = size;
*_size = cvSize(size);
}
#if defined __GNUC__ && __GNUC__ >= 8
#pragma GCC diagnostic pop // "-Wclass-memaccess"
#endif
/* End of file. */