diff options
author | Kurt Zenker <kz@openoffice.org> | 2005-11-02 12:43:15 +0000 |
---|---|---|
committer | Kurt Zenker <kz@openoffice.org> | 2005-11-02 12:43:15 +0000 |
commit | f221d52d2ec751a3888c590f4ef20ced8d2eb1bf (patch) | |
tree | f304ddf1684b9bad013c5545b5d32380b71d27fe /cppcanvas | |
parent | 692ab6aecf8dbc625e258005c2bea2d22a58a486 (diff) |
INTEGRATION: CWS canvas02 (1.5.8); FILE MERGED
2005/10/09 09:19:00 thb 1.5.8.2: RESYNC: (1.5-1.6); FILE MERGED
2005/08/19 11:08:34 thb 1.5.8.1: #i53538# Changed clip setting to use basegfx polygon (cppcanvas::PolyPolygon contains reference back to canvas); changed direct access to base class member to getter method, thus, providing the actual XCanvas clip polygon lazily.
Diffstat (limited to 'cppcanvas')
-rw-r--r-- | cppcanvas/source/wrapper/implcanvas.cxx | 38 |
1 files changed, 24 insertions, 14 deletions
diff --git a/cppcanvas/source/wrapper/implcanvas.cxx b/cppcanvas/source/wrapper/implcanvas.cxx index 2cadbfca8f70..01d8d10437c1 100644 --- a/cppcanvas/source/wrapper/implcanvas.cxx +++ b/cppcanvas/source/wrapper/implcanvas.cxx @@ -4,9 +4,9 @@ * * $RCSfile: implcanvas.cxx,v $ * - * $Revision: 1.6 $ + * $Revision: 1.7 $ * - * last change: $Author: rt $ $Date: 2005-09-08 08:26:17 $ + * last change: $Author: kz $ $Date: 2005-11-02 13:43:15 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -33,8 +33,6 @@ * ************************************************************************/ -#include <implcanvas.hxx> - #ifndef _RTL_USTRING_HXX_ #include <rtl/ustring.hxx> #endif @@ -44,6 +42,9 @@ #ifndef _BGFX_POLYGON_B2DPOLYPOLYGON_HXX #include <basegfx/polygon/b2dpolypolygon.hxx> #endif +#ifndef _BGFX_TOOLS_CANVASTOOLS_HXX +#include <basegfx/tools/canvastools.hxx> +#endif #ifndef _COM_SUN_STAR_RENDERING_XCANVAS_HPP_ #include <com/sun/star/rendering/XCanvas.hpp> @@ -55,6 +56,8 @@ #include <implfont.hxx> #include <implcolor.hxx> +#include <implcanvas.hxx> + using namespace ::com::sun::star; @@ -65,7 +68,7 @@ namespace cppcanvas ImplCanvas::ImplCanvas( const uno::Reference< rendering::XCanvas >& xCanvas ) : maViewState(), - mpClipPolyPolygon(), + maClipPolyPolygon(), mxCanvas( xCanvas ) { OSL_ENSURE( mxCanvas.is(), "Canvas::Canvas() invalid XCanvas" ); @@ -89,19 +92,16 @@ namespace cppcanvas maViewState ); } - void ImplCanvas::setClip( const PolyPolygonSharedPtr& rClipPoly ) + void ImplCanvas::setClip( const ::basegfx::B2DPolyPolygon& rClipPoly ) { - mpClipPolyPolygon = rClipPoly; - - if( rClipPoly.get() ) - maViewState.Clip = rClipPoly->getUNOPolyPolygon(); - else - maViewState.Clip.clear(); + // TODO(T3): not thread-safe. B2DPolyPolygon employs copy-on-write + maClipPolyPolygon = rClipPoly; + maViewState.Clip.clear(); } - PolyPolygonSharedPtr ImplCanvas::getClip() const + ::basegfx::B2DPolyPolygon ImplCanvas::getClip() const { - return mpClipPolyPolygon; + return maClipPolyPolygon; } FontSharedPtr ImplCanvas::createFont( const ::rtl::OUString& rFontName, const double& rCellSize ) const @@ -128,6 +128,16 @@ namespace cppcanvas rendering::ViewState ImplCanvas::getViewState() const { + if( maClipPolyPolygon.count() && !maViewState.Clip.is() ) + { + if( !mxCanvas.is() ) + return maViewState; + + maViewState.Clip = ::basegfx::unotools::xPolyPolygonFromB2DPolyPolygon( + mxCanvas->getDevice(), + maClipPolyPolygon ); + } + return maViewState; } |