[Libreoffice-commits] core.git: Branch 'feature/chart-3d-chart2' - 2 commits - avmedia/source
Jan Holesovsky
kendy at collabora.com
Wed May 28 03:42:28 PDT 2014
avmedia/source/opengl/oglplayer.cxx | 42 ++++++++++++++++++++++++++++--------
1 file changed, 33 insertions(+), 9 deletions(-)
New commits:
commit b8e4b6ae59a56d19726fef4165aa958ccd5ccb29
Author: Jan Holesovsky <kendy at collabora.com>
Date: Wed May 28 12:38:15 2014 +0200
Revert "[not for master] This makes the presentation work, but the preview does not."
This reverts commit 0e69e6ec4db9ba1651f460a1ca36fc31b79e5729.
diff --git a/avmedia/source/opengl/oglplayer.cxx b/avmedia/source/opengl/oglplayer.cxx
index 39667ac..8955e59 100644
--- a/avmedia/source/opengl/oglplayer.cxx
+++ b/avmedia/source/opengl/oglplayer.cxx
@@ -265,7 +265,6 @@ uno::Reference< media::XFrameGrabber > SAL_CALL OGLPlayer::createFrameGrabber()
m_pHandle->viewport.width = getPreferredPlayerWindowSize().Width;
m_pHandle->viewport.height = getPreferredPlayerWindowSize().Height;
gltf_renderer_set_content(m_pHandle);
- return uno::Reference< media::XFrameGrabber >();
OGLFrameGrabber *pFrameGrabber = new OGLFrameGrabber( m_pHandle );
return uno::Reference< media::XFrameGrabber >( pFrameGrabber );
}
commit aa456b62ec2df6013d61e70bb5cb2f804c88f73a
Author: Jan Holesovsky <kendy at collabora.com>
Date: Wed May 28 12:37:09 2014 +0200
[not for master] Display FPS when running the animation.
Change-Id: I6b329d1f44c1cbd9116802216fc5e23bfdb4102a
diff --git a/avmedia/source/opengl/oglplayer.cxx b/avmedia/source/opengl/oglplayer.cxx
index af3707f..39667ac 100644
--- a/avmedia/source/opengl/oglplayer.cxx
+++ b/avmedia/source/opengl/oglplayer.cxx
@@ -7,15 +7,18 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
+#include <config_folders.h>
+
#include "oglplayer.hxx"
#include "oglframegrabber.hxx"
#include "oglwindow.hxx"
#include <cppuhelper/supportsservice.hxx>
+#include <rtl/bootstrap.hxx>
#include <tools/stream.hxx>
+#include <tools/urlobj.hxx>
#include <vcl/graph.hxx>
#include <vcl/graphicfilter.hxx>
-#include <tools/urlobj.hxx>
#include <vcl/opengl/OpenGLHelper.hxx>
using namespace com::sun::star;
@@ -33,21 +36,30 @@ OGLPlayer::~OGLPlayer()
gltf_renderer_release(m_pHandle);
}
-static bool lcl_LoadFile( glTFFile* io_pFile, const OUString& rURL)
+static int lcl_LoadFileContent(const OUString& rURL, char** pBuffer)
{
+ *pBuffer = NULL;
+
SvFileStream aStream( rURL, STREAM_READ );
if( !aStream.IsOpen() )
- return false;
+ {
+ SAL_WARN("avmedia.opengl", "Failed to open: " << rURL);
+ return -1;
+ }
const sal_Int64 nBytes = aStream.remainingSize();
- char* pBuffer = new char[nBytes];
- aStream.Read( pBuffer, nBytes );
+ *pBuffer = new char[nBytes];
+ aStream.Read(*pBuffer, nBytes);
aStream.Close();
- io_pFile->buffer = pBuffer;
- io_pFile->size = nBytes;
+ return nBytes;
+}
+
+static bool lcl_LoadFile(glTFFile* io_pFile, const OUString& rURL)
+{
+ io_pFile->size = lcl_LoadFileContent(rURL, &io_pFile->buffer);
- return true;
+ return io_pFile->size > 0;
}
bool OGLPlayer::create( const OUString& rURL )
@@ -220,6 +232,19 @@ uno::Reference< media::XPlayerWindow > SAL_CALL OGLPlayer::createPlayerWindow( c
m_pHandle->viewport.width = aSize.Width();
m_pHandle->viewport.height = aSize.Height();
gltf_renderer_set_content(m_pHandle);
+
+ // initialize the FPS counter
+ OUString aFontPath("$BRAND_BASE_DIR/" LIBO_SHARE_FOLDER "/fonts/truetype/DejaVuSans.ttf");
+ rtl::Bootstrap::expandMacros(aFontPath);
+
+ char *pFontFile = NULL;
+ int nFontFileSize = lcl_LoadFileContent(aFontPath, &pFontFile);
+ if (nFontFileSize > 0)
+ {
+ gltf_render_FPS_initialize(m_pHandle, reinterpret_cast<unsigned char*>(pFontFile), nFontFileSize);
+ delete [] pFontFile;
+ }
+
m_pOGLWindow = new OGLWindow(m_pHandle, &m_aContext, pChildWindow);
return uno::Reference< media::XPlayerWindow >( m_pOGLWindow );
}
More information about the Libreoffice-commits
mailing list