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,7 +77,8 @@ 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();
......
......@@ -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);
}
......
......@@ -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);
}
......
......@@ -71,8 +71,8 @@ struct MediaTempFile
struct SdrMediaObj::Impl
{
::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 );
......@@ -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(),
......
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