diff options
author | Thorsten Behrens <thb@documentfoundation.org> | 2013-10-27 17:16:45 +0100 |
---|---|---|
committer | Thorsten Behrens <thb@documentfoundation.org> | 2013-11-16 01:36:29 +0100 |
commit | 5d7c894678f3ba8999017e4ed66ba81a5314b15b (patch) | |
tree | 23b2a75fcf441289b9ed549bed060290fb50ca14 | |
parent | dd675b0100df14f6a5da0949426f14c5468aaeda (diff) |
Rework slideshow to use XCanvas directly. Kill cppcanvas references.
This builds now, but is not working yet ...
Change-Id: I9995fe8cdbb0b8ca1be8d73a678feeb2c3708c9e
48 files changed, 770 insertions, 763 deletions
diff --git a/include/canvas/canvastools.hxx b/include/canvas/canvastools.hxx index fd6dadd0a791..2bc651dad25b 100644 --- a/include/canvas/canvastools.hxx +++ b/include/canvas/canvastools.hxx @@ -378,7 +378,7 @@ namespace canvas /// Convert standard 8888 RGBA color to vcl color CANVASTOOLS_DLLPUBLIC ::Color stdIntSequenceToColor( const ::com::sun::star::uno::Sequence<sal_Int8>& rColor ); - /// Convert standard 8888 RGBA color to vcl color + /// Convert standard vcl Color to 8888 RGBA color CANVASTOOLS_DLLPUBLIC ::com::sun::star::uno::Sequence<sal_Int8> colorToStdIntSequence( const ::Color& rColor ); // Modeled closely after boost::numeric_cast, only that we diff --git a/offapi/com/sun/star/rendering/XCanvas.idl b/offapi/com/sun/star/rendering/XCanvas.idl index 5a97339d98d9..83e71ece216f 100644 --- a/offapi/com/sun/star/rendering/XCanvas.idl +++ b/offapi/com/sun/star/rendering/XCanvas.idl @@ -120,12 +120,12 @@ interface XCanvas : ::com::sun::star::uno::XInterface */ void erase(); - /** Clears the whole canvas area to given color.<p> + /** Fills the whole canvas area to given color.<p> This method fills the whole canvas area with the given device color. */ - void clear( [in] sequence<ColorComponent> aColor ); + void fill( [in] sequence<ColorComponent> aColor ); /** Draw a point in device resolution on the device. diff --git a/slideshow/CppunitTest_slideshow.mk b/slideshow/CppunitTest_slideshow.mk index bc5c9a5944ec..4ff1afd715af 100644 --- a/slideshow/CppunitTest_slideshow.mk +++ b/slideshow/CppunitTest_slideshow.mk @@ -40,7 +40,6 @@ $(eval $(call gb_CppunitTest_use_libraries,slideshow,\ basegfx \ canvastools \ comphelper \ - cppcanvas \ cppu \ cppuhelper \ sal \ diff --git a/slideshow/Executable_demoshow.mk b/slideshow/Executable_demoshow.mk index 56725bd6c7fc..a116e7263fa2 100644 --- a/slideshow/Executable_demoshow.mk +++ b/slideshow/Executable_demoshow.mk @@ -35,7 +35,6 @@ $(eval $(call gb_Library_use_sdk_api,demoshow)) $(eval $(call gb_Executable_use_libraries,demoshow,\ basegfx \ comphelper \ - cppcanvas \ cppu \ cppuhelper \ sal \ diff --git a/slideshow/Library_slideshow.mk b/slideshow/Library_slideshow.mk index a11ca8e6bfed..81b2348684b0 100644 --- a/slideshow/Library_slideshow.mk +++ b/slideshow/Library_slideshow.mk @@ -36,7 +36,6 @@ $(eval $(call gb_Library_use_libraries,slideshow,\ basegfx \ canvastools \ comphelper \ - cppcanvas \ cppu \ cppuhelper \ drawinglayer \ diff --git a/slideshow/TODO b/slideshow/TODO new file mode 100644 index 000000000000..bc1f820340e0 --- /dev/null +++ b/slideshow/TODO @@ -0,0 +1,14 @@ +Stuff left doing +================ + + - grep for TODO-NYI + - migrate emf+ renderer over to primitives + - implement stateful canvas processor (e.g. for the color changes?) + -or- decorate primitives with color modifiers e.g. + - do we need viewstate at the canvas to pass around? + + - how much of the wrapper state in cppcanvas _was_ actually useful? + - review canvas api - e.g. for the createBitmap / createSprite + methods, is anyone *not* creating a Size struct on the fly? + + - when all of that is done -> git rm cppcanvas diff --git a/slideshow/inc/pch/precompiled_slideshow.hxx b/slideshow/inc/pch/precompiled_slideshow.hxx index 6d8b4a9c3fb5..bf82987da99e 100644 --- a/slideshow/inc/pch/precompiled_slideshow.hxx +++ b/slideshow/inc/pch/precompiled_slideshow.hxx @@ -169,14 +169,6 @@ #include <comphelper/sequence.hxx> #include <comphelper/servicedecl.hxx> #include <comphelper/uno3.hxx> -#include <cppcanvas/basegfxfactory.hxx> -#include <cppcanvas/bitmap.hxx> -#include <cppcanvas/canvas.hxx> -#include <cppcanvas/customsprite.hxx> -#include <cppcanvas/polypolygon.hxx> -#include <cppcanvas/renderer.hxx> -#include <cppcanvas/spritecanvas.hxx> -#include <cppcanvas/vclfactory.hxx> #include <cppuhelper/basemutex.hxx> #include <cppuhelper/compbase1.hxx> #include <cppuhelper/compbase2.hxx> diff --git a/slideshow/source/engine/animatedsprite.cxx b/slideshow/source/engine/animatedsprite.cxx index 5d421c21bf05..bb332507e844 100644 --- a/slideshow/source/engine/animatedsprite.cxx +++ b/slideshow/source/engine/animatedsprite.cxx @@ -24,9 +24,7 @@ #include <animatedsprite.hxx> -#include <cppcanvas/canvas.hxx> #include <canvas/canvastools.hxx> - #include <basegfx/vector/b2dvector.hxx> #include <basegfx/point/b2dpoint.hxx> #include <basegfx/matrix/b2dhommatrix.hxx> @@ -63,15 +61,17 @@ namespace slideshow mpSprite = mpViewLayer->createSprite( maEffectiveSpriteSizePixel, mnSpritePrio ); - ENSURE_OR_THROW( mpSprite, "AnimatedSprite::AnimatedSprite(): Could not create sprite" ); + ENSURE_OR_THROW( mpSprite.is(), + "AnimatedSprite::AnimatedSprite(): Could not create sprite" ); } - ::cppcanvas::CanvasSharedPtr AnimatedSprite::getContentCanvas() const + uno::Reference< rendering::XCanvas > AnimatedSprite::getContentCanvas() const { - ENSURE_OR_THROW( mpViewLayer->getCanvas(), "AnimatedSprite::getContentCanvas(): No view layer canvas" ); + ENSURE_OR_THROW( mpViewLayer->getCanvas().is(), + "AnimatedSprite::getContentCanvas(): No view layer canvas" ); - const ::cppcanvas::CanvasSharedPtr pContentCanvas( mpSprite->getContentCanvas() ); - pContentCanvas->clear(); + const uno::Reference< rendering::XCanvas > pContentCanvas( mpSprite->getContentCanvas() ); + pContentCanvas->erase(); // extract linear part of canvas view transformation // (linear means: without translational components). The @@ -86,7 +86,8 @@ namespace slideshow aLinearTransform.set( 1, 2, maContentPixelOffset.getY() ); // apply linear part of canvas view transformation to sprite canvas - pContentCanvas->setTransformation( aLinearTransform ); + // TODO-NYI + //pContentCanvas->setTransformation( aLinearTransform ); return pContentCanvas; } @@ -134,24 +135,25 @@ namespace slideshow mpSprite = mpViewLayer->createSprite( maEffectiveSpriteSizePixel, mnSpritePrio ); - ENSURE_OR_THROW( mpSprite, + ENSURE_OR_THROW( mpSprite.is(), "AnimatedSprite::resize(): Could not create new sprite" ); // set attributes similar to previous sprite - if( mpSprite && mbSpriteVisible ) + if( mpSprite.is() && mbSpriteVisible ) { mpSprite->show(); mpSprite->setAlpha( mnAlpha ); - if( maPosPixel ) - mpSprite->movePixel( *maPosPixel ); + // TODO-NYI + // if( maPosPixel ) + // mpSprite->movePixel( *maPosPixel ); - if( maClip ) - mpSprite->setClip( *maClip ); + // if( maClip ) + // mpSprite->setClip( *maClip ); } } - return static_cast< bool >(mpSprite); + return mpSprite.is(); } void AnimatedSprite::setPixelOffset( const ::basegfx::B2DSize& rPixelOffset ) @@ -162,7 +164,8 @@ namespace slideshow void AnimatedSprite::movePixel( const ::basegfx::B2DPoint& rNewPos ) { maPosPixel.reset( rNewPos ); - mpSprite->movePixel( rNewPos ); + // TODO-NYI + //mpSprite->movePixel( rNewPos ); } void AnimatedSprite::setAlpha( double nAlpha ) @@ -174,19 +177,22 @@ namespace slideshow void AnimatedSprite::clip( const ::basegfx::B2DPolyPolygon& rClip ) { maClip.reset( rClip ); - mpSprite->setClipPixel( rClip ); + // TODO-NYI + //mpSprite->setClipPixel( rClip ); } void AnimatedSprite::clip() { maClip.reset(); - mpSprite->setClip(); + // TODO-NYI + //mpSprite->setClip(); } void AnimatedSprite::transform( const ::basegfx::B2DHomMatrix& rTransform ) { maTransform.reset( rTransform ); - mpSprite->transform( rTransform ); + // TODO-NYI + //mpSprite->transform( rTransform ); } void AnimatedSprite::hide() diff --git a/slideshow/source/engine/color.cxx b/slideshow/source/engine/color.cxx index 06ce617d0ef9..67210f08b1c9 100644 --- a/slideshow/source/engine/color.cxx +++ b/slideshow/source/engine/color.cxx @@ -308,13 +308,6 @@ namespace slideshow { } - RGBColor::RGBColor( ::cppcanvas::Color::IntSRGBA nRGBColor ) : - maRGBTriple( ::cppcanvas::getRed( nRGBColor ) / 255.0, - ::cppcanvas::getGreen( nRGBColor ) / 255.0, - ::cppcanvas::getBlue( nRGBColor ) / 255.0 ) - { - } - RGBColor::RGBColor( double nRed, double nGreen, double nBlue ) : maRGBTriple( nRed, nGreen, nBlue ) { @@ -327,6 +320,13 @@ namespace slideshow { } + RGBColor::RGBColor( sal_uInt32 nColor ) : + maRGBTriple( (sal_uInt8)(nColor>>16) / 255.0, + (sal_uInt8)(sal_uInt16(nColor) >> 8) / 255.0, + (sal_uInt8)nColor / 255.0 ) + { + } + double RGBColor::getRed() const { return maRGBTriple.mnRed; @@ -342,14 +342,6 @@ namespace slideshow return maRGBTriple.mnBlue; } - ::cppcanvas::Color::IntSRGBA RGBColor::getIntegerColor() const - { - return ::cppcanvas::makeColor( colorToInt( getRed() ), - colorToInt( getGreen() ), - colorToInt( getBlue() ), - 255 ); - } - sal_Bool operator==( const RGBColor& rLHS, const RGBColor& rRHS ) { return ( rLHS.getRed() == rRHS.getRed() && diff --git a/slideshow/source/engine/pointersymbol.cxx b/slideshow/source/engine/pointersymbol.cxx index 20dd121ad877..b08e8ba36180 100644 --- a/slideshow/source/engine/pointersymbol.cxx +++ b/slideshow/source/engine/pointersymbol.cxx @@ -83,7 +83,7 @@ void PointerSymbol::setVisible( const bool bVisible ) ViewsVecT::const_iterator const aEnd ( maViews.end() ); while( aIter != aEnd ) { - if( aIter->second ) + if( aIter->second.is() ) { if( bVisible ) aIter->second->show(); @@ -111,7 +111,7 @@ basegfx::B2DPoint PointerSymbol::calcSpritePos(UnoViewSharedPtr const & rView) c void PointerSymbol::viewAdded( const UnoViewSharedPtr& rView ) { - cppcanvas::CustomSpriteSharedPtr sprite; + uno::Reference< rendering::XCustomSprite > sprite; try { @@ -124,11 +124,12 @@ void PointerSymbol::viewAdded( const UnoViewSharedPtr& rView ) canvas::tools::initViewState( viewState ); rendering::RenderState renderState; canvas::tools::initRenderState( renderState ); - sprite->getContentCanvas()->getUNOCanvas()->drawBitmap( + sprite->getContentCanvas()->drawBitmap( mxBitmap, viewState, renderState ); sprite->setAlpha( 0.9 ); - sprite->movePixel( calcSpritePos( rView ) ); + // TODO-NYI + // sprite->movePixel( calcSpritePos( rView ) ); if( mbVisible ) sprite->show(); } @@ -172,9 +173,12 @@ void PointerSymbol::viewChanged( const UnoViewSharedPtr& rView ) if( aModifiedEntry == maViews.end() ) return; - if( aModifiedEntry->second ) +#if 0 + // TODO-NYI + if( aModifiedEntry->second.is() ) aModifiedEntry->second->movePixel( calcSpritePos(aModifiedEntry->first) ); +#endif } void PointerSymbol::viewsChanged() @@ -184,9 +188,12 @@ void PointerSymbol::viewsChanged() ViewsVecT::const_iterator const aEnd ( maViews.end() ); while( aIter != aEnd ) { - if( aIter->second ) + if( aIter->second.is() ) +#if 0 + // TODO-NYI aIter->second->movePixel( calcSpritePos( aIter->first )); +#endif ++aIter; } } @@ -202,10 +209,11 @@ void PointerSymbol::viewsChanged(const geometry::RealPoint2D pos) ViewsVecT::const_iterator const aEnd ( maViews.end() ); while( aIter != aEnd ) { - if( aIter->second ) + if( aIter->second.is() ) { - aIter->second->movePixel( - calcSpritePos( aIter->first )); + // TODO-NYI + // aIter->second->movePixel( + calcSpritePos( aIter->first ); mrScreenUpdater.notifyUpdate(); mrScreenUpdater.commitUpdates(); } diff --git a/slideshow/source/engine/pointersymbol.hxx b/slideshow/source/engine/pointersymbol.hxx index 706f312d8f54..cbc658429786 100644 --- a/slideshow/source/engine/pointersymbol.hxx +++ b/slideshow/source/engine/pointersymbol.hxx @@ -12,7 +12,6 @@ #define POINTERSYMBOL_HXX_INCLUDED #include <com/sun/star/rendering/XBitmap.hpp> -#include <cppcanvas/customsprite.hxx> #include "com/sun/star/uno/Reference.hxx" @@ -83,7 +82,7 @@ private: typedef ::std::vector< ::std::pair<UnoViewSharedPtr, - cppcanvas::CustomSpriteSharedPtr> > ViewsVecT; + css::uno::Reference< css::rendering::XCustomSprite >> > ViewsVecT; ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XBitmap> mxBitmap; diff --git a/slideshow/source/engine/rehearsetimingsactivity.cxx b/slideshow/source/engine/rehearsetimingsactivity.cxx index 44e03051fd00..4aa75604d2c2 100644 --- a/slideshow/source/engine/rehearsetimingsactivity.cxx +++ b/slideshow/source/engine/rehearsetimingsactivity.cxx @@ -24,9 +24,9 @@ #include <vcl/gdimtf.hxx> #include <vcl/virdev.hxx> #include <vcl/metric.hxx> -#include <cppcanvas/vclfactory.hxx> -#include <cppcanvas/basegfxfactory.hxx> #include <basegfx/range/b2drange.hxx> +#include <basegfx/vector/b2dsize.hxx> +#include <basegfx/matrix/b2dhommatrix.hxx> #include <comphelper/anytostring.hxx> #include <cppuhelper/exc_hlp.hxx> @@ -217,7 +217,7 @@ void RehearseTimingsActivity::start() // paint and show all sprites: paintAllSprites(); - for_each_sprite( boost::bind( &cppcanvas::Sprite::show, _1 ) ); + for_each_sprite( boost::bind( &rendering::XCustomSprite::show, _1 ) ); mrActivitiesQueue.addActivity( shared_from_this() ); @@ -235,7 +235,7 @@ double RehearseTimingsActivity::stop() mbActive = false; // will be removed from queue - for_each_sprite( boost::bind( &cppcanvas::Sprite::hide, _1 ) ); + for_each_sprite( boost::bind( &rendering::XCustomSprite::hide, _1 ) ); return maElapsedTime.getElapsedTime(); } @@ -306,7 +306,7 @@ void RehearseTimingsActivity::end() basegfx::B2DRange RehearseTimingsActivity::calcSpriteRectangle( UnoViewSharedPtr const& rView ) const { - const Reference<rendering::XBitmap> xBitmap( rView->getCanvas()->getUNOCanvas(), + const Reference<rendering::XBitmap> xBitmap( rView->getCanvas(), UNO_QUERY ); if( !xBitmap.is() ) return basegfx::B2DRange(); @@ -331,7 +331,7 @@ basegfx::B2DRange RehearseTimingsActivity::calcSpriteRectangle( UnoViewSharedPtr void RehearseTimingsActivity::viewAdded( const UnoViewSharedPtr& rView ) { - cppcanvas::CustomSpriteSharedPtr sprite( + css::uno::Reference< css::rendering::XCustomSprite > sprite( rView->createSprite( basegfx::B2DSize( maSpriteSizePixel.getX()+2, maSpriteSizePixel.getY()+2 ), @@ -340,9 +340,12 @@ void RehearseTimingsActivity::viewAdded( const UnoViewSharedPtr& rView ) sprite->setAlpha( 0.8 ); const basegfx::B2DRange spriteRectangle( calcSpriteRectangle( rView ) ); +#if 0 + // TODO-NYI - keep local state, or encapsulate in dedicated sprite object again? sprite->move( basegfx::B2DPoint( spriteRectangle.getMinX(), spriteRectangle.getMinY() ) ); +#endif if( maViews.empty() ) maSpriteRectangle = spriteRectangle; @@ -387,7 +390,8 @@ void RehearseTimingsActivity::viewChanged( const UnoViewSharedPtr& rView ) maSpriteRectangle = calcSpriteRectangle( rView ); // reposition sprite: - aModifiedEntry->second->move( maSpriteRectangle.getMinimum() ); + // TODO-NYI - keep local state, or encapsulate in dedicated sprite object again? + //aModifiedEntry->second->move( maSpriteRectangle.getMinimum() ); // sprites changed, need screen update mrScreenUpdater.notifyUpdate( rView ); @@ -400,10 +404,13 @@ void RehearseTimingsActivity::viewsChanged() // new sprite pos, transformation might have changed: maSpriteRectangle = calcSpriteRectangle( maViews.front().first ); +#if 0 + // TODO-NYI // reposition sprites - for_each_sprite( boost::bind( &cppcanvas::Sprite::move, + for_each_sprite( boost::bind( &rendering::XCustomSprite::move, _1, boost::cref(maSpriteRectangle.getMinimum())) ); +#endif // sprites changed, need screen update mrScreenUpdater.notifyUpdate(); @@ -416,11 +423,14 @@ void RehearseTimingsActivity::paintAllSprites() const boost::bind( &RehearseTimingsActivity::paint, this, // call getContentCanvas() on each sprite: boost::bind( - &cppcanvas::CustomSprite::getContentCanvas, _1 ) ) ); + &rendering::XCustomSprite::getContentCanvas, _1 ) ) ); } -void RehearseTimingsActivity::paint( cppcanvas::CanvasSharedPtr const & canvas ) const +void RehearseTimingsActivity::paint( css::uno::Reference< css::rendering::XCanvas > const & ) const { +#if 0 + // TODO-NYI - move this over to drawing layer primitives! + // build timer string: const sal_Int32 nTimeSecs = static_cast<sal_Int32>(maElapsedTime.getElapsedTime()); @@ -479,6 +489,7 @@ void RehearseTimingsActivity::paint( cppcanvas::CanvasSharedPtr const & canvas ) const bool succ = renderer->draw(); OSL_ASSERT( succ ); (void)succ; +#endif } diff --git a/slideshow/source/engine/rehearsetimingsactivity.hxx b/slideshow/source/engine/rehearsetimingsactivity.hxx index c0a6c1322fa1..e1b5d598ec5a 100644 --- a/slideshow/source/engine/rehearsetimingsactivity.hxx +++ b/slideshow/source/engine/rehearsetimingsactivity.hxx @@ -32,7 +32,6 @@ class Font; namespace canvas{ namespace tools{ class ElapsedTime; }} -namespace cppcanvas{ class CustomSprite; } namespace basegfx { class B2IVector; @@ -91,7 +90,7 @@ private: explicit RehearseTimingsActivity( const SlideShowContext& rContext ); - void paint( ::cppcanvas::CanvasSharedPtr const & canvas ) const; + void paint( css::uno::Reference< css::rendering::XCanvas > const & canvas ) const; void paintAllSprites() const; class MouseHandler; @@ -99,7 +98,7 @@ private: typedef ::std::vector< ::std::pair<UnoViewSharedPtr, - boost::shared_ptr<cppcanvas::CustomSprite> > > ViewsVecT; + css::uno::Reference<css::rendering::XCustomSprite> > > ViewsVecT; template <typename func_type> void for_each_sprite( func_type const & func ) const diff --git a/slideshow/source/engine/shapes/drawshape.cxx b/slideshow/source/engine/shapes/drawshape.cxx index 5d250be7fc27..8ea1d2260d73 100644 --- a/slideshow/source/engine/shapes/drawshape.cxx +++ b/slideshow/source/engine/shapes/drawshape.cxx @@ -180,7 +180,6 @@ namespace slideshow ::boost::cref( mxShape ), ::boost::cref( mxPage ), ::boost::cref( mxPrimitives ), - ::boost::cref( mpCurrMtf ), ::boost::cref( getViewRenderArgs() ), nUpdateFlags, @@ -299,9 +298,12 @@ namespace slideshow // added or removed). Maybe we should exclude it here, // always assuming full bounds? - ::cppcanvas::CanvasSharedPtr pDestinationCanvas( + css::uno::Reference< css::rendering::XCanvas > pDestinationCanvas( maViewShapes.front()->getViewLayer()->getCanvas() ); +#if 0 + // TODO-NYI + // TODO(Q2): Although this _is_ currently // view-agnostic, it might not stay like // that. Maybe this method should again be moved @@ -362,6 +364,7 @@ namespace slideshow maCurrentShapeUnitBounds.reset( aTotalBounds ); } +#endif } return *maCurrentShapeUnitBounds; @@ -674,7 +677,6 @@ namespace slideshow pNewShape->update( mxShape, mxPage, mxPrimitives, - mpCurrMtf, getViewRenderArgs(), ViewShape::FORCE, isVisible() ); @@ -1000,9 +1002,12 @@ namespace slideshow // TODO(Q2): Although this _is_ currently // view-agnostic, it might not stay like that. ViewShapeSharedPtr const& pViewShape = maViewShapes.front(); - cppcanvas::CanvasSharedPtr const pCanvas( + css::uno::Reference< css::rendering::XCanvas > const pCanvas( pViewShape->getViewLayer()->getCanvas() ); +#if 0 + // TODO-NYI + // reuse Renderer of first view shape: cppcanvas::RendererSharedPtr const pRenderer( pViewShape->getRenderer( @@ -1037,6 +1042,7 @@ namespace slideshow maHyperlinkRegions[pos].first = region; } } +#endif } // shift shape-relative hyperlink regions to diff --git a/slideshow/source/engine/shapes/shapeimporter.cxx b/slideshow/source/engine/shapes/shapeimporter.cxx index 5d1879fde006..824ae15fb4e4 100644 --- a/slideshow/source/engine/shapes/shapeimporter.cxx +++ b/slideshow/source/engine/shapes/shapeimporter.cxx @@ -27,8 +27,7 @@ #include <unotools/streamwrap.hxx> #include <basegfx/point/b2dpoint.hxx> #include <basegfx/polygon/b2dpolygon.hxx> -#include <cppcanvas/basegfxfactory.hxx> -#include <cppcanvas/polypolygon.hxx> +#include <basegfx/tools/canvastools.hxx> #include <com/sun/star/awt/Rectangle.hpp> #include <com/sun/star/drawing/ColorMode.hpp> #include <com/sun/star/text/GraphicCrop.hpp> @@ -475,8 +474,8 @@ bool ShapeImporter::isSkip( void ShapeImporter::importPolygons(uno::Reference<beans::XPropertySet> const& xPropSet) { drawing::PointSequenceSequence aRetval; - sal_Int32 nLineColor=0; - double fLineWidth; + sal_Int32 nLineColor=0; + double fLineWidth; getPropertyValue( aRetval, xPropSet, "PolyPolygon" ); getPropertyValue( nLineColor, xPropSet, "LineColor" ); getPropertyValue( fLineWidth, xPropSet, "LineWidth" ); @@ -496,16 +495,20 @@ void ShapeImporter::importPolygons(uno::Reference<beans::XPropertySet> const& xP UnoViewVector::const_iterator aEnd=(mrContext.mrViewContainer).end(); while(aIter != aEnd) { - ::cppcanvas::PolyPolygonSharedPtr pPolyPoly( - ::cppcanvas::BaseGfxFactory::getInstance().createPolyPolygon( (*aIter)->getCanvas(), - aPoly ) ); - if( pPolyPoly ) + uno::Reference< rendering::XPolyPolygon2D > xPoly= + basegfx::unotools::xPolyPolygonFromB2DPolygon( + (*aIter)->getCanvas()->getDevice(), + aPoly); +#if 0 + // TODO-NYI + if( xPoly.is() ) { - pPolyPoly->setRGBALineColor( unoColor2RGBColor( nLineColor ).getIntegerColor() ); - pPolyPoly->setStrokeWidth(fLineWidth); - pPolyPoly->draw(); - maPolygons.push_back(pPolyPoly); + pPolyPoly->setRGBALineColor( unoColor2RGBColor( nLineColor ).getIntegerColor() ); + pPolyPoly->setStrokeWidth(fLineWidth); + pPolyPoly->draw(); + maPolygons.push_back(xPoly); } +#endif ++aIter; } } diff --git a/slideshow/source/engine/shapes/viewappletshape.cxx b/slideshow/source/engine/shapes/viewappletshape.cxx index 87175eeb3d8a..65165d6fac15 100644 --- a/slideshow/source/engine/shapes/viewappletshape.cxx +++ b/slideshow/source/engine/shapes/viewappletshape.cxx @@ -30,7 +30,6 @@ #include <basegfx/range/b2irange.hxx> #include <basegfx/tools/canvastools.hxx> -#include <cppcanvas/spritecanvas.hxx> #include <canvas/canvastools.hxx> #include <com/sun/star/uno/XComponentContext.hpp> @@ -73,7 +72,7 @@ namespace slideshow { ENSURE_OR_THROW( rxShape.is(), "ViewAppletShape::ViewAppletShape(): Invalid Shape" ); ENSURE_OR_THROW( mpViewLayer, "ViewAppletShape::ViewAppletShape(): Invalid View" ); - ENSURE_OR_THROW( mpViewLayer->getCanvas(), "ViewAppletShape::ViewAppletShape(): Invalid ViewLayer canvas" ); + ENSURE_OR_THROW( mpViewLayer->getCanvas().is(), "ViewAppletShape::ViewAppletShape(): Invalid ViewLayer canvas" ); ENSURE_OR_THROW( mxComponentContext.is(), "ViewAppletShape::ViewAppletShape(): Invalid component context" ); uno::Reference<lang::XMultiComponentFactory> xFactory( @@ -128,13 +127,13 @@ namespace slideshow bool ViewAppletShape::startApplet( const ::basegfx::B2DRectangle& rBounds ) { - ENSURE_OR_RETURN_FALSE( mpViewLayer && mpViewLayer->getCanvas() && mpViewLayer->getCanvas()->getUNOCanvas().is(), - "ViewAppletShape::startApplet(): Invalid or disposed view" ); + ENSURE_OR_RETURN_FALSE( mpViewLayer && mpViewLayer->getCanvas().is(), + "ViewAppletShape::startApplet(): Invalid or disposed view" ); try { - ::cppcanvas::CanvasSharedPtr pCanvas = mpViewLayer->getCanvas(); + css::uno::Reference< css::rendering::XCanvas > pCanvas = mpViewLayer->getCanvas(); - uno::Reference< beans::XPropertySet > xPropSet( pCanvas->getUNOCanvas()->getDevice(), + uno::Reference< beans::XPropertySet > xPropSet( pCanvas->getDevice(), uno::UNO_QUERY_THROW ); uno::Reference< awt::XWindow2 > xParentWindow( @@ -232,17 +231,17 @@ namespace slideshow bool ViewAppletShape::render( const ::basegfx::B2DRectangle& rBounds ) const { - ::cppcanvas::CanvasSharedPtr pCanvas = mpViewLayer->getCanvas(); + css::uno::Reference< css::rendering::XCanvas > pCanvas = mpViewLayer->getCanvas(); - if( !pCanvas ) + if( !pCanvas.is() ) return false; if( !mxFrame.is() ) { - // fill the shape background with black + // fill the shape background with white fillRect( pCanvas, rBounds, - 0xFFFFFFFFU ); + basegfx::BColor(1.0) ); } return true; diff --git a/slideshow/source/engine/shapes/viewbackgroundshape.cxx b/slideshow/source/engine/shapes/viewbackgroundshape.cxx index 05f255b28604..58c386894df9 100644 --- a/slideshow/source/engine/shapes/viewbackgroundshape.cxx +++ b/slideshow/source/engine/shapes/viewbackgroundshape.cxx @@ -37,13 +37,10 @@ #include <basegfx/matrix/b2dhommatrixtools.hxx> #include <com/sun/star/rendering/XCanvas.hpp> +#include <com/sun/star/rendering/XIntegerBitmap.hpp> #include <canvas/verbosetrace.hxx> #include <canvas/canvastools.hxx> -#include <cppcanvas/vclfactory.hxx> -#include <cppcanvas/basegfxfactory.hxx> -#include <cppcanvas/renderer.hxx> -#include <cppcanvas/bitmap.hxx> using namespace ::com::sun::star; @@ -53,7 +50,7 @@ namespace slideshow namespace internal { - bool ViewBackgroundShape::prefetch( const ::cppcanvas::CanvasSharedPtr& rDestinationCanvas, + bool ViewBackgroundShape::prefetch( const css::uno::Reference< css::rendering::XCanvas >& rDestinationCanvas, const GDIMetaFileSharedPtr& rMtf ) const { SAL_INFO( "slideshow", "::presentation::internal::ViewBackgroundShape::prefetch()" ); @@ -78,39 +75,44 @@ namespace slideshow // determine pixel size of bitmap (choose it one pixel // larger, as polygon rendering takes one pixel more // to the right and to the bottom) - const ::basegfx::B2ISize aBmpSizePixel( + const css::geometry::IntegerSize2D aBmpSizePixel( ::basegfx::fround( aTmpRect.getRange().getX() + 1), ::basegfx::fround( aTmpRect.getRange().getY() + 1) ); - // create a bitmap of appropriate size - ::cppcanvas::BitmapSharedPtr pBitmap( - ::cppcanvas::BaseGfxFactory::getInstance().createBitmap( - rDestinationCanvas, - aBmpSizePixel ) ); + // create a non-transparent bitmap of appropriate size + uno::Reference< rendering::XIntegerBitmap > pBitmap( + rDestinationCanvas->getDevice()->createCompatibleBitmap( + aBmpSizePixel), + uno::UNO_QUERY_THROW); - ENSURE_OR_THROW( pBitmap, - "ViewBackgroundShape::prefetch(): Cannot create background bitmap" ); + ENSURE_OR_THROW( pBitmap.is(), + "ViewBackgroundShape::prefetch(): Cannot create background bitmap" ); - ::cppcanvas::BitmapCanvasSharedPtr pBitmapCanvas( pBitmap->getBitmapCanvas() ); + uno::Reference< rendering::XCanvas > pBitmapCanvas( + pBitmap, uno::UNO_QUERY_THROW); - ENSURE_OR_THROW( pBitmapCanvas, - "ViewBackgroundShape::prefetch(): Cannot create background bitmap canvas" ); + ENSURE_OR_THROW( pBitmapCanvas.is(), + "ViewBackgroundShape::prefetch(): Cannot create background bitmap canvas" ); // clear bitmap - initSlideBackground( pBitmapCanvas, - aBmpSizePixel ); + pBitmapCanvas->fill( + ::basegfx::BColor(1.0,1.0,1.0).colorToDoubleSequence( + pBitmapCanvas->getDevice()) ); // apply linear part of destination canvas transformation (linear means in this context: // transformation without any translational components) ::basegfx::B2DHomMatrix aLinearTransform( rCanvasTransform ); aLinearTransform.set( 0, 2, 0.0 ); aLinearTransform.set( 1, 2, 0.0 ); - pBitmapCanvas->setTransformation( aLinearTransform ); + // TODO-NYI + //pBitmapCanvas->setTransformation( aLinearTransform ); const basegfx::B2DHomMatrix aShapeTransform(basegfx::tools::createScaleTranslateB2DHomMatrix( maBounds.getWidth(), maBounds.getHeight(), maBounds.getMinX(), maBounds.getMinY())); +# if 0 + // TODO-NYI ::cppcanvas::RendererSharedPtr pRenderer( ::cppcanvas::VCLFactory::getInstance().createRenderer( pBitmapCanvas, @@ -118,12 +120,12 @@ namespace slideshow ::cppcanvas::Renderer::Parameters() ) ); ENSURE_OR_RETURN_FALSE( pRenderer, - "ViewBackgroundShape::prefetch(): Could not create Renderer" ); + "ViewBackgroundShape::prefetch(): Could not create Renderer" ); pRenderer->setTransformation( aShapeTransform ); pRenderer->draw(); - - mxBitmap = pBitmap->getUNOBitmap(); +# endif + mxBitmap = pBitmap; } mpLastMtf = rMtf; @@ -140,8 +142,10 @@ namespace slideshow maLastTransformation(), maBounds( rShapeBounds ) { - ENSURE_OR_THROW( mpViewLayer, "ViewBackgroundShape::ViewBackgroundShape(): Invalid View" ); - ENSURE_OR_THROW( mpViewLayer->getCanvas(), "ViewBackgroundShape::ViewBackgroundShape(): Invalid ViewLayer canvas" ); + ENSURE_OR_THROW( mpViewLayer, + "ViewBackgroundShape::ViewBackgroundShape(): Invalid View" ); + ENSURE_OR_THROW( mpViewLayer->getCanvas().is(), + "ViewBackgroundShape::ViewBackgroundShape(): Invalid ViewLayer canvas" ); } ViewLayerSharedPtr ViewBackgroundShape::getViewLayer() const @@ -153,7 +157,7 @@ namespace slideshow { SAL_INFO( "slideshow", "::presentation::internal::ViewBackgroundShape::draw()" ); - const ::cppcanvas::CanvasSharedPtr& rDestinationCanvas( mpViewLayer->getCanvas() ); + const css::uno::Reference< css::rendering::XCanvas >& rDestinationCanvas( mpViewLayer->getCanvas() ); if( !prefetch( rDestinationCanvas, rMtf ) ) return false; @@ -180,9 +184,12 @@ namespace slideshow try { - rDestinationCanvas->getUNOCanvas()->drawBitmap( mxBitmap, - rDestinationCanvas->getViewState(), - aRenderState ); +#if 0 + // TODO-NYI + rDestinationCanvas->drawBitmap( mxBitmap, + rDestinationCanvas->getViewState(), + aRenderState ); +#endif } catch( uno::Exception& ) { diff --git a/slideshow/source/engine/shapes/viewbackgroundshape.hxx b/slideshow/source/engine/shapes/viewbackgroundshape.hxx index 4b9908dede0b..eac2b68153c5 100644 --- a/slideshow/source/engine/shapes/viewbackgroundshape.hxx +++ b/slideshow/source/engine/shapes/viewbackgroundshape.hxx @@ -22,10 +22,10 @@ #include <com/sun/star/uno/Reference.hxx> #include <com/sun/star/rendering/XBitmap.hpp> +#include <com/sun/star/rendering/XCanvas.hpp> #include <basegfx/range/b2drectangle.hxx> #include <basegfx/matrix/b2dhommatrix.hxx> -#include <cppcanvas/spritecanvas.hxx> #include <boost/shared_ptr.hpp> #include <boost/utility.hpp> @@ -68,8 +68,8 @@ namespace slideshow private: /** Prefetch bitmap for given canvas */ - bool prefetch( const ::cppcanvas::CanvasSharedPtr& rDestinationCanvas, - const GDIMetaFileSharedPtr& rMtf ) const; + bool prefetch( const css::uno::Reference< css::rendering::XCanvas >& rDestinationCanvas, + const GDIMetaFileSharedPtr& rMtf ) const; /** The view layer this object is part of. */ diff --git a/slideshow/source/engine/shapes/viewmediashape.cxx b/slideshow/source/engine/shapes/viewmediashape.cxx index b788a0ff6274..2e6f8bc011b5 100644 --- a/slideshow/source/engine/shapes/viewmediashape.cxx +++ b/slideshow/source/engine/shapes/viewmediashape.cxx @@ -41,8 +41,6 @@ #include <basegfx/polygon/b2dpolygontools.hxx> #include <basegfx/range/b2irange.hxx> #include <canvas/canvastools.hxx> -#include <cppcanvas/vclfactory.hxx> -#include <cppcanvas/basegfxfactory.hxx> #include <avmedia/mediawindow.hxx> #include <com/sun/star/media/XManager.hpp> @@ -81,7 +79,7 @@ namespace slideshow { ENSURE_OR_THROW( mxShape.is(), "ViewMediaShape::ViewMediaShape(): Invalid Shape" ); ENSURE_OR_THROW( mpViewLayer, "ViewMediaShape::ViewMediaShape(): Invalid View" ); - ENSURE_OR_THROW( mpViewLayer->getCanvas(), "ViewMediaShape::ViewMediaShape(): Invalid ViewLayer canvas" ); + ENSURE_OR_THROW( mpViewLayer->getCanvas().is(), "ViewMediaShape::ViewMediaShape(): Invalid ViewLayer canvas" ); ENSURE_OR_THROW( mxComponentContext.is(), "ViewMediaShape::ViewMediaShape(): Invalid component context" ); UnoViewSharedPtr pUnoView (::boost::dynamic_pointer_cast<UnoView>(rViewLayer)); @@ -179,9 +177,9 @@ namespace slideshow bool ViewMediaShape::render( const ::basegfx::B2DRectangle& rBounds ) const { - ::cppcanvas::CanvasSharedPtr pCanvas = mpViewLayer->getCanvas(); + css::uno::Reference< css::rendering::XCanvas > pCanvas = mpViewLayer->getCanvas(); - if( !pCanvas ) + if( !pCanvas.is() ) return false; if( !mpMediaWindow.get() && !mxPlayerWindow.is() ) @@ -193,10 +191,11 @@ namespace slideshow avmedia::MediaWindow::getAudioLogo() : avmedia::MediaWindow::getEmptyLogo() ); uno::Reference< rendering::XBitmap > xBitmap(vcl::unotools::xBitmapFromBitmapEx( - pCanvas->getUNOCanvas()->getDevice(), aAudioLogo)); + pCanvas->getDevice(), aAudioLogo)); rendering::ViewState aViewState; - aViewState.AffineTransform = pCanvas->getViewState().AffineTransform; + // TODO-NYI + //aViewState.AffineTransform = pCanvas->getViewState().AffineTransform; rendering::RenderState aRenderState; ::canvas::tools::initRenderState( aRenderState ); @@ -209,9 +208,9 @@ namespace slideshow aScale, rBounds.getMinimum())); ::canvas::tools::setRenderStateTransform( aRenderState, aTranslation ); - pCanvas->getUNOCanvas()->drawBitmap( xBitmap, - aViewState, - aRenderState ); + pCanvas->drawBitmap( xBitmap, + aViewState, + aRenderState ); } return true; @@ -221,15 +220,15 @@ namespace slideshow { maBounds = rNewBounds; - ::cppcanvas::CanvasSharedPtr pCanvas = mpViewLayer->getCanvas(); + css::uno::Reference< css::rendering::XCanvas > pCanvas = mpViewLayer->getCanvas(); - if( !pCanvas ) + if( !pCanvas.is() ) return false; if( !mxPlayerWindow.is() ) return true; - uno::Reference< beans::XPropertySet > xPropSet( pCanvas->getUNOCanvas()->getDevice(), + uno::Reference< beans::XPropertySet > xPropSet( pCanvas->getDevice(), uno::UNO_QUERY ); uno::Reference< awt::XWindow > xParentWindow; @@ -284,10 +283,10 @@ namespace slideshow { if( !mxPlayer.is() && mxShape.is() ) { - ENSURE_OR_RETURN_FALSE( mpViewLayer->getCanvas(), - "ViewMediaShape::update(): Invalid layer canvas" ); + ENSURE_OR_RETURN_FALSE( mpViewLayer->getCanvas().is(), + "ViewMediaShape::update(): Invalid layer canvas" ); - uno::Reference< rendering::XCanvas > xCanvas( mpViewLayer->getCanvas()->getUNOCanvas() ); + uno::Reference< rendering::XCanvas > xCanvas( mpViewLayer->getCanvas() ); if( xCanvas.is() ) { diff --git a/slideshow/source/engine/shapes/viewshape.cxx b/slideshow/source/engine/shapes/viewshape.cxx index 1f92acd9c5f5..e3d857953c5e 100644 --- a/slideshow/source/engine/shapes/viewshape.cxx +++ b/slideshow/source/engine/shapes/viewshape.cxx @@ -41,8 +41,6 @@ #include <canvas/verbosetrace.hxx> #include <canvas/canvastools.hxx> -#include <cppcanvas/vclfactory.hxx> -#include <cppcanvas/basegfxfactory.hxx> #include <drawinglayer/processor2d/canvasprocessor2d.hxx> #include "viewshape.hxx" @@ -62,16 +60,14 @@ namespace slideshow // char rotation etc.). Do that via mtf argument at this object bool ViewShape::prefetch( RendererCacheEntry& io_rCacheEntry, - const ::cppcanvas::CanvasSharedPtr& rDestinationCanvas, - const GDIMetaFileSharedPtr& rMtf, - const ShapeAttributeLayerSharedPtr& rAttr ) const + const css::uno::Reference< css::rendering::XCanvas >& rDestinationCanvas, + const ShapeAttributeLayerSharedPtr& ) const { - ENSURE_OR_RETURN_FALSE( rMtf, - "ViewShape::prefetch(): no valid metafile!" ); - - if( rMtf != io_rCacheEntry.mpMtf || - rDestinationCanvas != io_rCacheEntry.getDestinationCanvas() ) + if( rDestinationCanvas != io_rCacheEntry.getDestinationCanvas() ) { +#if 0 + // TODO-NYI + // buffered renderer invalid, re-create ::cppcanvas::Renderer::Parameters aParms; @@ -175,27 +171,23 @@ namespace slideshow io_rCacheEntry.mpLastBitmapCanvas.reset(); io_rCacheEntry.mpLastBitmap.reset(); } +#endif } - return static_cast< bool >(io_rCacheEntry.mpRenderer); + //return static_cast< bool >(io_rCacheEntry.mpRenderer); + return false; } - 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, - const ::basegfx::B2DPolyPolygon* pClip, - const VectorOfDocTreeNodes& rSubsets ) const + bool ViewShape::draw( const uno::Reference<rendering::XCanvas>& rDestinationCanvas, + const uno::Reference<drawing::XShape>& , + const uno::Reference<drawing::XDrawPage>& xPage, + const uno::Sequence< + uno::Reference<graphic::XPrimitive2D> >& xPrimitives, + const ShapeAttributeLayerSharedPtr& , + const ::basegfx::B2DHomMatrix& rTransform, + const ::basegfx::B2DPolyPolygon* , + const VectorOfDocTreeNodes& ) const { - ::cppcanvas::RendererSharedPtr pRenderer( - getRenderer( rDestinationCanvas, rMtf, rAttr ) ); - - ENSURE_OR_RETURN_FALSE( pRenderer, "ViewShape::draw(): Invalid renderer" ); - - pRenderer->setTransformation( rTransform ); #if OSL_DEBUG_LEVEL >= 2 rendering::RenderState aRenderState; ::canvas::tools::initRenderState(aRenderState); @@ -209,14 +201,17 @@ namespace slideshow try { - rDestinationCanvas->getUNOCanvas()->drawLine( geometry::RealPoint2D(0.0,0.0), - geometry::RealPoint2D(1.0,1.0), - rDestinationCanvas->getViewState(), - aRenderState ); - rDestinationCanvas->getUNOCanvas()->drawLine( geometry::RealPoint2D(1.0,0.0), - geometry::RealPoint2D(0.0,1.0), - rDestinationCanvas->getViewState(), - aRenderState ); +#if 0 + // TODO-NYI + rDestinationCanvas->drawLine( geometry::RealPoint2D(0.0,0.0), + geometry::RealPoint2D(1.0,1.0), + rDestinationCanvas->getViewState(), + aRenderState ); + rDestinationCanvas->drawLine( geometry::RealPoint2D(1.0,0.0), + geometry::RealPoint2D(0.0,1.0), + rDestinationCanvas->getViewState(), + aRenderState ); +#endif } catch( uno::Exception& ) { @@ -232,7 +227,7 @@ namespace slideshow drawinglayer::processor2d::CanvasProcessor2D aProcessor( aViewInfo, - rDestinationCanvas->getUNOCanvas()); + rDestinationCanvas); aProcessor.process(xPrimitives); @@ -269,7 +264,9 @@ namespace slideshow // add antialiasing border around the shape (AA // touches pixel _outside_ the nominal bound rect) - aBoundsPixel.grow( ::cppcanvas::Canvas::ANTIALIASING_EXTRA_SIZE ); + + // TODO-NYI - make this canvas-dependent! + //aBoundsPixel.grow( ::cppcanvas::Canvas::ANTIALIASING_EXTRA_SIZE ); return aBoundsPixel; } @@ -289,19 +286,19 @@ namespace slideshow } } - bool ViewShape::renderSprite( const ViewLayerSharedPtr& rViewLayer, + 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, - const ::basegfx::B2DRectangle& rUnitBounds, - int nUpdateFlags, - const ShapeAttributeLayerSharedPtr& pAttr, - const VectorOfDocTreeNodes& rSubsets, - double nPrio, - bool bIsVisible ) const + const uno::Sequence<uno::Reference< + graphic::XPrimitive2D> >& xPrimitives, + const ::basegfx::B2DRectangle& rOrigBounds, + const ::basegfx::B2DRectangle& rBounds, + const ::basegfx::B2DRectangle& rUnitBounds, + int nUpdateFlags, + const ShapeAttributeLayerSharedPtr& pAttr, + const VectorOfDocTreeNodes& rSubsets, + double nPrio, + bool bIsVisible ) const { // TODO(P1): For multiple views, it might pay off to reorg Shape and ViewShape, // in that all the common setup steps here are refactored to Shape (would then @@ -408,12 +405,18 @@ namespace slideshow const ::basegfx::B2DSize& rSpriteCorrectionOffset( rSpriteBoundsPixel.getMinimum() - rNominalShapeBoundsPixel.getMinimum() ); +#if 0 + // TODO-NYI - make this canvas-dependent! + // offset added top, left for anti-aliasing (otherwise, // shapes fully filling the sprite will have anti-aliased // pixel cut off) const ::basegfx::B2DSize aAAOffset( ::cppcanvas::Canvas::ANTIALIASING_EXTRA_SIZE, ::cppcanvas::Canvas::ANTIALIASING_EXTRA_SIZE ); +#else + const ::basegfx::B2DSize aAAOffset(2,2); +#endif // set pixel output offset to sprite: we always leave // ANTIALIASING_EXTRA_SIZE room atop and to the left, and, @@ -464,12 +467,16 @@ namespace slideshow aViewTransform.set( 0, 2, 0.0 ); aViewTransform.set( 1, 2, 0.0 ); +#if 0 + // TODO-NYI make this canvas-dependent! + // make the clip 2*ANTIALIASING_EXTRA_SIZE larger // such that it's again centered over the sprite. aViewTransform.scale(rSpriteSizePixel.getX()/ (rSpriteSizePixel.getX()-2*::cppcanvas::Canvas::ANTIALIASING_EXTRA_SIZE), rSpriteSizePixel.getY()/ (rSpriteSizePixel.getY()-2*::cppcanvas::Canvas::ANTIALIASING_EXTRA_SIZE)); +#endif // transform clip polygon from view to device // coordinate space @@ -501,30 +508,29 @@ namespace slideshow // sprite needs repaint - output to sprite canvas // ============================================== - ::cppcanvas::CanvasSharedPtr pContentCanvas( mpSprite->getContentCanvas() ); + css::uno::Reference< css::rendering::XCanvas > pContentCanvas( mpSprite->getContentCanvas() ); return draw( pContentCanvas, xShape, xPage, xPrimitives, - rMtf, pAttr, aShapeTransformation, NULL, // clipping is done via Sprite::clip() rSubsets ); } - 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, - int nUpdateFlags, - const ShapeAttributeLayerSharedPtr& pAttr, - const VectorOfDocTreeNodes& rSubsets, - bool bIsVisible ) const + bool ViewShape::render( const uno::Reference<rendering::XCanvas >& rDestinationCanvas, + const uno::Reference<drawing::XShape>& xShape, + const uno::Reference<drawing::XDrawPage>& xPage, + const uno::Sequence<uno::Reference< + graphic::XPrimitive2D> >& xPrimitives, + const ::basegfx::B2DRectangle& rBounds, + const ::basegfx::B2DRectangle& , + int nUpdateFlags, + const ShapeAttributeLayerSharedPtr& pAttr, + const VectorOfDocTreeNodes& rSubsets, + bool bIsVisible ) const { // TODO(P1): For multiple views, it might pay off to reorg Shape and ViewShape, // in that all the common setup steps here are refactored to Shape (would then @@ -578,6 +584,11 @@ namespace slideshow // a temp bitmap, and then to screen (this would have // been much easier if we'd be currently a sprite - // see above) + + // TODO-NYI - scratch that. either use drawing layer + // primitive, or make transparency groups a canvas op + // in the first place +#if 0 if( pAttr->isAlphaValid() ) { const double nAlpha( pAttr->getAlpha() ); @@ -626,7 +637,7 @@ namespace slideshow aCompositingSurface->mpLastBitmapCanvas->getSize() != aBmpSize ) { // create a bitmap of appropriate size - ::cppcanvas::BitmapSharedPtr pBitmap( + ::css::uno::Reference< css::rendering::XBitmap > pBitmap( ::cppcanvas::BaseGfxFactory::getInstance().createAlphaBitmap( rDestinationCanvas, aBmpSize ) ); @@ -642,10 +653,10 @@ namespace slideshow // buffer aCompositingSurface iterator content // - said one might get invalidated during // draw() below. - ::cppcanvas::BitmapCanvasSharedPtr pBitmapCanvas( + ::css::uno::Reference< css::rendering::XBitmapCanvas > pBitmapCanvas( aCompositingSurface->mpLastBitmapCanvas ); - ::cppcanvas::BitmapSharedPtr pBitmap( + ::css::uno::Reference< css::rendering::XBitmap > pBitmap( aCompositingSurface->mpLastBitmap); // setup bitmap canvas transformation - @@ -715,6 +726,7 @@ namespace slideshow return true; } } +#endif } // retrieve shape transformation, _with_ shape translation @@ -727,7 +739,6 @@ namespace slideshow xShape, xPage, xPrimitives, - rMtf, pAttr, aTransform, !aClip ? NULL : &(*aClip), @@ -752,7 +763,7 @@ namespace slideshow return mpViewLayer; } - ViewShape::RendererCacheVector::iterator ViewShape::getCacheEntry( const ::cppcanvas::CanvasSharedPtr& rDestinationCanvas ) const + ViewShape::RendererCacheVector::iterator ViewShape::getCacheEntry( const css::uno::Reference< css::rendering::XCanvas >& rDestinationCanvas ) const { // lookup destination canvas - is there already a renderer // created for that target? @@ -763,7 +774,7 @@ namespace slideshow if( (aIter=::std::find_if( maRenderers.begin(), aEnd, ::boost::bind( - ::std::equal_to< ::cppcanvas::CanvasSharedPtr >(), + ::std::equal_to< css::uno::Reference< css::rendering::XCanvas > >(), ::boost::cref( rDestinationCanvas ), ::boost::bind( &RendererCacheEntry::getDestinationCanvas, @@ -791,9 +802,10 @@ namespace slideshow return aIter; } - ::cppcanvas::RendererSharedPtr ViewShape::getRenderer( const ::cppcanvas::CanvasSharedPtr& rDestinationCanvas, - const GDIMetaFileSharedPtr& rMtf, - const ShapeAttributeLayerSharedPtr& rAttr ) const + // TODO-NYI - rename this method + drawinglayer::primitive2d::Primitive2DSequence ViewShape::getRenderer( + const css::uno::Reference< css::rendering::XCanvas >& rDestinationCanvas, + const ShapeAttributeLayerSharedPtr& rAttr ) const { // lookup destination canvas - is there already a renderer // created for that target? @@ -806,15 +818,14 @@ namespace slideshow // detect that) if( prefetch( *aIter, rDestinationCanvas, - rMtf, rAttr ) ) { - return aIter->mpRenderer; + return aIter->mpPrimitiveSequence; } else { // prefetch failed - renderer is invalid - return ::cppcanvas::RendererSharedPtr(); + return drawinglayer::primitive2d::Primitive2DSequence(); } } @@ -827,12 +838,15 @@ namespace slideshow ::basegfx::B2DSize ViewShape::getAntialiasingBorder() const { - ENSURE_OR_THROW( mpViewLayer->getCanvas(), + ENSURE_OR_THROW( mpViewLayer->getCanvas().is(), "ViewShape::getAntialiasingBorder(): Invalid ViewLayer canvas" ); +#if 0 + // TODO-NYI - move this to canvas! const ::basegfx::B2DHomMatrix& rViewTransform( mpViewLayer->getTransformation() ); + // TODO(F1): As a quick shortcut (did not want to invert // whole matrix here), taking only scale components of // view transformation matrix. This will be wrong when @@ -842,6 +856,9 @@ namespace slideshow return ::basegfx::B2DSize( nXBorder, nYBorder ); +#else + return ::basegfx::B2DSize( 1, 1 ); +#endif } bool ViewShape::enterAnimationMode() @@ -861,13 +878,14 @@ namespace slideshow 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 uno::Sequence<uno::Reference< + graphic::XPrimitive2D> >& xPrimitives, const RenderArgs& rArgs, int nUpdateFlags, bool bIsVisible ) const { - ENSURE_OR_RETURN_FALSE( mpViewLayer->getCanvas(), "ViewShape::update(): Invalid layer canvas" ); + ENSURE_OR_RETURN_FALSE( mpViewLayer->getCanvas().is(), + "ViewShape::update(): Invalid layer canvas" ); // Shall we render to a sprite, or to a plain canvas? if( isBackgroundDetached() ) @@ -875,7 +893,6 @@ namespace slideshow xShape, xPage, xPrimitives, - rMtf, rArgs.maOrigBounds, rArgs.maBounds, rArgs.maUnitBounds, @@ -889,7 +906,6 @@ namespace slideshow xShape, xPage, xPrimitives, - rMtf, rArgs.maBounds, rArgs.maUpdateBounds, nUpdateFlags, diff --git a/slideshow/source/engine/shapes/viewshape.hxx b/slideshow/source/engine/shapes/viewshape.hxx index 8a29c46db649..52dea11550d3 100644 --- a/slideshow/source/engine/shapes/viewshape.hxx +++ b/slideshow/source/engine/shapes/viewshape.hxx @@ -20,11 +20,11 @@ #ifndef INCLUDED_SLIDESHOW_VIEWSHAPE_HXX #define INCLUDED_SLIDESHOW_VIEWSHAPE_HXX -#include <cppcanvas/renderer.hxx> -#include <cppcanvas/bitmap.hxx> - #include <basegfx/range/b2drectangle.hxx> #include <basegfx/polygon/b2dpolygon.hxx> +#include <drawinglayer/primitive2d/baseprimitive2d.hxx> + +#include <com/sun/star/rendering/XBitmapCanvas.hpp> #include <boost/shared_ptr.hpp> #include <boost/utility.hpp> @@ -177,9 +177,6 @@ namespace slideshow canvas. This method does not render anything, if the update flags are 0. - @param rMtf - The metafile representation of the shape - @param rArgs Parameter structure, containing all necessary arguments @@ -192,17 +189,13 @@ namespace slideshow @return whether the rendering finished successfully. */ - 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; + bool update( const css::uno::Reference<css::drawing::XShape >& xShape, + const css::uno::Reference<css::drawing::XDrawPage >& xPage, + const css::uno::Sequence<css::uno::Reference< + css::graphic::XPrimitive2D > >& xPrimitives, + const RenderArgs& rArgs, + int nUpdateFlags, + bool bIsVisible ) const; /** Retrieve renderer for given canvas and metafile. @@ -212,33 +205,30 @@ namespace slideshow @return a renderer that renders to the given destination canvas */ - ::cppcanvas::RendererSharedPtr getRenderer( const ::cppcanvas::CanvasSharedPtr& rDestinationCanvas, - const GDIMetaFileSharedPtr& rMtf, - const ShapeAttributeLayerSharedPtr& rAttr ) const; - + drawinglayer::primitive2d::Primitive2DSequence getRenderer( + const css::uno::Reference<css::rendering::XCanvas>& rDestinationCanvas, + const ShapeAttributeLayerSharedPtr& rAttr ) const; private: struct RendererCacheEntry { RendererCacheEntry() : mpDestinationCanvas(), - mpRenderer(), - mpMtf(), + mpPrimitiveSequence(), mpLastBitmap(), mpLastBitmapCanvas() { } - ::cppcanvas::CanvasSharedPtr getDestinationCanvas() const + css::uno::Reference<css::rendering::XCanvas> getDestinationCanvas() const { return mpDestinationCanvas; } - ::cppcanvas::CanvasSharedPtr mpDestinationCanvas; - ::cppcanvas::RendererSharedPtr mpRenderer; - GDIMetaFileSharedPtr mpMtf; - ::cppcanvas::BitmapSharedPtr mpLastBitmap; - ::cppcanvas::BitmapCanvasSharedPtr mpLastBitmapCanvas; + css::uno::Reference<css::rendering::XCanvas> mpDestinationCanvas; + drawinglayer::primitive2d::Primitive2DSequence mpPrimitiveSequence; + ::css::uno::Reference<css::rendering::XBitmap> mpLastBitmap; + ::css::uno::Reference<css::rendering::XBitmapCanvas> mpLastBitmapCanvas; }; typedef ::std::vector< RendererCacheEntry > RendererCacheVector; @@ -246,67 +236,54 @@ namespace slideshow /** Prefetch Renderer for given canvas */ - bool prefetch( RendererCacheEntry& io_rCacheEntry, - const ::cppcanvas::CanvasSharedPtr& rDestinationCanvas, - const GDIMetaFileSharedPtr& rMtf, - const ShapeAttributeLayerSharedPtr& rAttr ) const; + bool prefetch( RendererCacheEntry& io_rCacheEntry, + const css::uno::Reference<css::rendering::XCanvas>& rDestinationCanvas, + const ShapeAttributeLayerSharedPtr& rAttr ) const; /** Draw with prefetched Renderer to stored canvas This method draws prefetched Renderer to its 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, - const ::basegfx::B2DPolyPolygon* pClip, - const VectorOfDocTreeNodes& rSubsets ) const; + bool draw( const css::uno::Reference<css::rendering::XCanvas>& rDestinationCanvas, + const css::uno::Reference<css::drawing::XShape>& xShape, + const css::uno::Reference<css::drawing::XDrawPage>& xPage, + const css::uno::Sequence< css::uno::Reference< + css::graphic::XPrimitive2D > >& xPrimitives, + const ShapeAttributeLayerSharedPtr& rAttr, + const ::basegfx::B2DHomMatrix& rTransform, + const ::basegfx::B2DPolyPolygon* pClip, + const VectorOfDocTreeNodes& rSubsets ) const; /** 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, - const ::basegfx::B2DRectangle& rUnitBounds, - int nUpdateFlags, - const ShapeAttributeLayerSharedPtr& pAttr, - const VectorOfDocTreeNodes& rSubsets, - double nPrio, - bool bIsVisible ) const; + bool renderSprite( const ViewLayerSharedPtr& rViewLayer, + const css::uno::Reference<css::drawing::XShape>& xShape, + const css::uno::Reference<css::drawing::XDrawPage>& xPage, + const css::uno::Sequence<css::uno::Reference< + css::graphic::XPrimitive2D > >& xPrimitives, + const ::basegfx::B2DRectangle& rOrigBounds, + const ::basegfx::B2DRectangle& rBounds, + const ::basegfx::B2DRectangle& rUnitBounds, + int nUpdateFlags, + const ShapeAttributeLayerSharedPtr& pAttr, + const VectorOfDocTreeNodes& rSubsets, + double nPrio, + bool bIsVisible ) const; /** 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, - int nUpdateFlags, - const ShapeAttributeLayerSharedPtr& pAttr, - const VectorOfDocTreeNodes& rSubsets, - bool bIsVisible ) const; + bool render( const css::uno::Reference<css::rendering::XCanvas>& rDestinationCanvas, + const css::uno::Reference<css::drawing::XShape >& xShape, + const css::uno::Reference<css::drawing::XDrawPage >& xPage, + const css::uno::Sequence<css::uno::Reference< + css::graphic::XPrimitive2D > >& xPrimitives, + const ::basegfx::B2DRectangle& rBounds, + const ::basegfx::B2DRectangle& rUpdateBounds, + int nUpdateFlags, + const ShapeAttributeLayerSharedPtr& pAttr, + const VectorOfDocTreeNodes& rSubsets, + bool bIsVisible ) const; /** Calc sprite size in pixel @@ -332,7 +309,8 @@ namespace slideshow the given canvas. The entry might be default-constructed (if newly added) */ - RendererCacheVector::iterator getCacheEntry( const ::cppcanvas::CanvasSharedPtr& rDestinationCanvas ) const; + RendererCacheVector::iterator getCacheEntry( const css::uno::Reference< + css::rendering::XCanvas>& rDestinationCanvas ) const; void invalidateRenderer() const; diff --git a/slideshow/source/engine/slide/layer.hxx b/slideshow/source/engine/slide/layer.hxx index 8bc81218ac16..721ac00bd4fb 100644 --- a/slideshow/source/engine/slide/layer.hxx +++ b/slideshow/source/engine/slide/layer.hxx @@ -21,7 +21,6 @@ #define INCLUDED_SLIDESHOW_LAYER_HXX #include <basegfx/range/b2dpolyrange.hxx> -#include <cppcanvas/spritecanvas.hxx> #include "view.hxx" #include "animatableshape.hxx" diff --git a/slideshow/source/engine/slide/layermanager.cxx b/slideshow/source/engine/slide/layermanager.cxx index bbe45787836f..f6b1e4ad4632 100644 --- a/slideshow/source/engine/slide/layermanager.cxx +++ b/slideshow/source/engine/slide/layermanager.cxx @@ -598,7 +598,7 @@ namespace slideshow class DummyLayer : public ViewLayer { public: - explicit DummyLayer( const ::cppcanvas::CanvasSharedPtr& rCanvas ) : + explicit DummyLayer( const css::uno::Reference< css::rendering::XCanvas >& rCanvas ) : mpCanvas( rCanvas ) { } @@ -608,7 +608,7 @@ namespace slideshow return true; // visible on all views } - virtual ::cppcanvas::CanvasSharedPtr getCanvas() const + virtual css::uno::Reference< css::rendering::XCanvas > getCanvas() const { return mpCanvas; } @@ -623,12 +623,12 @@ namespace slideshow // NOOP } - virtual ::cppcanvas::CustomSpriteSharedPtr createSprite( const ::basegfx::B2DSize& /*rSpriteSizePixel*/, + virtual css::uno::Reference< css::rendering::XCustomSprite > createSprite( const ::basegfx::B2DSize& /*rSpriteSizePixel*/, double /*nSpritePrio*/ ) const { ENSURE_OR_THROW( false, "DummyLayer::createSprite(): This method is not supposed to be called!" ); - return ::cppcanvas::CustomSpriteSharedPtr(); + return css::uno::Reference< css::rendering::XCustomSprite >(); } virtual void setPriority( const basegfx::B1DRange& /*rRange*/ ) @@ -643,7 +643,9 @@ namespace slideshow virtual ::basegfx::B2DHomMatrix getTransformation() const { - return mpCanvas->getTransformation(); + // TODO-NYI + //return mpCanvas->getTransformation(); + return ::basegfx::B2DHomMatrix(); } virtual ::basegfx::B2DHomMatrix getSpriteTransformation() const @@ -664,11 +666,11 @@ namespace slideshow } private: - ::cppcanvas::CanvasSharedPtr mpCanvas; + css::uno::Reference< css::rendering::XCanvas > mpCanvas; }; } - bool LayerManager::renderTo( const ::cppcanvas::CanvasSharedPtr& rTargetCanvas ) const + bool LayerManager::renderTo( const css::uno::Reference< css::rendering::XCanvas >& rTargetCanvas ) const { bool bRet( true ); ViewLayerSharedPtr pTmpLayer( new DummyLayer( rTargetCanvas ) ); diff --git a/slideshow/source/engine/slide/layermanager.hxx b/slideshow/source/engine/slide/layermanager.hxx index ef404f44cb6a..ad868a3bb5dd 100644 --- a/slideshow/source/engine/slide/layermanager.hxx +++ b/slideshow/source/engine/slide/layermanager.hxx @@ -23,8 +23,6 @@ #include <boost/shared_ptr.hpp> #include <boost/noncopyable.hpp> -#include <cppcanvas/spritecanvas.hxx> - #include "unoview.hxx" #include "unoviewcontainer.hxx" #include "attributableshape.hxx" @@ -223,7 +221,7 @@ namespace slideshow @param rTargetCanvas Target canvas to output onto. */ - bool renderTo( const ::cppcanvas::CanvasSharedPtr& rTargetCanvas ) const; + bool renderTo( const css::uno::Reference< css::rendering::XCanvas >& rTargetCanvas ) const; private: /** A hash map which maps the XShape to the corresponding Shape object. diff --git a/slideshow/source/engine/slide/slideimpl.cxx b/slideshow/source/engine/slide/slideimpl.cxx index a39325b04072..7777a6806fa0 100644 --- a/slideshow/source/engine/slide/slideimpl.cxx +++ b/slideshow/source/engine/slide/slideimpl.cxx @@ -22,7 +22,6 @@ #include <canvas/debug.hxx> #include <tools/diagnose_ex.h> #include <canvas/canvastools.hxx> -#include <cppcanvas/basegfxfactory.hxx> #include <basegfx/matrix/b2dhommatrix.hxx> #include <basegfx/point/b2dpoint.hxx> @@ -42,6 +41,7 @@ #include <com/sun/star/animations/XAnimationNodeSupplier.hpp> #include <com/sun/star/animations/XTargetPropertiesCreator.hpp> #include <com/sun/star/drawing/TextAnimationKind.hpp> +#include <com/sun/star/rendering/XBitmapCanvas.hpp> #include <animations/animationnodehelper.hxx> @@ -309,14 +309,16 @@ public: rView->clearAll(); SlideBitmapSharedPtr pBitmap( mrSlide.getCurrentSlideBitmap( rView ) ); - ::cppcanvas::CanvasSharedPtr pCanvas( rView->getCanvas() ); + css::uno::Reference< css::rendering::XCanvas > pCanvas( rView->getCanvas() ); const ::basegfx::B2DHomMatrix aViewTransform( rView->getTransformation() ); const ::basegfx::B2DPoint aOutPosPixel( aViewTransform * ::basegfx::B2DPoint() ); // setup a canvas with device coordinate space, the slide // bitmap already has the correct dimension. - ::cppcanvas::CanvasSharedPtr pDevicePixelCanvas( pCanvas->clone() ); +#if 0 + // TODO-NYI + css::uno::Reference< css::rendering::XCanvas > pDevicePixelCanvas( pCanvas->clone() ); pDevicePixelCanvas->setTransformation( ::basegfx::B2DHomMatrix() ); // render at given output position @@ -326,6 +328,7 @@ public: // transition) pBitmap->clip( ::basegfx::B2DPolyPolygon() ); pBitmap->draw( pDevicePixelCanvas ); +#endif } private: @@ -745,27 +748,29 @@ bool SlideImpl::isAnimated() SlideBitmapSharedPtr SlideImpl::createCurrentSlideBitmap( const UnoViewSharedPtr& rView, const ::basegfx::B2ISize& rBmpSize ) const { - ENSURE_OR_THROW( rView && rView->getCanvas(), + ENSURE_OR_THROW( rView && rView->getCanvas().is(), "SlideImpl::createCurrentSlideBitmap(): Invalid view" ); ENSURE_OR_THROW( mpLayerManager, "SlideImpl::createCurrentSlideBitmap(): Invalid layer manager" ); ENSURE_OR_THROW( mbShowLoaded, "SlideImpl::createCurrentSlideBitmap(): No show loaded" ); - ::cppcanvas::CanvasSharedPtr pCanvas( rView->getCanvas() ); + uno::Reference< rendering::XCanvas > pCanvas( + rView->getCanvas() ); // create a bitmap of appropriate size - ::cppcanvas::BitmapSharedPtr pBitmap( - ::cppcanvas::BaseGfxFactory::getInstance().createBitmap( - pCanvas, - rBmpSize ) ); + uno::Reference< rendering::XBitmap > pBitmap( + pCanvas->getDevice()->createCompatibleBitmap( + geometry::IntegerSize2D( + rBmpSize.getX(), rBmpSize.getY())) ); - ENSURE_OR_THROW( pBitmap, + ENSURE_OR_THROW( pBitmap.is(), "SlideImpl::createCurrentSlideBitmap(): Cannot create page bitmap" ); - ::cppcanvas::BitmapCanvasSharedPtr pBitmapCanvas( pBitmap->getBitmapCanvas() ); + uno::Reference< rendering::XBitmapCanvas > pBitmapCanvas( + pBitmap, uno::UNO_QUERY_THROW ); - ENSURE_OR_THROW( pBitmapCanvas, + ENSURE_OR_THROW( pBitmapCanvas.is(), "SlideImpl::createCurrentSlideBitmap(): Cannot create page bitmap canvas" ); // apply linear part of destination canvas transformation (linear means in this context: @@ -773,10 +778,17 @@ SlideBitmapSharedPtr SlideImpl::createCurrentSlideBitmap( const UnoViewSharedPtr ::basegfx::B2DHomMatrix aLinearTransform( rView->getTransformation() ); aLinearTransform.set( 0, 2, 0.0 ); aLinearTransform.set( 1, 2, 0.0 ); +#if 0 + // TODO-NYI pBitmapCanvas->setTransformation( aLinearTransform ); + // clear to white + pBitmapCanvas->fill( + ::basegfx::BColor(1.0,1.0,1.0).colorToDoubleSequence( + pBitmapCanvas->getDevice()) ); +#endif + // output all shapes to bitmap - initSlideBackground( pBitmapCanvas, rBmpSize ); mpLayerManager->renderTo( pBitmapCanvas ); return SlideBitmapSharedPtr( new SlideBitmap( pBitmap ) ); diff --git a/slideshow/source/engine/slide/userpaintoverlay.cxx b/slideshow/source/engine/slide/userpaintoverlay.cxx index 86341488107f..788a9bd28cf4 100644 --- a/slideshow/source/engine/slide/userpaintoverlay.cxx +++ b/slideshow/source/engine/slide/userpaintoverlay.cxx @@ -28,7 +28,8 @@ #include <basegfx/point/b2dpoint.hxx> #include <basegfx/polygon/b2dpolygon.hxx> -#include <cppcanvas/basegfxfactory.hxx> +#include <basegfx/matrix/b2dhommatrix.hxx> +#include <basegfx/tools/canvastools.hxx> #include "activity.hxx" #include "slideshowcontext.hxx" @@ -144,14 +145,16 @@ namespace slideshow //get via SlideImpl instance the bitmap of the slide unmodified to redraw it SlideBitmapSharedPtr pBitmap( mrSlide.getCurrentSlideBitmap( (*aIter) ) ); - ::cppcanvas::CanvasSharedPtr pCanvas( (*aIter)->getCanvas() ); + css::uno::Reference< css::rendering::XCanvas > pCanvas( (*aIter)->getCanvas() ); const ::basegfx::B2DHomMatrix aViewTransform( (*aIter)->getTransformation() ); const ::basegfx::B2DPoint aOutPosPixel( aViewTransform * ::basegfx::B2DPoint() ); +#if 0 + // TODO-NYI // setup a canvas with device coordinate space, the slide // bitmap already has the correct dimension. - ::cppcanvas::CanvasSharedPtr pDevicePixelCanvas( pCanvas->clone() ); + css::uno::Reference< css::rendering::XCanvas > pDevicePixelCanvas( pCanvas->clone() ); pDevicePixelCanvas->setTransformation( ::basegfx::B2DHomMatrix() ); @@ -162,6 +165,7 @@ namespace slideshow // transition) pBitmap->clip( ::basegfx::B2DPolyPolygon() ); pBitmap->draw( pDevicePixelCanvas ); +#endif mrScreenUpdater.notifyUpdate(*aIter,true); } @@ -223,7 +227,8 @@ namespace slideshow aIter!=aEnd; ++aIter ) { - (*aIter)->draw(); + // TODO-NYI + //(*aIter)->draw(); } // screen update necessary to show painting mrScreenUpdater.notifyUpdate(); @@ -362,21 +367,23 @@ namespace slideshow //The point is to redraw the LastPoint the way it was originally on the bitmap, //of the slide - for( UnoViewVector::iterator aIter=maViews.begin(), aEnd=maViews.end(); - aIter!=aEnd; - ++aIter ) + for( UnoViewVector::iterator aIter=maViews.begin(), aEnd=maViews.end(); + aIter!=aEnd; + ++aIter ) { //get via SlideImpl instance the bitmap of the slide unmodified to redraw it - SlideBitmapSharedPtr pBitmap( mrSlide.getCurrentSlideBitmap( (*aIter) ) ); - ::cppcanvas::CanvasSharedPtr pCanvas( (*aIter)->getCanvas() ); + SlideBitmapSharedPtr pBitmap( mrSlide.getCurrentSlideBitmap( (*aIter) ) ); + css::uno::Reference< css::rendering::XCanvas > pCanvas( (*aIter)->getCanvas() ); - ::basegfx::B2DHomMatrix aViewTransform( (*aIter)->getTransformation() ); - const ::basegfx::B2DPoint aOutPosPixel( aViewTransform * ::basegfx::B2DPoint() ); + ::basegfx::B2DHomMatrix aViewTransform( (*aIter)->getTransformation() ); + const ::basegfx::B2DPoint aOutPosPixel( aViewTransform * ::basegfx::B2DPoint() ); +#if 0 + // TODO-NYI // setup a canvas with device coordinate space, the slide // bitmap already has the correct dimension. - ::cppcanvas::CanvasSharedPtr pDevicePixelCanvas( pCanvas->clone() ); + css::uno::Reference< css::rendering::XCanvas > pDevicePixelCanvas( pCanvas->clone() ); pDevicePixelCanvas->setTransformation( ::basegfx::B2DHomMatrix() ); @@ -389,11 +396,10 @@ namespace slideshow // set clip so that we just redraw a part of the canvas pBitmap->clip(aPolyPoly); pBitmap->draw( pDevicePixelCanvas ); - +#endif mrScreenUpdater.notifyUpdate(*aIter,true); } - - } + } else { if( !mbIsLastPointValid ) @@ -417,15 +423,19 @@ namespace slideshow aIter!=aEnd; ++aIter ) { - ::cppcanvas::PolyPolygonSharedPtr pPolyPoly( - ::cppcanvas::BaseGfxFactory::getInstance().createPolyPolygon( (*aIter)->getCanvas(), - aPoly ) ); + uno::Reference< rendering::XPolyPolygon2D > pPolyPoly( + basegfx::unotools::xPolyPolygonFromB2DPolygon( + (*aIter)->getCanvas()->getDevice(), + aPoly ) ); - if( pPolyPoly ) + if( pPolyPoly.is() ) { +#if 0 + // TODO-NYI pPolyPoly->setStrokeWidth(mnStrokeWidth); pPolyPoly->setRGBALineColor( maStrokeColor.getIntegerColor() ); pPolyPoly->draw(); +#endif maPolygons.push_back(pPolyPoly); } } diff --git a/slideshow/source/engine/slide/userpaintoverlay.hxx b/slideshow/source/engine/slide/userpaintoverlay.hxx index fb39ef890b73..68639060cc43 100644 --- a/slideshow/source/engine/slide/userpaintoverlay.hxx +++ b/slideshow/source/engine/slide/userpaintoverlay.hxx @@ -40,7 +40,7 @@ namespace slideshow class PaintOverlayHandler; typedef ::boost::shared_ptr< class UserPaintOverlay > UserPaintOverlaySharedPtr; - typedef ::std::vector< ::cppcanvas::PolyPolygonSharedPtr> PolyPolygonVector; + /** Slide overlay, which can be painted into by the user. This class registers itself at the EventMultiplexer, diff --git a/slideshow/source/engine/slidebitmap.cxx b/slideshow/source/engine/slidebitmap.cxx index 998f4d1c764b..df9a39b6d7f5 100644 --- a/slideshow/source/engine/slidebitmap.cxx +++ b/slideshow/source/engine/slidebitmap.cxx @@ -42,26 +42,24 @@ namespace slideshow namespace internal { - SlideBitmap::SlideBitmap( const ::cppcanvas::BitmapSharedPtr& rBitmap ) : + SlideBitmap::SlideBitmap( const ::css::uno::Reference< css::rendering::XBitmap >& rBitmap ) : maOutputPos(), maClipPoly(), - mxBitmap() + mxBitmap(rBitmap) { - if( rBitmap ) - mxBitmap = rBitmap->getUNOBitmap(); - ENSURE_OR_THROW( mxBitmap.is(), "SlideBitmap::SlideBitmap(): Invalid bitmap" ); } - bool SlideBitmap::draw( const ::cppcanvas::CanvasSharedPtr& rCanvas ) const + bool SlideBitmap::draw( const css::uno::Reference< css::rendering::XCanvas >& rCanvas ) const { - ENSURE_OR_RETURN_FALSE( rCanvas && rCanvas->getUNOCanvas().is(), - "SlideBitmap::draw(): Invalid canvas" ); + ENSURE_OR_RETURN_FALSE( rCanvas.is(), + "SlideBitmap::draw(): Invalid canvas" ); // selectively only copy the transformation from current viewstate, // don't want no clipping here. rendering::ViewState aViewState; - aViewState.AffineTransform = rCanvas->getViewState().AffineTransform; + // TODO-NYI + //aViewState.AffineTransform = rCanvas->getViewState().AffineTransform; rendering::RenderState aRenderState; ::canvas::tools::initRenderState( aRenderState ); @@ -76,13 +74,13 @@ namespace slideshow // TODO(P1): Buffer the clip polygon aRenderState.Clip = ::basegfx::unotools::xPolyPolygonFromB2DPolyPolygon( - rCanvas->getUNOCanvas()->getDevice(), + rCanvas->getDevice(), maClipPoly ); } - rCanvas->getUNOCanvas()->drawBitmap( mxBitmap, - aViewState, - aRenderState ); + rCanvas->drawBitmap( mxBitmap, + aViewState, + aRenderState ); } catch( uno::Exception& ) { diff --git a/slideshow/source/engine/slideshowimpl.cxx b/slideshow/source/engine/slideshowimpl.cxx index b1fc0b175326..22c9f14c0348 100644 --- a/slideshow/source/engine/slideshowimpl.cxx +++ b/slideshow/source/engine/slideshowimpl.cxx @@ -36,10 +36,6 @@ #include <comphelper/servicedecl.hxx> #include <comphelper/namecontainer.hxx> -#include <cppcanvas/spritecanvas.hxx> -#include <cppcanvas/vclfactory.hxx> -#include <cppcanvas/basegfxfactory.hxx> - #include <tools/debug.hxx> #include <basegfx/point/b2dpoint.hxx> @@ -206,8 +202,6 @@ private: typedef cppu::WeakComponentImplHelper1<presentation::XSlideShow> SlideShowImplBase; -typedef ::std::vector< ::cppcanvas::PolyPolygonSharedPtr> PolyPolygonVector; - /// Maps XDrawPage for annotations persistence typedef ::std::map< ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XDrawPage>, @@ -1466,7 +1460,7 @@ void SlideShowImpl::registerUserPaintPolygons( const uno::Reference< lang::XMult PolygonMap::iterator aIter=maPolygons.begin(); PolyPolygonVector aPolygons; - ::cppcanvas::PolyPolygonSharedPtr pPolyPoly; + uno::Reference<rendering::XPolyPolygon2D> pPolyPoly; ::basegfx::B2DPolyPolygon b2DPolyPoly; //Register polygons for each slide @@ -1481,7 +1475,8 @@ void SlideShowImpl::registerUserPaintPolygons( const uno::Reference< lang::XMult aIterPoly!=aEnd; ++aIterPoly ) { pPolyPoly = (*aIterPoly); - b2DPolyPoly = ::basegfx::unotools::b2DPolyPolygonFromXPolyPolygon2D(pPolyPoly->getUNOPolyPolygon()); + b2DPolyPoly = ::basegfx::unotools::b2DPolyPolygonFromXPolyPolygon2D( + pPolyPoly); //Normally there is only one polygon for(sal_uInt32 i=0; i< b2DPolyPoly.count();i++) @@ -1533,15 +1528,19 @@ void SlideShowImpl::registerUserPaintPolygons( const uno::Reference< lang::XMult aXPropSet->setPropertyValue("LineStyle", aAny ); //LineColor - sal_uInt32 nLineColor; - nLineColor = pPolyPoly->getRGBALineColor(); + // TODO-NYI + //sal_uInt32 nLineColor; + // TODO-NYI + // nLineColor = pPolyPoly->getRGBALineColor(); //Transform polygon color from RRGGBBAA to AARRGGBB - aAny <<= RGBAColor2UnoColor(nLineColor); + // TODO-NYI + //aAny <<= RGBAColor2UnoColor(nLineColor); aXPropSet->setPropertyValue("LineColor", aAny ); //LineWidth - double fLineWidth; - fLineWidth = pPolyPoly->getStrokeWidth(); + double fLineWidth(0); + // TODO-NYI + // fLineWidth = pPolyPoly->getStrokeWidth(); aAny <<= (sal_Int32)fLineWidth; aXPropSet->setPropertyValue("LineWidth", aAny ); diff --git a/slideshow/source/engine/slideview.cxx b/slideshow/source/engine/slideview.cxx index 2d2c42153318..2dc354d61620 100644 --- a/slideshow/source/engine/slideview.cxx +++ b/slideshow/source/engine/slideview.cxx @@ -34,16 +34,12 @@ #include <cppuhelper/interfacecontainer.h> #include <comphelper/make_shared_from_uno.hxx> -#include <cppcanvas/spritecanvas.hxx> -#include <cppcanvas/customsprite.hxx> -#include <cppcanvas/vclfactory.hxx> -#include <cppcanvas/basegfxfactory.hxx> - #include <tools/debug.hxx> #include <basegfx/range/b1drange.hxx> #include <basegfx/range/b2drange.hxx> #include <basegfx/range/b2irange.hxx> +#include <basegfx/vector/b2dsize.hxx> #include <basegfx/point/b2dpoint.hxx> #include <basegfx/polygon/b2dpolygon.hxx> #include <basegfx/matrix/b2dhommatrix.hxx> @@ -85,8 +81,8 @@ struct StaticUnitRectPoly : public rtl::StaticWithInit<basegfx::B2DPolygon, Stat */ struct SpriteEntry { - SpriteEntry( const cppcanvas::CustomSpriteSharedPtr& rSprite, - double nPrio ) : + SpriteEntry( const uno::Reference<rendering::XCustomSprite>& rSprite, + double nPrio ) : mpSprite( rSprite ), mnPriority( nPrio ) { @@ -97,8 +93,8 @@ struct SpriteEntry return mnPriority < rRHS.mnPriority; } - boost::weak_ptr< cppcanvas::CustomSprite > mpSprite; - double mnPriority; + uno::WeakReference< rendering::XCustomSprite > mpSprite; + double mnPriority; }; typedef std::vector< SpriteEntry > SpriteVector; @@ -119,9 +115,9 @@ typedef std::vector< SpriteEntry > SpriteVector; @return the view clip polygon, in view coordinates, which is guaranteed to at least clip to the view size. */ -basegfx::B2DPolyPolygon createClipPolygon( const basegfx::B2DPolyPolygon& rClip, - const cppcanvas::CanvasSharedPtr& /*rCanvas*/, - const basegfx::B2DSize& rUserSize ) +basegfx::B2DPolyPolygon createClipPolygon( const basegfx::B2DPolyPolygon& rClip, + const uno::Reference<rendering::XCanvas>& /*rCanvas*/, + const basegfx::B2DSize& rUserSize ) { // setup canvas clipping // ===================== @@ -166,33 +162,36 @@ basegfx::B2DPolyPolygon prepareClip( const basegfx::B2DPolyPolygon& rClip ) } -void clearRect( ::cppcanvas::CanvasSharedPtr const& pCanvas, - basegfx::B2IRange const& rArea ) +void clearRect( const basegfx::B2IRange& ) { +#if 0 + // TODO-NYI + pCanvas = getCanvas(); ... + // convert clip polygon to device coordinate system ::basegfx::B2DPolyPolygon const* pClipPoly( pCanvas->getClip() ); if( pClipPoly ) { ::basegfx::B2DPolyPolygon aClipPoly( *pClipPoly ); aClipPoly.transform( pCanvas->getTransformation() ); - pCanvas->setClip( aClipPoly ); + // TODO-NYI + //pCanvas->setClip( aClipPoly ); } // set transformation to identitiy (->device pixel) - pCanvas->setTransformation( ::basegfx::B2DHomMatrix() ); + // TODO-NYI + //pCanvas->setTransformation( ::basegfx::B2DHomMatrix() ); // #i42440# Fill the _full_ background in // black. Since we had to extend the bitmap by one // pixel, and the bitmap is initialized white, // depending on the slide content a one pixel wide // line will show to the bottom and the right. - const ::basegfx::B2DPolygon aPoly( - ::basegfx::tools::createPolygonFromRect( - basegfx::B2DRange(rArea))); - - ::cppcanvas::PolyPolygonSharedPtr pPolyPoly( - ::cppcanvas::BaseGfxFactory::getInstance().createPolyPolygon( pCanvas, - aPoly ) ); + uno::Reference<rendering::XPolyPolygon> pPolyPoly( + basegfx::unotools::xPolyPolygonFromB2DPolygon( + pCanvas->getDevice(), + basegfx::tools::createPolygonFromRect( + basegfx::B2DRange(rArea))) ); if( pPolyPoly ) { @@ -200,9 +199,11 @@ void clearRect( ::cppcanvas::CanvasSharedPtr const& pCanvas, pPolyPoly->setRGBAFillColor( 0xFFFFFF00U ); pPolyPoly->draw(); } +#endif #if OSL_DEBUG_LEVEL >= 2 && defined(DBG_UTIL) - ::cppcanvas::CanvasSharedPtr pCliplessCanvas( pCanvas->clone() ); + // TODO-NYI + uno::Reference<rendering::XCanvas> pCliplessCanvas( pCanvas->clone() ); pCliplessCanvas->setClip(); if( pCanvas->getClip() ) @@ -302,9 +303,8 @@ class LayerSpriteContainer const SpriteVector::iterator aEnd( maSprites.end() ); while( aCurrSprite != aEnd ) { - cppcanvas::CustomSpriteSharedPtr pCurrSprite( aCurrSprite->mpSprite.lock() ); - - if( pCurrSprite ) + uno::Reference<rendering::XCustomSprite> pCurrSprite( aCurrSprite->mpSprite ); + if( pCurrSprite.is() ) { // only copy still valid sprites over to the refreshed // sprite vector. @@ -344,10 +344,10 @@ public: } } - void addSprite( const cppcanvas::CustomSpriteSharedPtr& pSprite, - double nPriority ) + void addSprite( const uno::Reference<rendering::XCustomSprite>& pSprite, + double nPriority ) { - if( !pSprite ) + if( !pSprite.is() ) return; SpriteEntry aEntry( pSprite,nPriority ); @@ -423,15 +423,15 @@ class SlideViewLayer : public ViewLayer, basegfx::B2DHomMatrix maTransformation; /// 'parent' canvas, this viewlayer is associated with - const cppcanvas::SpriteCanvasSharedPtr mpSpriteCanvas; + const uno::Reference<rendering::XSpriteCanvas> mpSpriteCanvas; /** output surface (necessarily a sprite, won't otherwise be able to display anything <em>before</em> other sprites) */ - mutable cppcanvas::CustomSpriteSharedPtr mpSprite; + mutable uno::Reference<rendering::XCustomSprite> mpSprite; /// actual output canvas retrieved from a sprite - mutable cppcanvas::CanvasSharedPtr mpOutputCanvas; + mutable uno::Reference<rendering::XCanvas> mpOutputCanvas; /// ptr back to owning view. needed for isOnView() method View const* const mpParentView; @@ -448,11 +448,11 @@ public: @param rLayerBounds Initial layer bounds, in view coordinate system */ - SlideViewLayer( const cppcanvas::SpriteCanvasSharedPtr& pCanvas, - const basegfx::B2DHomMatrix& rTransform, - const basegfx::B2DRange& rLayerBounds, - const basegfx::B2DSize& rUserSize, - View const* const pParentView) : + SlideViewLayer( const uno::Reference<rendering::XSpriteCanvas>& pCanvas, + const basegfx::B2DHomMatrix& rTransform, + const basegfx::B2DRange& rLayerBounds, + const basegfx::B2DSize& rUserSize, + View const* const pParentView) : maSpriteContainer(), maLayerBounds(rLayerBounds), maLayerBoundsPixel(), @@ -484,8 +484,8 @@ public: if( rNewLayerPixel != maLayerBoundsPixel ) { // re-gen sprite with new size - mpOutputCanvas.reset(); - mpSprite.reset(); + mpOutputCanvas.clear(); + mpSprite.clear(); } } @@ -511,12 +511,14 @@ private: // ViewLayer interface // ---------------------------------------------- - virtual cppcanvas::CustomSpriteSharedPtr createSprite( + virtual uno::Reference<rendering::XCustomSprite> createSprite( const ::basegfx::B2DSize& rSpriteSizePixel, double nPriority ) const { - cppcanvas::CustomSpriteSharedPtr pSprite( - mpSpriteCanvas->createCustomSprite( rSpriteSizePixel ) ); + css::uno::Reference< css::rendering::XCustomSprite > pSprite( + mpSpriteCanvas->createCustomSprite( + ::basegfx::unotools::size2DFromB2DSize( + rSpriteSizePixel) ) ); maSpriteContainer.addSprite( pSprite, nPriority ); @@ -533,7 +535,7 @@ private: maSpriteContainer.setLayerPriority( rRange ); - if( mpSprite ) + if( mpSprite.is() ) mpSprite->setPriority( rRange.getMinimum() ); } @@ -566,27 +568,22 @@ private: virtual void clear() const { - // grab canvas - that also lazy-initializes maLayerBoundsPixel - cppcanvas::CanvasSharedPtr pCanvas=getCanvas()->clone(); - // clear whole canvas const basegfx::B2I64Tuple& rSpriteSize(maLayerBoundsPixel.getRange()); - clearRect(pCanvas, - basegfx::B2IRange(0,0,rSpriteSize.getX(),rSpriteSize.getY())); + clearRect(basegfx::B2IRange(0,0, + rSpriteSize.getX(),rSpriteSize.getY())); } virtual void clearAll() const { - // grab canvas - that also lazy-initializes maLayerBoundsPixel - ::cppcanvas::CanvasSharedPtr pCanvas( getCanvas()->clone() ); - + // TODO-NYI // clear layer clip, to clear whole area - pCanvas->setClip(); + //pCanvas->setClip(); // clear whole canvas const basegfx::B2I64Tuple& rSpriteSize(maLayerBoundsPixel.getRange()); - clearRect(pCanvas, - basegfx::B2IRange(0,0,rSpriteSize.getX(),rSpriteSize.getY())); + clearRect(basegfx::B2IRange(0,0, + rSpriteSize.getX(),rSpriteSize.getY())); } virtual bool isOnView(boost::shared_ptr<View> const& rView) const @@ -594,11 +591,11 @@ private: return rView.get() == mpParentView; } - virtual cppcanvas::CanvasSharedPtr getCanvas() const + virtual uno::Reference<rendering::XCanvas> getCanvas() const { - if( !mpOutputCanvas ) + if( !mpOutputCanvas.is() ) { - if( !mpSprite ) + if( !mpSprite.is() ) { maLayerBoundsPixel = getLayerBoundsPixel(maLayerBounds, maTransformation); @@ -613,8 +610,9 @@ private: const basegfx::B2I64Tuple& rSpriteSize(maLayerBoundsPixel.getRange()); mpSprite = mpSpriteCanvas->createCustomSprite( - basegfx::B2DVector(sal::static_int_cast<sal_Int32>(rSpriteSize.getX()), - sal::static_int_cast<sal_Int32>(rSpriteSize.getY())) ); + geometry::RealSize2D( + sal::static_int_cast<sal_Int32>(rSpriteSize.getX()), + sal::static_int_cast<sal_Int32>(rSpriteSize.getY())) ); mpSprite->setPriority( maSpriteContainer.getLayerPriority().getMinimum() ); @@ -626,28 +624,33 @@ private: mpSprite->setAlpha(0.5); #else +#if 0 + // TODO-NYI mpSprite->movePixel( basegfx::B2DPoint(maLayerBoundsPixel.getMinimum()) ); - +#endif mpSprite->setAlpha(1.0); #endif mpSprite->show(); } - ENSURE_OR_THROW( mpSprite, + ENSURE_OR_THROW( mpSprite.is(), "SlideViewLayer::getCanvas(): no layer sprite" ); mpOutputCanvas = mpSprite->getContentCanvas(); - ENSURE_OR_THROW( mpOutputCanvas, + ENSURE_OR_THROW( mpOutputCanvas.is(), "SlideViewLayer::getCanvas(): sprite doesn't yield a canvas" ); +#if 0 + // TODO-NYI // new canvas retrieved - setup transformation and clip mpOutputCanvas->setTransformation( getTransformation() ); mpOutputCanvas->setClip( createClipPolygon( maClip, mpOutputCanvas, maUserSize )); +#endif } return mpOutputCanvas; @@ -661,11 +664,14 @@ private: { maClip = aNewClip; - if(mpOutputCanvas ) +#if 0 + // TODO-NYI + if(mpOutputCanvas.is()) mpOutputCanvas->setClip( createClipPolygon( maClip, mpOutputCanvas, maUserSize )); +#endif } } @@ -714,8 +720,8 @@ private: virtual bool isOnView(boost::shared_ptr<View> const& rView) const; virtual void clear() const; virtual void clearAll() const; - virtual cppcanvas::CanvasSharedPtr getCanvas() const; - virtual cppcanvas::CustomSpriteSharedPtr createSprite( const ::basegfx::B2DSize& rSpriteSizePixel, + virtual css::uno::Reference<rendering::XCanvas> getCanvas() const; + virtual css::uno::Reference<rendering::XCustomSprite> createSprite( const ::basegfx::B2DSize& rSpriteSizePixel, double nPriority ) const; virtual void setPriority( const basegfx::B1DRange& rRange ); virtual geometry::IntegerSize2D getTranslationOffset() const; @@ -757,7 +763,7 @@ private: enum{ LAYER_ULLAGE=8 }; uno::Reference<presentation::XSlideShowView> mxView; - cppcanvas::SpriteCanvasSharedPtr mpCanvas; + uno::Reference<rendering::XSpriteCanvas> mpCanvas; EventMultiplexer& mrEventMultiplexer; EventQueue& mrEventQueue; @@ -793,10 +799,9 @@ SlideView::SlideView( const uno::Reference<presentation::XSlideShowView>& xView, ENSURE_OR_THROW( mxView.is(), "SlideView::SlideView(): Invalid view" ); - mpCanvas = cppcanvas::VCLFactory::getInstance().createSpriteCanvas( - xView->getCanvas() ); - ENSURE_OR_THROW( mpCanvas, - "Could not create cppcanvas" ); + mpCanvas = xView->getCanvas(); + ENSURE_OR_THROW( mpCanvas.is(), + "Could not obtain Canvas" ); geometry::AffineMatrix2D aViewTransform( xView->getTransformation() ); @@ -827,7 +832,7 @@ void SlideView::disposing() maViewLayers.clear(); maSprites.clear(); - mpCanvas.reset(); + mpCanvas.clear(); // additionally, also de-register from XSlideShowView if (mxView.is()) @@ -842,7 +847,7 @@ ViewLayerSharedPtr SlideView::createViewLayer( const basegfx::B2DRange& rLayerBo { osl::MutexGuard aGuard( m_aMutex ); - ENSURE_OR_THROW( mpCanvas, + ENSURE_OR_THROW( mpCanvas.is(), "SlideView::createViewLayer(): Disposed" ); const std::size_t nNumLayers( maViewLayers.size() ); @@ -886,14 +891,13 @@ void SlideView::clear() const { osl::MutexGuard aGuard( m_aMutex ); - OSL_ENSURE( mxView.is() && mpCanvas, + OSL_ENSURE( mxView.is() && mpCanvas.is(), "SlideView::clear(): Disposed" ); - if( !mxView.is() || !mpCanvas ) + if( !mxView.is() || !mpCanvas.is() ) return; // keep layer clip - clearRect(getCanvas()->clone(), - getLayerBoundsPixel( + clearRect(getLayerBoundsPixel( basegfx::B2DRange(0,0, maUserSize.getX(), maUserSize.getY()), @@ -904,12 +908,12 @@ void SlideView::clearAll() const { osl::MutexGuard aGuard( m_aMutex ); - OSL_ENSURE( mxView.is() && mpCanvas, + OSL_ENSURE( mxView.is() && mpCanvas.is(), "SlideView::clear(): Disposed" ); - if( !mxView.is() || !mpCanvas ) + if( !mxView.is() || !mpCanvas.is() ) return; - mpCanvas->clear(); // this is unnecessary, strictly speaking. but + mpCanvas->erase(); // this is unnecessary, strictly speaking. but // it makes the SlideView behave exactly like a // sprite-based SlideViewLayer, because those // are created from scratch after a resize @@ -939,26 +943,28 @@ bool SlideView::isOnView(boost::shared_ptr<View> const& rView) const return rView.get() == this; } -cppcanvas::CanvasSharedPtr SlideView::getCanvas() const +css::uno::Reference< css::rendering::XCanvas > SlideView::getCanvas() const { osl::MutexGuard aGuard( m_aMutex ); - ENSURE_OR_THROW( mpCanvas, + ENSURE_OR_THROW( mpCanvas.is(), "SlideView::getCanvas(): Disposed" ); return mpCanvas; } -cppcanvas::CustomSpriteSharedPtr SlideView::createSprite( +css::uno::Reference< css::rendering::XCustomSprite > SlideView::createSprite( const basegfx::B2DSize& rSpriteSizePixel, double nPriority ) const { osl::MutexGuard aGuard( m_aMutex ); - ENSURE_OR_THROW( mpCanvas, "SlideView::createSprite(): Disposed" ); + ENSURE_OR_THROW( mpCanvas.is(), "SlideView::createSprite(): Disposed" ); - cppcanvas::CustomSpriteSharedPtr pSprite( - mpCanvas->createCustomSprite( rSpriteSizePixel ) ); + css::uno::Reference< css::rendering::XCustomSprite > pSprite( + mpCanvas->createCustomSprite( + ::basegfx::unotools::size2DFromB2DSize( + rSpriteSizePixel) ) ); maSprites.addSprite( pSprite, nPriority ); @@ -1113,7 +1119,7 @@ void SlideView::windowPaint( const awt::PaintEvent& /*e*/ ) { osl::MutexGuard aGuard( m_aMutex ); - OSL_ENSURE( mxView.is() && mpCanvas, "Disposed, but event received?!" ); + OSL_ENSURE( mxView.is() && mpCanvas.is(), "Disposed, but event received?!" ); // notify view clobbering. Don't call EventMultiplexer directly, // this might not be the main thread! @@ -1125,18 +1131,21 @@ void SlideView::windowPaint( const awt::PaintEvent& /*e*/ ) void SlideView::updateCanvas() { - OSL_ENSURE( mpCanvas, + OSL_ENSURE( mpCanvas.is(), "SlideView::updateCanvasTransform(): Disposed" ); - if( !mpCanvas || !mxView.is()) + if( !mpCanvas.is() || !mxView.is()) return; clearAll(); +#if 0 + // TODO-NYI mpCanvas->setTransformation( getTransformation() ); mpCanvas->setClip( createClipPolygon( maClip, mpCanvas, maUserSize )); +#endif // forward update to viewlayers pruneLayers( true ); @@ -1144,17 +1153,20 @@ void SlideView::updateCanvas() void SlideView::updateClip() { - OSL_ENSURE( mpCanvas, + // TODO-NYI - here and other places, consolidate to ensure_and_return! + OSL_ENSURE( mpCanvas.is(), "SlideView::updateClip(): Disposed" ); - if( !mpCanvas ) + if( !mpCanvas.is() ) return; +#if 0 + // TODO-NYI mpCanvas->setClip( createClipPolygon( maClip, mpCanvas, maUserSize )); - +#endif pruneLayers( false ); } diff --git a/slideshow/source/engine/tools.cxx b/slideshow/source/engine/tools.cxx index fac4bed6e1f5..59865ab41626 100644 --- a/slideshow/source/engine/tools.cxx +++ b/slideshow/source/engine/tools.cxx @@ -39,10 +39,9 @@ #include <basegfx/matrix/b2dhommatrix.hxx> #include <basegfx/numeric/ftools.hxx> #include <basegfx/tools/lerp.hxx> +#include <basegfx/tools/canvastools.hxx> #include <basegfx/matrix/b2dhommatrixtools.hxx> -#include <cppcanvas/basegfxfactory.hxx> - #include "unoview.hxx" #include "smilfunctionparser.hxx" #include "tools.hxx" @@ -296,11 +295,9 @@ namespace slideshow "extractValue(): inappropriate length for RGB color value" ); // truncate to byte - o_rValue = RGBColor( ::cppcanvas::makeColor( - static_cast<sal_uInt8>(aTmp[0]), - static_cast<sal_uInt8>(aTmp[1]), - static_cast<sal_uInt8>(aTmp[2]), - 255 ) ); + o_rValue = RGBColor( static_cast<sal_uInt8>(aTmp[0])/255.0, + static_cast<sal_uInt8>(aTmp[1])/255.0, + static_cast<sal_uInt8>(aTmp[2])/255.0 ); // succeeded return true; @@ -315,7 +312,9 @@ namespace slideshow ENSURE_OR_THROW( aTmp.getLength() == 3, "extractValue(): inappropriate length for RGB color value" ); - o_rValue = RGBColor( ::cppcanvas::makeColor( aTmp[0], aTmp[1], aTmp[2], 255 ) ); + o_rValue = RGBColor( aTmp[0] / 255.0, + aTmp[1] / 255.0, + aTmp[2] / 255.0 ); // succeeded return true; @@ -665,77 +664,28 @@ namespace slideshow RGBColor unoColor2RGBColor( sal_Int32 nColor ) { - return RGBColor( - ::cppcanvas::makeColor( - // convert from API color to IntSRGBA color - // (0xAARRGGBB -> 0xRRGGBBAA) - static_cast< sal_uInt8 >( nColor >> 16U ), - static_cast< sal_uInt8 >( nColor >> 8U ), - static_cast< sal_uInt8 >( nColor ), - static_cast< sal_uInt8 >( nColor >> 24U ) ) ); - } - - sal_Int32 RGBAColor2UnoColor( ::cppcanvas::Color::IntSRGBA aColor ) - { - return ::cppcanvas::makeColorARGB( - // convert from IntSRGBA color to API color - // (0xRRGGBBAA -> 0xAARRGGBB) - static_cast< sal_uInt8 >(0), - ::cppcanvas::getRed(aColor), - ::cppcanvas::getGreen(aColor), - ::cppcanvas::getBlue(aColor)); - } - - void fillRect( const ::cppcanvas::CanvasSharedPtr& rCanvas, - const ::basegfx::B2DRectangle& rRect, - ::cppcanvas::Color::IntSRGBA aFillColor ) - { - const ::basegfx::B2DPolygon aPoly( - ::basegfx::tools::createPolygonFromRect( rRect )); - - ::cppcanvas::PolyPolygonSharedPtr pPolyPoly( - ::cppcanvas::BaseGfxFactory::getInstance().createPolyPolygon( rCanvas, - aPoly ) ); - - if( pPolyPoly ) - { - pPolyPoly->setRGBAFillColor( aFillColor ); - pPolyPoly->draw(); - } + return RGBColor( static_cast< sal_uInt8 >( nColor >> 16U ) / 255.0, + static_cast< sal_uInt8 >( nColor >> 8U ) / 255.0, + static_cast< sal_uInt8 >( nColor ) / 255.0 ); } - void initSlideBackground( const ::cppcanvas::CanvasSharedPtr& rCanvas, - const ::basegfx::B2ISize& rSize ) + void fillRect( const uno::Reference< rendering::XCanvas >& xCanvas, + const ::basegfx::B2DRectangle& rRect, + const basegfx::BColor& rFillColor ) { - ::cppcanvas::CanvasSharedPtr pCanvas( rCanvas->clone() ); - - // set transformation to identitiy (->device pixel) - pCanvas->setTransformation( ::basegfx::B2DHomMatrix() ); - - // #i42440# Fill the _full_ background in - // black. Since we had to extend the bitmap by one - // pixel, and the bitmap is initialized white, - // depending on the slide content a one pixel wide - // line will show to the bottom and the right. - fillRect( pCanvas, - ::basegfx::B2DRectangle( 0.0, 0.0, - rSize.getX(), - rSize.getY() ), - 0x000000FFU ); - - // fill the bounds rectangle in white. Subtract one pixel - // from both width and height, because the slide size is - // chosen one pixel larger than given by the drawing - // layer. This is because shapes with line style, that - // have the size of the slide would otherwise be cut - // off. OTOH, every other slide background (solid fill, - // gradient, bitmap) render one pixel less, thus revealing - // ugly white pixel to the right and the bottom. - fillRect( pCanvas, - ::basegfx::B2DRectangle( 0.0, 0.0, - rSize.getX()-1, - rSize.getY()-1 ), - 0xFFFFFFFFU ); + // TODO-NYI + rendering::ViewState aViewState; + rendering::RenderState aRenderState; + canvas::tools::initRenderState(aRenderState); + aRenderState.DeviceColor = + rFillColor.colorToDoubleSequence( + xCanvas->getDevice()); + + xCanvas->fillPolyPolygon( + basegfx::unotools::xPolyPolygonFromB2DPolygon( + xCanvas->getDevice(), + ::basegfx::tools::createPolygonFromRect( rRect )), + aViewState, aRenderState); } ::basegfx::B2DRectangle getAPIShapeBounds( const uno::Reference< drawing::XShape >& xShape ) diff --git a/slideshow/source/engine/transitions/clippingfunctor.cxx b/slideshow/source/engine/transitions/clippingfunctor.cxx index 5050d4fc2efc..a8c912f3d272 100644 --- a/slideshow/source/engine/transitions/clippingfunctor.cxx +++ b/slideshow/source/engine/transitions/clippingfunctor.cxx @@ -160,17 +160,13 @@ namespace slideshow mbForwardParameterSweep ? nValue : 1.0 - nValue ); // TODO(Q4): workaround here, better be fixed in cppcanvas + // TODO-NYI - check this! if (aClipPoly.count() == 0) aClipPoly.append( basegfx::B2DPolygon() ); if (mbFlip) aClipPoly.flip(); - // currently, clipper cannot cope with curves. Subdivide first - // AW: Should be no longer necessary; clipping tools are now bezier-safe - // if( aClipPoly.areControlPointsUsed() ) - // aClipPoly = ::basegfx::tools::adaptiveSubdivideByAngle(aClipPoly); - if( mbSubtractPolygon ) { // subtract given polygon from background diff --git a/slideshow/source/engine/transitions/combtransition.cxx b/slideshow/source/engine/transitions/combtransition.cxx index abd632069135..94f920b00cb4 100644 --- a/slideshow/source/engine/transitions/combtransition.cxx +++ b/slideshow/source/engine/transitions/combtransition.cxx @@ -24,12 +24,11 @@ #include <basegfx/matrix/b2dhommatrix.hxx> #include <basegfx/matrix/b2dhommatrixtools.hxx> -#include <cppcanvas/spritecanvas.hxx> - #include "combtransition.hxx" #include <boost/bind.hpp> +using namespace ::com::sun::star; namespace slideshow { namespace internal { @@ -89,13 +88,13 @@ CombTransition::CombTransition( { } -void CombTransition::renderComb( double t, +void CombTransition::renderComb( double , const ViewEntry& rViewEntry ) const { const SlideBitmapSharedPtr& pEnteringBitmap = getEnteringBitmap(rViewEntry); - const cppcanvas::CanvasSharedPtr pCanvas_ = rViewEntry.mpView->getCanvas(); + const uno::Reference<rendering::XCanvas> pCanvas = rViewEntry.mpView->getCanvas(); - if( !pEnteringBitmap || !pCanvas_ ) + if( !pEnteringBitmap || !pCanvas.is() ) return; // calc bitmap offsets. The enter/leaving bitmaps are only @@ -110,9 +109,7 @@ void CombTransition::renderComb( double t, const basegfx::B2DHomMatrix viewTransform( rViewEntry.mpView->getTransformation() ); const basegfx::B2DPoint pageOrigin( viewTransform * basegfx::B2DPoint() ); - // change transformation on cloned canvas to be in - // device pixel - cppcanvas::CanvasSharedPtr pCanvas( pCanvas_->clone() ); + // transformation from now on in device pixel basegfx::B2DPoint p; // TODO(Q2): Use basegfx bitmaps here @@ -132,6 +129,8 @@ void CombTransition::renderComb( double t, enteringSizePixel, mnNumStripes, 1 ) ); +#if 0 + // TODO-NYI - and let's use xsprites here FFS SlideBitmapSharedPtr const & pLeavingBitmap = getLeavingBitmap(rViewEntry); if( pLeavingBitmap ) { @@ -166,6 +165,7 @@ void CombTransition::renderComb( double t, p = basegfx::B2DPoint( pageOrigin + ((1.0 - t) * aPushDirection) ); pCanvas->setTransformation(basegfx::tools::createTranslateB2DHomMatrix(p.getX(), p.getY())); pEnteringBitmap->draw( pCanvas ); +#endif } bool CombTransition::operator()( double t ) diff --git a/slideshow/source/engine/transitions/slidechangebase.cxx b/slideshow/source/engine/transitions/slidechangebase.cxx index dd0cabfbce4d..185886a8bda0 100644 --- a/slideshow/source/engine/transitions/slidechangebase.cxx +++ b/slideshow/source/engine/transitions/slidechangebase.cxx @@ -25,7 +25,8 @@ #include <basegfx/polygon/b2dpolygontools.hxx> #include <basegfx/polygon/b2dpolypolygontools.hxx> #include <basegfx/matrix/b2dhommatrixtools.hxx> -#include <cppcanvas/basegfxfactory.hxx> + +#include <com/sun/star/rendering/XBitmapCanvas.hpp> #include "slidechangebase.hxx" #include "tools.hxx" @@ -101,34 +102,30 @@ SlideBitmapSharedPtr SlideChangeBase::createBitmap( const UnoViewSharedPtr& getSlideSizePixel( basegfx::B2DSize( mpEnteringSlide->getSlideSize() ), rView )); - cppcanvas::CanvasSharedPtr pCanvas( rView->getCanvas() ); + uno::Reference<rendering::XCanvas> pCanvas( rView->getCanvas() ); // create a bitmap of appropriate size - cppcanvas::BitmapSharedPtr pBitmap( - cppcanvas::BaseGfxFactory::getInstance().createBitmap( - pCanvas, - slideSizePixel ) ); + uno::Reference<rendering::XBitmap> pBitmap( + pCanvas->getDevice()->createCompatibleBitmap( + css::geometry::IntegerSize2D( + slideSizePixel.getX(), + slideSizePixel.getY()) )); ENSURE_OR_THROW( - pBitmap, + pBitmap.is(), "SlideChangeBase::createBitmap(): Cannot create page bitmap" ); - cppcanvas::BitmapCanvasSharedPtr pBitmapCanvas( - pBitmap->getBitmapCanvas() ); + uno::Reference<rendering::XBitmapCanvas> pBitmapCanvas( + pBitmap, uno::UNO_QUERY); - ENSURE_OR_THROW( pBitmapCanvas, + ENSURE_OR_THROW( pBitmapCanvas.is(), "SlideChangeBase::createBitmap(): " "Cannot create page bitmap canvas" ); - // set transformation to identitiy (->device pixel) - pBitmapCanvas->setTransformation( ::basegfx::B2DHomMatrix() ); - // clear bitmap to black - fillRect( pBitmapCanvas, - ::basegfx::B2DRectangle( 0.0, 0.0, - slideSizePixel.getX(), - slideSizePixel.getY() ), - 0x000000FFU ); + pBitmapCanvas->fill( + ::basegfx::BColor(0,0,0).colorToDoubleSequence( + pBitmapCanvas->getDevice()) ); pRet.reset( new SlideBitmap( pBitmap )); } @@ -148,17 +145,19 @@ SlideBitmapSharedPtr SlideChangeBase::createBitmap( const UnoViewSharedPtr& void SlideChangeBase::renderBitmap( SlideBitmapSharedPtr const & pSlideBitmap, - cppcanvas::CanvasSharedPtr const & pCanvas ) + uno::Reference<rendering::XCanvas> const & pCanvas ) { - if( pSlideBitmap && pCanvas ) + if( pSlideBitmap && pCanvas.is() ) { +#if 0 + // TODO-NYI // need to render without any transformation (we // assume device units): const basegfx::B2DHomMatrix viewTransform( pCanvas->getTransformation() ); const basegfx::B2DPoint pageOrigin( viewTransform * basegfx::B2DPoint() ); - const cppcanvas::CanvasSharedPtr pDevicePixelCanvas( + const uno::Reference<rendering::XCanvas> pDevicePixelCanvas( pCanvas->clone() ); // render at output position, don't modify bitmap object (no move!): @@ -167,6 +166,7 @@ void SlideChangeBase::renderBitmap( pDevicePixelCanvas->setTransformation( transform ); pSlideBitmap->draw( pDevicePixelCanvas ); +#endif } } @@ -278,9 +278,9 @@ bool SlideChangeBase::operator()( double nValue ) // (i.e. pixel). ViewEntry& rViewEntry( maViewData[i] ); - const ::cppcanvas::CanvasSharedPtr& rCanvas( rViewEntry.mpView->getCanvas() ); - ::cppcanvas::CustomSpriteSharedPtr& rInSprite( rViewEntry.mpInSprite ); - ::cppcanvas::CustomSpriteSharedPtr& rOutSprite( rViewEntry.mpOutSprite ); + const uno::Reference<rendering::XCanvas>& rCanvas( rViewEntry.mpView->getCanvas() ); + uno::Reference<rendering::XCustomSprite>& rInSprite( rViewEntry.mpInSprite ); + uno::Reference<rendering::XCustomSprite>& rOutSprite( rViewEntry.mpOutSprite ); // TODO(F2): Properly respect clip here. @@ -290,22 +290,25 @@ bool SlideChangeBase::operator()( double nValue ) const ::basegfx::B2DPoint aSpritePosPixel( aViewTransform * ::basegfx::B2DPoint() ); +#if 0 + // TODO-NYI // move sprite to final output position, in // device coordinates - if( rOutSprite ) + if( rOutSprite.is() ) rOutSprite->movePixel( aSpritePosPixel ); - if( rInSprite ) + if( rInSprite.is() ) rInSprite->movePixel( aSpritePosPixel ); +#endif if( !mbSpritesVisible ) { - if( rOutSprite ) + if( rOutSprite.is() ) { // only render once: clipping is done // exclusively with the sprite - const ::cppcanvas::CanvasSharedPtr pOutContentCanvas( + const uno::Reference<rendering::XCanvas> pOutContentCanvas( rOutSprite->getContentCanvas() ); - if( pOutContentCanvas) + if( pOutContentCanvas.is() ) { // TODO(Q2): Use basegfx bitmaps here @@ -319,13 +322,13 @@ bool SlideChangeBase::operator()( double nValue ) } } - if( rInSprite ) + if( rInSprite.is() ) { // only render once: clipping is done // exclusively with the sprite - const ::cppcanvas::CanvasSharedPtr pInContentCanvas( + const uno::Reference<rendering::XCanvas> pInContentCanvas( rInSprite->getContentCanvas() ); - if( pInContentCanvas ) + if( pInContentCanvas.is() ) { // TODO(Q2): Use basegfx bitmaps here @@ -338,18 +341,18 @@ bool SlideChangeBase::operator()( double nValue ) } } - if( rOutSprite ) + if( rOutSprite.is() ) performOut( rOutSprite, rViewEntry, rCanvas, nValue ); - if( rInSprite ) + if( rInSprite.is() ) performIn( rInSprite, rViewEntry, rCanvas, nValue ); // finishing deeds for first run. if( !mbSpritesVisible) { // enable sprites: - if( rOutSprite ) + if( rOutSprite.is() ) rOutSprite->show(); - if( rInSprite ) + if( rInSprite.is() ) rInSprite->show(); bSpritesVisible = true; } @@ -363,23 +366,23 @@ bool SlideChangeBase::operator()( double nValue ) void SlideChangeBase::prepareForRun( const ViewEntry& /* rViewEntry */, - const boost::shared_ptr<cppcanvas::Canvas>& /* rDestinationCanvas */ ) + const uno::Reference<rendering::XCanvas>& /* rDestinationCanvas */ ) { } void SlideChangeBase::performIn( - const cppcanvas::CustomSpriteSharedPtr& /*rSprite*/, - const ViewEntry& /*rViewEntry*/, - const cppcanvas::CanvasSharedPtr& /*rDestinationCanvas*/, - double /*t*/ ) + const uno::Reference<rendering::XCustomSprite>& /*rSprite*/, + const ViewEntry& /*rViewEntry*/, + const uno::Reference<rendering::XCanvas>& /*rDestinationCanvas*/, + double /*t*/ ) { } void SlideChangeBase::performOut( - const cppcanvas::CustomSpriteSharedPtr& /*rSprite*/, - const ViewEntry& /*rViewEntry*/, - const cppcanvas::CanvasSharedPtr& /*rDestinationCanvas*/, - double /*t*/ ) + const uno::Reference<rendering::XCustomSprite>& /*rSprite*/, + const ViewEntry& /*rViewEntry*/, + const uno::Reference<rendering::XCanvas>& /*rDestinationCanvas*/, + double /*t*/ ) { } @@ -470,13 +473,13 @@ void SlideChangeBase::viewsChanged() } } -cppcanvas::CustomSpriteSharedPtr SlideChangeBase::createSprite( +uno::Reference<rendering::XCustomSprite> SlideChangeBase::createSprite( UnoViewSharedPtr const & pView, basegfx::B2DSize const & rSpriteSize, double nPrio ) const { // TODO(P2): change to bitmapsprite once that's working - const cppcanvas::CustomSpriteSharedPtr pSprite( + const uno::Reference<rendering::XCustomSprite> pSprite( pView->createSprite( rSpriteSize, nPrio )); @@ -521,8 +524,8 @@ void SlideChangeBase::clearViewEntry( ViewEntry& rEntry ) // resize) rEntry.mpEnteringBitmap.reset(); rEntry.mpLeavingBitmap.reset(); - rEntry.mpInSprite.reset(); - rEntry.mpOutSprite.reset(); + rEntry.mpInSprite.clear(); + rEntry.mpOutSprite.clear(); } } // namespace internal diff --git a/slideshow/source/engine/transitions/slidechangebase.hxx b/slideshow/source/engine/transitions/slidechangebase.hxx index 396c03ab32ec..b683dc15814c 100644 --- a/slideshow/source/engine/transitions/slidechangebase.hxx +++ b/slideshow/source/engine/transitions/slidechangebase.hxx @@ -33,12 +33,6 @@ #include <boost/noncopyable.hpp> #include <boost/optional.hpp> -namespace cppcanvas -{ - class Canvas; - class CustomSprite; -} - namespace slideshow { namespace internal { @@ -98,9 +92,9 @@ protected: /// The view this entry is for UnoViewSharedPtr mpView; /// outgoing slide sprite - boost::shared_ptr<cppcanvas::CustomSprite> mpOutSprite; + css::uno::Reference<css::rendering::XCustomSprite> mpOutSprite; /// incoming slide sprite - boost::shared_ptr<cppcanvas::CustomSprite> mpInSprite; + css::uno::Reference<css::rendering::XCustomSprite> mpInSprite; /// outgoing slide bitmap mutable SlideBitmapSharedPtr mpLeavingBitmap; /// incoming slide bitmap @@ -123,8 +117,8 @@ protected: ::basegfx::B2ISize getEnteringSlideSizePixel( const UnoViewSharedPtr& pView ) const; - void renderBitmap( SlideBitmapSharedPtr const& pSlideBitmap, - boost::shared_ptr<cppcanvas::Canvas> const& pCanvas ); + void renderBitmap( SlideBitmapSharedPtr const& pSlideBitmap, + css::uno::Reference<css::rendering::XCanvas> const& pCanvas ); /** Called on derived classes to perform actions before first run. @@ -136,7 +130,7 @@ protected: */ virtual void prepareForRun( const ViewEntry& rViewEntry, - const cppcanvas::CanvasSharedPtr& rDestinationCanvas ); + const css::uno::Reference< css::rendering::XCanvas >& rDestinationCanvas ); /** Called on derived classes to implement actual slide change. @@ -150,10 +144,10 @@ protected: Current parameter value */ virtual void performIn( - const boost::shared_ptr<cppcanvas::CustomSprite>& rSprite, - const ViewEntry& rViewEntry, - const boost::shared_ptr<cppcanvas::Canvas>& rDestinationCanvas, - double t ); + const css::uno::Reference<css::rendering::XCustomSprite>& rSprite, + const ViewEntry& rViewEntry, + const css::uno::Reference<css::rendering::XCanvas>& rDestinationCanvas, + double t ); /** Called on derived classes to implement actual slide change. @@ -167,16 +161,16 @@ protected: Current parameter value */ virtual void performOut( - const boost::shared_ptr<cppcanvas::CustomSprite>& rSprite, - const ViewEntry& rViewEntry, - const boost::shared_ptr<cppcanvas::Canvas>& rDestinationCanvas, - double t ); + const css::uno::Reference<css::rendering::XCustomSprite>& rSprite, + const ViewEntry& rViewEntry, + const css::uno::Reference<css::rendering::XCanvas>& rDestinationCanvas, + double t ); ScreenUpdater& getScreenUpdater() const { return mrScreenUpdater; } private: - boost::shared_ptr<cppcanvas::CustomSprite> createSprite( + css::uno::Reference<css::rendering::XCustomSprite> createSprite( UnoViewSharedPtr const & pView, ::basegfx::B2DSize const & rSpriteSize, double nPrio ) const; diff --git a/slideshow/source/engine/transitions/slidetransitionfactory.cxx b/slideshow/source/engine/transitions/slidetransitionfactory.cxx index 057c96e3bf92..f75a079a042b 100644 --- a/slideshow/source/engine/transitions/slidetransitionfactory.cxx +++ b/slideshow/source/engine/transitions/slidetransitionfactory.cxx @@ -25,8 +25,6 @@ #include <basegfx/polygon/b2dpolygontools.hxx> #include <basegfx/polygon/b2dpolypolygontools.hxx> -#include <cppcanvas/basegfxfactory.hxx> - #include <comphelper/optional.hxx> #include <comphelper/make_shared_from_uno.hxx> @@ -64,13 +62,15 @@ namespace { // helper methods // ============================================= -void fillPage( const ::cppcanvas::CanvasSharedPtr& rDestinationCanvas, - const ::basegfx::B2DSize& rPageSizePixel, - const RGBColor& rFillColor ) +void fillPage( const uno::Reference<rendering::XCanvas>& , + const ::basegfx::B2DSize& , + const RGBColor& ) { +#if 0 + // TODO-NYI // need to render without any transformation (we // assume rPageSizePixel to represent device units) - const ::cppcanvas::CanvasSharedPtr pDevicePixelCanvas( + const uno::Reference<rendering::XCanvas> pDevicePixelCanvas( rDestinationCanvas->clone() ); pDevicePixelCanvas->setTransformation( ::basegfx::B2DHomMatrix() ); @@ -88,6 +88,7 @@ void fillPage( const ::cppcanvas::CanvasSharedPtr& rDestinationCanvas, aOutputPosPixel.getX() + rPageSizePixel.getX(), aOutputPosPixel.getY() + rPageSizePixel.getY() ), rFillColor.getIntegerColor() ); +#endif } class PluginSlideChange: public SlideChangeBase @@ -332,27 +333,29 @@ public: {} virtual void performIn( - const ::cppcanvas::CustomSpriteSharedPtr& rSprite, - const ViewEntry& rViewEntry, - const ::cppcanvas::CanvasSharedPtr& rDestinationCanvas, - double t ); + const uno::Reference<rendering::XCustomSprite>& rSprite, + const ViewEntry& rViewEntry, + const uno::Reference<rendering::XCanvas>& rDestinationCanvas, + double t ); virtual void performOut( - const ::cppcanvas::CustomSpriteSharedPtr& rSprite, - const ViewEntry& rViewEntry, - const ::cppcanvas::CanvasSharedPtr& rDestinationCanvas, - double t ); + const uno::Reference<rendering::XCustomSprite>& rSprite, + const ViewEntry& rViewEntry, + const uno::Reference<rendering::XCanvas>& rDestinationCanvas, + double t ); private: ClippingFunctor maClippingFunctor; }; void ClippedSlideChange::performIn( - const ::cppcanvas::CustomSpriteSharedPtr& rSprite, - const ViewEntry& rViewEntry, - const ::cppcanvas::CanvasSharedPtr& /*rDestinationCanvas*/, - double t ) + const uno::Reference<rendering::XCustomSprite>& , + const ViewEntry& , + const uno::Reference<rendering::XCanvas>& , + double ) { +#if 0 + // TODO-NYI // #i46602# Better work in device coordinate space here, // otherwise, we too easily suffer from roundoffs. Apart from // that, getEnteringSizePixel() _guarantees_ to cover the whole @@ -361,13 +364,14 @@ void ClippedSlideChange::performIn( rSprite->setClipPixel( maClippingFunctor( t, ::basegfx::B2DSize( getEnteringSlideSizePixel(rViewEntry.mpView) ) ) ); +#endif } void ClippedSlideChange::performOut( - const ::cppcanvas::CustomSpriteSharedPtr& /*rSprite*/, - const ViewEntry& /*rViewEntry*/, - const ::cppcanvas::CanvasSharedPtr& /*rDestinationCanvas*/, - double /*t*/ ) + const uno::Reference<rendering::XCustomSprite >& /*rSprite*/, + const ViewEntry& /*rViewEntry*/, + const uno::Reference<rendering::XCanvas >& /*rDestinationCanvas*/, + double /*t*/ ) { // not needed here } @@ -398,19 +402,19 @@ public: virtual void prepareForRun( const ViewEntry& rViewEntry, - const cppcanvas::CanvasSharedPtr& rDestinationCanvas ); + const uno::Reference<rendering::XCanvas>& rDestinationCanvas ); virtual void performIn( - const ::cppcanvas::CustomSpriteSharedPtr& rSprite, - const ViewEntry& rViewEntry, - const ::cppcanvas::CanvasSharedPtr& rDestinationCanvas, - double t ); + const uno::Reference<rendering::XCustomSprite>& rSprite, + const ViewEntry& rViewEntry, + const uno::Reference<rendering::XCanvas>& rDestinationCanvas, + double t ); virtual void performOut( - const ::cppcanvas::CustomSpriteSharedPtr& rSprite, - const ViewEntry& rViewEntry, - const ::cppcanvas::CanvasSharedPtr& rDestinationCanvas, - double t ); + const uno::Reference<rendering::XCustomSprite>& rSprite, + const ViewEntry& rViewEntry, + const uno::Reference<rendering::XCanvas>& rDestinationCanvas, + double t ); private: const boost::optional< RGBColor > maFadeColor; @@ -418,7 +422,7 @@ private: void FadingSlideChange::prepareForRun( const ViewEntry& rViewEntry, - const cppcanvas::CanvasSharedPtr& rDestinationCanvas ) + const uno::Reference<rendering::XCanvas>& rDestinationCanvas ) { if ( maFadeColor ) { @@ -431,13 +435,13 @@ void FadingSlideChange::prepareForRun( } void FadingSlideChange::performIn( - const ::cppcanvas::CustomSpriteSharedPtr& rSprite, - const ViewEntry& /*rViewEntry*/, - const ::cppcanvas::CanvasSharedPtr& /*rDestinationCanvas*/, - double t ) + const uno::Reference<rendering::XCustomSprite>& rSprite, + const ViewEntry& /*rViewEntry*/, + const uno::Reference<rendering::XCanvas>& /*rDestinationCanvas*/, + double t ) { ENSURE_OR_THROW( - rSprite, + rSprite.is(), "FadingSlideChange::performIn(): Invalid sprite" ); if( maFadeColor ) @@ -449,16 +453,16 @@ void FadingSlideChange::performIn( } void FadingSlideChange::performOut( - const ::cppcanvas::CustomSpriteSharedPtr& rSprite, - const ViewEntry& /* rViewEntry */, - const ::cppcanvas::CanvasSharedPtr& rDestinationCanvas, - double t ) + const uno::Reference<rendering::XCustomSprite>& rSprite, + const ViewEntry& /* rViewEntry */, + const uno::Reference<rendering::XCanvas>& rDestinationCanvas, + double t ) { ENSURE_OR_THROW( - rSprite, + rSprite.is(), "FadingSlideChange::performOut(): Invalid sprite" ); ENSURE_OR_THROW( - rDestinationCanvas, + rDestinationCanvas.is(), "FadingSlideChange::performOut(): Invalid dest canvas" ); // only needed for color fades @@ -496,19 +500,19 @@ public: virtual void prepareForRun( const ViewEntry& rViewEntry, - const cppcanvas::CanvasSharedPtr& rDestinationCanvas ); + const uno::Reference<rendering::XCanvas>& rDestinationCanvas ); virtual void performIn( - const ::cppcanvas::CustomSpriteSharedPtr& rSprite, - const ViewEntry& rViewEntry, - const ::cppcanvas::CanvasSharedPtr& rDestinationCanvas, - double t ); + const uno::Reference<rendering::XCustomSprite>& rSprite, + const ViewEntry& rViewEntry, + const uno::Reference<rendering::XCanvas>& rDestinationCanvas, + double t ); virtual void performOut( - const ::cppcanvas::CustomSpriteSharedPtr& rSprite, - const ViewEntry& rViewEntry, - const ::cppcanvas::CanvasSharedPtr& rDestinationCanvas, - double t ); + const uno::Reference<rendering::XCustomSprite>& rSprite, + const ViewEntry& rViewEntry, + const uno::Reference<rendering::XCanvas>& rDestinationCanvas, + double t ); private: RGBColor maFadeColor; @@ -516,7 +520,7 @@ private: void CutSlideChange::prepareForRun( const ViewEntry& rViewEntry, - const cppcanvas::CanvasSharedPtr& rDestinationCanvas ) + const uno::Reference<rendering::XCanvas>& rDestinationCanvas ) { // clear page to given fade color. 'Leaving' slide is // painted atop of that @@ -526,13 +530,13 @@ void CutSlideChange::prepareForRun( } void CutSlideChange::performIn( - const ::cppcanvas::CustomSpriteSharedPtr& rSprite, - const ViewEntry& /*rViewEntry*/, - const ::cppcanvas::CanvasSharedPtr& /*rDestinationCanvas*/, - double t ) + const uno::Reference<rendering::XCustomSprite>& rSprite, + const ViewEntry& /*rViewEntry*/, + const uno::Reference<rendering::XCanvas>& /*rDestinationCanvas*/, + double t ) { ENSURE_OR_THROW( - rSprite, + rSprite.is(), "CutSlideChange::performIn(): Invalid sprite" ); // After 2/3rd of the active time, display new slide @@ -540,16 +544,16 @@ void CutSlideChange::performIn( } void CutSlideChange::performOut( - const ::cppcanvas::CustomSpriteSharedPtr& rSprite, - const ViewEntry& /* rViewEntry */, - const ::cppcanvas::CanvasSharedPtr& rDestinationCanvas, - double t ) + const uno::Reference<rendering::XCustomSprite>& rSprite, + const ViewEntry& /* rViewEntry */, + const uno::Reference<rendering::XCanvas>& rDestinationCanvas, + double t ) { ENSURE_OR_THROW( - rSprite, + rSprite.is(), "CutSlideChange::performOut(): Invalid sprite" ); ENSURE_OR_THROW( - rDestinationCanvas, + rDestinationCanvas.is(), "CutSlideChange::performOut(): Invalid dest canvas" ); // Until 1/3rd of the active time, display old slide. @@ -610,24 +614,24 @@ public: virtual void prepareForRun( const ViewEntry& rViewEntry, - const cppcanvas::CanvasSharedPtr& rDestinationCanvas ); + const uno::Reference<rendering::XCanvas>& rDestinationCanvas ); virtual void performIn( - const ::cppcanvas::CustomSpriteSharedPtr& rSprite, - const ViewEntry& rViewEntry, - const ::cppcanvas::CanvasSharedPtr& rDestinationCanvas, - double t ); + const uno::Reference<rendering::XCustomSprite>& rSprite, + const ViewEntry& rViewEntry, + const uno::Reference<rendering::XCanvas>& rDestinationCanvas, + double t ); virtual void performOut( - const ::cppcanvas::CustomSpriteSharedPtr& rSprite, - const ViewEntry& rViewEntry, - const ::cppcanvas::CanvasSharedPtr& rDestinationCanvas, - double t ); + const uno::Reference<rendering::XCustomSprite>& rSprite, + const ViewEntry& rViewEntry, + const uno::Reference<rendering::XCanvas>& rDestinationCanvas, + double t ); }; void MovingSlideChange::prepareForRun( const ViewEntry& rViewEntry, - const cppcanvas::CanvasSharedPtr& rDestinationCanvas ) + const uno::Reference<rendering::XCanvas>& rDestinationCanvas ) { if ( maLeavingDirection.equalZero() ) renderBitmap( getLeavingBitmap( rViewEntry ), rDestinationCanvas ); @@ -636,20 +640,22 @@ void MovingSlideChange::prepareForRun( } void MovingSlideChange::performIn( - const ::cppcanvas::CustomSpriteSharedPtr& rSprite, - const ViewEntry& rViewEntry, - const ::cppcanvas::CanvasSharedPtr& rDestinationCanvas, - double t ) + const uno::Reference<rendering::XCustomSprite>& rSprite, + const ViewEntry& , + const uno::Reference<rendering::XCanvas>& rDestinationCanvas, + double ) { // intro sprite moves: ENSURE_OR_THROW( - rSprite, + rSprite.is(), "MovingSlideChange::performIn(): Invalid sprite" ); ENSURE_OR_THROW( - rDestinationCanvas, + rDestinationCanvas.is(), "MovingSlideChange::performIn(): Invalid dest canvas" ); +#if 0 + // TODO-NYI // TODO(F1): This does not account for non-translational // transformations! If the canvas is rotated, we still // move the sprite unrotated (which might or might not @@ -665,23 +671,26 @@ void MovingSlideChange::performIn( ((t - 1.0) * ::basegfx::B2DSize( getEnteringSlideSizePixel(rViewEntry.mpView) ) * maEnteringDirection) ); +#endif } void MovingSlideChange::performOut( - const ::cppcanvas::CustomSpriteSharedPtr& rSprite, - const ViewEntry& rViewEntry, - const ::cppcanvas::CanvasSharedPtr& rDestinationCanvas, - double t ) + const uno::Reference<rendering::XCustomSprite>& rSprite, + const ViewEntry& , + const uno::Reference<rendering::XCanvas>& rDestinationCanvas, + double ) { // outro sprite moves: ENSURE_OR_THROW( - rSprite, + rSprite.is(), "MovingSlideChange::performOut(): Invalid sprite" ); ENSURE_OR_THROW( - rDestinationCanvas, + rDestinationCanvas.is(), "MovingSlideChange::performOut(): Invalid dest canvas" ); +#if 0 + // TODO-NYI // TODO(F1): This does not account for non-translational // transformations! If the canvas is rotated, we still // move the sprite unrotated (which might or might not @@ -696,6 +705,7 @@ void MovingSlideChange::performOut( aPageOrigin + (t * ::basegfx::B2DSize( getEnteringSlideSizePixel(rViewEntry.mpView) ) * maLeavingDirection) ); +#endif } diff --git a/slideshow/source/engine/waitsymbol.cxx b/slideshow/source/engine/waitsymbol.cxx index 2017d7419ed1..6f3e6bcdebe8 100644 --- a/slideshow/source/engine/waitsymbol.cxx +++ b/slideshow/source/engine/waitsymbol.cxx @@ -85,7 +85,7 @@ void WaitSymbol::setVisible( const bool bVisible ) ViewsVecT::const_iterator const aEnd ( maViews.end() ); while( aIter != aEnd ) { - if( aIter->second ) + if( aIter->second.is() ) { if( bVisible ) aIter->second->show(); @@ -115,7 +115,7 @@ basegfx::B2DPoint WaitSymbol::calcSpritePos( void WaitSymbol::viewAdded( const UnoViewSharedPtr& rView ) { - cppcanvas::CustomSpriteSharedPtr sprite; + css::uno::Reference< css::rendering::XCustomSprite > sprite; try { @@ -128,11 +128,12 @@ void WaitSymbol::viewAdded( const UnoViewSharedPtr& rView ) canvas::tools::initViewState( viewState ); rendering::RenderState renderState; canvas::tools::initRenderState( renderState ); - sprite->getContentCanvas()->getUNOCanvas()->drawBitmap( + sprite->getContentCanvas()->drawBitmap( mxBitmap, viewState, renderState ); sprite->setAlpha( 0.9 ); - sprite->movePixel( calcSpritePos( rView ) ); + // TODO-NYI + //sprite->movePixel( calcSpritePos( rView ) ); if( mbVisible ) sprite->show(); } @@ -176,9 +177,12 @@ void WaitSymbol::viewChanged( const UnoViewSharedPtr& rView ) if( aModifiedEntry == maViews.end() ) return; - if( aModifiedEntry->second ) +#if 0 + // TODO-NYI + if( aModifiedEntry->second.is() ) aModifiedEntry->second->movePixel( calcSpritePos(aModifiedEntry->first) ); +#endif } void WaitSymbol::viewsChanged() @@ -188,9 +192,12 @@ void WaitSymbol::viewsChanged() ViewsVecT::const_iterator const aEnd ( maViews.end() ); while( aIter != aEnd ) { - if( aIter->second ) +#if 0 + // TODO-NYI + if( aIter->second.is() ) aIter->second->movePixel( calcSpritePos( aIter->first )); +#endif ++aIter; } } diff --git a/slideshow/source/engine/waitsymbol.hxx b/slideshow/source/engine/waitsymbol.hxx index 655ceb108f2c..2cb4742b951a 100644 --- a/slideshow/source/engine/waitsymbol.hxx +++ b/slideshow/source/engine/waitsymbol.hxx @@ -21,7 +21,6 @@ #define WAITSYMBOL_HXX_INCLUDED #include <com/sun/star/rendering/XBitmap.hpp> -#include <cppcanvas/customsprite.hxx> #include "vieweventhandler.hxx" #include "screenupdater.hxx" @@ -85,7 +84,7 @@ private: typedef ::std::vector< ::std::pair<UnoViewSharedPtr, - cppcanvas::CustomSpriteSharedPtr> > ViewsVecT; + css::uno::Reference< css::rendering::XCustomSprite >> > ViewsVecT; ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XBitmap> mxBitmap; diff --git a/slideshow/source/inc/animatedsprite.hxx b/slideshow/source/inc/animatedsprite.hxx index 61e21197bd56..8be16d0d2ea2 100644 --- a/slideshow/source/inc/animatedsprite.hxx +++ b/slideshow/source/inc/animatedsprite.hxx @@ -20,7 +20,9 @@ #ifndef INCLUDED_SLIDESHOW_ANIMATEDSPRITE_HXX #define INCLUDED_SLIDESHOW_ANIMATEDSPRITE_HXX -#include <cppcanvas/customsprite.hxx> +#include <com/sun/star/uno/Reference.hxx> +#include <com/sun/star/rendering/XCanvas.hpp> +#include <com/sun/star/rendering/XCustomSprite.hpp> #include <basegfx/matrix/b2dhommatrix.hxx> #include <basegfx/vector/b2dsize.hxx> @@ -104,7 +106,7 @@ namespace slideshow canvas is already correctly setup, matching the associated destination canvas. */ - ::cppcanvas::CanvasSharedPtr getContentCanvas() const; + css::uno::Reference< css::rendering::XCanvas > getContentCanvas() const; /** Move the sprite in device pixel space. @@ -144,7 +146,7 @@ namespace slideshow private: ViewLayerSharedPtr mpViewLayer; - ::cppcanvas::CustomSpriteSharedPtr mpSprite; + css::uno::Reference< css::rendering::XCustomSprite > mpSprite; ::basegfx::B2DSize maEffectiveSpriteSizePixel; ::basegfx::B2DSize maContentPixelOffset; diff --git a/slideshow/source/inc/hslcolor.hxx b/slideshow/source/inc/hslcolor.hxx index 7c8fb436531c..b069a5a2b125 100644 --- a/slideshow/source/inc/hslcolor.hxx +++ b/slideshow/source/inc/hslcolor.hxx @@ -20,8 +20,7 @@ #ifndef INCLUDED_SLIDESHOW_HSLCOLOR_HXX #define INCLUDED_SLIDESHOW_HSLCOLOR_HXX -#include <cppcanvas/color.hxx> - +#include <sal/types.h> /* Definition of HSLColor class */ diff --git a/slideshow/source/inc/rgbcolor.hxx b/slideshow/source/inc/rgbcolor.hxx index 4b3dedad5c52..0b5147ef667d 100644 --- a/slideshow/source/inc/rgbcolor.hxx +++ b/slideshow/source/inc/rgbcolor.hxx @@ -20,8 +20,7 @@ #ifndef INCLUDED_SLIDESHOW_RGBCOLOR_HXX #define INCLUDED_SLIDESHOW_RGBCOLOR_HXX -#include <cppcanvas/color.hxx> - +#include <sal/types.h> /* Definition of RGBColor class */ @@ -37,9 +36,9 @@ namespace slideshow { public: RGBColor(); - explicit RGBColor( ::cppcanvas::Color::IntSRGBA nRGBColor ); RGBColor( double nRed, double nGreen, double nBlue ); explicit RGBColor( const HSLColor& rColor ); + explicit RGBColor( sal_uInt32 nColor ); /** Get the RGB red value. */ @@ -53,10 +52,6 @@ namespace slideshow */ double getBlue() const; - /** Create an integer sRGBA color. - */ - ::cppcanvas::Color::IntSRGBA getIntegerColor() const; - struct RGBTriple { RGBTriple(); diff --git a/slideshow/source/inc/shapeimporter.hxx b/slideshow/source/inc/shapeimporter.hxx index c3ad90f4ddaf..d87e508cb6fe 100644 --- a/slideshow/source/inc/shapeimporter.hxx +++ b/slideshow/source/inc/shapeimporter.hxx @@ -26,6 +26,7 @@ #include "unoviewcontainer.hxx" #include "unoview.hxx" +#include "slide.hxx" #include "shape.hxx" #include <stack> @@ -35,9 +36,8 @@ namespace internal { struct SlideShowContext; -typedef ::std::vector< ::cppcanvas::PolyPolygonSharedPtr> PolyPolygonVector; -typedef ::boost::shared_ptr< UnoView > UnoViewSharedPtr; -typedef ::std::vector< UnoViewSharedPtr > UnoViewVector; +typedef ::boost::shared_ptr< UnoView > UnoViewSharedPtr; +typedef ::std::vector< UnoViewSharedPtr > UnoViewVector; /** This class imports all shapes from a given XShapes object */ diff --git a/slideshow/source/inc/slide.hxx b/slideshow/source/inc/slide.hxx index 9058ed0cc32a..0d13162424d2 100644 --- a/slideshow/source/inc/slide.hxx +++ b/slideshow/source/inc/slide.hxx @@ -26,6 +26,9 @@ #include "slidebitmap.hxx" #include "shapemaps.hxx" +#include <com/sun/star/uno/Reference.hxx> +#include <com/sun/star/rendering/XPolyPolygon2D.hpp> + #include <boost/shared_ptr.hpp> namespace com { namespace sun { namespace star { @@ -53,7 +56,7 @@ namespace slideshow { class RGBColor; class ScreenUpdater; - typedef ::std::vector< ::cppcanvas::PolyPolygonSharedPtr> PolyPolygonVector; + class Slide { public: diff --git a/slideshow/source/inc/slidebitmap.hxx b/slideshow/source/inc/slidebitmap.hxx index 9527c2b32ca9..2856fd871e42 100644 --- a/slideshow/source/inc/slidebitmap.hxx +++ b/slideshow/source/inc/slidebitmap.hxx @@ -21,10 +21,11 @@ #define INCLUDED_SLIDESHOW_SLIDEBITMAP_HXX #include <com/sun/star/uno/Reference.hxx> -#include <cppcanvas/canvas.hxx> -#include <cppcanvas/bitmap.hxx> +#include <com/sun/star/rendering/XCanvas.hpp> +#include <com/sun/star/rendering/XBitmap.hpp> #include <basegfx/point/b2dpoint.hxx> +#include <basegfx/vector/b2isize.hxx> #include <basegfx/polygon/b2dpolypolygon.hxx> #include <boost/shared_ptr.hpp> @@ -60,9 +61,9 @@ namespace slideshow class SlideBitmap : private boost::noncopyable { public: - SlideBitmap( const ::cppcanvas::BitmapSharedPtr& rBitmap ); + SlideBitmap( const css::uno::Reference< css::rendering::XBitmap >& rBitmap ); - bool draw( const ::cppcanvas::CanvasSharedPtr& rCanvas ) const; + bool draw( const css::uno::Reference< css::rendering::XCanvas >& rCanvas ) const; ::basegfx::B2ISize getSize() const; ::basegfx::B2DPoint getOutputPos() const{return maOutputPos;} void move( const ::basegfx::B2DPoint& rNewPos ); diff --git a/slideshow/source/inc/tools.hxx b/slideshow/source/inc/tools.hxx index d0ee0b751e2f..c2053e056b5f 100644 --- a/slideshow/source/inc/tools.hxx +++ b/slideshow/source/inc/tools.hxx @@ -21,9 +21,11 @@ #define INCLUDED_SLIDESHOW_TOOLS_HXX #include <com/sun/star/uno/Sequence.hxx> +#include <com/sun/star/uno/Reference.hxx> #include <com/sun/star/beans/XPropertySet.hpp> +#include <com/sun/star/rendering/XCanvas.hpp> -#include <cppcanvas/color.hxx> +#include <basegfx/color/bcolor.hxx> #include "shapeattributelayer.hxx" #include "shape.hxx" @@ -50,7 +52,6 @@ namespace basegfx class B2IVector; class B2DHomMatrix; } -namespace cppcanvas{ class Canvas; } class GDIMetaFile; @@ -268,23 +269,14 @@ namespace slideshow const basegfx::B2DRange& rOrigBounds, const boost::shared_ptr<ShapeAttributeLayer>& pAttr ); - /** Convert a plain UNO API 32 bit int to RGBColor - */ - RGBColor unoColor2RGBColor( sal_Int32 ); - /** Convert an IntSRGBA to plain UNO API 32 bit int - */ - sal_Int32 RGBAColor2UnoColor( cppcanvas::Color::IntSRGBA ); + /// Convert UNO API packed integer color to RGBColor struct + RGBColor unoColor2RGBColor( sal_Int32 nColor ); /** Fill a plain rectangle on the given canvas with the given color */ - void fillRect( const boost::shared_ptr< cppcanvas::Canvas >& rCanvas, - const basegfx::B2DRange& rRect, - cppcanvas::Color::IntSRGBA aFillColor ); - - /** Init canvas with default background (white) - */ - void initSlideBackground( const boost::shared_ptr< cppcanvas::Canvas >& rCanvas, - const basegfx::B2IVector& rSize ); + void fillRect( const css::uno::Reference< css::rendering::XCanvas >& rCanvas, + const basegfx::B2DRange& rRect, + const basegfx::BColor& rFillColor ); /// Gets a random ordinal [0,n) inline ::std::size_t getRandomOrdinal( const ::std::size_t n ) diff --git a/slideshow/source/inc/unoview.hxx b/slideshow/source/inc/unoview.hxx index 574386d73c47..d0ad712687d9 100644 --- a/slideshow/source/inc/unoview.hxx +++ b/slideshow/source/inc/unoview.hxx @@ -37,6 +37,8 @@ namespace slideshow { namespace internal { + typedef ::std::vector< css::uno::Reference< css::rendering::XPolyPolygon2D > > PolyPolygonVector; + /** Extend View with UNO interface retrieval. This interface extends View with an UNO interface diff --git a/slideshow/source/inc/viewlayer.hxx b/slideshow/source/inc/viewlayer.hxx index f47f18aaa96b..b4129657b7e4 100644 --- a/slideshow/source/inc/viewlayer.hxx +++ b/slideshow/source/inc/viewlayer.hxx @@ -22,7 +22,10 @@ #include <sal/config.h> #include <boost/shared_ptr.hpp> +#include <com/sun/star/uno/Reference.hxx> #include <com/sun/star/geometry/IntegerSize2D.hpp> +#include <com/sun/star/rendering/XCanvas.hpp> +#include <com/sun/star/rendering/XCustomSprite.hpp> namespace basegfx { @@ -32,11 +35,6 @@ namespace basegfx class B2DHomMatrix; class B2DPolyPolygon; } -namespace cppcanvas -{ - class Canvas; - class CustomSprite; -} /* Definition of ViewLayer interface */ @@ -64,7 +62,7 @@ namespace slideshow The canvas returned by this method must not change, as long as this object is alive. */ - virtual boost::shared_ptr< cppcanvas::Canvas > getCanvas() const = 0; + virtual css::uno::Reference< css::rendering::XCanvas > getCanvas() const = 0; /** Clear the clipped view layer area @@ -99,7 +97,7 @@ namespace slideshow @return the sprite, or NULL on failure (or if this canvas does not support sprites). */ - virtual boost::shared_ptr< cppcanvas::CustomSprite > + virtual css::uno::Reference< css::rendering::XCustomSprite > createSprite( const basegfx::B2DVector& rSpriteSizePixel, double nPriority ) const = 0; diff --git a/slideshow/test/testview.cxx b/slideshow/test/testview.cxx index b382fac2cfd3..0e4313a64f57 100644 --- a/slideshow/test/testview.cxx +++ b/slideshow/test/testview.cxx @@ -171,17 +171,17 @@ public: return true; } - virtual ::cppcanvas::CanvasSharedPtr getCanvas() const + virtual css::uno::Reference< css::rendering::XCanvas > getCanvas() const { - return ::cppcanvas::CanvasSharedPtr(); + return css::uno::Reference< css::rendering::XCanvas >(); } - virtual ::cppcanvas::CustomSpriteSharedPtr createSprite( const ::basegfx::B2DSize& rSpriteSizePixel, + virtual css::uno::Reference< css::rendering::XCustomSprite > createSprite( const ::basegfx::B2DSize& rSpriteSizePixel, double nPriority ) const { maCreatedSprites.push_back( std::make_pair(rSpriteSizePixel,nPriority) ); - return ::cppcanvas::CustomSpriteSharedPtr(); + return css::uno::Reference< css::rendering::XCustomSprite >(); } virtual void setPriority( const basegfx::B1DRange& rRange ) |