INTEGRATION: CWS presfixes12 (1.8.18); FILE MERGED

2007/06/19 11:25:23 thb 1.8.18.3: #i10000# Reversed order, seems that gcc does not handle the safe bool idiom correctly here
2007/06/18 14:33:23 thb 1.8.18.2: #i10000# Avoid boost::optional::get(), which changed semantics after 1.31 (breaks the build for --with-system-boost)
2007/03/08 21:37:07 thb 1.8.18.1: #i37778# Added extra setClip() method to be able to set no clip - setting a clip with zero polygons by definition clips everything
This commit is contained in:
Oliver Bolte 2007-07-17 14:26:30 +00:00
parent 5bb8d6bf74
commit db8ecd8421

View File

@ -4,9 +4,9 @@
*
* $RCSfile: canvasgraphichelper.cxx,v $
*
* $Revision: 1.8 $
* $Revision: 1.9 $
*
* last change: $Author: obo $ $Date: 2006-10-12 15:00:40 $
* last change: $Author: obo $ $Date: 2007-07-17 15:26:30 $
*
* The Contents of this file are made available subject to
* the terms of GNU Lesser General Public License Version 2.1.
@ -38,25 +38,15 @@
#include <canvasgraphichelper.hxx>
#ifndef _COM_SUN_STAR_RENDERING_XGRAPHICDEVICE_HPP_
#include <com/sun/star/rendering/XGraphicDevice.hpp>
#endif
#ifndef _COM_SUN_STAR_RENDERING_XPOLYPOLYGON2D_HPP_
#include <com/sun/star/rendering/XPolyPolygon2D.hpp>
#endif
#ifndef _CANVAS_CANVASTOOLS_HXX
#include <canvas/canvastools.hxx>
#endif
#ifndef _BGFX_TOOLS_CANVASTOOLS_HXX
#include <basegfx/tools/canvastools.hxx>
#endif
#ifndef _BGFX_MATRIX_B2DHOMMATRIX_HXX
#include <basegfx/matrix/b2dhommatrix.hxx>
#endif
#include <cppcanvas/polypolygon.hxx>
#include <tools.hxx>
#include "tools.hxx"
using namespace ::com::sun::star;
@ -101,18 +91,24 @@ namespace cppcanvas
void CanvasGraphicHelper::setClip( const ::basegfx::B2DPolyPolygon& rClipPoly )
{
// TODO(T3): not thread-safe. B2DPolyPolygon employs copy-on-write
maClipPolyPolygon = rClipPoly;
maClipPolyPolygon.reset( rClipPoly );
maRenderState.Clip.clear();
}
::basegfx::B2DPolyPolygon CanvasGraphicHelper::getClip() const
void CanvasGraphicHelper::setClip()
{
return maClipPolyPolygon;
maClipPolyPolygon.reset();
maRenderState.Clip.clear();
}
::basegfx::B2DPolyPolygon const* CanvasGraphicHelper::getClip() const
{
return !maClipPolyPolygon ? NULL : &(*maClipPolyPolygon);
}
const rendering::RenderState& CanvasGraphicHelper::getRenderState() const
{
if( maClipPolyPolygon.count() && !maRenderState.Clip.is() )
if( maClipPolyPolygon && !maRenderState.Clip.is() )
{
uno::Reference< rendering::XCanvas > xCanvas( mpCanvas->getUNOCanvas() );
if( !xCanvas.is() )
@ -120,7 +116,7 @@ namespace cppcanvas
maRenderState.Clip = ::basegfx::unotools::xPolyPolygonFromB2DPolyPolygon(
xCanvas->getDevice(),
maClipPolyPolygon );
*maClipPolyPolygon );
}
return maRenderState;