From: Vladislav Vinogradov Date: Mon, 27 Feb 2012 13:22:41 +0000 (+0000) Subject: reused buffer in GlTexture::copyFrom(GpuMat) X-Git-Tag: accepted/tizen/6.0/unified/20201030.111113~5452 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=5c0f2f8ea1cc7717472b9d03dcc298731e1af4c2;p=platform%2Fupstream%2Fopencv.git reused buffer in GlTexture::copyFrom(GpuMat) --- diff --git a/modules/core/include/opencv2/core/opengl_interop.hpp b/modules/core/include/opencv2/core/opengl_interop.hpp index 7b0f088..338466b 100644 --- a/modules/core/include/opencv2/core/opengl_interop.hpp +++ b/modules/core/include/opencv2/core/opengl_interop.hpp @@ -157,6 +157,7 @@ namespace cv int type_; Ptr impl_; + GlBuffer buf_; }; template <> CV_EXPORTS void Ptr::delete_obj(); diff --git a/modules/core/src/opengl_interop.cpp b/modules/core/src/opengl_interop.cpp index e478c69..a9c7819 100644 --- a/modules/core/src/opengl_interop.cpp +++ b/modules/core/src/opengl_interop.cpp @@ -915,7 +915,7 @@ inline void cv::GlTexture::Impl::unbind() const #endif // HAVE_OPENGL -cv::GlTexture::GlTexture() : rows_(0), cols_(0), type_(0) +cv::GlTexture::GlTexture() : rows_(0), cols_(0), type_(0), buf_(GlBuffer::TEXTURE_BUFFER) { #ifndef HAVE_OPENGL throw_nogl; @@ -924,7 +924,7 @@ cv::GlTexture::GlTexture() : rows_(0), cols_(0), type_(0) #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), buf_(GlBuffer::TEXTURE_BUFFER) { #ifndef HAVE_OPENGL (void)rows; @@ -939,7 +939,7 @@ cv::GlTexture::GlTexture(int rows, int cols, int type) : rows_(0), cols_(0), typ #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), buf_(GlBuffer::TEXTURE_BUFFER) { #ifndef HAVE_OPENGL (void)size; @@ -953,7 +953,7 @@ cv::GlTexture::GlTexture(Size size, int type) : rows_(0), cols_(0), type_(0) #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), buf_(GlBuffer::TEXTURE_BUFFER) { #ifndef HAVE_OPENGL (void)mat_; @@ -1058,8 +1058,8 @@ void cv::GlTexture::copyFrom(InputArray mat_, bool bgra) throw_nocuda; #else GpuMat d_mat = mat_.getGpuMat(); - GlBuffer buf(d_mat, GlBuffer::TEXTURE_BUFFER); - impl_->copyFrom(buf, bgra); + buf_.copyFrom(d_mat); + impl_->copyFrom(buf_, bgra); #endif break;