diff options
author | Chris Sherlock <chris.sherlock79@gmail.com> | 2014-04-13 12:35:59 +1000 |
---|---|---|
committer | Chris Sherlock <chris.sherlock79@gmail.com> | 2014-04-16 07:33:51 +1000 |
commit | 9bbcc95f6ed446c16f4d6ca1a8b6eafe63198c0d (patch) | |
tree | ea5c44ad44cca5137b9ad0f8af1702adfcc39992 /vcl/source/gdi | |
parent | 674801eb4af21c9ae83c122499f15fa4f4785b0f (diff) |
Move OutputDevice polygon funcs to vcl/source/gdi/outdev/polygon.cxx
Change-Id: I3bff53898ab8cb912d38f343b3521ca3d51471f6
Diffstat (limited to 'vcl/source/gdi')
-rw-r--r-- | vcl/source/gdi/outdev/outdev4.cxx | 70 | ||||
-rw-r--r-- | vcl/source/gdi/outdev/polygon.cxx | 111 |
2 files changed, 111 insertions, 70 deletions
diff --git a/vcl/source/gdi/outdev/outdev4.cxx b/vcl/source/gdi/outdev/outdev4.cxx index 0df1990759ca..929378796c22 100644 --- a/vcl/source/gdi/outdev/outdev4.cxx +++ b/vcl/source/gdi/outdev/outdev4.cxx @@ -57,76 +57,6 @@ extern "C" int SAL_CALL ImplHatchCmpFnc( const void* p1, const void* p2 ) return ( nX1 > nX2 ? 1 : nX1 == nX2 ? nY1 > nY2 ? 1: nY1 == nY2 ? 0 : -1 : -1 ); } -void OutputDevice::ImplDrawPolygon( const Polygon& rPoly, const PolyPolygon* pClipPolyPoly ) -{ - if( pClipPolyPoly ) - ImplDrawPolyPolygon( rPoly, pClipPolyPoly ); - else - { - sal_uInt16 nPoints = rPoly.GetSize(); - - if ( nPoints < 2 ) - return; - - const SalPoint* pPtAry = (const SalPoint*)rPoly.GetConstPointAry(); - mpGraphics->DrawPolygon( nPoints, pPtAry, this ); - } -} - -void OutputDevice::ImplDrawPolyPolygon( const PolyPolygon& rPolyPoly, const PolyPolygon* pClipPolyPoly ) -{ - PolyPolygon* pPolyPoly; - - if( pClipPolyPoly ) - { - pPolyPoly = new PolyPolygon; - rPolyPoly.GetIntersection( *pClipPolyPoly, *pPolyPoly ); - } - else - pPolyPoly = (PolyPolygon*) &rPolyPoly; - - if( pPolyPoly->Count() == 1 ) - { - const Polygon rPoly = pPolyPoly->GetObject( 0 ); - sal_uInt16 nSize = rPoly.GetSize(); - - if( nSize >= 2 ) - { - const SalPoint* pPtAry = (const SalPoint*)rPoly.GetConstPointAry(); - mpGraphics->DrawPolygon( nSize, pPtAry, this ); - } - } - else if( pPolyPoly->Count() ) - { - sal_uInt16 nCount = pPolyPoly->Count(); - boost::scoped_array<sal_uInt32> pPointAry(new sal_uInt32[nCount]); - boost::scoped_array<PCONSTSALPOINT> pPointAryAry(new PCONSTSALPOINT[nCount]); - sal_uInt16 i = 0; - do - { - const Polygon& rPoly = pPolyPoly->GetObject( i ); - sal_uInt16 nSize = rPoly.GetSize(); - if ( nSize ) - { - pPointAry[i] = nSize; - pPointAryAry[i] = (PCONSTSALPOINT)rPoly.GetConstPointAry(); - i++; - } - else - nCount--; - } - while( i < nCount ); - - if( nCount == 1 ) - mpGraphics->DrawPolygon( pPointAry[0], pPointAryAry[0], this ); - else - mpGraphics->DrawPolyPolygon( nCount, pPointAry.get(), pPointAryAry.get(), this ); - } - - if( pClipPolyPoly ) - delete pPolyPoly; -} - void OutputDevice::DrawHatch( const PolyPolygon& rPolyPoly, const Hatch& rHatch ) { diff --git a/vcl/source/gdi/outdev/polygon.cxx b/vcl/source/gdi/outdev/polygon.cxx new file mode 100644 index 000000000000..5ded92041f4f --- /dev/null +++ b/vcl/source/gdi/outdev/polygon.cxx @@ -0,0 +1,111 @@ +/* -*- 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/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#include <tools/debug.hxx> +#include <tools/line.hxx> +#include <tools/poly.hxx> + +#include <vcl/metaact.hxx> +#include <vcl/gdimtf.hxx> +#include <vcl/salbtype.hxx> +#include <vcl/hatch.hxx> +#include <vcl/virdev.hxx> +#include <vcl/outdev.hxx> +#include <vcl/settings.hxx> + +#include "salframe.hxx" +#include "salgdi.hxx" +#include "svdata.hxx" +#include "outdata.hxx" + +#include <basegfx/polygon/b2dpolygon.hxx> +#include <basegfx/polygon/b2dpolypolygon.hxx> +#include <basegfx/matrix/b2dhommatrix.hxx> +#include <boost/scoped_array.hpp> +#include <boost/scoped_ptr.hpp> + +void OutputDevice::ImplDrawPolygon( const Polygon& rPoly, const PolyPolygon* pClipPolyPoly ) +{ + if( pClipPolyPoly ) + ImplDrawPolyPolygon( rPoly, pClipPolyPoly ); + else + { + sal_uInt16 nPoints = rPoly.GetSize(); + + if ( nPoints < 2 ) + return; + + const SalPoint* pPtAry = (const SalPoint*)rPoly.GetConstPointAry(); + mpGraphics->DrawPolygon( nPoints, pPtAry, this ); + } +} + +void OutputDevice::ImplDrawPolyPolygon( const PolyPolygon& rPolyPoly, const PolyPolygon* pClipPolyPoly ) +{ + PolyPolygon* pPolyPoly; + + if( pClipPolyPoly ) + { + pPolyPoly = new PolyPolygon; + rPolyPoly.GetIntersection( *pClipPolyPoly, *pPolyPoly ); + } + else + pPolyPoly = (PolyPolygon*) &rPolyPoly; + + if( pPolyPoly->Count() == 1 ) + { + const Polygon rPoly = pPolyPoly->GetObject( 0 ); + sal_uInt16 nSize = rPoly.GetSize(); + + if( nSize >= 2 ) + { + const SalPoint* pPtAry = (const SalPoint*)rPoly.GetConstPointAry(); + mpGraphics->DrawPolygon( nSize, pPtAry, this ); + } + } + else if( pPolyPoly->Count() ) + { + sal_uInt16 nCount = pPolyPoly->Count(); + boost::scoped_array<sal_uInt32> pPointAry(new sal_uInt32[nCount]); + boost::scoped_array<PCONSTSALPOINT> pPointAryAry(new PCONSTSALPOINT[nCount]); + sal_uInt16 i = 0; + do + { + const Polygon& rPoly = pPolyPoly->GetObject( i ); + sal_uInt16 nSize = rPoly.GetSize(); + if ( nSize ) + { + pPointAry[i] = nSize; + pPointAryAry[i] = (PCONSTSALPOINT)rPoly.GetConstPointAry(); + i++; + } + else + nCount--; + } + while( i < nCount ); + + if( nCount == 1 ) + mpGraphics->DrawPolygon( pPointAry[0], pPointAryAry[0], this ); + else + mpGraphics->DrawPolyPolygon( nCount, pPointAry.get(), pPointAryAry.get(), this ); + } + + if( pClipPolyPoly ) + delete pPolyPoly; +} |