minor
This commit is contained in:
parent
1a1d167bb8
commit
fa93b724ee
@ -90,11 +90,10 @@ namespace cv
|
|||||||
gpu::GpuMat mapDevice();
|
gpu::GpuMat mapDevice();
|
||||||
void unmapDevice();
|
void unmapDevice();
|
||||||
|
|
||||||
int rows;
|
inline int rows() const { return rows_; }
|
||||||
int cols;
|
inline int cols() const { return cols_; }
|
||||||
|
inline Size size() const { return Size(cols_, rows_); }
|
||||||
inline Size size() const { return Size(cols, rows); }
|
inline bool empty() const { return rows_ == 0 || cols_ == 0; }
|
||||||
inline bool empty() const { return rows == 0 || cols == 0; }
|
|
||||||
|
|
||||||
inline int type() const { return type_; }
|
inline int type() const { return type_; }
|
||||||
inline int depth() const { return CV_MAT_DEPTH(type_); }
|
inline int depth() const { return CV_MAT_DEPTH(type_); }
|
||||||
@ -105,6 +104,8 @@ namespace cv
|
|||||||
inline Usage usage() const { return usage_; }
|
inline Usage usage() const { return usage_; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
int rows_;
|
||||||
|
int cols_;
|
||||||
int type_;
|
int type_;
|
||||||
Usage usage_;
|
Usage usage_;
|
||||||
|
|
||||||
@ -138,11 +139,10 @@ namespace cv
|
|||||||
void bind() const;
|
void bind() const;
|
||||||
void unbind() const;
|
void unbind() const;
|
||||||
|
|
||||||
int rows;
|
inline int rows() const { return rows_; }
|
||||||
int cols;
|
inline int cols() const { return cols_; }
|
||||||
|
inline Size size() const { return Size(cols_, rows_); }
|
||||||
inline Size size() const { return Size(cols, rows); }
|
inline bool empty() const { return rows_ == 0 || cols_ == 0; }
|
||||||
inline bool empty() const { return rows == 0 || cols == 0; }
|
|
||||||
|
|
||||||
inline int type() const { return type_; }
|
inline int type() const { return type_; }
|
||||||
inline int depth() const { return CV_MAT_DEPTH(type_); }
|
inline int depth() const { return CV_MAT_DEPTH(type_); }
|
||||||
@ -151,6 +151,8 @@ namespace cv
|
|||||||
inline int elemSize1() const { return CV_ELEM_SIZE1(type_); }
|
inline int elemSize1() const { return CV_ELEM_SIZE1(type_); }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
int rows_;
|
||||||
|
int cols_;
|
||||||
int type_;
|
int type_;
|
||||||
|
|
||||||
class Impl;
|
class Impl;
|
||||||
@ -183,8 +185,8 @@ namespace cv
|
|||||||
void bind() const;
|
void bind() const;
|
||||||
void unbind() const;
|
void unbind() const;
|
||||||
|
|
||||||
inline int rows() const { return vertex_.rows; }
|
inline int rows() const { return vertex_.rows(); }
|
||||||
inline int cols() const { return vertex_.cols; }
|
inline int cols() const { return vertex_.cols(); }
|
||||||
inline Size size() const { return vertex_.size(); }
|
inline Size size() const { return vertex_.size(); }
|
||||||
inline bool empty() const { return vertex_.empty(); }
|
inline bool empty() const { return vertex_.empty(); }
|
||||||
|
|
||||||
|
@ -282,7 +282,8 @@ class cv::GlBuffer::Impl
|
|||||||
class cv::GlBuffer::Impl
|
class cv::GlBuffer::Impl
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
Impl();
|
static const Ptr<Impl>& empty();
|
||||||
|
|
||||||
Impl(int rows, int cols, int type, unsigned int target);
|
Impl(int rows, int cols, int type, unsigned int target);
|
||||||
Impl(const Mat& m, unsigned int target);
|
Impl(const Mat& m, unsigned int target);
|
||||||
~Impl();
|
~Impl();
|
||||||
@ -305,6 +306,8 @@ public:
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
Impl();
|
||||||
|
|
||||||
unsigned int buffer_;
|
unsigned int buffer_;
|
||||||
|
|
||||||
#ifdef HAVE_CUDA
|
#ifdef HAVE_CUDA
|
||||||
@ -312,6 +315,12 @@ private:
|
|||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
|
inline const Ptr<cv::GlBuffer::Impl>& cv::GlBuffer::Impl::empty()
|
||||||
|
{
|
||||||
|
static Ptr<Impl> p(new Impl);
|
||||||
|
return p;
|
||||||
|
}
|
||||||
|
|
||||||
inline cv::GlBuffer::Impl::Impl() : buffer_(0)
|
inline cv::GlBuffer::Impl::Impl() : buffer_(0)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
@ -471,40 +480,40 @@ inline void cv::GlBuffer::Impl::unmapDevice(cudaStream_t stream)
|
|||||||
|
|
||||||
#endif // HAVE_OPENGL
|
#endif // HAVE_OPENGL
|
||||||
|
|
||||||
cv::GlBuffer::GlBuffer(Usage usage) : rows(0), cols(0), type_(0), usage_(usage)
|
cv::GlBuffer::GlBuffer(Usage usage) : rows_(0), cols_(0), type_(0), usage_(usage)
|
||||||
{
|
{
|
||||||
#ifndef HAVE_OPENGL
|
#ifndef HAVE_OPENGL
|
||||||
throw_nogl;
|
throw_nogl;
|
||||||
#else
|
#else
|
||||||
impl_ = new Impl;
|
impl_ = Impl::empty();
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
cv::GlBuffer::GlBuffer(int rows_, int cols_, int type, Usage usage) : rows(0), cols(0), type_(0), usage_(usage)
|
cv::GlBuffer::GlBuffer(int rows, int cols, int type, Usage usage) : rows_(0), cols_(0), type_(0), usage_(usage)
|
||||||
{
|
{
|
||||||
#ifndef HAVE_OPENGL
|
#ifndef HAVE_OPENGL
|
||||||
throw_nogl;
|
throw_nogl;
|
||||||
#else
|
#else
|
||||||
impl_ = new Impl(rows_, cols_, type, usage);
|
impl_ = new Impl(rows, cols, type, usage);
|
||||||
rows = rows_;
|
rows_ = rows;
|
||||||
cols = cols_;
|
cols_ = cols;
|
||||||
type_ = type;
|
type_ = type;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
cv::GlBuffer::GlBuffer(Size size, int type, Usage usage) : rows(0), cols(0), type_(0), usage_(usage)
|
cv::GlBuffer::GlBuffer(Size size, int type, Usage usage) : rows_(0), cols_(0), type_(0), usage_(usage)
|
||||||
{
|
{
|
||||||
#ifndef HAVE_OPENGL
|
#ifndef HAVE_OPENGL
|
||||||
throw_nogl;
|
throw_nogl;
|
||||||
#else
|
#else
|
||||||
impl_ = new Impl(size.height, size.width, type, usage);
|
impl_ = new Impl(size.height, size.width, type, usage);
|
||||||
rows = size.height;
|
rows_ = size.height;
|
||||||
cols = size.width;
|
cols_ = size.width;
|
||||||
type_ = type;
|
type_ = type;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
cv::GlBuffer::GlBuffer(InputArray mat_, Usage usage) : rows(0), cols(0), type_(0), usage_(usage)
|
cv::GlBuffer::GlBuffer(InputArray mat_, Usage usage) : rows_(0), cols_(0), type_(0), usage_(usage)
|
||||||
{
|
{
|
||||||
#ifndef HAVE_OPENGL
|
#ifndef HAVE_OPENGL
|
||||||
throw_nogl;
|
throw_nogl;
|
||||||
@ -529,22 +538,22 @@ cv::GlBuffer::GlBuffer(InputArray mat_, Usage usage) : rows(0), cols(0), type_(0
|
|||||||
impl_ = new Impl(mat, usage);
|
impl_ = new Impl(mat, usage);
|
||||||
}
|
}
|
||||||
|
|
||||||
rows = size.height;
|
rows_ = size.height;
|
||||||
cols = size.width;
|
cols_ = size.width;
|
||||||
type_ = type;
|
type_ = type;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void cv::GlBuffer::create(int rows_, int cols_, int type, Usage usage)
|
void cv::GlBuffer::create(int rows, int cols, int type, Usage usage)
|
||||||
{
|
{
|
||||||
#ifndef HAVE_OPENGL
|
#ifndef HAVE_OPENGL
|
||||||
throw_nogl;
|
throw_nogl;
|
||||||
#else
|
#else
|
||||||
if (rows_ != rows || cols_ != cols || type_ != type || usage_ != usage)
|
if (rows_ != rows || cols_ != cols || type_ != type || usage_ != usage)
|
||||||
{
|
{
|
||||||
impl_ = new Impl(rows_, cols_, type, usage);
|
impl_ = new Impl(rows, cols, type, usage);
|
||||||
rows = rows_;
|
rows_ = rows;
|
||||||
cols = cols_;
|
cols_ = cols;
|
||||||
type_ = type;
|
type_ = type;
|
||||||
usage_ = usage;
|
usage_ = usage;
|
||||||
}
|
}
|
||||||
@ -556,7 +565,7 @@ void cv::GlBuffer::release()
|
|||||||
#ifndef HAVE_OPENGL
|
#ifndef HAVE_OPENGL
|
||||||
throw_nogl;
|
throw_nogl;
|
||||||
#else
|
#else
|
||||||
impl_ = new Impl;
|
impl_ = Impl::empty();
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -623,7 +632,7 @@ Mat cv::GlBuffer::mapHost()
|
|||||||
throw_nogl;
|
throw_nogl;
|
||||||
return Mat();
|
return Mat();
|
||||||
#else
|
#else
|
||||||
return impl_->mapHost(rows, cols, type_, usage_);
|
return impl_->mapHost(rows_, cols_, type_, usage_);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -646,7 +655,7 @@ GpuMat cv::GlBuffer::mapDevice()
|
|||||||
throw_nocuda;
|
throw_nocuda;
|
||||||
return GpuMat();
|
return GpuMat();
|
||||||
#else
|
#else
|
||||||
return impl_->mapDevice(rows, cols, type_);
|
return impl_->mapDevice(rows_, cols_, type_);
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
@ -683,7 +692,7 @@ class cv::GlTexture::Impl
|
|||||||
class cv::GlTexture::Impl
|
class cv::GlTexture::Impl
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
Impl();
|
static const Ptr<Impl> empty();
|
||||||
|
|
||||||
Impl(int rows, int cols, int type);
|
Impl(int rows, int cols, int type);
|
||||||
|
|
||||||
@ -699,9 +708,17 @@ public:
|
|||||||
void unbind() const;
|
void unbind() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
Impl();
|
||||||
|
|
||||||
GLuint tex_;
|
GLuint tex_;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
inline const Ptr<cv::GlTexture::Impl> cv::GlTexture::Impl::empty()
|
||||||
|
{
|
||||||
|
static Ptr<Impl> p(new Impl);
|
||||||
|
return p;
|
||||||
|
}
|
||||||
|
|
||||||
inline cv::GlTexture::Impl::Impl() : tex_(0)
|
inline cv::GlTexture::Impl::Impl() : tex_(0)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
@ -808,7 +825,7 @@ cv::GlTexture::Impl::Impl(const GlBuffer& buf, bool bgra) : tex_(0)
|
|||||||
glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
|
glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
|
||||||
CV_CheckGlError();
|
CV_CheckGlError();
|
||||||
|
|
||||||
glTexImage2D(GL_TEXTURE_2D, 0, cn, buf.cols, buf.rows, 0, format, gl_types[depth], 0);
|
glTexImage2D(GL_TEXTURE_2D, 0, cn, buf.cols(), buf.rows(), 0, format, gl_types[depth], 0);
|
||||||
CV_CheckGlError();
|
CV_CheckGlError();
|
||||||
|
|
||||||
buf.unbind();
|
buf.unbind();
|
||||||
@ -853,7 +870,7 @@ void cv::GlTexture::Impl::copyFrom(const GlBuffer& buf, bool bgra)
|
|||||||
int cn = buf.channels();
|
int cn = buf.channels();
|
||||||
GLenum format = cn == 1 ? GL_LUMINANCE : (cn == 3 ? (bgra ? GL_BGR : GL_RGB) : (bgra ? GL_BGRA : GL_RGBA));
|
GLenum format = cn == 1 ? GL_LUMINANCE : (cn == 3 ? (bgra ? GL_BGR : GL_RGB) : (bgra ? GL_BGRA : GL_RGBA));
|
||||||
|
|
||||||
glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, buf.cols, buf.rows, format, gl_types[buf.depth()], 0);
|
glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, buf.cols(), buf.rows(), format, gl_types[buf.depth()], 0);
|
||||||
CV_CheckGlError();
|
CV_CheckGlError();
|
||||||
|
|
||||||
buf.unbind();
|
buf.unbind();
|
||||||
@ -881,40 +898,40 @@ inline void cv::GlTexture::Impl::unbind() const
|
|||||||
|
|
||||||
#endif // HAVE_OPENGL
|
#endif // HAVE_OPENGL
|
||||||
|
|
||||||
cv::GlTexture::GlTexture() : rows(0), cols(0), type_(0)
|
cv::GlTexture::GlTexture() : rows_(0), cols_(0), type_(0)
|
||||||
{
|
{
|
||||||
#ifndef HAVE_OPENGL
|
#ifndef HAVE_OPENGL
|
||||||
throw_nogl;
|
throw_nogl;
|
||||||
#else
|
#else
|
||||||
impl_ = new Impl;
|
impl_ = Impl::empty();
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
cv::GlTexture::GlTexture(int rows_, int cols_, int type) : rows(0), cols(0), type_(0)
|
cv::GlTexture::GlTexture(int rows, int cols, int type) : rows_(0), cols_(0), type_(0)
|
||||||
{
|
{
|
||||||
#ifndef HAVE_OPENGL
|
#ifndef HAVE_OPENGL
|
||||||
throw_nogl;
|
throw_nogl;
|
||||||
#else
|
#else
|
||||||
impl_ = new Impl(rows_, cols_, type);
|
impl_ = new Impl(rows, cols, type);
|
||||||
rows = rows_;
|
rows_ = rows;
|
||||||
cols = cols_;
|
cols_ = cols;
|
||||||
type_ = type;
|
type_ = type;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
cv::GlTexture::GlTexture(Size size, int type) : rows(0), cols(0), type_(0)
|
cv::GlTexture::GlTexture(Size size, int type) : rows_(0), cols_(0), type_(0)
|
||||||
{
|
{
|
||||||
#ifndef HAVE_OPENGL
|
#ifndef HAVE_OPENGL
|
||||||
throw_nogl;
|
throw_nogl;
|
||||||
#else
|
#else
|
||||||
impl_ = new Impl(size.height, size.width, type);
|
impl_ = new Impl(size.height, size.width, type);
|
||||||
rows = size.height;
|
rows_ = size.height;
|
||||||
cols = size.width;
|
cols_ = size.width;
|
||||||
type_ = type;
|
type_ = type;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
cv::GlTexture::GlTexture(InputArray mat_, bool bgra) : rows(0), cols(0), type_(0)
|
cv::GlTexture::GlTexture(InputArray mat_, bool bgra) : rows_(0), cols_(0), type_(0)
|
||||||
{
|
{
|
||||||
#ifndef HAVE_OPENGL
|
#ifndef HAVE_OPENGL
|
||||||
throw_nogl;
|
throw_nogl;
|
||||||
@ -951,22 +968,22 @@ cv::GlTexture::GlTexture(InputArray mat_, bool bgra) : rows(0), cols(0), type_(0
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
rows = size.height;
|
rows_ = size.height;
|
||||||
cols = size.width;
|
cols_ = size.width;
|
||||||
type_ = type;
|
type_ = type;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void cv::GlTexture::create(int rows_, int cols_, int type)
|
void cv::GlTexture::create(int rows, int cols, int type)
|
||||||
{
|
{
|
||||||
#ifndef HAVE_OPENGL
|
#ifndef HAVE_OPENGL
|
||||||
throw_nogl;
|
throw_nogl;
|
||||||
#else
|
#else
|
||||||
if (rows_ != rows || cols_ != cols || type_ != type)
|
if (rows_ != rows || cols_ != cols || type_ != type)
|
||||||
{
|
{
|
||||||
impl_ = new Impl(rows_, cols_, type);
|
impl_ = new Impl(rows, cols, type);
|
||||||
rows = rows_;
|
rows_ = rows;
|
||||||
cols = cols_;
|
cols_ = cols;
|
||||||
type_ = type;
|
type_ = type;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@ -977,7 +994,7 @@ void cv::GlTexture::release()
|
|||||||
#ifndef HAVE_OPENGL
|
#ifndef HAVE_OPENGL
|
||||||
throw_nogl;
|
throw_nogl;
|
||||||
#else
|
#else
|
||||||
impl_ = new Impl;
|
impl_ = Impl::empty();
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user