xref: /AOO41X/main/vcl/source/gdi/bmpacc3.cxx (revision 9f62ea84a806e17e6f2bbff75724a7257a0eb5d9)
1*9f62ea84SAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*9f62ea84SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*9f62ea84SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*9f62ea84SAndrew Rist  * distributed with this work for additional information
6*9f62ea84SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*9f62ea84SAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*9f62ea84SAndrew Rist  * "License"); you may not use this file except in compliance
9*9f62ea84SAndrew Rist  * with the License.  You may obtain a copy of the License at
10cdf0e10cSrcweir  *
11*9f62ea84SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12cdf0e10cSrcweir  *
13*9f62ea84SAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*9f62ea84SAndrew Rist  * software distributed under the License is distributed on an
15*9f62ea84SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*9f62ea84SAndrew Rist  * KIND, either express or implied.  See the License for the
17*9f62ea84SAndrew Rist  * specific language governing permissions and limitations
18*9f62ea84SAndrew Rist  * under the License.
19cdf0e10cSrcweir  *
20*9f62ea84SAndrew Rist  *************************************************************/
21*9f62ea84SAndrew Rist 
22*9f62ea84SAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
25cdf0e10cSrcweir #include "precompiled_vcl.hxx"
26cdf0e10cSrcweir 
27cdf0e10cSrcweir #include <tools/poly.hxx>
28cdf0e10cSrcweir 
29cdf0e10cSrcweir #include <vcl/salbtype.hxx>
30cdf0e10cSrcweir #include <vcl/bitmap.hxx>
31cdf0e10cSrcweir #include <vcl/region.hxx>
32cdf0e10cSrcweir #include <vcl/bmpacc.hxx>
33cdf0e10cSrcweir 
34cdf0e10cSrcweir #include <bmpfast.hxx>
35cdf0e10cSrcweir 
36cdf0e10cSrcweir // ---------------------
37cdf0e10cSrcweir // - BitmapWriteAccess -
38cdf0e10cSrcweir // ---------------------
39cdf0e10cSrcweir 
40cdf0e10cSrcweir void BitmapWriteAccess::SetLineColor()
41cdf0e10cSrcweir {
42cdf0e10cSrcweir 	delete mpLineColor;
43cdf0e10cSrcweir 	mpLineColor = NULL;
44cdf0e10cSrcweir }
45cdf0e10cSrcweir 
46cdf0e10cSrcweir // ------------------------------------------------------------------
47cdf0e10cSrcweir 
48cdf0e10cSrcweir void BitmapWriteAccess::SetLineColor( const Color& rColor )
49cdf0e10cSrcweir {
50cdf0e10cSrcweir 	delete mpLineColor;
51cdf0e10cSrcweir 
52cdf0e10cSrcweir 	if( rColor.GetTransparency() == 255 )
53cdf0e10cSrcweir 		mpLineColor = NULL;
54cdf0e10cSrcweir 	else
55cdf0e10cSrcweir 		mpLineColor = ( HasPalette() ? new BitmapColor(  (sal_uInt8) GetBestPaletteIndex( rColor ) ) : new BitmapColor( rColor ) );
56cdf0e10cSrcweir }
57cdf0e10cSrcweir 
58cdf0e10cSrcweir // ------------------------------------------------------------------
59cdf0e10cSrcweir 
60cdf0e10cSrcweir Color BitmapWriteAccess::GetLineColor() const
61cdf0e10cSrcweir {
62cdf0e10cSrcweir 	Color aRet;
63cdf0e10cSrcweir 
64cdf0e10cSrcweir 	if( mpLineColor )
65cdf0e10cSrcweir 		aRet = (const Color&) *mpLineColor;
66cdf0e10cSrcweir 	else
67cdf0e10cSrcweir 		aRet.SetTransparency( 255 );
68cdf0e10cSrcweir 
69cdf0e10cSrcweir 	return aRet;
70cdf0e10cSrcweir }
71cdf0e10cSrcweir 
72cdf0e10cSrcweir // ------------------------------------------------------------------
73cdf0e10cSrcweir 
74cdf0e10cSrcweir void BitmapWriteAccess::SetFillColor()
75cdf0e10cSrcweir {
76cdf0e10cSrcweir 	delete mpFillColor;
77cdf0e10cSrcweir 	mpFillColor = NULL;
78cdf0e10cSrcweir }
79cdf0e10cSrcweir 
80cdf0e10cSrcweir // ------------------------------------------------------------------
81cdf0e10cSrcweir 
82cdf0e10cSrcweir void BitmapWriteAccess::SetFillColor( const Color& rColor )
83cdf0e10cSrcweir {
84cdf0e10cSrcweir 	delete mpFillColor;
85cdf0e10cSrcweir 
86cdf0e10cSrcweir 	if( rColor.GetTransparency() == 255 )
87cdf0e10cSrcweir 		mpFillColor = NULL;
88cdf0e10cSrcweir 	else
89cdf0e10cSrcweir 		mpFillColor = ( HasPalette() ? new BitmapColor(  (sal_uInt8) GetBestPaletteIndex( rColor ) ) : new BitmapColor( rColor ) );
90cdf0e10cSrcweir }
91cdf0e10cSrcweir 
92cdf0e10cSrcweir // ------------------------------------------------------------------
93cdf0e10cSrcweir 
94cdf0e10cSrcweir Color BitmapWriteAccess::GetFillColor() const
95cdf0e10cSrcweir {
96cdf0e10cSrcweir 	Color aRet;
97cdf0e10cSrcweir 
98cdf0e10cSrcweir 	if( mpFillColor )
99cdf0e10cSrcweir 		aRet = (const Color&) *mpFillColor;
100cdf0e10cSrcweir 	else
101cdf0e10cSrcweir 		aRet.SetTransparency( 255 );
102cdf0e10cSrcweir 
103cdf0e10cSrcweir 	return aRet;
104cdf0e10cSrcweir }
105cdf0e10cSrcweir 
106cdf0e10cSrcweir // ------------------------------------------------------------------
107cdf0e10cSrcweir 
108cdf0e10cSrcweir void BitmapWriteAccess::Erase( const Color& rColor )
109cdf0e10cSrcweir {
110cdf0e10cSrcweir     // convert the color format from RGB to palette index if needed
111cdf0e10cSrcweir     // TODO: provide and use Erase( BitmapColor& method)
112cdf0e10cSrcweir     BitmapColor aColor = rColor;
113cdf0e10cSrcweir     if( HasPalette() )
114cdf0e10cSrcweir         aColor = BitmapColor( (sal_uInt8)GetBestPaletteIndex( rColor) );
115cdf0e10cSrcweir     // try fast bitmap method first
116cdf0e10cSrcweir     if( ImplFastEraseBitmap( *mpBuffer, aColor ) )
117cdf0e10cSrcweir         return;
118cdf0e10cSrcweir 
119cdf0e10cSrcweir     // use the canonical method to clear the bitmap
120cdf0e10cSrcweir 	BitmapColor*	pOldFillColor = mpFillColor ? new BitmapColor( *mpFillColor ) : NULL;
121cdf0e10cSrcweir 	const Point		aPoint;
122cdf0e10cSrcweir 	const Rectangle	aRect( aPoint, maBitmap.GetSizePixel() );
123cdf0e10cSrcweir 
124cdf0e10cSrcweir 	SetFillColor( rColor );
125cdf0e10cSrcweir 	FillRect( aRect );
126cdf0e10cSrcweir 	delete mpFillColor;
127cdf0e10cSrcweir 	mpFillColor = pOldFillColor;
128cdf0e10cSrcweir }
129cdf0e10cSrcweir 
130cdf0e10cSrcweir // ------------------------------------------------------------------
131cdf0e10cSrcweir 
132cdf0e10cSrcweir void BitmapWriteAccess::DrawLine( const Point& rStart, const Point& rEnd )
133cdf0e10cSrcweir {
134cdf0e10cSrcweir 	if( mpLineColor )
135cdf0e10cSrcweir 	{
136cdf0e10cSrcweir 		const BitmapColor&	rLineColor = *mpLineColor;
137cdf0e10cSrcweir 		long 				nX, nY;
138cdf0e10cSrcweir 
139cdf0e10cSrcweir 		if ( rStart.X() == rEnd.X() )
140cdf0e10cSrcweir 		{
141cdf0e10cSrcweir 			// vertikale Line
142cdf0e10cSrcweir 			const long nEndY = rEnd.Y();
143cdf0e10cSrcweir 
144cdf0e10cSrcweir 			nX = rStart.X();
145cdf0e10cSrcweir 			nY = rStart.Y();
146cdf0e10cSrcweir 
147cdf0e10cSrcweir 			if ( nEndY > nY )
148cdf0e10cSrcweir 			{
149cdf0e10cSrcweir 				for (; nY <= nEndY; nY++ )
150cdf0e10cSrcweir 					SetPixel( nY, nX, rLineColor );
151cdf0e10cSrcweir 			}
152cdf0e10cSrcweir 			else
153cdf0e10cSrcweir 			{
154cdf0e10cSrcweir 				for (; nY >= nEndY; nY-- )
155cdf0e10cSrcweir 					SetPixel( nY, nX, rLineColor );
156cdf0e10cSrcweir 			}
157cdf0e10cSrcweir 		}
158cdf0e10cSrcweir 		else if ( rStart.Y() == rEnd.Y() )
159cdf0e10cSrcweir 		{
160cdf0e10cSrcweir 			// horizontale Line
161cdf0e10cSrcweir 			const long nEndX = rEnd.X();
162cdf0e10cSrcweir 
163cdf0e10cSrcweir 			nX = rStart.X();
164cdf0e10cSrcweir 			nY = rStart.Y();
165cdf0e10cSrcweir 
166cdf0e10cSrcweir 			if ( nEndX > nX )
167cdf0e10cSrcweir 			{
168cdf0e10cSrcweir 				for (; nX <= nEndX; nX++ )
169cdf0e10cSrcweir 					SetPixel( nY, nX, rLineColor );
170cdf0e10cSrcweir 			}
171cdf0e10cSrcweir 			else
172cdf0e10cSrcweir 			{
173cdf0e10cSrcweir 				for (; nX >= nEndX; nX-- )
174cdf0e10cSrcweir 					SetPixel( nY, nX, rLineColor );
175cdf0e10cSrcweir 			}
176cdf0e10cSrcweir 		}
177cdf0e10cSrcweir 		else
178cdf0e10cSrcweir 		{
179cdf0e10cSrcweir 			const long	nDX = labs( rEnd.X() - rStart.X() );
180cdf0e10cSrcweir 			const long	nDY = labs( rEnd.Y() - rStart.Y() );
181cdf0e10cSrcweir 			long		nX1;
182cdf0e10cSrcweir 			long		nY1;
183cdf0e10cSrcweir 			long		nX2;
184cdf0e10cSrcweir 			long		nY2;
185cdf0e10cSrcweir 
186cdf0e10cSrcweir 			if ( nDX >= nDY )
187cdf0e10cSrcweir 			{
188cdf0e10cSrcweir 				if ( rStart.X() < rEnd.X() )
189cdf0e10cSrcweir 				{
190cdf0e10cSrcweir 					nX1 = rStart.X();
191cdf0e10cSrcweir 					nY1 = rStart.Y();
192cdf0e10cSrcweir 					nX2 = rEnd.X();
193cdf0e10cSrcweir 					nY2 = rEnd.Y();
194cdf0e10cSrcweir 				}
195cdf0e10cSrcweir 				else
196cdf0e10cSrcweir 				{
197cdf0e10cSrcweir 					nX1 = rEnd.X();
198cdf0e10cSrcweir 					nY1 = rEnd.Y();
199cdf0e10cSrcweir 					nX2 = rStart.X();
200cdf0e10cSrcweir 					nY2 = rStart.Y();
201cdf0e10cSrcweir 				}
202cdf0e10cSrcweir 
203cdf0e10cSrcweir 				const long	nDYX = ( nDY - nDX ) << 1;
204cdf0e10cSrcweir 				const long	nDY2 = nDY << 1;
205cdf0e10cSrcweir 				long		nD = nDY2 - nDX;
206cdf0e10cSrcweir 				sal_Bool		bPos = nY1 < nY2;
207cdf0e10cSrcweir 
208cdf0e10cSrcweir 				for ( nX = nX1, nY = nY1; nX <= nX2; nX++ )
209cdf0e10cSrcweir 				{
210cdf0e10cSrcweir 					SetPixel( nY, nX, rLineColor );
211cdf0e10cSrcweir 
212cdf0e10cSrcweir 					if ( nD < 0 )
213cdf0e10cSrcweir 						nD += nDY2;
214cdf0e10cSrcweir 					else
215cdf0e10cSrcweir 					{
216cdf0e10cSrcweir 						nD += nDYX;
217cdf0e10cSrcweir 
218cdf0e10cSrcweir 						if ( bPos )
219cdf0e10cSrcweir 							nY++;
220cdf0e10cSrcweir 						else
221cdf0e10cSrcweir 							nY--;
222cdf0e10cSrcweir 					}
223cdf0e10cSrcweir 				}
224cdf0e10cSrcweir 			}
225cdf0e10cSrcweir 			else
226cdf0e10cSrcweir 			{
227cdf0e10cSrcweir 				if ( rStart.Y() < rEnd.Y() )
228cdf0e10cSrcweir 				{
229cdf0e10cSrcweir 					nX1 = rStart.X();
230cdf0e10cSrcweir 					nY1 = rStart.Y();
231cdf0e10cSrcweir 					nX2 = rEnd.X();
232cdf0e10cSrcweir 					nY2 = rEnd.Y();
233cdf0e10cSrcweir 				}
234cdf0e10cSrcweir 				else
235cdf0e10cSrcweir 				{
236cdf0e10cSrcweir 					nX1 = rEnd.X();
237cdf0e10cSrcweir 					nY1 = rEnd.Y();
238cdf0e10cSrcweir 					nX2 = rStart.X();
239cdf0e10cSrcweir 					nY2 = rStart.Y();
240cdf0e10cSrcweir 				}
241cdf0e10cSrcweir 
242cdf0e10cSrcweir 				const long	nDYX = ( nDX - nDY ) << 1;
243cdf0e10cSrcweir 				const long	nDY2 = nDX << 1;
244cdf0e10cSrcweir 				long		nD = nDY2 - nDY;
245cdf0e10cSrcweir 				sal_Bool		bPos = nX1 < nX2;
246cdf0e10cSrcweir 
247cdf0e10cSrcweir 				for ( nX = nX1, nY = nY1; nY <= nY2; nY++ )
248cdf0e10cSrcweir 				{
249cdf0e10cSrcweir 					SetPixel( nY, nX, rLineColor );
250cdf0e10cSrcweir 
251cdf0e10cSrcweir 					if ( nD < 0 )
252cdf0e10cSrcweir 						nD += nDY2;
253cdf0e10cSrcweir 					else
254cdf0e10cSrcweir 					{
255cdf0e10cSrcweir 						nD += nDYX;
256cdf0e10cSrcweir 
257cdf0e10cSrcweir 						if ( bPos )
258cdf0e10cSrcweir 							nX++;
259cdf0e10cSrcweir 						else
260cdf0e10cSrcweir 							nX--;
261cdf0e10cSrcweir 					}
262cdf0e10cSrcweir 				}
263cdf0e10cSrcweir 			}
264cdf0e10cSrcweir 		}
265cdf0e10cSrcweir 	}
266cdf0e10cSrcweir }
267cdf0e10cSrcweir 
268cdf0e10cSrcweir // ------------------------------------------------------------------
269cdf0e10cSrcweir 
270cdf0e10cSrcweir void BitmapWriteAccess::FillRect( const Rectangle& rRect )
271cdf0e10cSrcweir {
272cdf0e10cSrcweir 	if( mpFillColor )
273cdf0e10cSrcweir 	{
274cdf0e10cSrcweir 		const BitmapColor&	rFillColor = *mpFillColor;
275cdf0e10cSrcweir 		Point 				aPoint;
276cdf0e10cSrcweir 		Rectangle			aRect( aPoint, maBitmap.GetSizePixel() );
277cdf0e10cSrcweir 
278cdf0e10cSrcweir 		aRect.Intersection( rRect );
279cdf0e10cSrcweir 
280cdf0e10cSrcweir 		if( !aRect.IsEmpty() )
281cdf0e10cSrcweir 		{
282cdf0e10cSrcweir 			const long	nStartX = rRect.Left();
283cdf0e10cSrcweir 			const long	nStartY = rRect.Top();
284cdf0e10cSrcweir 			const long	nEndX = rRect.Right();
285cdf0e10cSrcweir 			const long	nEndY = rRect.Bottom();
286cdf0e10cSrcweir 
287cdf0e10cSrcweir 			for( long nY = nStartY; nY <= nEndY; nY++ )
288cdf0e10cSrcweir 				for( long nX = nStartX; nX <= nEndX; nX++ )
289cdf0e10cSrcweir 					SetPixel( nY, nX, rFillColor );
290cdf0e10cSrcweir 		}
291cdf0e10cSrcweir 	}
292cdf0e10cSrcweir }
293cdf0e10cSrcweir 
294cdf0e10cSrcweir // ------------------------------------------------------------------
295cdf0e10cSrcweir 
296cdf0e10cSrcweir void BitmapWriteAccess::DrawRect( const Rectangle& rRect )
297cdf0e10cSrcweir {
298cdf0e10cSrcweir 	if( mpFillColor )
299cdf0e10cSrcweir 		FillRect( rRect );
300cdf0e10cSrcweir 
301cdf0e10cSrcweir 	if( mpLineColor && ( !mpFillColor || ( *mpFillColor != *mpLineColor ) ) )
302cdf0e10cSrcweir 	{
303cdf0e10cSrcweir 		DrawLine( rRect.TopLeft(), rRect.TopRight() );
304cdf0e10cSrcweir 		DrawLine( rRect.TopRight(), rRect.BottomRight() );
305cdf0e10cSrcweir 		DrawLine( rRect.BottomRight(), rRect.BottomLeft() );
306cdf0e10cSrcweir 		DrawLine( rRect.BottomLeft(), rRect.TopLeft() );
307cdf0e10cSrcweir 	}
308cdf0e10cSrcweir }
309cdf0e10cSrcweir 
310cdf0e10cSrcweir // ------------------------------------------------------------------
311cdf0e10cSrcweir 
312cdf0e10cSrcweir void BitmapWriteAccess::FillPolygon( const Polygon& rPoly )
313cdf0e10cSrcweir {
314cdf0e10cSrcweir 	const sal_uInt16 nSize = rPoly.GetSize();
315cdf0e10cSrcweir 
316cdf0e10cSrcweir 	if( nSize && mpFillColor )
317cdf0e10cSrcweir 	{
318cdf0e10cSrcweir 		const BitmapColor&	rFillColor = *mpFillColor;
319cdf0e10cSrcweir 		Region				aRegion( rPoly );
320cdf0e10cSrcweir 		Rectangle			aRect;
321cdf0e10cSrcweir 
322cdf0e10cSrcweir 		aRegion.Intersect( Rectangle( Point(), Size( Width(), Height() ) ) );
323cdf0e10cSrcweir 
324cdf0e10cSrcweir 		if( !aRegion.IsEmpty() )
325cdf0e10cSrcweir 		{
326cdf0e10cSrcweir 			RegionHandle aRegHandle( aRegion.BeginEnumRects() );
327cdf0e10cSrcweir 
328cdf0e10cSrcweir 			while( aRegion.GetNextEnumRect( aRegHandle, aRect ) )
329cdf0e10cSrcweir 				for( long nY = aRect.Top(), nEndY = aRect.Bottom(); nY <= nEndY; nY++ )
330cdf0e10cSrcweir 					for( long nX = aRect.Left(), nEndX = aRect.Right(); nX <= nEndX; nX++ )
331cdf0e10cSrcweir 						SetPixel( nY, nX, rFillColor );
332cdf0e10cSrcweir 
333cdf0e10cSrcweir 			aRegion.EndEnumRects( aRegHandle );
334cdf0e10cSrcweir 		}
335cdf0e10cSrcweir 	}
336cdf0e10cSrcweir }
337cdf0e10cSrcweir 
338cdf0e10cSrcweir // ------------------------------------------------------------------
339cdf0e10cSrcweir 
340cdf0e10cSrcweir void BitmapWriteAccess::DrawPolygon( const Polygon& rPoly )
341cdf0e10cSrcweir {
342cdf0e10cSrcweir 	if( mpFillColor )
343cdf0e10cSrcweir 		FillPolygon( rPoly );
344cdf0e10cSrcweir 
345cdf0e10cSrcweir 	if( mpLineColor && ( !mpFillColor || ( *mpFillColor != *mpLineColor ) ) )
346cdf0e10cSrcweir 	{
347cdf0e10cSrcweir 		const sal_uInt16 nSize = rPoly.GetSize();
348cdf0e10cSrcweir 
349cdf0e10cSrcweir 		for( sal_uInt16 i = 0, nSize1 = nSize - 1; i < nSize1; i++ )
350cdf0e10cSrcweir 			DrawLine( rPoly[ i ], rPoly[ i + 1 ] );
351cdf0e10cSrcweir 
352cdf0e10cSrcweir 		if( rPoly[ nSize - 1 ] != rPoly[ 0 ] )
353cdf0e10cSrcweir 			DrawLine( rPoly[ nSize - 1 ], rPoly[ 0 ] );
354cdf0e10cSrcweir 	}
355cdf0e10cSrcweir }
356cdf0e10cSrcweir 
357cdf0e10cSrcweir // ------------------------------------------------------------------
358cdf0e10cSrcweir 
359cdf0e10cSrcweir void BitmapWriteAccess::FillPolyPolygon( const PolyPolygon& rPolyPoly )
360cdf0e10cSrcweir {
361cdf0e10cSrcweir 	const sal_uInt16 nCount = rPolyPoly.Count();
362cdf0e10cSrcweir 
363cdf0e10cSrcweir 	if( nCount && mpFillColor )
364cdf0e10cSrcweir 	{
365cdf0e10cSrcweir 		const BitmapColor&	rFillColor = *mpFillColor;
366cdf0e10cSrcweir 		Region				aRegion( rPolyPoly );
367cdf0e10cSrcweir 		Rectangle			aRect;
368cdf0e10cSrcweir 
369cdf0e10cSrcweir 		aRegion.Intersect( Rectangle( Point(), Size( Width(), Height() ) ) );
370cdf0e10cSrcweir 
371cdf0e10cSrcweir 		if( !aRegion.IsEmpty() )
372cdf0e10cSrcweir 		{
373cdf0e10cSrcweir 			RegionHandle aRegHandle( aRegion.BeginEnumRects() );
374cdf0e10cSrcweir 
375cdf0e10cSrcweir 			while( aRegion.GetNextEnumRect( aRegHandle, aRect ) )
376cdf0e10cSrcweir 				for( long nY = aRect.Top(), nEndY = aRect.Bottom(); nY <= nEndY; nY++ )
377cdf0e10cSrcweir 					for( long nX = aRect.Left(), nEndX = aRect.Right(); nX <= nEndX; nX++ )
378cdf0e10cSrcweir 						SetPixel( nY, nX, rFillColor );
379cdf0e10cSrcweir 
380cdf0e10cSrcweir 			aRegion.EndEnumRects( aRegHandle );
381cdf0e10cSrcweir 		}
382cdf0e10cSrcweir 	}
383cdf0e10cSrcweir }
384cdf0e10cSrcweir 
385cdf0e10cSrcweir // ------------------------------------------------------------------
386cdf0e10cSrcweir 
387cdf0e10cSrcweir void BitmapWriteAccess::DrawPolyPolygon( const PolyPolygon& rPolyPoly )
388cdf0e10cSrcweir {
389cdf0e10cSrcweir 	if( mpFillColor )
390cdf0e10cSrcweir 		FillPolyPolygon( rPolyPoly );
391cdf0e10cSrcweir 
392cdf0e10cSrcweir 	if( mpLineColor && ( !mpFillColor || ( *mpFillColor != *mpLineColor ) ) )
393cdf0e10cSrcweir 	{
394cdf0e10cSrcweir 		for( sal_uInt16 n = 0, nCount = rPolyPoly.Count(); n < nCount; )
395cdf0e10cSrcweir 		{
396cdf0e10cSrcweir 			const Polygon&	rPoly = rPolyPoly[ n++ ];
397cdf0e10cSrcweir 			const sal_uInt16	nSize = rPoly.GetSize();
398cdf0e10cSrcweir 
399cdf0e10cSrcweir 			if( nSize )
400cdf0e10cSrcweir 			{
401cdf0e10cSrcweir 				for( sal_uInt16 i = 0, nSize1 = nSize - 1; i < nSize1; i++ )
402cdf0e10cSrcweir 					DrawLine( rPoly[ i ], rPoly[ i + 1 ] );
403cdf0e10cSrcweir 
404cdf0e10cSrcweir 				if( rPoly[ nSize - 1 ] != rPoly[ 0 ] )
405cdf0e10cSrcweir 					DrawLine( rPoly[ nSize - 1 ], rPoly[ 0 ] );
406cdf0e10cSrcweir 			}
407cdf0e10cSrcweir 		}
408cdf0e10cSrcweir 	}
409cdf0e10cSrcweir }
410