summaryrefslogtreecommitdiff
path: root/svx/source/svdraw
diff options
context:
space:
mode:
authorMichael Meeks <michael.meeks@suse.com>2012-09-25 12:14:15 +0100
committerMichael Meeks <michael.meeks@suse.com>2012-09-25 12:57:02 +0100
commita00648547aa49ac0a80eea7441b53c842c323e83 (patch)
tree6abec122118e86f06c2e7be8524f2db2c4938414 /svx/source/svdraw
parent27b2823907f6964211f0a0e2e091f77e81215d5f (diff)
substantially accelerate slides with media on them.
Don't pre-roll, and re-snapshot the video for every move of the mouse, click, partial re-render etc. Cache that instead on the SdrMediaObj. Remove unused setGraphic method. Change-Id: Id2af2f0bba857078480783dd6a7ee89f9b331b1b
Diffstat (limited to 'svx/source/svdraw')
-rw-r--r--svx/source/svdraw/svdomedia.cxx23
1 files changed, 12 insertions, 11 deletions
diff --git a/svx/source/svdraw/svdomedia.cxx b/svx/source/svdraw/svdomedia.cxx
index ef6194846334..a811ad319250 100644
--- a/svx/source/svdraw/svdomedia.cxx
+++ b/svx/source/svdraw/svdomedia.cxx
@@ -70,9 +70,9 @@ struct MediaTempFile
struct SdrMediaObj::Impl
{
- ::avmedia::MediaItem m_MediaProperties;
- ::boost::scoped_ptr<Graphic> m_pGraphic;
- ::boost::shared_ptr<MediaTempFile> m_pTempFile;
+ ::avmedia::MediaItem m_MediaProperties;
+ ::boost::shared_ptr< MediaTempFile > m_pTempFile;
+ uno::Reference< graphic::XGraphic > m_xCachedSnapshot;
};
TYPEINIT1( SdrMediaObj, SdrRectObj );
@@ -185,10 +185,17 @@ SdrMediaObj& SdrMediaObj::operator=(const SdrMediaObj& rObj)
m_pImpl->m_pTempFile = rObj.m_pImpl->m_pTempFile; // before props
setMediaProperties( rObj.getMediaProperties() );
- setGraphic( rObj.m_pImpl->m_pGraphic.get() );
+ m_pImpl->m_xCachedSnapshot = rObj.m_pImpl->m_xCachedSnapshot;
return *this;
}
+uno::Reference< graphic::XGraphic > SdrMediaObj::getSnapshot()
+{
+ if( !m_pImpl->m_xCachedSnapshot.is() )
+ m_pImpl->m_xCachedSnapshot = avmedia::MediaWindow::grabFrame(getURL(), true);
+ return m_pImpl->m_xCachedSnapshot;
+}
+
// ------------------------------------------------------------------------------
void SdrMediaObj::AdjustToMaxRect( const Rectangle& rMaxRect, bool bShrinkOnly /* = false */ )
@@ -276,12 +283,6 @@ Size SdrMediaObj::getPreferredSize() const
// ------------------------------------------------------------------------------
-void SdrMediaObj::setGraphic( const Graphic* pGraphic )
-{
- m_pImpl->m_pGraphic.reset( pGraphic ? new Graphic( *pGraphic ) : NULL );
-}
-
-// ------------------------------------------------------------------------------
uno::Reference<io::XInputStream> SdrMediaObj::GetInputStream()
{
if (!m_pImpl->m_pTempFile)
@@ -362,7 +363,7 @@ void SdrMediaObj::mediaPropertiesChanged( const ::avmedia::MediaItem& rNewProper
if( ( AVMEDIA_SETMASK_URL & nMaskSet ) &&
( rNewProperties.getURL() != getURL() ))
{
- setGraphic();
+ m_pImpl->m_xCachedSnapshot = uno::Reference< graphic::XGraphic >();
::rtl::OUString const url(rNewProperties.getURL());
if ((0 == rtl_ustr_ascii_shortenedCompareIgnoreAsciiCase_WithLength(
url.getStr(), url.getLength(),