summaryrefslogtreecommitdiff
path: root/svx
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
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')
-rw-r--r--svx/inc/svx/svdomedia.hxx5
-rw-r--r--svx/source/sdr/contact/viewcontact.cxx2
-rw-r--r--svx/source/sdr/contact/viewcontactofsdrmediaobj.cxx2
-rw-r--r--svx/source/svdraw/svdomedia.cxx23
4 files changed, 17 insertions, 15 deletions
diff --git a/svx/inc/svx/svdomedia.hxx b/svx/inc/svx/svdomedia.hxx
index e3e2f4248877..ddfc18c9c52a 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 4c18c8bff9d4..f14b3af56aab 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 e5ad178e5585..a4f05b8989c8 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 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(),