[Libreoffice-commits] core.git: 2 commits - avmedia/source
Zolnai Tamás
tamas.zolnai at collabora.com
Thu May 29 06:07:03 PDT 2014
avmedia/source/opengl/oglframegrabber.cxx | 11 ++++++-----
avmedia/source/opengl/oglframegrabber.hxx | 4 ++--
avmedia/source/opengl/oglplayer.cxx | 2 +-
avmedia/source/opengl/oglwindow.cxx | 7 -------
4 files changed, 9 insertions(+), 15 deletions(-)
New commits:
commit 1f1c3b2966c36149ca8b8a2e411d562c154f6c6b
Author: Zolnai Tamás <tamas.zolnai at collabora.com>
Date: Thu May 29 15:00:20 2014 +0200
OGLFrameGrabber: use reference instead of pointer
Change-Id: Id21138ce2a5d8e764407f42afa2b21464da70e45
diff --git a/avmedia/source/opengl/oglframegrabber.cxx b/avmedia/source/opengl/oglframegrabber.cxx
index e92cd86..cca8cc0 100644
--- a/avmedia/source/opengl/oglframegrabber.cxx
+++ b/avmedia/source/opengl/oglframegrabber.cxx
@@ -23,9 +23,9 @@ using namespace com::sun::star;
namespace avmedia { namespace ogl {
-OGLFrameGrabber::OGLFrameGrabber( glTFHandle* pHandle )
+OGLFrameGrabber::OGLFrameGrabber( glTFHandle& rHandle )
: FrameGrabber_BASE()
- , m_pHandle( pHandle )
+ , m_rHandle( rHandle )
{
}
@@ -36,9 +36,10 @@ OGLFrameGrabber::~OGLFrameGrabber()
uno::Reference< css::graphic::XGraphic > SAL_CALL OGLFrameGrabber::grabFrame( double /*fMediaTime*/ )
throw ( uno::RuntimeException, std::exception )
{
- boost::scoped_array<sal_uInt8> pBuffer(new sal_uInt8[m_pHandle->viewport.width * m_pHandle->viewport.height * 4]);
- gltf_renderer_get_bitmap(&m_pHandle, 1, (char*)pBuffer.get(), GL_BGRA);
- BitmapEx aBitmap = OpenGLHelper::ConvertBGRABufferToBitmapEx(pBuffer.get(), m_pHandle->viewport.width, m_pHandle->viewport.height);
+ boost::scoped_array<sal_uInt8> pBuffer(new sal_uInt8[m_rHandle.viewport.width * m_rHandle.viewport.height * 4]);
+ glTFHandle* pHandle = &m_rHandle;
+ gltf_renderer_get_bitmap(&pHandle, 1, (char*)pBuffer.get(), GL_BGRA);
+ BitmapEx aBitmap = OpenGLHelper::ConvertBGRABufferToBitmapEx(pBuffer.get(), m_rHandle.viewport.width, m_rHandle.viewport.height);
return Graphic( aBitmap ).GetXGraphic();
}
diff --git a/avmedia/source/opengl/oglframegrabber.hxx b/avmedia/source/opengl/oglframegrabber.hxx
index 5be6371..b6cc0e8 100644
--- a/avmedia/source/opengl/oglframegrabber.hxx
+++ b/avmedia/source/opengl/oglframegrabber.hxx
@@ -25,7 +25,7 @@ class OGLFrameGrabber : public FrameGrabber_BASE
{
public:
- OGLFrameGrabber( glTFHandle* pHandle );
+ OGLFrameGrabber( glTFHandle& rHandle );
virtual ~OGLFrameGrabber();
// XFrameGrabber
@@ -37,7 +37,7 @@ public:
virtual com::sun::star::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() throw (com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
private:
- glTFHandle* m_pHandle;
+ glTFHandle& m_rHandle;
};
} // namespace ogl
diff --git a/avmedia/source/opengl/oglplayer.cxx b/avmedia/source/opengl/oglplayer.cxx
index 7a111f9..35d99a4 100644
--- a/avmedia/source/opengl/oglplayer.cxx
+++ b/avmedia/source/opengl/oglplayer.cxx
@@ -291,7 +291,7 @@ uno::Reference< media::XFrameGrabber > SAL_CALL OGLPlayer::createFrameGrabber()
SAL_WARN("avmedia.opengl", "Error occured while parsing *.json file! Error code: " << nRet);
return uno::Reference< media::XFrameGrabber >();
}
- OGLFrameGrabber *pFrameGrabber = new OGLFrameGrabber( m_pHandle );
+ OGLFrameGrabber *pFrameGrabber = new OGLFrameGrabber( *m_pHandle );
return uno::Reference< media::XFrameGrabber >( pFrameGrabber );
}
commit c90a742ed507b493fc20a5dbe68f8601217f7e4c
Author: Zolnai Tamás <tamas.zolnai at collabora.com>
Date: Thu May 29 14:54:59 2014 +0200
OGLWindow: no need to call update after changes, timer takes care of it
Change-Id: Ifc5ecf4ec3e385293889c82a3b678a8dbcd3edbb
diff --git a/avmedia/source/opengl/oglwindow.cxx b/avmedia/source/opengl/oglwindow.cxx
index dd43095..aa29f4b 100644
--- a/avmedia/source/opengl/oglwindow.cxx
+++ b/avmedia/source/opengl/oglwindow.cxx
@@ -96,10 +96,6 @@ void SAL_CALL OGLWindow::setPosSize( sal_Int32 nX, sal_Int32 nY, sal_Int32 nWidt
m_rHandle.viewport.y = nY;
m_rHandle.viewport.width = nWidth;
m_rHandle.viewport.height = nHeight;
- if( m_bVisible )
- {
- update();
- }
}
}
@@ -116,7 +112,6 @@ void SAL_CALL OGLWindow::setVisible( sal_Bool bSet )
assert(m_rEventHandler.GetParent());
if( bSet && !m_bVisible )
{
- update();
m_rEventHandler.GetParent()->AddEventListener( LINK(this, OGLWindow, FocusGrabber));
m_rEventHandler.AddEventListener( LINK(this, OGLWindow, CameraHandler));
m_rEventHandler.GrabFocus();
@@ -266,7 +261,6 @@ IMPL_LINK(OGLWindow, CameraHandler, VclWindowEvent*, pEvent)
if(nCode == KEY_S)vMoveBy += vMup*(0.0005f*fModelSize);
}
gltf_renderer_move_camera(&m_rHandle, vMoveBy.x, vMoveBy.y, vMoveBy.z, 0.0);
- update();
}
}
}
@@ -313,7 +307,6 @@ IMPL_LINK(OGLWindow, CameraHandler, VclWindowEvent*, pEvent)
long nDeltaY = aCurPos.Y()-m_aLastMousePos.Y();
// TODO: It seems this method just moves the camera but not rotate it.
gltf_renderer_rotate_camera(&m_rHandle, (float)nDeltaX*fSensitivity, (float)nDeltaY*fSensitivity, 0.0, 0.0);
- update();
m_aLastMousePos = aCurPos;
}
More information about the Libreoffice-commits
mailing list