svx/inc/svx/svdomedia.hxx | 5 ++-- svx/source/sdr/contact/viewcontact.cxx | 2 - svx/source/sdr/contact/viewcontactofsdrmediaobj.cxx | 2 - svx/source/svdraw/svdomedia.cxx | 23 ++++++++++---------- 4 files changed, 17 insertions(+), 15 deletions(-)
New commits: commit a00648547aa49ac0a80eea7441b53c842c323e83 Author: Michael Meeks <[email protected]> Date: Tue Sep 25 12:14:15 2012 +0100 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 diff --git a/svx/inc/svx/svdomedia.hxx b/svx/inc/svx/svdomedia.hxx index e3e2f42..ddfc18c 100644 --- a/svx/inc/svx/svdomedia.hxx +++ b/svx/inc/svx/svdomedia.hxx @@ -77,9 +77,10 @@ public: Size getPreferredSize() const; - void setGraphic( const Graphic* pGraphic = NULL ); + ::com::sun::star::uno::Reference< ::com::sun::star::graphic::XGraphic > + getSnapshot(); ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream> - GetInputStream(); + GetInputStream(); protected: diff --git a/svx/source/sdr/contact/viewcontact.cxx b/svx/source/sdr/contact/viewcontact.cxx index 4c18c8b..f14b3af 100644 --- a/svx/source/sdr/contact/viewcontact.cxx +++ b/svx/source/sdr/contact/viewcontact.cxx @@ -120,7 +120,7 @@ namespace sdr if(!pRetval) { // create a new one. It's inserted to the local list from the - // VieObjectContact constructor via AddViewObjectContact() + // ViewObjectContact constructor via AddViewObjectContact() pRetval = &CreateObjectSpecificViewObjectContact(rObjectContact); } diff --git a/svx/source/sdr/contact/viewcontactofsdrmediaobj.cxx b/svx/source/sdr/contact/viewcontactofsdrmediaobj.cxx index e5ad178..a4f05b8 100644 --- a/svx/source/sdr/contact/viewcontactofsdrmediaobj.cxx +++ b/svx/source/sdr/contact/viewcontactofsdrmediaobj.cxx @@ -152,7 +152,7 @@ namespace sdr const drawinglayer::primitive2d::Primitive2DReference xRetval( new drawinglayer::primitive2d::MediaPrimitive2D( aTransform, rURL, aBackgroundColor, nPixelBorder, - avmedia::MediaWindow::grabFrame(rURL, true))); + GetSdrMediaObj().getSnapshot())); return drawinglayer::primitive2d::Primitive2DSequence(&xRetval, 1); } diff --git a/svx/source/svdraw/svdomedia.cxx b/svx/source/svdraw/svdomedia.cxx index ef61948..a811ad3 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(), _______________________________________________ Libreoffice-commits mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
