offapi/com/sun/star/graphic/XPrimitive2D.idl | 21 ++++- offapi/com/sun/star/graphic/XPrimitiveFactory2D.idl | 72 ++++++++++++++++++ slideshow/Library_slideshow.mk | 1 slideshow/source/engine/shapes/drawshape.cxx | 15 +++ slideshow/source/engine/shapes/drawshape.hxx | 5 + slideshow/source/engine/shapes/viewshape.cxx | 77 ++++++++++++-------- slideshow/source/engine/shapes/viewshape.hxx | 33 ++++++++ slideshow/source/engine/slide/slideimpl.cxx | 9 ++ slideshow/source/engine/slideshowcontext.cxx | 8 +- slideshow/source/engine/slideshowimpl.cxx | 3 slideshow/source/inc/slideshowcontext.hxx | 14 ++- 11 files changed, 217 insertions(+), 41 deletions(-)
New commits: commit e0c1dc6fe6078eade26779a10f7410726d8d86c2 Author: Thorsten Behrens <tbehr...@suse.com> Date: Fri Oct 11 15:22:28 2013 +0200 Move slideshow over to use drawinglayer primitives. Change-Id: I5d76809413ba2d9417fc842f3a316646b7e04162 diff --git a/slideshow/Library_slideshow.mk b/slideshow/Library_slideshow.mk index 49c0c17..a11ca8e 100644 --- a/slideshow/Library_slideshow.mk +++ b/slideshow/Library_slideshow.mk @@ -39,6 +39,7 @@ $(eval $(call gb_Library_use_libraries,slideshow,\ cppcanvas \ cppu \ cppuhelper \ + drawinglayer \ sal \ svt \ tl \ diff --git a/slideshow/source/engine/shapes/drawshape.cxx b/slideshow/source/engine/shapes/drawshape.cxx index 7543569..5d250be 100644 --- a/slideshow/source/engine/shapes/drawshape.cxx +++ b/slideshow/source/engine/shapes/drawshape.cxx @@ -177,6 +177,9 @@ namespace slideshow // it does _not_ for MSVC without // the extra mem_fn. WTF. _1, + ::boost::cref( mxShape ), + ::boost::cref( mxPage ), + ::boost::cref( mxPrimitives ), ::boost::cref( mpCurrMtf ), ::boost::cref( getViewRenderArgs() ), @@ -390,6 +393,9 @@ namespace slideshow mnAttributeVisibilityState(0), maViewShapes(), mxComponentContext( rContext.mxComponentContext ), + mxPrimitives( + rContext.mxPrimitiveFactory->createPrimitivesFromXShape(xShape, + uno::Sequence<beans::PropertyValue>()) ), maHyperlinkIndices(), maHyperlinkRegions(), maSubsetting(), @@ -451,6 +457,9 @@ namespace slideshow mnAttributeVisibilityState(0), maViewShapes(), mxComponentContext( rContext.mxComponentContext ), + mxPrimitives( + rContext.mxPrimitiveFactory->createPrimitivesFromXShape(xShape, + uno::Sequence<beans::PropertyValue>()) ), maHyperlinkIndices(), maHyperlinkRegions(), maSubsetting(), @@ -503,6 +512,7 @@ namespace slideshow mnAttributeVisibilityState(0), maViewShapes(), mxComponentContext( rSrc.mxComponentContext ), + mxPrimitives( rSrc.mxPrimitives ), maHyperlinkIndices(), maHyperlinkRegions(), maSubsetting( rTreeNode, mpCurrMtf ), @@ -661,7 +671,10 @@ namespace slideshow // render the Shape on the newly added ViewLayer if( bRedrawLayer ) { - pNewShape->update( mpCurrMtf, + pNewShape->update( mxShape, + mxPage, + mxPrimitives, + mpCurrMtf, getViewRenderArgs(), ViewShape::FORCE, isVisible() ); diff --git a/slideshow/source/engine/shapes/drawshape.hxx b/slideshow/source/engine/shapes/drawshape.hxx index 034f124..bfb5ee0 100644 --- a/slideshow/source/engine/shapes/drawshape.hxx +++ b/slideshow/source/engine/shapes/drawshape.hxx @@ -22,6 +22,7 @@ #include <osl/diagnose.hxx> #include <com/sun/star/drawing/XShape.hpp> +#include <com/sun/star/graphic/XPrimitiveFactory2D.hpp> #include "attributableshape.hxx" #include "doctreenodesupplier.hxx" @@ -335,6 +336,10 @@ namespace slideshow ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext> mxComponentContext; + ::com::sun::star::uno::Sequence< + ::com::sun::star::uno::Reference< + ::com::sun::star::graphic::XPrimitive2D > > mxPrimitives; + /// hyperlink support typedef ::std::pair<sal_Int32 /* mtf start */, sal_Int32 /* mtf end */> HyperlinkIndexPair; diff --git a/slideshow/source/engine/shapes/viewshape.cxx b/slideshow/source/engine/shapes/viewshape.cxx index 6be622b..1f92acd 100644 --- a/slideshow/source/engine/shapes/viewshape.cxx +++ b/slideshow/source/engine/shapes/viewshape.cxx @@ -43,6 +43,7 @@ #include <canvas/canvastools.hxx> #include <cppcanvas/vclfactory.hxx> #include <cppcanvas/basegfxfactory.hxx> +#include <drawinglayer/processor2d/canvasprocessor2d.hxx> #include "viewshape.hxx" #include "tools.hxx" @@ -180,6 +181,9 @@ namespace slideshow } bool ViewShape::draw( const ::cppcanvas::CanvasSharedPtr& rDestinationCanvas, + const uno::Reference<drawing::XShape>& xShape, + const uno::Reference<drawing::XDrawPage>& xPage, + const uno::Sequence<uno::Reference<graphic::XPrimitive2D> >& xPrimitives, const GDIMetaFileSharedPtr& rMtf, const ShapeAttributeLayerSharedPtr& rAttr, const ::basegfx::B2DHomMatrix& rTransform, @@ -219,34 +223,29 @@ namespace slideshow DBG_UNHANDLED_EXCEPTION(); } #endif + + drawinglayer::geometry::ViewInformation2D aViewInfo( + basegfx::B2DHomMatrix(), rTransform, + basegfx::B2DRange(-10000,-10000,10000,10000), // HACK + xPage, 0.0, + uno::Sequence<beans::PropertyValue>()); + + drawinglayer::processor2d::CanvasProcessor2D aProcessor( + aViewInfo, + rDestinationCanvas->getUNOCanvas()); + + aProcessor.process(xPrimitives); + +#if 0 + pRenderer->setTransformation( rTransform ); if( pClip ) pRenderer->setClip( *pClip ); else pRenderer->setClip(); - if( rSubsets.empty() ) - { - return pRenderer->draw(); - } - else - { - // render subsets of whole metafile - // -------------------------------- - - bool bRet(true); - VectorOfDocTreeNodes::const_iterator aIter( rSubsets.begin() ); - const VectorOfDocTreeNodes::const_iterator aEnd ( rSubsets.end() ); - while( aIter != aEnd ) - { - if( !pRenderer->drawSubset( aIter->getStartIndex(), - aIter->getEndIndex() ) ) - bRet = false; - - ++aIter; - } - - return bRet; - } + return pRenderer->draw(); +#endif + return true; } namespace @@ -291,6 +290,9 @@ namespace slideshow } bool ViewShape::renderSprite( const ViewLayerSharedPtr& rViewLayer, + const uno::Reference<drawing::XShape>& xShape, + const uno::Reference<drawing::XDrawPage>& xPage, + const uno::Sequence<uno::Reference<graphic::XPrimitive2D> >& xPrimitives, const GDIMetaFileSharedPtr& rMtf, const ::basegfx::B2DRectangle& rOrigBounds, const ::basegfx::B2DRectangle& rBounds, @@ -502,6 +504,9 @@ namespace slideshow ::cppcanvas::CanvasSharedPtr pContentCanvas( mpSprite->getContentCanvas() ); return draw( pContentCanvas, + xShape, + xPage, + xPrimitives, rMtf, pAttr, aShapeTransformation, @@ -510,6 +515,9 @@ namespace slideshow } bool ViewShape::render( const ::cppcanvas::CanvasSharedPtr& rDestinationCanvas, + const uno::Reference<drawing::XShape>& xShape, + const uno::Reference<drawing::XDrawPage>& xPage, + const uno::Sequence<uno::Reference<graphic::XPrimitive2D> >& xPrimitives, const GDIMetaFileSharedPtr& rMtf, const ::basegfx::B2DRectangle& rBounds, const ::basegfx::B2DRectangle& rUpdateBounds, @@ -669,6 +677,9 @@ namespace slideshow // render into this bitmap if( !draw( pBitmapCanvas, + xShape, + xPage, + xPrimitives, rMtf, pAttr, aTransform, @@ -713,6 +724,9 @@ namespace slideshow pAttr ) ); return draw( rDestinationCanvas, + xShape, + xPage, + xPrimitives, rMtf, pAttr, aTransform, @@ -845,16 +859,22 @@ namespace slideshow mbForceUpdate = true; } - bool ViewShape::update( const GDIMetaFileSharedPtr& rMtf, - const RenderArgs& rArgs, - int nUpdateFlags, - bool bIsVisible ) const + bool ViewShape::update( const uno::Reference<drawing::XShape>& xShape, + const uno::Reference<drawing::XDrawPage>& xPage, + const uno::Sequence<uno::Reference<graphic::XPrimitive2D> >& xPrimitives, + const GDIMetaFileSharedPtr& rMtf, + const RenderArgs& rArgs, + int nUpdateFlags, + bool bIsVisible ) const { ENSURE_OR_RETURN_FALSE( mpViewLayer->getCanvas(), "ViewShape::update(): Invalid layer canvas" ); // Shall we render to a sprite, or to a plain canvas? if( isBackgroundDetached() ) return renderSprite( mpViewLayer, + xShape, + xPage, + xPrimitives, rMtf, rArgs.maOrigBounds, rArgs.maBounds, @@ -866,6 +886,9 @@ namespace slideshow bIsVisible ); else return render( mpViewLayer->getCanvas(), + xShape, + xPage, + xPrimitives, rMtf, rArgs.maBounds, rArgs.maUpdateBounds, diff --git a/slideshow/source/engine/shapes/viewshape.hxx b/slideshow/source/engine/shapes/viewshape.hxx index 68419de..8a29c46 100644 --- a/slideshow/source/engine/shapes/viewshape.hxx +++ b/slideshow/source/engine/shapes/viewshape.hxx @@ -37,6 +37,9 @@ #include <vector> +namespace com{ namespace sun{ namespace star{ namespace graphic { + class XPrimitive2D; +}}}} namespace slideshow { @@ -189,7 +192,14 @@ namespace slideshow @return whether the rendering finished successfully. */ - bool update( const GDIMetaFileSharedPtr& rMtf, + bool update( const ::com::sun::star::uno::Reference< + ::com::sun::star::drawing::XShape >& xShape, + const ::com::sun::star::uno::Reference< + ::com::sun::star::drawing::XDrawPage >& xPage, + const ::com::sun::star::uno::Sequence< + ::com::sun::star::uno::Reference< + ::com::sun::star::graphic::XPrimitive2D > >& xPrimitives, + const GDIMetaFileSharedPtr& rMtf, const RenderArgs& rArgs, int nUpdateFlags, bool bIsVisible ) const; @@ -247,6 +257,13 @@ namespace slideshow associated canvas (which happens to be mpLastCanvas). */ bool draw( const ::cppcanvas::CanvasSharedPtr& rDestinationCanvas, + const ::com::sun::star::uno::Reference< + ::com::sun::star::drawing::XShape >& xShape, + const ::com::sun::star::uno::Reference< + ::com::sun::star::drawing::XDrawPage >& xPage, + const ::com::sun::star::uno::Sequence< + ::com::sun::star::uno::Reference< + ::com::sun::star::graphic::XPrimitive2D > >& xPrimitives, const GDIMetaFileSharedPtr& rMtf, const ShapeAttributeLayerSharedPtr& rAttr, const ::basegfx::B2DHomMatrix& rTransform, @@ -256,6 +273,13 @@ namespace slideshow /** Render shape to an active sprite */ bool renderSprite( const ViewLayerSharedPtr& rViewLayer, + const ::com::sun::star::uno::Reference< + ::com::sun::star::drawing::XShape >& xShape, + const ::com::sun::star::uno::Reference< + ::com::sun::star::drawing::XDrawPage >& xPage, + const ::com::sun::star::uno::Sequence< + ::com::sun::star::uno::Reference< + ::com::sun::star::graphic::XPrimitive2D > >& xPrimitives, const GDIMetaFileSharedPtr& rMtf, const ::basegfx::B2DRectangle& rOrigBounds, const ::basegfx::B2DRectangle& rBounds, @@ -269,6 +293,13 @@ namespace slideshow /** Render shape to given canvas */ bool render( const ::cppcanvas::CanvasSharedPtr& rDestinationCanvas, + const ::com::sun::star::uno::Reference< + ::com::sun::star::drawing::XShape >& xShape, + const ::com::sun::star::uno::Reference< + ::com::sun::star::drawing::XDrawPage >& xPage, + const ::com::sun::star::uno::Sequence< + ::com::sun::star::uno::Reference< + ::com::sun::star::graphic::XPrimitive2D > >& xPrimitives, const GDIMetaFileSharedPtr& rMtf, const ::basegfx::B2DRectangle& rBounds, const ::basegfx::B2DRectangle& rUpdateBounds, diff --git a/slideshow/source/engine/slide/slideimpl.cxx b/slideshow/source/engine/slide/slideimpl.cxx index e061641..a39325b 100644 --- a/slideshow/source/engine/slide/slideimpl.cxx +++ b/slideshow/source/engine/slide/slideimpl.cxx @@ -36,6 +36,7 @@ #include <com/sun/star/beans/XPropertySet.hpp> #include <com/sun/star/container/XEnumerationAccess.hpp> #include <com/sun/star/awt/Rectangle.hpp> +#include <com/sun/star/graphic/XPrimitiveFactory2D.hpp> #include <com/sun/star/presentation/ParagraphTarget.hpp> #include <com/sun/star/presentation/EffectNodeType.hpp> #include <com/sun/star/animations/XAnimationNodeSupplier.hpp> @@ -376,7 +377,13 @@ SlideImpl::SlideImpl( const uno::Reference< drawing::XDrawPage >& xDra rUserEventQueue, *this, rViewContainer, - xComponentContext ), + xComponentContext, + uno::Reference<com::sun::star::graphic::XPrimitiveFactory2D>( + xComponentContext->getServiceManager()->createInstanceWithContext( + ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( + "com.sun.star.graphic.PrimitiveFactory2D") ), + xComponentContext ), + uno::UNO_QUERY_THROW ) ), mrCursorManager( rCursorManager ), maAnimations( maContext, basegfx::B2DSize( getSlideSizeImpl() ) ), diff --git a/slideshow/source/engine/slideshowcontext.cxx b/slideshow/source/engine/slideshowcontext.cxx index 2bc19cf..cbdb0a2 100644 --- a/slideshow/source/engine/slideshowcontext.cxx +++ b/slideshow/source/engine/slideshowcontext.cxx @@ -19,6 +19,7 @@ #include <com/sun/star/uno/Reference.hxx> #include <com/sun/star/uno/XComponentContext.hpp> +#include <com/sun/star/graphic/XPrimitiveFactory2D.hpp> #include "slideshowcontext.hxx" #include "subsettableshapemanager.hxx" @@ -46,7 +47,9 @@ SlideShowContext::SlideShowContext( SubsettableShapeManagerSharedPtr& rSubsettab CursorManager& rCursorManager, const UnoViewContainer& rViewContainer, const uno::Reference< - uno::XComponentContext>& rComponentContext ) : + uno::XComponentContext>& rComponentContext, + const uno::Reference< + graphic::XPrimitiveFactory2D>& rPrimitiveFactory ) : mpSubsettableShapeManager( rSubsettableShapeManager ), mrEventQueue( rEventQueue ), mrEventMultiplexer( rEventMultiplexer ), @@ -55,7 +58,8 @@ SlideShowContext::SlideShowContext( SubsettableShapeManagerSharedPtr& rSubsettab mrUserEventQueue( rUserEventQueue ), mrCursorManager( rCursorManager ), mrViewContainer( rViewContainer ), - mxComponentContext( rComponentContext ) + mxComponentContext( rComponentContext ), + mxPrimitiveFactory( rPrimitiveFactory ) {} void SlideShowContext::dispose() diff --git a/slideshow/source/engine/slideshowimpl.cxx b/slideshow/source/engine/slideshowimpl.cxx index 4c59b25..b1fc0b1 100644 --- a/slideshow/source/engine/slideshowimpl.cxx +++ b/slideshow/source/engine/slideshowimpl.cxx @@ -1749,7 +1749,8 @@ sal_Bool SlideShowImpl::setProperty( beans::PropertyValue const& rProperty ) maUserEventQueue, *this, maViewContainer, - mxComponentContext) ); + mxComponentContext, + 0) ); } else if (mpRehearseTimingsActivity) { diff --git a/slideshow/source/inc/slideshowcontext.hxx b/slideshow/source/inc/slideshowcontext.hxx index e398413..b17b665 100644 --- a/slideshow/source/inc/slideshowcontext.hxx +++ b/slideshow/source/inc/slideshowcontext.hxx @@ -23,9 +23,11 @@ #include <com/sun/star/uno/Reference.hxx> #include <boost/shared_ptr.hpp> -namespace com{ namespace sun{ namespace star{ namespace uno -{ - class XComponentContext; +namespace com{ namespace sun{ namespace star{ +namespace uno { + class XComponentContext; } +namespace graphic { + class XPrimitiveFactory2D; }}}} @@ -90,7 +92,9 @@ namespace slideshow CursorManager& rCursorManager, const UnoViewContainer& rViewContainer, const ::com::sun::star::uno::Reference< - ::com::sun::star::uno::XComponentContext>& rComponentContext ); + ::com::sun::star::uno::XComponentContext>& rComponentContext, + const ::com::sun::star::uno::Reference< + ::com::sun::star::graphic::XPrimitiveFactory2D>& rPrimitiveFactory ); void dispose(); boost::shared_ptr<SubsettableShapeManager>& mpSubsettableShapeManager; @@ -103,6 +107,8 @@ namespace slideshow const UnoViewContainer& mrViewContainer; ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext> mxComponentContext; + ::com::sun::star::uno::Reference< + ::com::sun::star::graphic::XPrimitiveFactory2D> mxPrimitiveFactory; }; } } commit 21b68db761a6c7fa9c2e0354e139deceb028020a Author: Thorsten Behrens <tbehr...@suse.com> Date: Fri Oct 11 15:16:24 2013 +0200 More detailed docs on drawinglayer primitive UNO api. Change-Id: I4e1c86be5fbfff12f32ae5471000889ee9a990b4 diff --git a/offapi/com/sun/star/graphic/XPrimitive2D.idl b/offapi/com/sun/star/graphic/XPrimitive2D.idl index 30bdeaf..d6a230d 100644 --- a/offapi/com/sun/star/graphic/XPrimitive2D.idl +++ b/offapi/com/sun/star/graphic/XPrimitive2D.idl @@ -39,11 +39,19 @@ interface XPrimitive2D : ::com::sun::star::uno::XInterface 2D View-specific parameter set. The defined but not mandatory parameters include: - ::com::sun::star::geometry::AffineMatrix2D Transformation + ::com::sun::star::geometry::AffineMatrix2D ObjectTransformation - A transformation matrix which maps between world coordinates (which - is equal to object's local coordinates) to view coordinates. If not - defined, an empty transformation is implied. + A transformation matrix which maps between object coordinates + (which is equal to object's local coordinates) to world + coordinates. If not defined, the identity transformation is + implied. + + ::com::sun::star::geometry::AffineMatrix2D ViewTransformation + + A transformation matrix which maps between world coordinates + to view coordinates, i.e. usually the actual pixel on + screen. If not defined, the identity transformation is + implied. ::com::sun::star::geometry::RealRectangle2D Viewport @@ -58,6 +66,11 @@ interface XPrimitive2D : ::com::sun::star::uno::XInterface lead to varied results for animated objects. This value is defined in the range [0.0 .. n[, negative values are not allowed. If not given, a value of 0.0 is implied. + + ::com::sun::star::drawing::XDrawPage VisualizedPage + + The page object this is displayed on. Used to e.g. resolve + page number placeholders and the like. */ sequence< XPrimitive2D > getDecomposition( [in] sequence< ::com::sun::star::beans::PropertyValue > aViewParameters ); diff --git a/offapi/com/sun/star/graphic/XPrimitiveFactory2D.idl b/offapi/com/sun/star/graphic/XPrimitiveFactory2D.idl index 6dfcc424..fee1a79 100644 --- a/offapi/com/sun/star/graphic/XPrimitiveFactory2D.idl +++ b/offapi/com/sun/star/graphic/XPrimitiveFactory2D.idl @@ -53,6 +53,42 @@ interface XPrimitiveFactory2D : ::com::sun::star::uno::XInterface Sequence of factory parameters, whose semantics depend on the shape to be generated. + 2D View-specific parameter set. The defined but not mandatory + parameters include: + + ::com::sun::star::geometry::AffineMatrix2D ObjectTransformation + + A transformation matrix which maps between object coordinates + (which is equal to object's local coordinates) to world + coordinates. If not defined, the identity transformation is + implied. + + ::com::sun::star::geometry::AffineMatrix2D ViewTransformation + + A transformation matrix which maps between world coordinates + to view coordinates, i.e. usually the actual pixel on + screen. If not defined, the identity transformation is + implied. + + ::com::sun::star::geometry::RealRectangle2D Viewport + + Defines the visible part of the view in world coordinates. May be used + to optimize decompositions, e.g. for 3d scenes only the visible part + needs to be created. If not given, an empty Viewport is implied which + means all is visible. + + double Time + + Defines the point in time for which the geometry is defined. This may + lead to varied results for animated objects. This value is defined in the + range [0.0 .. n[, negative values are not allowed. If not given, a value of + 0.0 is implied. + + ::com::sun::star::drawing::XDrawPage VisualizedPage + + The page object this is displayed on. Used to e.g. resolve + page number placeholders and the like. + @return a sequence of primitives, that consists of the geometrical representation from the given XShape. */ @@ -71,6 +107,42 @@ interface XPrimitiveFactory2D : ::com::sun::star::uno::XInterface Sequence of factory parameters, whose semantics depend on the page to be generated. + 2D View-specific parameter set. The defined but not mandatory + parameters include: + + ::com::sun::star::geometry::AffineMatrix2D ObjectTransformation + + A transformation matrix which maps between object coordinates + (which is equal to object's local coordinates) to world + coordinates. If not defined, the identity transformation is + implied. + + ::com::sun::star::geometry::AffineMatrix2D ViewTransformation + + A transformation matrix which maps between world coordinates + to view coordinates, i.e. usually the actual pixel on + screen. If not defined, the identity transformation is + implied. + + ::com::sun::star::geometry::RealRectangle2D Viewport + + Defines the visible part of the view in world coordinates. May be used + to optimize decompositions, e.g. for 3d scenes only the visible part + needs to be created. If not given, an empty Viewport is implied which + means all is visible. + + double Time + + Defines the point in time for which the geometry is defined. This may + lead to varied results for animated objects. This value is defined in the + range [0.0 .. n[, negative values are not allowed. If not given, a value of + 0.0 is implied. + + ::com::sun::star::drawing::XDrawPage VisualizedPage + + The page object this is displayed on. Used to e.g. resolve + page number placeholders and the like. + @return a sequence of primitives, that consists of the geometrical representation for the given XDrawPage. */ _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits