Kaydet (Commit) a0064854 authored tarafından Michael Meeks's avatar Michael Meeks

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
üst 27b28239
...@@ -77,9 +77,10 @@ public: ...@@ -77,9 +77,10 @@ public:
Size getPreferredSize() const; 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> ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream>
GetInputStream(); GetInputStream();
protected: protected:
......
...@@ -120,7 +120,7 @@ namespace sdr ...@@ -120,7 +120,7 @@ namespace sdr
if(!pRetval) if(!pRetval)
{ {
// create a new one. It's inserted to the local list from the // create a new one. It's inserted to the local list from the
// VieObjectContact constructor via AddViewObjectContact() // ViewObjectContact constructor via AddViewObjectContact()
pRetval = &CreateObjectSpecificViewObjectContact(rObjectContact); pRetval = &CreateObjectSpecificViewObjectContact(rObjectContact);
} }
......
...@@ -152,7 +152,7 @@ namespace sdr ...@@ -152,7 +152,7 @@ namespace sdr
const drawinglayer::primitive2d::Primitive2DReference xRetval( const drawinglayer::primitive2d::Primitive2DReference xRetval(
new drawinglayer::primitive2d::MediaPrimitive2D( new drawinglayer::primitive2d::MediaPrimitive2D(
aTransform, rURL, aBackgroundColor, nPixelBorder, aTransform, rURL, aBackgroundColor, nPixelBorder,
avmedia::MediaWindow::grabFrame(rURL, true))); GetSdrMediaObj().getSnapshot()));
return drawinglayer::primitive2d::Primitive2DSequence(&xRetval, 1); return drawinglayer::primitive2d::Primitive2DSequence(&xRetval, 1);
} }
......
...@@ -70,9 +70,9 @@ struct MediaTempFile ...@@ -70,9 +70,9 @@ struct MediaTempFile
struct SdrMediaObj::Impl struct SdrMediaObj::Impl
{ {
::avmedia::MediaItem m_MediaProperties; ::avmedia::MediaItem m_MediaProperties;
::boost::scoped_ptr<Graphic> m_pGraphic; ::boost::shared_ptr< MediaTempFile > m_pTempFile;
::boost::shared_ptr<MediaTempFile> m_pTempFile; uno::Reference< graphic::XGraphic > m_xCachedSnapshot;
}; };
TYPEINIT1( SdrMediaObj, SdrRectObj ); TYPEINIT1( SdrMediaObj, SdrRectObj );
...@@ -185,10 +185,17 @@ SdrMediaObj& SdrMediaObj::operator=(const SdrMediaObj& rObj) ...@@ -185,10 +185,17 @@ SdrMediaObj& SdrMediaObj::operator=(const SdrMediaObj& rObj)
m_pImpl->m_pTempFile = rObj.m_pImpl->m_pTempFile; // before props m_pImpl->m_pTempFile = rObj.m_pImpl->m_pTempFile; // before props
setMediaProperties( rObj.getMediaProperties() ); setMediaProperties( rObj.getMediaProperties() );
setGraphic( rObj.m_pImpl->m_pGraphic.get() ); m_pImpl->m_xCachedSnapshot = rObj.m_pImpl->m_xCachedSnapshot;
return *this; 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 */ ) void SdrMediaObj::AdjustToMaxRect( const Rectangle& rMaxRect, bool bShrinkOnly /* = false */ )
...@@ -276,12 +283,6 @@ Size SdrMediaObj::getPreferredSize() const ...@@ -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() uno::Reference<io::XInputStream> SdrMediaObj::GetInputStream()
{ {
if (!m_pImpl->m_pTempFile) if (!m_pImpl->m_pTempFile)
...@@ -362,7 +363,7 @@ void SdrMediaObj::mediaPropertiesChanged( const ::avmedia::MediaItem& rNewProper ...@@ -362,7 +363,7 @@ void SdrMediaObj::mediaPropertiesChanged( const ::avmedia::MediaItem& rNewProper
if( ( AVMEDIA_SETMASK_URL & nMaskSet ) && if( ( AVMEDIA_SETMASK_URL & nMaskSet ) &&
( rNewProperties.getURL() != getURL() )) ( rNewProperties.getURL() != getURL() ))
{ {
setGraphic(); m_pImpl->m_xCachedSnapshot = uno::Reference< graphic::XGraphic >();
::rtl::OUString const url(rNewProperties.getURL()); ::rtl::OUString const url(rNewProperties.getURL());
if ((0 == rtl_ustr_ascii_shortenedCompareIgnoreAsciiCase_WithLength( if ((0 == rtl_ustr_ascii_shortenedCompareIgnoreAsciiCase_WithLength(
url.getStr(), url.getLength(), url.getStr(), url.getLength(),
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment