INTEGRATION: CWS canvas02 (1.6.4); FILE MERGED
2005/10/09 09:14:23 thb 1.6.4.2: RESYNC: (1.6-1.7); FILE MERGED 2005/08/24 23:02:57 thb 1.6.4.1: #i52876# Added CachedPrimitiveBase base class for common XCachedPrimitive handling; removed external header guards from cxx files
This commit is contained in:
@@ -4,9 +4,9 @@
|
|||||||
*
|
*
|
||||||
* $RCSfile: polypolyaction.cxx,v $
|
* $RCSfile: polypolyaction.cxx,v $
|
||||||
*
|
*
|
||||||
* $Revision: 1.7 $
|
* $Revision: 1.8 $
|
||||||
*
|
*
|
||||||
* last change: $Author: rt $ $Date: 2005-09-08 08:21:32 $
|
* last change: $Author: kz $ $Date: 2005-11-02 13:41:45 $
|
||||||
*
|
*
|
||||||
* The Contents of this file are made available subject to
|
* The Contents of this file are made available subject to
|
||||||
* the terms of GNU Lesser General Public License Version 2.1.
|
* the terms of GNU Lesser General Public License Version 2.1.
|
||||||
@@ -33,40 +33,25 @@
|
|||||||
*
|
*
|
||||||
************************************************************************/
|
************************************************************************/
|
||||||
|
|
||||||
#include <polypolyaction.hxx>
|
|
||||||
#include <outdevstate.hxx>
|
|
||||||
|
|
||||||
#ifndef _RTL_LOGFILE_HXX_
|
|
||||||
#include <rtl/logfile.hxx>
|
#include <rtl/logfile.hxx>
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef _COM_SUN_STAR_RENDERING_XCANVAS_HPP_
|
|
||||||
#include <com/sun/star/rendering/XCanvas.hpp>
|
#include <com/sun/star/rendering/XCanvas.hpp>
|
||||||
#endif
|
|
||||||
#ifndef _COM_SUN_STAR_RENDERING_TEXTURINGMODE_HPP_
|
|
||||||
#include <com/sun/star/rendering/TexturingMode.hpp>
|
#include <com/sun/star/rendering/TexturingMode.hpp>
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef _SV_GEN_HXX
|
|
||||||
#include <tools/gen.hxx>
|
#include <tools/gen.hxx>
|
||||||
#endif
|
|
||||||
#ifndef _VCL_CANVASTOOLS_HXX
|
|
||||||
#include <vcl/canvastools.hxx>
|
#include <vcl/canvastools.hxx>
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef _BGFX_RANGE_B2DRANGE_HXX
|
|
||||||
#include <basegfx/range/b2drange.hxx>
|
#include <basegfx/range/b2drange.hxx>
|
||||||
#endif
|
|
||||||
#ifndef _BGFX_TOOLS_CANVASTOOLS_HXX
|
|
||||||
#include <basegfx/tools/canvastools.hxx>
|
#include <basegfx/tools/canvastools.hxx>
|
||||||
#endif
|
#include <basegfx/matrix/b2dhommatrix.hxx>
|
||||||
#ifndef _CANVAS_CANVASTOOLS_HXX
|
|
||||||
#include <canvas/canvastools.hxx>
|
#include <canvas/canvastools.hxx>
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <boost/utility.hpp>
|
#include <boost/utility.hpp>
|
||||||
|
|
||||||
#include <mtftools.hxx>
|
#include "cachedprimitivebase.hxx"
|
||||||
|
#include "polypolyaction.hxx"
|
||||||
|
#include "outdevstate.hxx"
|
||||||
|
#include "mtftools.hxx"
|
||||||
|
|
||||||
|
|
||||||
using namespace ::com::sun::star;
|
using namespace ::com::sun::star;
|
||||||
@@ -77,7 +62,7 @@ namespace cppcanvas
|
|||||||
{
|
{
|
||||||
namespace
|
namespace
|
||||||
{
|
{
|
||||||
class PolyPolyAction : public Action, private ::boost::noncopyable
|
class PolyPolyAction : public CachedPrimitiveBase
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
PolyPolyAction( const ::PolyPolygon&,
|
PolyPolyAction( const ::PolyPolygon&,
|
||||||
@@ -92,7 +77,6 @@ namespace cppcanvas
|
|||||||
bool bStroke,
|
bool bStroke,
|
||||||
int nTransparency );
|
int nTransparency );
|
||||||
|
|
||||||
virtual bool render( const ::basegfx::B2DHomMatrix& rTransformation ) const;
|
|
||||||
virtual bool render( const ::basegfx::B2DHomMatrix& rTransformation,
|
virtual bool render( const ::basegfx::B2DHomMatrix& rTransformation,
|
||||||
const Subset& rSubset ) const;
|
const Subset& rSubset ) const;
|
||||||
|
|
||||||
@@ -103,6 +87,9 @@ namespace cppcanvas
|
|||||||
virtual sal_Int32 getActionCount() const;
|
virtual sal_Int32 getActionCount() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
virtual bool render( uno::Reference< rendering::XCachedPrimitive >& rCachedPrimitive,
|
||||||
|
const ::basegfx::B2DHomMatrix& rTransformation ) const;
|
||||||
|
|
||||||
const uno::Reference< rendering::XPolyPolygon2D > mxPolyPoly;
|
const uno::Reference< rendering::XPolyPolygon2D > mxPolyPoly;
|
||||||
const ::Rectangle maBounds;
|
const ::Rectangle maBounds;
|
||||||
const CanvasSharedPtr mpCanvas;
|
const CanvasSharedPtr mpCanvas;
|
||||||
@@ -118,6 +105,7 @@ namespace cppcanvas
|
|||||||
const OutDevState& rState,
|
const OutDevState& rState,
|
||||||
bool bFill,
|
bool bFill,
|
||||||
bool bStroke ) :
|
bool bStroke ) :
|
||||||
|
CachedPrimitiveBase( rCanvas, false ),
|
||||||
mxPolyPoly( ::vcl::unotools::xPolyPolygonFromPolyPolygon( rCanvas->getUNOCanvas()->getDevice(),
|
mxPolyPoly( ::vcl::unotools::xPolyPolygonFromPolyPolygon( rCanvas->getUNOCanvas()->getDevice(),
|
||||||
rPolyPoly ) ),
|
rPolyPoly ) ),
|
||||||
maBounds( rPolyPoly.GetBoundRect() ),
|
maBounds( rPolyPoly.GetBoundRect() ),
|
||||||
@@ -140,6 +128,7 @@ namespace cppcanvas
|
|||||||
bool bFill,
|
bool bFill,
|
||||||
bool bStroke,
|
bool bStroke,
|
||||||
int nTransparency ) :
|
int nTransparency ) :
|
||||||
|
CachedPrimitiveBase( rCanvas, false ),
|
||||||
mxPolyPoly( ::vcl::unotools::xPolyPolygonFromPolyPolygon( rCanvas->getUNOCanvas()->getDevice(),
|
mxPolyPoly( ::vcl::unotools::xPolyPolygonFromPolyPolygon( rCanvas->getUNOCanvas()->getDevice(),
|
||||||
rPolyPoly ) ),
|
rPolyPoly ) ),
|
||||||
maBounds( rPolyPoly.GetBoundRect() ),
|
maBounds( rPolyPoly.GetBoundRect() ),
|
||||||
@@ -174,7 +163,8 @@ namespace cppcanvas
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool PolyPolyAction::render( const ::basegfx::B2DHomMatrix& rTransformation ) const
|
bool PolyPolyAction::render( uno::Reference< rendering::XCachedPrimitive >& rCachedPrimitive,
|
||||||
|
const ::basegfx::B2DHomMatrix& rTransformation ) const
|
||||||
{
|
{
|
||||||
RTL_LOGFILE_CONTEXT( aLog, "::cppcanvas::internal::PolyPolyAction::render()" );
|
RTL_LOGFILE_CONTEXT( aLog, "::cppcanvas::internal::PolyPolyAction::render()" );
|
||||||
RTL_LOGFILE_CONTEXT_TRACE1( aLog, "::cppcanvas::internal::PolyPolyAction: 0x%X", this );
|
RTL_LOGFILE_CONTEXT_TRACE1( aLog, "::cppcanvas::internal::PolyPolyAction: 0x%X", this );
|
||||||
@@ -203,20 +193,18 @@ namespace cppcanvas
|
|||||||
const uno::Sequence< double > aTmpColor( aLocalState.DeviceColor );
|
const uno::Sequence< double > aTmpColor( aLocalState.DeviceColor );
|
||||||
aLocalState.DeviceColor = maFillColor;
|
aLocalState.DeviceColor = maFillColor;
|
||||||
|
|
||||||
// TODO(P1): implement caching
|
rCachedPrimitive = mpCanvas->getUNOCanvas()->fillPolyPolygon( mxPolyPoly,
|
||||||
mpCanvas->getUNOCanvas()->fillPolyPolygon( mxPolyPoly,
|
mpCanvas->getViewState(),
|
||||||
mpCanvas->getViewState(),
|
aLocalState );
|
||||||
aLocalState );
|
|
||||||
|
|
||||||
aLocalState.DeviceColor = aTmpColor;
|
aLocalState.DeviceColor = aTmpColor;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( aLocalState.DeviceColor.getLength() )
|
if( aLocalState.DeviceColor.getLength() )
|
||||||
{
|
{
|
||||||
// TODO(P1): implement caching
|
rCachedPrimitive = mpCanvas->getUNOCanvas()->drawPolyPolygon( mxPolyPoly,
|
||||||
mpCanvas->getUNOCanvas()->drawPolyPolygon( mxPolyPoly,
|
mpCanvas->getViewState(),
|
||||||
mpCanvas->getViewState(),
|
aLocalState );
|
||||||
aLocalState );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@@ -234,7 +222,7 @@ namespace cppcanvas
|
|||||||
rSubset.mnSubsetEnd != 1 )
|
rSubset.mnSubsetEnd != 1 )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
return render( rTransformation );
|
return CachedPrimitiveBase::render( rTransformation );
|
||||||
}
|
}
|
||||||
|
|
||||||
::basegfx::B2DRange PolyPolyAction::getBounds( const ::basegfx::B2DHomMatrix& rTransformation ) const
|
::basegfx::B2DRange PolyPolyAction::getBounds( const ::basegfx::B2DHomMatrix& rTransformation ) const
|
||||||
@@ -273,7 +261,7 @@ namespace cppcanvas
|
|||||||
|
|
||||||
// -------------------------------------------------------------------------------
|
// -------------------------------------------------------------------------------
|
||||||
|
|
||||||
class TexturedPolyPolyAction : public Action, private ::boost::noncopyable
|
class TexturedPolyPolyAction : public CachedPrimitiveBase
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
TexturedPolyPolyAction( const ::PolyPolygon& rPoly,
|
TexturedPolyPolyAction( const ::PolyPolygon& rPoly,
|
||||||
@@ -281,7 +269,6 @@ namespace cppcanvas
|
|||||||
const OutDevState& rState,
|
const OutDevState& rState,
|
||||||
const rendering::Texture& rTexture );
|
const rendering::Texture& rTexture );
|
||||||
|
|
||||||
virtual bool render( const ::basegfx::B2DHomMatrix& rTransformation ) const;
|
|
||||||
virtual bool render( const ::basegfx::B2DHomMatrix& rTransformation,
|
virtual bool render( const ::basegfx::B2DHomMatrix& rTransformation,
|
||||||
const Subset& rSubset ) const;
|
const Subset& rSubset ) const;
|
||||||
|
|
||||||
@@ -292,6 +279,9 @@ namespace cppcanvas
|
|||||||
virtual sal_Int32 getActionCount() const;
|
virtual sal_Int32 getActionCount() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
virtual bool render( uno::Reference< rendering::XCachedPrimitive >& rCachedPrimitive,
|
||||||
|
const ::basegfx::B2DHomMatrix& rTransformation ) const;
|
||||||
|
|
||||||
const uno::Reference< rendering::XPolyPolygon2D > mxPolyPoly;
|
const uno::Reference< rendering::XPolyPolygon2D > mxPolyPoly;
|
||||||
const ::Rectangle maBounds;
|
const ::Rectangle maBounds;
|
||||||
const CanvasSharedPtr mpCanvas;
|
const CanvasSharedPtr mpCanvas;
|
||||||
@@ -305,6 +295,7 @@ namespace cppcanvas
|
|||||||
const CanvasSharedPtr& rCanvas,
|
const CanvasSharedPtr& rCanvas,
|
||||||
const OutDevState& rState,
|
const OutDevState& rState,
|
||||||
const rendering::Texture& rTexture ) :
|
const rendering::Texture& rTexture ) :
|
||||||
|
CachedPrimitiveBase( rCanvas, true ),
|
||||||
mxPolyPoly( ::vcl::unotools::xPolyPolygonFromPolyPolygon( rCanvas->getUNOCanvas()->getDevice(),
|
mxPolyPoly( ::vcl::unotools::xPolyPolygonFromPolyPolygon( rCanvas->getUNOCanvas()->getDevice(),
|
||||||
rPolyPoly ) ),
|
rPolyPoly ) ),
|
||||||
maBounds( rPolyPoly.GetBoundRect() ),
|
maBounds( rPolyPoly.GetBoundRect() ),
|
||||||
@@ -315,7 +306,8 @@ namespace cppcanvas
|
|||||||
tools::initRenderState(maState,rState);
|
tools::initRenderState(maState,rState);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool TexturedPolyPolyAction::render( const ::basegfx::B2DHomMatrix& rTransformation ) const
|
bool TexturedPolyPolyAction::render( uno::Reference< rendering::XCachedPrimitive >& rCachedPrimitive,
|
||||||
|
const ::basegfx::B2DHomMatrix& rTransformation ) const
|
||||||
{
|
{
|
||||||
RTL_LOGFILE_CONTEXT( aLog, "::cppcanvas::internal::PolyPolyAction::render()" );
|
RTL_LOGFILE_CONTEXT( aLog, "::cppcanvas::internal::PolyPolyAction::render()" );
|
||||||
RTL_LOGFILE_CONTEXT_TRACE1( aLog, "::cppcanvas::internal::PolyPolyAction: 0x%X", this );
|
RTL_LOGFILE_CONTEXT_TRACE1( aLog, "::cppcanvas::internal::PolyPolyAction: 0x%X", this );
|
||||||
@@ -326,10 +318,10 @@ namespace cppcanvas
|
|||||||
uno::Sequence< rendering::Texture > aSeq(1);
|
uno::Sequence< rendering::Texture > aSeq(1);
|
||||||
aSeq[0] = maTexture;
|
aSeq[0] = maTexture;
|
||||||
|
|
||||||
mpCanvas->getUNOCanvas()->fillTexturedPolyPolygon( mxPolyPoly,
|
rCachedPrimitive = mpCanvas->getUNOCanvas()->fillTexturedPolyPolygon( mxPolyPoly,
|
||||||
mpCanvas->getViewState(),
|
mpCanvas->getViewState(),
|
||||||
aLocalState,
|
aLocalState,
|
||||||
aSeq );
|
aSeq );
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -345,7 +337,7 @@ namespace cppcanvas
|
|||||||
rSubset.mnSubsetEnd != 1 )
|
rSubset.mnSubsetEnd != 1 )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
return render( rTransformation );
|
return CachedPrimitiveBase::render( rTransformation );
|
||||||
}
|
}
|
||||||
|
|
||||||
::basegfx::B2DRange TexturedPolyPolyAction::getBounds( const ::basegfx::B2DHomMatrix& rTransformation ) const
|
::basegfx::B2DRange TexturedPolyPolyAction::getBounds( const ::basegfx::B2DHomMatrix& rTransformation ) const
|
||||||
@@ -383,7 +375,7 @@ namespace cppcanvas
|
|||||||
|
|
||||||
// -------------------------------------------------------------------------------
|
// -------------------------------------------------------------------------------
|
||||||
|
|
||||||
class StrokedPolyPolyAction : public Action, private ::boost::noncopyable
|
class StrokedPolyPolyAction : public CachedPrimitiveBase
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
StrokedPolyPolyAction( const ::PolyPolygon& rPoly,
|
StrokedPolyPolyAction( const ::PolyPolygon& rPoly,
|
||||||
@@ -391,7 +383,6 @@ namespace cppcanvas
|
|||||||
const OutDevState& rState,
|
const OutDevState& rState,
|
||||||
const rendering::StrokeAttributes& rStrokeAttributes );
|
const rendering::StrokeAttributes& rStrokeAttributes );
|
||||||
|
|
||||||
virtual bool render( const ::basegfx::B2DHomMatrix& rTransformation ) const;
|
|
||||||
virtual bool render( const ::basegfx::B2DHomMatrix& rTransformation,
|
virtual bool render( const ::basegfx::B2DHomMatrix& rTransformation,
|
||||||
const Subset& rSubset ) const;
|
const Subset& rSubset ) const;
|
||||||
|
|
||||||
@@ -402,6 +393,9 @@ namespace cppcanvas
|
|||||||
virtual sal_Int32 getActionCount() const;
|
virtual sal_Int32 getActionCount() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
virtual bool render( uno::Reference< rendering::XCachedPrimitive >& rCachedPrimitive,
|
||||||
|
const ::basegfx::B2DHomMatrix& rTransformation ) const;
|
||||||
|
|
||||||
const uno::Reference< rendering::XPolyPolygon2D > mxPolyPoly;
|
const uno::Reference< rendering::XPolyPolygon2D > mxPolyPoly;
|
||||||
const ::Rectangle maBounds;
|
const ::Rectangle maBounds;
|
||||||
const CanvasSharedPtr mpCanvas;
|
const CanvasSharedPtr mpCanvas;
|
||||||
@@ -413,6 +407,7 @@ namespace cppcanvas
|
|||||||
const CanvasSharedPtr& rCanvas,
|
const CanvasSharedPtr& rCanvas,
|
||||||
const OutDevState& rState,
|
const OutDevState& rState,
|
||||||
const rendering::StrokeAttributes& rStrokeAttributes ) :
|
const rendering::StrokeAttributes& rStrokeAttributes ) :
|
||||||
|
CachedPrimitiveBase( rCanvas, false ),
|
||||||
mxPolyPoly( ::vcl::unotools::xPolyPolygonFromPolyPolygon( rCanvas->getUNOCanvas()->getDevice(),
|
mxPolyPoly( ::vcl::unotools::xPolyPolygonFromPolyPolygon( rCanvas->getUNOCanvas()->getDevice(),
|
||||||
rPolyPoly ) ),
|
rPolyPoly ) ),
|
||||||
maBounds( rPolyPoly.GetBoundRect() ),
|
maBounds( rPolyPoly.GetBoundRect() ),
|
||||||
@@ -424,7 +419,8 @@ namespace cppcanvas
|
|||||||
maState.DeviceColor = rState.lineColor;
|
maState.DeviceColor = rState.lineColor;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool StrokedPolyPolyAction::render( const ::basegfx::B2DHomMatrix& rTransformation ) const
|
bool StrokedPolyPolyAction::render( uno::Reference< rendering::XCachedPrimitive >& rCachedPrimitive,
|
||||||
|
const ::basegfx::B2DHomMatrix& rTransformation ) const
|
||||||
{
|
{
|
||||||
RTL_LOGFILE_CONTEXT( aLog, "::cppcanvas::internal::PolyPolyAction::render()" );
|
RTL_LOGFILE_CONTEXT( aLog, "::cppcanvas::internal::PolyPolyAction::render()" );
|
||||||
RTL_LOGFILE_CONTEXT_TRACE1( aLog, "::cppcanvas::internal::PolyPolyAction: 0x%X", this );
|
RTL_LOGFILE_CONTEXT_TRACE1( aLog, "::cppcanvas::internal::PolyPolyAction: 0x%X", this );
|
||||||
@@ -432,10 +428,10 @@ namespace cppcanvas
|
|||||||
rendering::RenderState aLocalState( maState );
|
rendering::RenderState aLocalState( maState );
|
||||||
::canvas::tools::prependToRenderState(aLocalState, rTransformation);
|
::canvas::tools::prependToRenderState(aLocalState, rTransformation);
|
||||||
|
|
||||||
mpCanvas->getUNOCanvas()->strokePolyPolygon( mxPolyPoly,
|
rCachedPrimitive = mpCanvas->getUNOCanvas()->strokePolyPolygon( mxPolyPoly,
|
||||||
mpCanvas->getViewState(),
|
mpCanvas->getViewState(),
|
||||||
aLocalState,
|
aLocalState,
|
||||||
maStrokeAttributes );
|
maStrokeAttributes );
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -451,7 +447,7 @@ namespace cppcanvas
|
|||||||
rSubset.mnSubsetEnd != 1 )
|
rSubset.mnSubsetEnd != 1 )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
return render( rTransformation );
|
return CachedPrimitiveBase::render( rTransformation );
|
||||||
}
|
}
|
||||||
|
|
||||||
::basegfx::B2DRange StrokedPolyPolyAction::getBounds( const ::basegfx::B2DHomMatrix& rTransformation ) const
|
::basegfx::B2DRange StrokedPolyPolyAction::getBounds( const ::basegfx::B2DHomMatrix& rTransformation ) const
|
||||||
|
Reference in New Issue
Block a user