diff options
author | Vladimir Glazounov <vg@openoffice.org> | 2009-08-27 01:14:49 +0000 |
---|---|---|
committer | Vladimir Glazounov <vg@openoffice.org> | 2009-08-27 01:14:49 +0000 |
commit | 12d7db51687fa7316f99e3dfcb750bdb8125b05d (patch) | |
tree | 0f87c80418a00e0345d8c25fa6621d985d06dd7d /tools | |
parent | CWS-TOOLING: integrate CWS aw075 (diff) | |
download | core-12d7db51687fa7316f99e3dfcb750bdb8125b05d.tar.gz core-12d7db51687fa7316f99e3dfcb750bdb8125b05d.zip |
CWS-TOOLING: integrate CWS gpc100
2009-08-07 20:21:15 +0200 ka r274784 : CWS-TOOLING: rebase CWS gpc100 to trunk@274622 (milestone: DEV300:m54)
2009-08-07 14:11:35 +0200 ka r274764 : #i75026#: removal of GPC dependency
Diffstat (limited to 'tools')
-rw-r--r-- | tools/inc/tools/poly.hxx | 1 | ||||
-rw-r--r-- | tools/source/generic/makefile.mk | 4 | ||||
-rw-r--r-- | tools/source/generic/poly2.cxx | 114 | ||||
-rw-r--r-- | tools/util/makefile.mk | 7 |
4 files changed, 12 insertions, 114 deletions
diff --git a/tools/inc/tools/poly.hxx b/tools/inc/tools/poly.hxx index 606c9c91e879..a77782bc963c 100644 --- a/tools/inc/tools/poly.hxx +++ b/tools/inc/tools/poly.hxx @@ -260,7 +260,6 @@ private: ImplPolyPolygon* mpImplPolyPolygon; //#if 0 // _SOLAR__PRIVATE - TOOLS_DLLPRIVATE void *ImplCreateGPCPolygon() const; TOOLS_DLLPRIVATE void ImplDoOperation( const PolyPolygon& rPolyPoly, PolyPolygon& rResult, ULONG nOperation ) const; TOOLS_DLLPRIVATE void *ImplCreateArtVpath() const; TOOLS_DLLPRIVATE void ImplSetFromArtVpath( void *pVpath ); diff --git a/tools/source/generic/makefile.mk b/tools/source/generic/makefile.mk index 9562999bd5d7..6340e4daae08 100644 --- a/tools/source/generic/makefile.mk +++ b/tools/source/generic/makefile.mk @@ -39,10 +39,6 @@ TARGET=gen .INCLUDE : settings.mk .INCLUDE : $(PRJ)$/util$/makefile.pmk -.IF "$(WITH_GPC)"!="NO" -CDEFS+=-DHAVE_GPC_H -.ENDIF - # --- Files -------------------------------------------------------- EXCEPTIONSFILES = $(SLO)$/poly.obj $(OBJ)$/poly.obj diff --git a/tools/source/generic/poly2.cxx b/tools/source/generic/poly2.cxx index a560c961f481..ff97e6006a41 100644 --- a/tools/source/generic/poly2.cxx +++ b/tools/source/generic/poly2.cxx @@ -33,17 +33,10 @@ #define _SV_POLY2_CXX -extern "C" -{ -#if defined (HAVE_GPC_H) && !defined (__gpc_h) -# include <external/gpc/gpc.h> -#else -# define GPC_INT 0 -# define GPC_UNION 1 -# define GPC_DIFF 2 -# define GPC_XOR 3 -#endif // HAVE_GPC_H -} +#define POLY_CLIP_INT 0 +#define POLY_CLIP_UNION 1 +#define POLY_CLIP_DIFF 2 +#define POLY_CLIP_XOR 3 #include <rtl/math.hxx> #include <poly.h> @@ -389,115 +382,34 @@ void PolyPolygon::AdaptiveSubdivide( PolyPolygon& rResult, const double d ) cons void PolyPolygon::GetIntersection( const PolyPolygon& rPolyPoly, PolyPolygon& rResult ) const { - ImplDoOperation( rPolyPoly, rResult, GPC_INT ); + ImplDoOperation( rPolyPoly, rResult, POLY_CLIP_INT ); } // ----------------------------------------------------------------------- void PolyPolygon::GetUnion( const PolyPolygon& rPolyPoly, PolyPolygon& rResult ) const { - ImplDoOperation( rPolyPoly, rResult, GPC_UNION ); + ImplDoOperation( rPolyPoly, rResult, POLY_CLIP_UNION ); } // ----------------------------------------------------------------------- void PolyPolygon::GetDifference( const PolyPolygon& rPolyPoly, PolyPolygon& rResult ) const { - ImplDoOperation( rPolyPoly, rResult, GPC_DIFF ); + ImplDoOperation( rPolyPoly, rResult, POLY_CLIP_DIFF ); } // ----------------------------------------------------------------------- void PolyPolygon::GetXOR( const PolyPolygon& rPolyPoly, PolyPolygon& rResult ) const { - ImplDoOperation( rPolyPoly, rResult, GPC_XOR ); -} - -// ----------------------------------------------------------------------- - -#ifdef HAVE_GPC_H - -void* PolyPolygon::ImplCreateGPCPolygon() const -{ - gpc_polygon* pRet = new gpc_polygon; - - pRet->num_contours = 0; - pRet->hole = NULL; - pRet->contour = NULL; - - for( USHORT i = 0, nCount = Count(); i < nCount; i++ ) - { - const Polygon& rPoly = GetObject( i ); - const USHORT nSize = rPoly.GetSize(); - - if( nSize > 1 ) - { - gpc_vertex_list aVertexList; - gpc_vertex* pVertex; - - aVertexList.num_vertices = nSize; - aVertexList.vertex = pVertex = new gpc_vertex[ nSize ]; - - for( USHORT nPos = 0; nPos < nSize; nPos++, pVertex++ ) - { - const Point& rPoint = rPoly[ nPos ]; - pVertex->x = rPoint.X(); - pVertex->y = rPoint.Y(); - } - - gpc_add_contour( pRet, &aVertexList, 0 ); - delete[] aVertexList.vertex; - } - } - - return pRet; + ImplDoOperation( rPolyPoly, rResult, POLY_CLIP_XOR ); } // ----------------------------------------------------------------------- void PolyPolygon::ImplDoOperation( const PolyPolygon& rPolyPoly, PolyPolygon& rResult, ULONG nOperation ) const { - gpc_polygon* pGPCPoly1 = (gpc_polygon*) ImplCreateGPCPolygon(); - gpc_polygon* pGPCPoly2 = (gpc_polygon*) rPolyPoly.ImplCreateGPCPolygon(); - gpc_polygon* pResult = new gpc_polygon; - - pResult->num_contours = 0; - pResult->hole = NULL; - pResult->contour = NULL; - - gpc_polygon_clip( (gpc_op) nOperation, pGPCPoly1, pGPCPoly2, pResult ); - - rResult.Clear(); - - for( int i = 0; i < pResult->num_contours; i++ ) - { - gpc_vertex_list& rVertexList = pResult->contour[ i ]; - Polygon aPoly( ::sal::static_int_cast< USHORT >( rVertexList.num_vertices ) ); - - for( int j = 0; j < rVertexList.num_vertices; j++ ) - { - Point& rPt = aPoly[ ::sal::static_int_cast< USHORT >( j ) ]; - rPt.X() = FRound( rVertexList.vertex[ j ].x ); - rPt.Y() = FRound( rVertexList.vertex[ j ].y ); - } - - rResult.Insert( aPoly ); - } - - gpc_free_polygon( pGPCPoly1 ); - delete pGPCPoly1; - - gpc_free_polygon( pGPCPoly2 ); - delete pGPCPoly2; - - gpc_free_polygon( pResult ); - delete pResult; -} - -#else - -void PolyPolygon::ImplDoOperation( const PolyPolygon& rPolyPoly, PolyPolygon& rResult, ULONG nOperation ) const -{ // Convert to B2DPolyPolygon, temporarily. It might be // advantageous in the future, to have a PolyPolygon adaptor that // just simulates a B2DPolyPolygon here... @@ -514,21 +426,21 @@ void PolyPolygon::ImplDoOperation( const PolyPolygon& rPolyPoly, PolyPolygon& rR // All code extracted from svx/source/svdraw/svedtv2.cxx // ----------------------------------------------------- - case GPC_UNION: + case POLY_CLIP_UNION: { // merge A and B (OR) aMergePolyPolygonA = basegfx::tools::solvePolygonOperationOr(aMergePolyPolygonA, aMergePolyPolygonB); break; } - case GPC_DIFF: + case POLY_CLIP_DIFF: { // substract B from A (DIFF) aMergePolyPolygonA = basegfx::tools::solvePolygonOperationDiff(aMergePolyPolygonA, aMergePolyPolygonB); break; } - case GPC_XOR: + case POLY_CLIP_XOR: { // compute XOR between poly A and B aMergePolyPolygonA = basegfx::tools::solvePolygonOperationXor(aMergePolyPolygonA, aMergePolyPolygonB); @@ -536,7 +448,7 @@ void PolyPolygon::ImplDoOperation( const PolyPolygon& rPolyPoly, PolyPolygon& rR } default: - case GPC_INT: + case POLY_CLIP_INT: { // cut poly 1 against polys 2..n (AND) aMergePolyPolygonA = basegfx::tools::solvePolygonOperationAnd(aMergePolyPolygonA, aMergePolyPolygonB); @@ -547,8 +459,6 @@ void PolyPolygon::ImplDoOperation( const PolyPolygon& rPolyPoly, PolyPolygon& rR rResult = PolyPolygon( aMergePolyPolygonA ); } -#endif // HAVE_GPC_H - // ----------------------------------------------------------------------- USHORT PolyPolygon::Count() const diff --git a/tools/util/makefile.mk b/tools/util/makefile.mk index 546ef29a449a..d9ba720543e3 100644 --- a/tools/util/makefile.mk +++ b/tools/util/makefile.mk @@ -113,13 +113,6 @@ SHL1IMPLIB= itools SHL1USE_EXPORTS=name SHL1STDLIBS+= $(SALLIB) $(VOSLIB) $(BASEGFXLIB) $(I18NISOLANGLIB) $(COMPHELPERLIB) -.IF "$(WITH_LIBART)"=="YES" -SHL1STDLIBS+= $(LIBART_LIBS) -.ELSE -SHL1STDLIBS+= $(GPC3RDLIB) -.ENDIF - - .IF "$(GUI)"=="WNT" SHL1STDLIBS+= $(SHELL32LIB) \ $(MPRLIB) \ |