summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--slideshow/Library_slideshow.mk1
-rw-r--r--slideshow/TODO18
-rw-r--r--slideshow/source/engine/animatedsprite.cxx7
-rw-r--r--slideshow/source/engine/canvas.cxx32
-rw-r--r--slideshow/source/engine/rehearsetimingsactivity.cxx2
-rw-r--r--slideshow/source/engine/shapes/drawshape.cxx4
-rw-r--r--slideshow/source/engine/shapes/shapeimporter.cxx2
-rw-r--r--slideshow/source/engine/shapes/viewappletshape.cxx12
-rw-r--r--slideshow/source/engine/shapes/viewbackgroundshape.cxx4
-rw-r--r--slideshow/source/engine/shapes/viewmediashape.cxx10
-rw-r--r--slideshow/source/engine/shapes/viewshape.cxx8
-rw-r--r--slideshow/source/engine/slide/layermanager.cxx11
-rw-r--r--slideshow/source/engine/slide/slideimpl.cxx8
-rw-r--r--slideshow/source/engine/slide/userpaintoverlay.cxx6
-rw-r--r--slideshow/source/engine/slidebitmap.cxx12
-rw-r--r--slideshow/source/engine/slideview.cxx354
-rw-r--r--slideshow/source/engine/tools.cxx15
-rw-r--r--slideshow/source/engine/transitions/combtransition.cxx2
-rw-r--r--slideshow/source/engine/transitions/slidechangebase.cxx16
-rw-r--r--slideshow/source/inc/animatedsprite.hxx4
-rw-r--r--slideshow/source/inc/canvas.hxx45
-rw-r--r--slideshow/source/inc/slidebitmap.hxx5
-rw-r--r--slideshow/source/inc/tools.hxx7
-rw-r--r--slideshow/source/inc/viewlayer.hxx27
24 files changed, 374 insertions, 238 deletions
diff --git a/slideshow/Library_slideshow.mk b/slideshow/Library_slideshow.mk
index 81b2348684b0..d3334c8353bf 100644
--- a/slideshow/Library_slideshow.mk
+++ b/slideshow/Library_slideshow.mk
@@ -76,6 +76,7 @@ $(eval $(call gb_Library_add_exception_objects,slideshow,\
slideshow/source/engine/animationnodes/propertyanimationnode \
slideshow/source/engine/animationnodes/sequentialtimecontainer \
slideshow/source/engine/attributemap \
+ slideshow/source/engine/canvas \
slideshow/source/engine/color \
slideshow/source/engine/delayevent \
slideshow/source/engine/effectrewinder \
diff --git a/slideshow/TODO b/slideshow/TODO
index bc1f820340e0..c429ee4bde5d 100644
--- a/slideshow/TODO
+++ b/slideshow/TODO
@@ -1,6 +1,20 @@
Stuff left doing
================
+ - add draw/stroke/fillRectangle
+ - Canvas struct - possibly use derived SpriteCanvas, should the case
+ come up often enough (like in slideview, where we have it extra
+ currently)
+ - review drawing method input parameters - do structs make sense?
+ (uno structs are dumb, so people usually convert anyway from
+ language-specific classes, _at the callsite_)
+ candidates:
+ - X*Bitmap.idl
+ - XParametricPolyPolygon2D.idl
+ - XTextLayout.idl
+ - review geometry structs, are there any unused after the above?
+ - remove extraneous throw specs from canvas and slideshow - or does
+ that break dbgutil builds?
- grep for TODO-NYI
- migrate emf+ renderer over to primitives
- implement stateful canvas processor (e.g. for the color changes?)
@@ -8,7 +22,3 @@ Stuff left doing
- 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/source/engine/animatedsprite.cxx b/slideshow/source/engine/animatedsprite.cxx
index bb332507e844..74273a29bafd 100644
--- a/slideshow/source/engine/animatedsprite.cxx
+++ b/slideshow/source/engine/animatedsprite.cxx
@@ -65,9 +65,9 @@ namespace slideshow
"AnimatedSprite::AnimatedSprite(): Could not create sprite" );
}
- uno::Reference< rendering::XCanvas > AnimatedSprite::getContentCanvas() const
+ const Canvas& AnimatedSprite::getContentCanvas() const
{
- ENSURE_OR_THROW( mpViewLayer->getCanvas().is(),
+ ENSURE_OR_THROW( mpViewLayer->getCanvas().mxCanvas.is(),
"AnimatedSprite::getContentCanvas(): No view layer canvas" );
const uno::Reference< rendering::XCanvas > pContentCanvas( mpSprite->getContentCanvas() );
@@ -88,8 +88,7 @@ namespace slideshow
// apply linear part of canvas view transformation to sprite canvas
// TODO-NYI
//pContentCanvas->setTransformation( aLinearTransform );
-
- return pContentCanvas;
+ //return pContentCanvas;
}
bool AnimatedSprite::resize( const ::basegfx::B2DSize& rSpriteSizePixel )
diff --git a/slideshow/source/engine/canvas.cxx b/slideshow/source/engine/canvas.cxx
new file mode 100644
index 000000000000..213b71f4e6b7
--- /dev/null
+++ b/slideshow/source/engine/canvas.cxx
@@ -0,0 +1,32 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#include "canvas.hxx"
+#include <canvas/canvastools.hxx>
+
+namespace slideshow {
+namespace internal {
+
+Canvas::Canvas() :
+ mxCanvas(),
+ maViewState(),
+ maViewInfo(),
+ maDummyDefaultViewState(),
+ maDummyDefaultRenderState()
+{
+ ::canvas::tools::initViewState( maViewState );
+ ::canvas::tools::initViewState( maDummyDefaultViewState );
+ ::canvas::tools::initRenderState( maDummyDefaultRenderState );
+}
+
+}
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
+
diff --git a/slideshow/source/engine/rehearsetimingsactivity.cxx b/slideshow/source/engine/rehearsetimingsactivity.cxx
index 4aa75604d2c2..4d3dea200d4e 100644
--- a/slideshow/source/engine/rehearsetimingsactivity.cxx
+++ b/slideshow/source/engine/rehearsetimingsactivity.cxx
@@ -306,7 +306,7 @@ void RehearseTimingsActivity::end()
basegfx::B2DRange RehearseTimingsActivity::calcSpriteRectangle( UnoViewSharedPtr const& rView ) const
{
- const Reference<rendering::XBitmap> xBitmap( rView->getCanvas(),
+ const Reference<rendering::XBitmap> xBitmap( rView->getCanvas().mxCanvas,
UNO_QUERY );
if( !xBitmap.is() )
return basegfx::B2DRange();
diff --git a/slideshow/source/engine/shapes/drawshape.cxx b/slideshow/source/engine/shapes/drawshape.cxx
index 8ea1d2260d73..07bf2ea1ddc9 100644
--- a/slideshow/source/engine/shapes/drawshape.cxx
+++ b/slideshow/source/engine/shapes/drawshape.cxx
@@ -299,7 +299,7 @@ namespace slideshow
// always assuming full bounds?
css::uno::Reference< css::rendering::XCanvas > pDestinationCanvas(
- maViewShapes.front()->getViewLayer()->getCanvas() );
+ maViewShapes.front()->getViewLayer()->getCanvas().mxCanvas );
#if 0
// TODO-NYI
@@ -1003,7 +1003,7 @@ namespace slideshow
// view-agnostic, it might not stay like that.
ViewShapeSharedPtr const& pViewShape = maViewShapes.front();
css::uno::Reference< css::rendering::XCanvas > const pCanvas(
- pViewShape->getViewLayer()->getCanvas() );
+ pViewShape->getViewLayer()->getCanvas().mxCanvas );
#if 0
// TODO-NYI
diff --git a/slideshow/source/engine/shapes/shapeimporter.cxx b/slideshow/source/engine/shapes/shapeimporter.cxx
index 824ae15fb4e4..f24d89ff8f34 100644
--- a/slideshow/source/engine/shapes/shapeimporter.cxx
+++ b/slideshow/source/engine/shapes/shapeimporter.cxx
@@ -497,7 +497,7 @@ void ShapeImporter::importPolygons(uno::Reference<beans::XPropertySet> const& xP
{
uno::Reference< rendering::XPolyPolygon2D > xPoly=
basegfx::unotools::xPolyPolygonFromB2DPolygon(
- (*aIter)->getCanvas()->getDevice(),
+ (*aIter)->getCanvas().mxCanvas->getDevice(),
aPoly);
#if 0
// TODO-NYI
diff --git a/slideshow/source/engine/shapes/viewappletshape.cxx b/slideshow/source/engine/shapes/viewappletshape.cxx
index 65165d6fac15..0961d56facec 100644
--- a/slideshow/source/engine/shapes/viewappletshape.cxx
+++ b/slideshow/source/engine/shapes/viewappletshape.cxx
@@ -72,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().is(), "ViewAppletShape::ViewAppletShape(): Invalid ViewLayer canvas" );
+ ENSURE_OR_THROW( mpViewLayer->getCanvas().mxCanvas.is(), "ViewAppletShape::ViewAppletShape(): Invalid ViewLayer canvas" );
ENSURE_OR_THROW( mxComponentContext.is(), "ViewAppletShape::ViewAppletShape(): Invalid component context" );
uno::Reference<lang::XMultiComponentFactory> xFactory(
@@ -127,11 +127,11 @@ namespace slideshow
bool ViewAppletShape::startApplet( const ::basegfx::B2DRectangle& rBounds )
{
- ENSURE_OR_RETURN_FALSE( mpViewLayer && mpViewLayer->getCanvas().is(),
+ ENSURE_OR_RETURN_FALSE( mpViewLayer && mpViewLayer->getCanvas().mxCanvas.is(),
"ViewAppletShape::startApplet(): Invalid or disposed view" );
try
{
- css::uno::Reference< css::rendering::XCanvas > pCanvas = mpViewLayer->getCanvas();
+ css::uno::Reference< css::rendering::XCanvas > pCanvas = mpViewLayer->getCanvas().mxCanvas;
uno::Reference< beans::XPropertySet > xPropSet( pCanvas->getDevice(),
uno::UNO_QUERY_THROW );
@@ -231,15 +231,15 @@ namespace slideshow
bool ViewAppletShape::render( const ::basegfx::B2DRectangle& rBounds ) const
{
- css::uno::Reference< css::rendering::XCanvas > pCanvas = mpViewLayer->getCanvas();
+ const Canvas& rCanvas = mpViewLayer->getCanvas();
- if( !pCanvas.is() )
+ if( !rCanvas.mxCanvas.is() )
return false;
if( !mxFrame.is() )
{
// fill the shape background with white
- fillRect( pCanvas,
+ fillRect( rCanvas,
rBounds,
basegfx::BColor(1.0) );
}
diff --git a/slideshow/source/engine/shapes/viewbackgroundshape.cxx b/slideshow/source/engine/shapes/viewbackgroundshape.cxx
index dfa3daaf11ad..fc6400a246d3 100644
--- a/slideshow/source/engine/shapes/viewbackgroundshape.cxx
+++ b/slideshow/source/engine/shapes/viewbackgroundshape.cxx
@@ -141,7 +141,7 @@ namespace slideshow
{
ENSURE_OR_THROW( mpViewLayer,
"ViewBackgroundShape::ViewBackgroundShape(): Invalid View" );
- ENSURE_OR_THROW( mpViewLayer->getCanvas().is(),
+ ENSURE_OR_THROW( mpViewLayer->getCanvas().mxCanvas.is(),
"ViewBackgroundShape::ViewBackgroundShape(): Invalid ViewLayer canvas" );
}
@@ -154,7 +154,7 @@ namespace slideshow
{
SAL_INFO( "slideshow", "::presentation::internal::ViewBackgroundShape::draw()" );
- const css::uno::Reference< css::rendering::XCanvas >& rDestinationCanvas( mpViewLayer->getCanvas() );
+ const css::uno::Reference< css::rendering::XCanvas >& rDestinationCanvas( mpViewLayer->getCanvas().mxCanvas );
if( !prefetch( rDestinationCanvas, rMtf ) )
return false;
diff --git a/slideshow/source/engine/shapes/viewmediashape.cxx b/slideshow/source/engine/shapes/viewmediashape.cxx
index 2e6f8bc011b5..35eb4e64aec6 100644
--- a/slideshow/source/engine/shapes/viewmediashape.cxx
+++ b/slideshow/source/engine/shapes/viewmediashape.cxx
@@ -79,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().is(), "ViewMediaShape::ViewMediaShape(): Invalid ViewLayer canvas" );
+ ENSURE_OR_THROW( mpViewLayer->getCanvas().mxCanvas.is(), "ViewMediaShape::ViewMediaShape(): Invalid ViewLayer canvas" );
ENSURE_OR_THROW( mxComponentContext.is(), "ViewMediaShape::ViewMediaShape(): Invalid component context" );
UnoViewSharedPtr pUnoView (::boost::dynamic_pointer_cast<UnoView>(rViewLayer));
@@ -177,7 +177,7 @@ namespace slideshow
bool ViewMediaShape::render( const ::basegfx::B2DRectangle& rBounds ) const
{
- css::uno::Reference< css::rendering::XCanvas > pCanvas = mpViewLayer->getCanvas();
+ css::uno::Reference< css::rendering::XCanvas > pCanvas = mpViewLayer->getCanvas().mxCanvas;
if( !pCanvas.is() )
return false;
@@ -220,7 +220,7 @@ namespace slideshow
{
maBounds = rNewBounds;
- css::uno::Reference< css::rendering::XCanvas > pCanvas = mpViewLayer->getCanvas();
+ css::uno::Reference< css::rendering::XCanvas > pCanvas = mpViewLayer->getCanvas().mxCanvas;
if( !pCanvas.is() )
return false;
@@ -283,10 +283,10 @@ namespace slideshow
{
if( !mxPlayer.is() && mxShape.is() )
{
- ENSURE_OR_RETURN_FALSE( mpViewLayer->getCanvas().is(),
+ ENSURE_OR_RETURN_FALSE( mpViewLayer->getCanvas().mxCanvas.is(),
"ViewMediaShape::update(): Invalid layer canvas" );
- uno::Reference< rendering::XCanvas > xCanvas( mpViewLayer->getCanvas() );
+ uno::Reference< rendering::XCanvas > xCanvas( mpViewLayer->getCanvas().mxCanvas );
if( xCanvas.is() )
{
diff --git a/slideshow/source/engine/shapes/viewshape.cxx b/slideshow/source/engine/shapes/viewshape.cxx
index e3d857953c5e..2d92f71b6c5b 100644
--- a/slideshow/source/engine/shapes/viewshape.cxx
+++ b/slideshow/source/engine/shapes/viewshape.cxx
@@ -508,7 +508,7 @@ namespace slideshow
// sprite needs repaint - output to sprite canvas
// ==============================================
- css::uno::Reference< css::rendering::XCanvas > pContentCanvas( mpSprite->getContentCanvas() );
+ css::uno::Reference< css::rendering::XCanvas > pContentCanvas( mpSprite->getContentCanvas().mxCanvas );
return draw( pContentCanvas,
xShape,
@@ -838,7 +838,7 @@ namespace slideshow
::basegfx::B2DSize ViewShape::getAntialiasingBorder() const
{
- ENSURE_OR_THROW( mpViewLayer->getCanvas().is(),
+ ENSURE_OR_THROW( mpViewLayer->getCanvas().mxCanvas.is(),
"ViewShape::getAntialiasingBorder(): Invalid ViewLayer canvas" );
#if 0
@@ -884,7 +884,7 @@ namespace slideshow
int nUpdateFlags,
bool bIsVisible ) const
{
- ENSURE_OR_RETURN_FALSE( mpViewLayer->getCanvas().is(),
+ ENSURE_OR_RETURN_FALSE( mpViewLayer->getCanvas().mxCanvas.is(),
"ViewShape::update(): Invalid layer canvas" );
// Shall we render to a sprite, or to a plain canvas?
@@ -902,7 +902,7 @@ namespace slideshow
rArgs.mnShapePriority,
bIsVisible );
else
- return render( mpViewLayer->getCanvas(),
+ return render( mpViewLayer->getCanvas().mxCanvas,
xShape,
xPage,
xPrimitives,
diff --git a/slideshow/source/engine/slide/layermanager.cxx b/slideshow/source/engine/slide/layermanager.cxx
index f6b1e4ad4632..f4fdf98f394b 100644
--- a/slideshow/source/engine/slide/layermanager.cxx
+++ b/slideshow/source/engine/slide/layermanager.cxx
@@ -608,9 +608,10 @@ namespace slideshow
return true; // visible on all views
}
- virtual css::uno::Reference< css::rendering::XCanvas > getCanvas() const
+ virtual const Canvas& getCanvas() const
{
- return mpCanvas;
+ // TODO-NYI
+ //return mpCanvas;
}
virtual void clear() const
@@ -659,6 +660,12 @@ namespace slideshow
OSL_FAIL( "BitmapView::setClip(): This method is not supposed to be called!" );
}
+ virtual basegfx::B2DPolyPolygon getClip() const
+ {
+ OSL_FAIL( "BitmapView::getClip(): This method is not supposed to be called!" );
+ return basegfx::B2DPolyPolygon();
+ }
+
virtual bool resize( const ::basegfx::B2DRange& /*rArea*/ )
{
OSL_FAIL( "BitmapView::resize(): This method is not supposed to be called!" );
diff --git a/slideshow/source/engine/slide/slideimpl.cxx b/slideshow/source/engine/slide/slideimpl.cxx
index ec3fb75bf43b..7582c9d43469 100644
--- a/slideshow/source/engine/slide/slideimpl.cxx
+++ b/slideshow/source/engine/slide/slideimpl.cxx
@@ -308,8 +308,8 @@ public:
// fully clear view content to background color
rView->clearAll();
- SlideBitmapSharedPtr pBitmap( mrSlide.getCurrentSlideBitmap( rView ) );
- css::uno::Reference< css::rendering::XCanvas > pCanvas( rView->getCanvas() );
+ SlideBitmapSharedPtr pBitmap( mrSlide.getCurrentSlideBitmap( rView ) );
+ const Canvas& rCanvas( rView->getCanvas() );
const ::basegfx::B2DHomMatrix aViewTransform( rView->getTransformation() );
const ::basegfx::B2DPoint aOutPosPixel( aViewTransform * ::basegfx::B2DPoint() );
@@ -748,7 +748,7 @@ bool SlideImpl::isAnimated()
SlideBitmapSharedPtr SlideImpl::createCurrentSlideBitmap( const UnoViewSharedPtr& rView,
const ::basegfx::B2ISize& rBmpSize ) const
{
- ENSURE_OR_THROW( rView && rView->getCanvas().is(),
+ ENSURE_OR_THROW( rView && rView->getCanvas().mxCanvas.is(),
"SlideImpl::createCurrentSlideBitmap(): Invalid view" );
ENSURE_OR_THROW( mpLayerManager,
"SlideImpl::createCurrentSlideBitmap(): Invalid layer manager" );
@@ -756,7 +756,7 @@ SlideBitmapSharedPtr SlideImpl::createCurrentSlideBitmap( const UnoViewSharedPtr
"SlideImpl::createCurrentSlideBitmap(): No show loaded" );
uno::Reference< rendering::XCanvas > pCanvas(
- rView->getCanvas() );
+ rView->getCanvas().mxCanvas );
// create a bitmap of appropriate size
uno::Reference< rendering::XBitmap > pBitmap(
diff --git a/slideshow/source/engine/slide/userpaintoverlay.cxx b/slideshow/source/engine/slide/userpaintoverlay.cxx
index 788a9bd28cf4..d19bd7a3056e 100644
--- a/slideshow/source/engine/slide/userpaintoverlay.cxx
+++ b/slideshow/source/engine/slide/userpaintoverlay.cxx
@@ -145,7 +145,7 @@ namespace slideshow
//get via SlideImpl instance the bitmap of the slide unmodified to redraw it
SlideBitmapSharedPtr pBitmap( mrSlide.getCurrentSlideBitmap( (*aIter) ) );
- css::uno::Reference< css::rendering::XCanvas > pCanvas( (*aIter)->getCanvas() );
+ css::uno::Reference< css::rendering::XCanvas > pCanvas( (*aIter)->getCanvas().mxCanvas );
const ::basegfx::B2DHomMatrix aViewTransform( (*aIter)->getTransformation() );
const ::basegfx::B2DPoint aOutPosPixel( aViewTransform * ::basegfx::B2DPoint() );
@@ -374,7 +374,7 @@ namespace slideshow
//get via SlideImpl instance the bitmap of the slide unmodified to redraw it
SlideBitmapSharedPtr pBitmap( mrSlide.getCurrentSlideBitmap( (*aIter) ) );
- css::uno::Reference< css::rendering::XCanvas > pCanvas( (*aIter)->getCanvas() );
+ css::uno::Reference< css::rendering::XCanvas > pCanvas( (*aIter)->getCanvas().mxCanvas );
::basegfx::B2DHomMatrix aViewTransform( (*aIter)->getTransformation() );
const ::basegfx::B2DPoint aOutPosPixel( aViewTransform * ::basegfx::B2DPoint() );
@@ -425,7 +425,7 @@ namespace slideshow
{
uno::Reference< rendering::XPolyPolygon2D > pPolyPoly(
basegfx::unotools::xPolyPolygonFromB2DPolygon(
- (*aIter)->getCanvas()->getDevice(),
+ (*aIter)->getCanvas().mxCanvas->getDevice(),
aPoly ) );
if( pPolyPoly.is() )
diff --git a/slideshow/source/engine/slidebitmap.cxx b/slideshow/source/engine/slidebitmap.cxx
index df9a39b6d7f5..f983d6986eee 100644
--- a/slideshow/source/engine/slidebitmap.cxx
+++ b/slideshow/source/engine/slidebitmap.cxx
@@ -50,9 +50,9 @@ namespace slideshow
ENSURE_OR_THROW( mxBitmap.is(), "SlideBitmap::SlideBitmap(): Invalid bitmap" );
}
- bool SlideBitmap::draw( const css::uno::Reference< css::rendering::XCanvas >& rCanvas ) const
+ bool SlideBitmap::draw( const Canvas& rCanvas ) const
{
- ENSURE_OR_RETURN_FALSE( rCanvas.is(),
+ ENSURE_OR_RETURN_FALSE( rCanvas.mxCanvas.is(),
"SlideBitmap::draw(): Invalid canvas" );
// selectively only copy the transformation from current viewstate,
@@ -74,13 +74,13 @@ namespace slideshow
// TODO(P1): Buffer the clip polygon
aRenderState.Clip =
::basegfx::unotools::xPolyPolygonFromB2DPolyPolygon(
- rCanvas->getDevice(),
+ rCanvas.mxCanvas->getDevice(),
maClipPoly );
}
- rCanvas->drawBitmap( mxBitmap,
- aViewState,
- aRenderState );
+ rCanvas.mxCanvas->drawBitmap( mxBitmap,
+ aViewState,
+ aRenderState );
}
catch( uno::Exception& )
{
diff --git a/slideshow/source/engine/slideview.cxx b/slideshow/source/engine/slideview.cxx
index 8a6bf536d8fe..8d0a23f2a9f5 100644
--- a/slideshow/source/engine/slideview.cxx
+++ b/slideshow/source/engine/slideview.cxx
@@ -41,15 +41,18 @@
#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>
+#include <basegfx/polygon/b2dpolygon.hxx>
#include <basegfx/polygon/b2dpolygontools.hxx>
#include <basegfx/polygon/b2dpolypolygontools.hxx>
-#include <basegfx/tools/canvastools.hxx>
#include <basegfx/polygon/b2dpolygonclipper.hxx>
#include <basegfx/polygon/b2dpolypolygoncutter.hxx>
+#include <basegfx/tools/canvastools.hxx>
+#include <basegfx/color/bcolor.hxx>
#include <com/sun/star/presentation/XSlideShow.hpp>
+#include <com/sun/star/rendering/CompositeOperation.hpp>
+#include <com/sun/star/rendering/XPolyPolygon2D.hpp>
#include <boost/noncopyable.hpp>
#include <boost/bind.hpp>
@@ -150,61 +153,54 @@ basegfx::B2DPolyPolygon prepareClip( const basegfx::B2DPolyPolygon& rClip )
}
-void clearRect( const basegfx::B2IRange& )
+void clearRect( const ViewLayer& rViewLayer,
+ const basegfx::B2IRange& rArea,
+ const basegfx::B2DPolyPolygon* pClip=NULL )
{
-#if 0
- // TODO-NYI
- pCanvas = getCanvas(); ...
+ const Canvas& rViewCanvas = rViewLayer.getCanvas();
+
+ // set everything to default (including transformation (->device
+ // pixel))
+ rendering::ViewState aPixelViewState;
+ ::canvas::tools::initViewState( aPixelViewState );
- // convert clip polygon to device coordinate system
- ::basegfx::B2DPolyPolygon const* pClipPoly( pCanvas->getClip() );
- if( pClipPoly )
+ // convert clip polygon to device coordinate system & set to
+ // viewstate
+ if( pClip )
{
- ::basegfx::B2DPolyPolygon aClipPoly( *pClipPoly );
- aClipPoly.transform( pCanvas->getTransformation() );
- // TODO-NYI
- //pCanvas->setClip( aClipPoly );
+ ::basegfx::B2DPolyPolygon aClipPoly( *pClip );
+ aClipPoly.transform( rViewLayer.getTransformation() );
+ aPixelViewState.Clip = ::basegfx::unotools::xPolyPolygonFromB2DPolyPolygon(
+ rViewCanvas.mxCanvas->getDevice(),
+ aClipPoly );
}
- // set transformation to identitiy (->device pixel)
- // TODO-NYI
- //pCanvas->setTransformation( ::basegfx::B2DHomMatrix() );
+ rendering::RenderState aRenderState;
+ ::canvas::tools::initRenderState( aRenderState );
+ aRenderState.CompositeOperation = rendering::CompositeOperation::SOURCE;
+ aRenderState.DeviceColor = basegfx::BColor(0xFFFFFF00U).colorToDoubleSequence(
+ rViewCanvas.mxCanvas->getDevice());
// #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.
- uno::Reference<rendering::XPolyPolygon> pPolyPoly(
+ uno::Reference<rendering::XPolyPolygon2D> pPolyPoly(
basegfx::unotools::xPolyPolygonFromB2DPolygon(
- pCanvas->getDevice(),
+ rViewCanvas.mxCanvas->getDevice(),
basegfx::tools::createPolygonFromRect(
basegfx::B2DRange(rArea))) );
- if( pPolyPoly )
- {
- pPolyPoly->setCompositeOp( cppcanvas::CanvasGraphic::SOURCE );
- pPolyPoly->setRGBAFillColor( 0xFFFFFF00U );
- pPolyPoly->draw();
- }
-#endif
+ rViewCanvas.mxCanvas->fillPolyPolygon( pPolyPoly, aPixelViewState, aRenderState );
#if OSL_DEBUG_LEVEL >= 2 && defined(DBG_UTIL)
- // TODO-NYI
- uno::Reference<rendering::XCanvas> pCliplessCanvas( pCanvas->clone() );
- pCliplessCanvas->setClip();
-
- if( pCanvas->getClip() )
- {
- ::cppcanvas::PolyPolygonSharedPtr pPolyPoly2(
- ::cppcanvas::BaseGfxFactory::getInstance().createPolyPolygon( pCliplessCanvas,
- aPoly ));
- if( pPolyPoly2 )
- {
- pPolyPoly2->setRGBALineColor( 0x008000FFU );
- pPolyPoly2->draw();
- }
- }
+ // draw clip polygon in debug mode
+ pPolyPoly = aPixelViewState.Clip;
+ aPixelViewState.Clip.clear();
+ aRenderState.DeviceColor = basegfx::BColor(0x008000FFU).colorToDoubleSequence(
+ rViewCanvas.mxCanvas->getDevice());
+ rViewCanvas.mxCanvas->drawPolyPolygon( pPolyPoly, aPixelViewState, aRenderState );
#endif
}
@@ -393,36 +389,36 @@ class SlideViewLayer : public ViewLayer,
private boost::noncopyable
{
/// Smart container for all sprites issued by this layer
- mutable LayerSpriteContainer maSpriteContainer;
+ mutable LayerSpriteContainer maSpriteContainer;
/// Bounds of this layer in user space coordinates
- basegfx::B2DRange maLayerBounds;
+ basegfx::B2DRange maLayerBounds;
/// Bounds of this layer in device pixel
- mutable basegfx::B2IRange maLayerBoundsPixel;
+ mutable basegfx::B2IRange maLayerBoundsPixel;
/// Current clip polygon in user coordinates
- basegfx::B2DPolyPolygon maClip;
+ basegfx::B2DPolyPolygon maClip;
/// Current size of the view in user coordinates
- basegfx::B2DSize maUserSize;
+ basegfx::B2DSize maUserSize;
/// Current overall view transformation
- basegfx::B2DHomMatrix maTransformation;
+ basegfx::B2DHomMatrix maTransformation;
/// 'parent' canvas, this viewlayer is associated with
- const uno::Reference<rendering::XSpriteCanvas> mpSpriteCanvas;
+ const uno::Reference<rendering::XSpriteCanvas> mxSpriteCanvas;
/** output surface (necessarily a sprite, won't otherwise be able
to display anything <em>before</em> other sprites)
*/
- mutable uno::Reference<rendering::XCustomSprite> mpSprite;
+ mutable uno::Reference<rendering::XCustomSprite> mxSprite;
/// actual output canvas retrieved from a sprite
- mutable uno::Reference<rendering::XCanvas> mpOutputCanvas;
+ mutable Canvas maOutputCanvas;
/// ptr back to owning view. needed for isOnView() method
- View const* const mpParentView;
+ View const* const mpParentView;
public:
/** Create a new layer
@@ -436,7 +432,7 @@ public:
@param rLayerBounds
Initial layer bounds, in view coordinate system
*/
- SlideViewLayer( const uno::Reference<rendering::XSpriteCanvas>& pCanvas,
+ SlideViewLayer( const uno::Reference<rendering::XSpriteCanvas>& xCanvas,
const basegfx::B2DHomMatrix& rTransform,
const basegfx::B2DRange& rLayerBounds,
const basegfx::B2DSize& rUserSize,
@@ -447,9 +443,9 @@ public:
maClip(),
maUserSize(rUserSize),
maTransformation(rTransform),
- mpSpriteCanvas(pCanvas),
- mpSprite(),
- mpOutputCanvas(),
+ mxSpriteCanvas(xCanvas),
+ mxSprite(),
+ maOutputCanvas(),
mpParentView(pParentView)
{
}
@@ -472,8 +468,8 @@ public:
if( rNewLayerPixel != maLayerBoundsPixel )
{
// re-gen sprite with new size
- mpOutputCanvas.clear();
- mpSprite.clear();
+ maOutputCanvas.mxCanvas.clear();
+ mxSprite.clear();
}
}
@@ -503,15 +499,15 @@ private:
const ::basegfx::B2DSize& rSpriteSizePixel,
double nPriority ) const
{
- css::uno::Reference< css::rendering::XCustomSprite > pSprite(
- mpSpriteCanvas->createCustomSprite(
+ css::uno::Reference< css::rendering::XCustomSprite > xSprite(
+ mxSpriteCanvas->createCustomSprite(
rSpriteSizePixel.getX(),
rSpriteSizePixel.getY()) );
- maSpriteContainer.addSprite( pSprite,
+ maSpriteContainer.addSprite( xSprite,
nPriority );
- return pSprite;
+ return xSprite;
}
virtual void setPriority( const basegfx::B1DRange& rRange )
@@ -523,8 +519,8 @@ private:
maSpriteContainer.setLayerPriority( rRange );
- if( mpSprite.is() )
- mpSprite->setPriority( rRange.getMinimum() );
+ if( mxSprite.is() )
+ mxSprite->setPriority( rRange.getMinimum() );
}
virtual basegfx::B2DHomMatrix getTransformation() const
@@ -558,19 +554,20 @@ private:
{
// clear whole canvas
const basegfx::B2I64Tuple& rSpriteSize(maLayerBoundsPixel.getRange());
- clearRect(basegfx::B2IRange(0,0,
- rSpriteSize.getX(),rSpriteSize.getY()));
+ basegfx::B2DPolyPolygon aClip = getClip();
+
+ clearRect(*this,
+ basegfx::B2IRange(0,0,
+ rSpriteSize.getX(),rSpriteSize.getY()),
+ &aClip);
}
virtual void clearAll() const
{
- // TODO-NYI
- // clear layer clip, to clear whole area
- //pCanvas->setClip();
-
// clear whole canvas
const basegfx::B2I64Tuple& rSpriteSize(maLayerBoundsPixel.getRange());
- clearRect(basegfx::B2IRange(0,0,
+ clearRect(*this,
+ basegfx::B2IRange(0,0,
rSpriteSize.getX(),rSpriteSize.getY()));
}
@@ -579,11 +576,11 @@ private:
return rView.get() == mpParentView;
}
- virtual uno::Reference<rendering::XCanvas> getCanvas() const
+ virtual const Canvas& getCanvas() const
{
- if( !mpOutputCanvas.is() )
+ if( !maOutputCanvas.mxCanvas.is() )
{
- if( !mpSprite.is() )
+ if( !mxSprite.is() )
{
maLayerBoundsPixel = getLayerBoundsPixel(maLayerBounds,
maTransformation);
@@ -597,50 +594,44 @@ private:
maLayerBoundsPixel = basegfx::B2IRange(0,0,1,1);
const basegfx::B2I64Tuple& rSpriteSize(maLayerBoundsPixel.getRange());
- mpSprite = mpSpriteCanvas->createCustomSprite(
- sal::static_int_cast<sal_Int32>(rSpriteSize.getX()),
- sal::static_int_cast<sal_Int32>(rSpriteSize.getY()) );
+ mxSprite = mxSpriteCanvas->createCustomSprite(
+ sal::static_int_cast<sal_Int32>(rSpriteSize.getX()),
+ sal::static_int_cast<sal_Int32>(rSpriteSize.getY()) );
- mpSprite->setPriority(
+ mxSprite->setPriority(
maSpriteContainer.getLayerPriority().getMinimum() );
-#if OSL_DEBUG_LEVEL >= 2 && defined(DBG_UTIL)
- mpSprite->movePixel(
- basegfx::B2DPoint(maLayerBoundsPixel.getMinimum()) +
- basegfx::B2DPoint(10,10) );
-
- mpSprite->setAlpha(0.5);
-#else
-#if 0
- // TODO-NYI
- mpSprite->movePixel(
- basegfx::B2DPoint(maLayerBoundsPixel.getMinimum()) );
-#endif
- mpSprite->setAlpha(1.0);
-#endif
- mpSprite->show();
+ mxSprite->move(
+ basegfx::unotools::point2DFromB2DPoint(
+ basegfx::B2DPoint(
+ maLayerBoundsPixel.getMinimum())),
+ maOutputCanvas.maDummyDefaultViewState,
+ maOutputCanvas.maDummyDefaultRenderState);
+ mxSprite->setAlpha(1.0);
+ mxSprite->show();
}
- ENSURE_OR_THROW( mpSprite.is(),
- "SlideViewLayer::getCanvas(): no layer sprite" );
+ ENSURE_OR_THROW( mxSprite.is(),
+ "SlideViewLayer::getCanvas(): no layer sprite" );
- mpOutputCanvas = mpSprite->getContentCanvas();
+ maOutputCanvas.mxCanvas = mxSprite->getContentCanvas();
- ENSURE_OR_THROW( mpOutputCanvas.is(),
- "SlideViewLayer::getCanvas(): sprite doesn't yield a canvas" );
+ ENSURE_OR_THROW( maOutputCanvas.mxCanvas.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
+ // setup clip & transform
+ ::canvas::tools::setViewStateTransform( maOutputCanvas.maViewState,
+ getTransformation() );
+ ::basegfx::B2DPolyPolygon aClipPoly =
+ createClipPolygon( maClip,
+ maUserSize );
+ maOutputCanvas.maViewState.Clip =
+ ::basegfx::unotools::xPolyPolygonFromB2DPolyPolygon(
+ maOutputCanvas.mxCanvas->getDevice(),
+ aClipPoly );
}
- return mpOutputCanvas;
+ return maOutputCanvas;
}
virtual void setClip( const basegfx::B2DPolyPolygon& rClip )
@@ -651,17 +642,24 @@ private:
{
maClip = aNewClip;
-#if 0
- // TODO-NYI
- if(mpOutputCanvas.is())
- mpOutputCanvas->setClip(
+ if( maOutputCanvas.mxCanvas.is() )
+ {
+ ::basegfx::B2DPolyPolygon aClipPoly =
createClipPolygon( maClip,
- mpOutputCanvas,
- maUserSize ));
-#endif
+ maUserSize );
+ maOutputCanvas.maViewState.Clip =
+ ::basegfx::unotools::xPolyPolygonFromB2DPolyPolygon(
+ maOutputCanvas.mxCanvas->getDevice(),
+ aClipPoly );
+ }
}
}
+ virtual basegfx::B2DPolyPolygon getClip() const
+ {
+ return maClip;
+ }
+
virtual bool resize( const ::basegfx::B2DRange& rArea )
{
const bool bRet( maLayerBounds != rArea );
@@ -707,7 +705,7 @@ private:
virtual bool isOnView(boost::shared_ptr<View> const& rView) const;
virtual void clear() const;
virtual void clearAll() const;
- virtual css::uno::Reference<rendering::XCanvas> getCanvas() const;
+ virtual const Canvas& getCanvas() const;
virtual css::uno::Reference<rendering::XCustomSprite> createSprite( const ::basegfx::B2DSize& rSpriteSizePixel,
double nPriority ) const;
virtual void setPriority( const basegfx::B1DRange& rRange );
@@ -715,6 +713,7 @@ private:
virtual ::basegfx::B2DHomMatrix getTransformation() const;
virtual basegfx::B2DHomMatrix getSpriteTransformation() const;
virtual void setClip( const ::basegfx::B2DPolyPolygon& rClip );
+ virtual basegfx::B2DPolyPolygon getClip() const;
virtual bool resize( const ::basegfx::B2DRange& rArea );
// UnoView:
@@ -750,7 +749,8 @@ private:
enum{ LAYER_ULLAGE=8 };
uno::Reference<presentation::XSlideShowView> mxView;
- uno::Reference<rendering::XSpriteCanvas> mpCanvas;
+ mutable Canvas maCanvas;
+ uno::Reference<rendering::XSpriteCanvas> mxSpriteCanvas;
EventMultiplexer& mrEventMultiplexer;
EventQueue& mrEventQueue;
@@ -771,7 +771,8 @@ SlideView::SlideView( const uno::Reference<presentation::XSlideShowView>& xView,
EventMultiplexer& rEventMultiplexer ) :
SlideViewBase( m_aMutex ),
mxView( xView ),
- mpCanvas(),
+ maCanvas(),
+ mxSpriteCanvas(),
mrEventMultiplexer( rEventMultiplexer ),
mrEventQueue( rEventQueue ),
maSprites(),
@@ -786,9 +787,12 @@ SlideView::SlideView( const uno::Reference<presentation::XSlideShowView>& xView,
ENSURE_OR_THROW( mxView.is(),
"SlideView::SlideView(): Invalid view" );
- mpCanvas = xView->getCanvas();
- ENSURE_OR_THROW( mpCanvas.is(),
- "Could not obtain Canvas" );
+ maCanvas.mxCanvas = xView->getCanvas();
+ mxSpriteCanvas.set( maCanvas.mxCanvas,
+ uno::UNO_QUERY );
+
+ ENSURE_OR_THROW( maCanvas.mxCanvas.is() && mxSpriteCanvas.is(),
+ "Could not obtain XSpriteCanvas" );
geometry::AffineMatrix2D aViewTransform(
xView->getTransformation() );
@@ -819,7 +823,8 @@ void SlideView::disposing()
maViewLayers.clear();
maSprites.clear();
- mpCanvas.clear();
+ maCanvas.mxCanvas.clear();
+ mxSpriteCanvas.clear();
// additionally, also de-register from XSlideShowView
if (mxView.is())
@@ -834,7 +839,7 @@ ViewLayerSharedPtr SlideView::createViewLayer( const basegfx::B2DRange& rLayerBo
{
osl::MutexGuard aGuard( m_aMutex );
- ENSURE_OR_THROW( mpCanvas.is(),
+ ENSURE_OR_THROW( maCanvas.mxCanvas.is(),
"SlideView::createViewLayer(): Disposed" );
const std::size_t nNumLayers( maViewLayers.size() );
@@ -844,11 +849,12 @@ ViewLayerSharedPtr SlideView::createViewLayer( const basegfx::B2DRange& rLayerBo
if( nNumLayers > LAYER_ULLAGE )
pruneLayers();
- boost::shared_ptr<SlideViewLayer> pViewLayer( new SlideViewLayer(mpCanvas,
- getTransformation(),
- rLayerBounds,
- maUserSize,
- this) );
+ boost::shared_ptr<SlideViewLayer> pViewLayer(
+ new SlideViewLayer(mxSpriteCanvas,
+ getTransformation(),
+ rLayerBounds,
+ maUserSize,
+ this) );
maViewLayers.push_back( pViewLayer );
return pViewLayer;
@@ -858,52 +864,53 @@ bool SlideView::updateScreen() const
{
osl::MutexGuard aGuard( m_aMutex );
- ENSURE_OR_RETURN_FALSE( mpCanvas.get(),
+ ENSURE_OR_RETURN_FALSE( maCanvas.mxCanvas.is(),
"SlideView::updateScreen(): Disposed" );
- return mpCanvas->updateScreen( false );
+ return mxSpriteCanvas->updateScreen( false );
}
bool SlideView::paintScreen() const
{
osl::MutexGuard aGuard( m_aMutex );
- ENSURE_OR_RETURN_FALSE( mpCanvas.get(),
+ ENSURE_OR_RETURN_FALSE( maCanvas.mxCanvas.is(),
"SlideView::paintScreen(): Disposed" );
- return mpCanvas->updateScreen( true );
+ return mxSpriteCanvas->updateScreen( true );
}
void SlideView::clear() const
{
osl::MutexGuard aGuard( m_aMutex );
- OSL_ENSURE( mxView.is() && mpCanvas.is(),
+ OSL_ENSURE( mxView.is() && maCanvas.mxCanvas.is(),
"SlideView::clear(): Disposed" );
- if( !mxView.is() || !mpCanvas.is() )
+ if( !mxView.is() || !maCanvas.mxCanvas.is() )
return;
// keep layer clip
- clearRect(getLayerBoundsPixel(
- basegfx::B2DRange(0,0,
- maUserSize.getX(),
- maUserSize.getY()),
- getTransformation()));
+ clearRect( *this,
+ getLayerBoundsPixel(
+ basegfx::B2DRange(0,0,
+ maUserSize.getX(),
+ maUserSize.getY()),
+ getTransformation()));
}
void SlideView::clearAll() const
{
osl::MutexGuard aGuard( m_aMutex );
- OSL_ENSURE( mxView.is() && mpCanvas.is(),
+ OSL_ENSURE( mxView.is() && maCanvas.mxCanvas.is(),
"SlideView::clear(): Disposed" );
- if( !mxView.is() || !mpCanvas.is() )
+ if( !mxView.is() || !maCanvas.mxCanvas.is() )
return;
- 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
+ maCanvas.mxCanvas->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
// clear whole view
mxView->clear();
@@ -930,14 +937,14 @@ bool SlideView::isOnView(boost::shared_ptr<View> const& rView) const
return rView.get() == this;
}
-css::uno::Reference< css::rendering::XCanvas > SlideView::getCanvas() const
+const Canvas& SlideView::getCanvas() const
{
osl::MutexGuard aGuard( m_aMutex );
- ENSURE_OR_THROW( mpCanvas.is(),
+ ENSURE_OR_THROW( maCanvas.mxCanvas.is(),
"SlideView::getCanvas(): Disposed" );
- return mpCanvas;
+ return maCanvas;
}
css::uno::Reference< css::rendering::XCustomSprite > SlideView::createSprite(
@@ -946,10 +953,10 @@ css::uno::Reference< css::rendering::XCustomSprite > SlideView::createSprite(
{
osl::MutexGuard aGuard( m_aMutex );
- ENSURE_OR_THROW( mpCanvas.is(), "SlideView::createSprite(): Disposed" );
+ ENSURE_OR_THROW( maCanvas.mxCanvas.is(), "SlideView::createSprite(): Disposed" );
css::uno::Reference< css::rendering::XCustomSprite > pSprite(
- mpCanvas->createCustomSprite(
+ mxSpriteCanvas->createCustomSprite(
rSpriteSizePixel.getX(),
rSpriteSizePixel.getY()) );
@@ -964,7 +971,7 @@ void SlideView::setPriority( const basegfx::B1DRange& /*rRange*/ )
osl::MutexGuard aGuard( m_aMutex );
OSL_FAIL( "SlideView::setPriority() is a NOOP for slide view - "
- "content will always be shown in the background" );
+ "content will always be shown in the background" );
}
basegfx::B2DHomMatrix SlideView::getTransformation() const
@@ -1001,6 +1008,13 @@ void SlideView::setClip( const basegfx::B2DPolyPolygon& rClip )
}
}
+basegfx::B2DPolyPolygon SlideView::getClip() const
+{
+ osl::MutexGuard aGuard( m_aMutex );
+
+ return maClip;
+}
+
bool SlideView::resize( const ::basegfx::B2DRange& /*rArea*/ )
{
osl::MutexGuard aGuard( m_aMutex );
@@ -1106,7 +1120,7 @@ void SlideView::windowPaint( const awt::PaintEvent& /*e*/ )
{
osl::MutexGuard aGuard( m_aMutex );
- OSL_ENSURE( mxView.is() && mpCanvas.is(), "Disposed, but event received?!" );
+ OSL_ENSURE( mxView.is() && maCanvas.mxCanvas.is(), "Disposed, but event received?!" );
// notify view clobbering. Don't call EventMultiplexer directly,
// this might not be the main thread!
@@ -1118,20 +1132,24 @@ void SlideView::windowPaint( const awt::PaintEvent& /*e*/ )
void SlideView::updateCanvas()
{
- OSL_ENSURE( mpCanvas.is(),
+ OSL_ENSURE( maCanvas.mxCanvas.is(),
"SlideView::updateCanvasTransform(): Disposed" );
- if( !mpCanvas.is() || !mxView.is())
+ if( !maCanvas.mxCanvas.is() || !mxView.is())
return;
clearAll();
-#if 0
- // TODO-NYI
- mpCanvas->setTransformation( getTransformation() );
- mpCanvas->setClip(
- createClipPolygon( maClip,
- maUserSize ));
-#endif
+
+ ::canvas::tools::setViewStateTransform(
+ maCanvas.maViewState,
+ getTransformation() );
+ ::basegfx::B2DPolyPolygon aClipPoly =
+ createClipPolygon( maClip,
+ maUserSize );
+ maCanvas.maViewState.Clip =
+ ::basegfx::unotools::xPolyPolygonFromB2DPolyPolygon(
+ maCanvas.mxCanvas->getDevice(),
+ aClipPoly );
// forward update to viewlayers
pruneLayers( true );
@@ -1140,18 +1158,20 @@ void SlideView::updateCanvas()
void SlideView::updateClip()
{
// TODO-NYI - here and other places, consolidate to ensure_and_return!
- OSL_ENSURE( mpCanvas.is(),
+ OSL_ENSURE( maCanvas.mxCanvas.is(),
"SlideView::updateClip(): Disposed" );
- if( !mpCanvas.is() )
+ if( !maCanvas.mxCanvas.is() )
return;
-#if 0
- // TODO-NYI
- mpCanvas->setClip(
- createClipPolygon( maClip,
- maUserSize ));
-#endif
+ ::basegfx::B2DPolyPolygon aClipPoly =
+ createClipPolygon( maClip,
+ maUserSize );
+ maCanvas.maViewState.Clip =
+ ::basegfx::unotools::xPolyPolygonFromB2DPolyPolygon(
+ maCanvas.mxCanvas->getDevice(),
+ aClipPoly );
+
pruneLayers( false );
}
diff --git a/slideshow/source/engine/tools.cxx b/slideshow/source/engine/tools.cxx
index 59865ab41626..120d13e77b7d 100644
--- a/slideshow/source/engine/tools.cxx
+++ b/slideshow/source/engine/tools.cxx
@@ -669,23 +669,22 @@ namespace slideshow
static_cast< sal_uInt8 >( nColor ) / 255.0 );
}
- void fillRect( const uno::Reference< rendering::XCanvas >& xCanvas,
- const ::basegfx::B2DRectangle& rRect,
- const basegfx::BColor& rFillColor )
+ void fillRect( const Canvas& rCanvas,
+ const ::basegfx::B2DRectangle& rRect,
+ const basegfx::BColor& rFillColor )
{
// TODO-NYI
- rendering::ViewState aViewState;
rendering::RenderState aRenderState;
canvas::tools::initRenderState(aRenderState);
aRenderState.DeviceColor =
rFillColor.colorToDoubleSequence(
- xCanvas->getDevice());
+ rCanvas.mxCanvas->getDevice());
- xCanvas->fillPolyPolygon(
+ rCanvas.mxCanvas->fillPolyPolygon(
basegfx::unotools::xPolyPolygonFromB2DPolygon(
- xCanvas->getDevice(),
+ rCanvas.mxCanvas->getDevice(),
::basegfx::tools::createPolygonFromRect( rRect )),
- aViewState, aRenderState);
+ rCanvas.maViewState, aRenderState);
}
::basegfx::B2DRectangle getAPIShapeBounds( const uno::Reference< drawing::XShape >& xShape )
diff --git a/slideshow/source/engine/transitions/combtransition.cxx b/slideshow/source/engine/transitions/combtransition.cxx
index 94f920b00cb4..f80a194cf554 100644
--- a/slideshow/source/engine/transitions/combtransition.cxx
+++ b/slideshow/source/engine/transitions/combtransition.cxx
@@ -92,7 +92,7 @@ void CombTransition::renderComb( double ,
const ViewEntry& rViewEntry ) const
{
const SlideBitmapSharedPtr& pEnteringBitmap = getEnteringBitmap(rViewEntry);
- const uno::Reference<rendering::XCanvas> pCanvas = rViewEntry.mpView->getCanvas();
+ const uno::Reference<rendering::XCanvas> pCanvas = rViewEntry.mpView->getCanvas().mxCanvas;
if( !pEnteringBitmap || !pCanvas.is() )
return;
diff --git a/slideshow/source/engine/transitions/slidechangebase.cxx b/slideshow/source/engine/transitions/slidechangebase.cxx
index d33da9cbf7b6..38aaed3eb8fd 100644
--- a/slideshow/source/engine/transitions/slidechangebase.cxx
+++ b/slideshow/source/engine/transitions/slidechangebase.cxx
@@ -102,7 +102,7 @@ SlideBitmapSharedPtr SlideChangeBase::createBitmap( const UnoViewSharedPtr&
getSlideSizePixel( basegfx::B2DSize( mpEnteringSlide->getSlideSize() ),
rView ));
- uno::Reference<rendering::XCanvas> pCanvas( rView->getCanvas() );
+ uno::Reference<rendering::XCanvas> pCanvas( rView->getCanvas().mxCanvas );
// create a bitmap of appropriate size
uno::Reference<rendering::XBitmap> pBitmap(
@@ -200,7 +200,7 @@ void SlideChangeBase::start( const AnimatableShapeSharedPtr& rShape,
// get the subclasses a chance to do any specific initialization before run
for ( ViewsVecT::const_iterator aCurr( beginViews() ), aEnd( endViews() ); aCurr != aEnd; ++aCurr )
- prepareForRun( *aCurr, aCurr->mpView->getCanvas() );
+ prepareForRun( *aCurr, aCurr->mpView->getCanvas().mxCanvas );
// start accompanying sound effect, if any
if( mpSoundPlayer )
@@ -232,7 +232,7 @@ void SlideChangeBase::end()
pSlideBitmap->clip( basegfx::B2DPolyPolygon() /* no clipping */ );
aCurr->mpView->clearAll();
renderBitmap( pSlideBitmap,
- aCurr->mpView->getCanvas() );
+ aCurr->mpView->getCanvas().mxCanvas );
++aCurr;
}
@@ -277,7 +277,7 @@ bool SlideChangeBase::operator()( double nValue )
// (i.e. pixel).
ViewEntry& rViewEntry( maViewData[i] );
- const uno::Reference<rendering::XCanvas>& rCanvas( rViewEntry.mpView->getCanvas() );
+ const uno::Reference<rendering::XCanvas>& rCanvas( rViewEntry.mpView->getCanvas().mxCanvas );
uno::Reference<rendering::XCustomSprite>& rInSprite( rViewEntry.mpInSprite );
uno::Reference<rendering::XCustomSprite>& rOutSprite( rViewEntry.mpOutSprite );
@@ -316,8 +316,9 @@ bool SlideChangeBase::operator()( double nValue )
// render the content
OSL_ASSERT( getLeavingBitmap( rViewEntry ) );
- if( getLeavingBitmap( rViewEntry ) )
- getLeavingBitmap( rViewEntry )->draw( pOutContentCanvas );
+ // TODO-NYI
+ //if( getLeavingBitmap( rViewEntry ) )
+ //getLeavingBitmap( rViewEntry )->draw( pOutContentCanvas );
}
}
@@ -335,7 +336,8 @@ bool SlideChangeBase::operator()( double nValue )
// between different canvases!
// render the content
- getEnteringBitmap( rViewEntry )->draw( pInContentCanvas );
+ // TODO-NYI
+ //getEnteringBitmap( rViewEntry )->draw( pInContentCanvas );
}
}
}
diff --git a/slideshow/source/inc/animatedsprite.hxx b/slideshow/source/inc/animatedsprite.hxx
index 8be16d0d2ea2..5c0cb1ea243e 100644
--- a/slideshow/source/inc/animatedsprite.hxx
+++ b/slideshow/source/inc/animatedsprite.hxx
@@ -21,7 +21,6 @@
#define INCLUDED_SLIDESHOW_ANIMATEDSPRITE_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>
@@ -29,6 +28,7 @@
#include <basegfx/point/b2dpoint.hxx>
#include <basegfx/polygon/b2dpolypolygon.hxx>
+#include "canvas.hxx"
#include "viewlayer.hxx"
#include <boost/optional.hpp>
@@ -106,7 +106,7 @@ namespace slideshow
canvas is already correctly setup, matching the
associated destination canvas.
*/
- css::uno::Reference< css::rendering::XCanvas > getContentCanvas() const;
+ const Canvas& getContentCanvas() const;
/** Move the sprite in device pixel space.
diff --git a/slideshow/source/inc/canvas.hxx b/slideshow/source/inc/canvas.hxx
new file mode 100644
index 000000000000..e7f396fbf208
--- /dev/null
+++ b/slideshow/source/inc/canvas.hxx
@@ -0,0 +1,45 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_SLIDESHOW_CANVAS_HXX
+#define INCLUDED_SLIDESHOW_CANVAS_HXX
+
+#include <com/sun/star/uno/Reference.hxx>
+#include <com/sun/star/rendering/XCanvas.hpp>
+#include <com/sun/star/rendering/ViewState.hpp>
+#include <com/sun/star/rendering/RenderState.hpp>
+#include <drawinglayer/geometry/viewinformation2d.hxx>
+
+namespace slideshow
+{
+ namespace internal
+ {
+ /// XCanvas and state parameters to render stuff
+ struct Canvas
+ {
+ Canvas();
+
+ /// render target
+ css::uno::Reference< css::rendering::XCanvas > mxCanvas;
+ /// view setup, clip etc
+ css::rendering::ViewState maViewState;
+ /// drawing layer view setup
+ ::drawinglayer::geometry::ViewInformation2D maViewInfo;
+
+ /// default-state view, for output into raw device state
+ css::rendering::ViewState maDummyDefaultViewState;
+ /// default-state render, for output into raw device state
+ css::rendering::RenderState maDummyDefaultRenderState;
+ };
+ }
+}
+
+#endif /* INCLUDED_SLIDESHOW_CANVAS_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/slideshow/source/inc/slidebitmap.hxx b/slideshow/source/inc/slidebitmap.hxx
index 2856fd871e42..f0fd9b32d657 100644
--- a/slideshow/source/inc/slidebitmap.hxx
+++ b/slideshow/source/inc/slidebitmap.hxx
@@ -21,13 +21,14 @@
#define INCLUDED_SLIDESHOW_SLIDEBITMAP_HXX
#include <com/sun/star/uno/Reference.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 "canvas.hxx"
+
#include <boost/shared_ptr.hpp>
#include <boost/noncopyable.hpp>
@@ -63,7 +64,7 @@ namespace slideshow
public:
SlideBitmap( const css::uno::Reference< css::rendering::XBitmap >& rBitmap );
- bool draw( const css::uno::Reference< css::rendering::XCanvas >& rCanvas ) const;
+ bool draw( const Canvas& 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 c2053e056b5f..7caf7423afdd 100644
--- a/slideshow/source/inc/tools.hxx
+++ b/slideshow/source/inc/tools.hxx
@@ -27,6 +27,7 @@
#include <basegfx/color/bcolor.hxx>
+#include "canvas.hxx"
#include "shapeattributelayer.hxx"
#include "shape.hxx"
#include "rgbcolor.hxx"
@@ -274,9 +275,9 @@ namespace slideshow
/** Fill a plain rectangle on the given canvas with the given color
*/
- void fillRect( const css::uno::Reference< css::rendering::XCanvas >& rCanvas,
- const basegfx::B2DRange& rRect,
- const basegfx::BColor& rFillColor );
+ void fillRect( const Canvas& 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/viewlayer.hxx b/slideshow/source/inc/viewlayer.hxx
index b4129657b7e4..31435a85c627 100644
--- a/slideshow/source/inc/viewlayer.hxx
+++ b/slideshow/source/inc/viewlayer.hxx
@@ -24,9 +24,10 @@
#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>
+#include "canvas.hxx"
+
namespace basegfx
{
class B1DRange;
@@ -45,6 +46,14 @@ namespace slideshow
{
class View;
+ /** One layer in a View
+
+ One out of possibly many layers in one View (in the MVC
+ sense of view) of the slideshow. We use ViewLayers to
+ group shapes with similar animation state, such that
+ animated effects display at the right 'z' order (i.e. in
+ front or behind other shapes).
+ */
class ViewLayer
{
public:
@@ -62,7 +71,7 @@ namespace slideshow
The canvas returned by this method must not change, as
long as this object is alive.
*/
- virtual css::uno::Reference< css::rendering::XCanvas > getCanvas() const = 0;
+ virtual const Canvas& getCanvas() const = 0;
/** Clear the clipped view layer area
@@ -98,8 +107,8 @@ namespace slideshow
canvas does not support sprites).
*/
virtual css::uno::Reference< css::rendering::XCustomSprite >
- createSprite( const basegfx::B2DVector& rSpriteSizePixel,
- double nPriority ) const = 0;
+ createSprite( const basegfx::B2DVector& rSpriteSizePixel,
+ double nPriority ) const = 0;
/** Set the layer priority range
@@ -147,6 +156,16 @@ namespace slideshow
*/
virtual void setClip( const basegfx::B2DPolyPolygon& rClip ) = 0;
+ /** Get clipping of this view layer.
+
+ @return
+ Clip poly-polygon of this layer. The polygon is interpreted
+ in the user coordinate system, i.e. the view layer has
+ the size as given by setViewSize() on its
+ corresponding View.
+ */
+ virtual basegfx::B2DPolyPolygon getClip() const = 0;
+
/** Resize this view layer.
@param rArea