提交 66221a32 编写于 作者: V Vladislav Vinogradov

fixed memory leak in ogl::Texture2D

上级 f95ff0a3
......@@ -1022,6 +1022,7 @@ cv::ogl::Texture2D::Texture2D(InputArray arr, bool autoRelease) : rows_(0), cols
#else
GpuMat dmat = arr.getGpuMat();
ogl::Buffer buf(dmat, ogl::Buffer::PIXEL_UNPACK_BUFFER);
buf.setAutoRelease(true);
buf.bind(ogl::Buffer::PIXEL_UNPACK_BUFFER);
impl_ = new Impl(internalFormats[cn], asize.width, asize.height, srcFormats[cn], gl_types[depth], 0, autoRelease);
ogl::Buffer::unbind(ogl::Buffer::PIXEL_UNPACK_BUFFER);
......@@ -1135,6 +1136,7 @@ void cv::ogl::Texture2D::copyFrom(InputArray arr, bool autoRelease)
#else
GpuMat dmat = arr.getGpuMat();
ogl::Buffer buf(dmat, ogl::Buffer::PIXEL_UNPACK_BUFFER);
buf.setAutoRelease(true);
buf.bind(ogl::Buffer::PIXEL_UNPACK_BUFFER);
impl_->copyFrom(asize.width, asize.height, srcFormats[cn], gl_types[depth], 0);
ogl::Buffer::unbind(ogl::Buffer::PIXEL_UNPACK_BUFFER);
......@@ -1185,6 +1187,7 @@ void cv::ogl::Texture2D::copyTo(OutputArray arr, int ddepth, bool autoRelease) c
throw_nocuda();
#else
ogl::Buffer buf(rows_, cols_, CV_MAKE_TYPE(ddepth, cn), ogl::Buffer::PIXEL_PACK_BUFFER);
buf.setAutoRelease(true);
buf.bind(ogl::Buffer::PIXEL_PACK_BUFFER);
impl_->copyTo(dstFormat, gl_types[ddepth], 0);
ogl::Buffer::unbind(ogl::Buffer::PIXEL_PACK_BUFFER);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册