os/graphics/graphicsdeviceinterface/directgdiadaptation/swsrc/swdirectgdiline.cpp
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/graphics/graphicsdeviceinterface/directgdiadaptation/swsrc/swdirectgdiline.cpp	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,620 @@
     1.4 +// Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
     1.5 +// All rights reserved.
     1.6 +// This component and the accompanying materials are made available
     1.7 +// under the terms of "Eclipse Public License v1.0"
     1.8 +// which accompanies this distribution, and is available
     1.9 +// at the URL "http://www.eclipse.org/legal/epl-v10.html".
    1.10 +//
    1.11 +// Initial Contributors:
    1.12 +// Nokia Corporation - initial contribution.
    1.13 +//
    1.14 +// Contributors:
    1.15 +//
    1.16 +// Description:
    1.17 +//
    1.18 +
    1.19 +#include "swdirectgdiengine.h"
    1.20 +#include "swdirectgdipolygon.h"
    1.21 +
    1.22 +/**
    1.23 +@see MDirectGdiEngine::DrawLine()
    1.24 +*/
    1.25 +void CSwDirectGdiEngine::DrawLine(const TPoint& aPt1,const TPoint& aPt2)
    1.26 +    {
    1.27 +	DoDrawLine(aPt1,aPt2,ETrue);
    1.28 +	}
    1.29 +
    1.30 +/**
    1.31 +@see MDirectGdiEngine::DrawLineTo()
    1.32 +*/
    1.33 +void CSwDirectGdiEngine::DrawLineTo(const TPoint& aPoint)
    1.34 +	{
    1.35 +	DrawLine(iLinePosition,aPoint);
    1.36 +	}
    1.37 +
    1.38 +
    1.39 +/**
    1.40 +@see MDirectGdiEngine::DrawLineBy()
    1.41 +*/	
    1.42 +void CSwDirectGdiEngine::DrawLineBy(const TPoint& aVector)
    1.43 +    {
    1.44 +	DrawLine(iLinePosition,iLinePosition + aVector);
    1.45 +	}
    1.46 +
    1.47 +/**
    1.48 +@see MDirectGdiEngine::DrawPolyLine()
    1.49 +
    1.50 +@panic DGDIAdapter 27, if the passed point list has too few points (debug only).
    1.51 +*/
    1.52 +void CSwDirectGdiEngine::DrawPolyLine(const TArray<TPoint>& aPointList)
    1.53 +	{
    1.54 +	DrawPolyLineNoEndPoint(aPointList);
    1.55 +	
    1.56 +	if (iPenStyle == DirectGdi::ESolidPen)
    1.57 +		{
    1.58 +		Plot(aPointList[aPointList.Count()-1]);
    1.59 +		}
    1.60 +	}
    1.61 +
    1.62 +/**
    1.63 +@see MDirectGdiEngine::DrawPolyLineNoEndPoint()
    1.64 +
    1.65 +@panic DGDIAdapter 27, if the passed point list has too few points (debug only).
    1.66 +*/
    1.67 +void CSwDirectGdiEngine::DrawPolyLineNoEndPoint(const TArray<TPoint>& aPointList)
    1.68 +	{
    1.69 +	GRAPHICS_ASSERT_DEBUG(aPointList.Count() > 0, EDirectGdiPanicInvalidPointArray);
    1.70 +
    1.71 +	const TInt vertexes = aPointList.Count()-1;
    1.72 +
    1.73 +	for (TInt count = 0; count < vertexes; count++)
    1.74 +		{
    1.75 +		DrawLine(aPointList[count], aPointList[count + 1]);
    1.76 +		}
    1.77 +	}
    1.78 +
    1.79 +/**
    1.80 +@see MDirectGdiEngine::DrawPolygon()
    1.81 +*/
    1.82 +void CSwDirectGdiEngine::DrawPolygon(const TArray<TPoint>& aPointList, DirectGdi::TFillRule aFillRule)
    1.83 +	{
    1.84 +	const TInt numpoints = aPointList.Count();
    1.85 +
    1.86 +	if (iBrushStyle != DirectGdi::ENullBrush)
    1.87 +		{
    1.88 +		TRect pointrect(0,0,0,0);
    1.89 +		TRect truncrect(0,0,0,0);
    1.90 +		TBool largepolygon = EFalse;
    1.91 +
    1.92 +		for (TInt count = 0; count < numpoints; count++)
    1.93 +			{
    1.94 +			pointrect.iTl = aPointList[count] + iOrigin;
    1.95 +			truncrect.iTl = pointrect.iTl;
    1.96 +			TruncateRect(truncrect);
    1.97 +
    1.98 +			if (pointrect.iTl != truncrect.iTl)
    1.99 +				{
   1.100 +				largepolygon = ETrue;
   1.101 +				break;
   1.102 +				}
   1.103 +			}
   1.104 +
   1.105 +		if (largepolygon)
   1.106 +			{
   1.107 +			PolyFillLarge(&aPointList, aFillRule);
   1.108 +			}
   1.109 +		else
   1.110 +			{
   1.111 +			PolyFill(&aPointList, aFillRule);
   1.112 +			}
   1.113 +		}
   1.114 +
   1.115 +	if (iPenStyle != DirectGdi::ENullPen)
   1.116 +		{
   1.117 +		if (iPenSize.iWidth > 0 && iPenSize.iHeight > 0)
   1.118 +			{
   1.119 +			PolyOutline(&aPointList);
   1.120 +			}
   1.121 +		}
   1.122 +	}
   1.123 +
   1.124 +/**
   1.125 +Draws a straight line from the start to the end position using current pen size, colour and style.
   1.126 +
   1.127 +@param	aPt1 Start position.
   1.128 +@param	aPt2 End position.
   1.129 +@param	aDrawStartPoint	If ETrue, draws the first pixel of the line.
   1.130 +
   1.131 +@post   The internal drawing position is set to the line's endpoint.
   1.132 +@see CSwDirectGdiEngine::DrawLine()
   1.133 +*/
   1.134 +void CSwDirectGdiEngine::DoDrawLine(TPoint aPt1, TPoint aPt2, TBool aDrawStartPoint)
   1.135 +	{
   1.136 +	iLinePosition = aPt2;
   1.137 +
   1.138 +	if ((aPt1 == aPt2))
   1.139 +		{
   1.140 +		return;
   1.141 +		}
   1.142 +
   1.143 +	aPt1 += iOrigin;
   1.144 +	aPt2 += iOrigin;
   1.145 +
   1.146 +	TRect temp(aPt1,aPt2);
   1.147 +	temp.Normalize();
   1.148 +	temp.Grow(iPenSize.iWidth, iPenSize.iHeight);
   1.149 +
   1.150 +	TRect screenRect;
   1.151 +	iDrawDevice->GetDrawRect(screenRect);
   1.152 +	screenRect.Grow(iPenSize.iWidth, iPenSize.iHeight);
   1.153 +
   1.154 +	const TInt dotParam = iDotParam;
   1.155 +	TPoint plotpt(0,0);
   1.156 +	const CGraphicsContext::TDrawMode drawMode = GcDrawMode(iDrawMode);
   1.157 +
   1.158 +	TRect clipRect(0,0,0,0);
   1.159 +	for (TInt count = 0; count < iDefaultRegionPtr->Count(); count++)
   1.160 +		{
   1.161 +		iDotParam = dotParam;
   1.162 +		clipRect = (*iDefaultRegionPtr)[count];
   1.163 +
   1.164 +		if (!clipRect.Intersects(temp))
   1.165 +			{
   1.166 +			TLinearDDA line;
   1.167 +			line.Construct(aPt1,aPt2);
   1.168 +			line.JumpToRect(screenRect);
   1.169 +			if (iPenStyle != DirectGdi::ESolidPen)
   1.170 +				{
   1.171 +				while (!line.SingleStep(plotpt))
   1.172 +					{
   1.173 +					iDotParam += iDotDirection;
   1.174 +					}
   1.175 +				}
   1.176 +			continue;
   1.177 +			}
   1.178 +
   1.179 +		clipRect.Intersection(temp);
   1.180 +
   1.181 +		if ((iPenSize.iWidth > 1 || iPenSize.iHeight > 1) && (iPenStyle == DirectGdi::ESolidPen)) // wide solid line
   1.182 +			{
   1.183 +			DoDrawSolidWideLine(aPt1, aPt2, aDrawStartPoint, screenRect, clipRect);
   1.184 +			}
   1.185 +		else if (iPenSize.iWidth > 1 || iPenSize.iHeight > 1) // dotted line
   1.186 +			{
   1.187 +			DoDrawDottedWideLine(aPt1, aPt2, aDrawStartPoint, screenRect, clipRect);
   1.188 +			}
   1.189 +		else if (iPenStyle != DirectGdi::ESolidPen) // single pixel dotted line
   1.190 +			{
   1.191 +			TLinearDDA line;
   1.192 +			line.Construct(aPt1,aPt2);
   1.193 +			line.JumpToRect(screenRect);
   1.194 +
   1.195 +			iDotParam = dotParam;
   1.196 +			if (!aDrawStartPoint)
   1.197 +				{
   1.198 +				line.SingleStep(plotpt);
   1.199 +				iDotParam += iDotDirection;
   1.200 +				}
   1.201 +
   1.202 +			while (!line.SingleStep(plotpt))
   1.203 +				{
   1.204 +				PenDrawClipped(plotpt, clipRect);
   1.205 +				iDotParam += iDotDirection;
   1.206 +				}
   1.207 +			}
   1.208 +		else if (aPt1.iY == aPt2.iY && 
   1.209 +				(aPt1.iY >= clipRect.iTl.iY && 
   1.210 +				 aPt1.iY < clipRect.iBr.iY))
   1.211 +			{ // single pixel solid horizontal line
   1.212 +			TInt start = Min(aPt1.iX,aPt2.iX + 1);
   1.213 +			TInt length = Abs(aPt2.iX - aPt1.iX);
   1.214 +
   1.215 +			if (!aDrawStartPoint)
   1.216 +				{
   1.217 +				if (aPt1.iX < aPt2.iX)
   1.218 +					{
   1.219 +					start++;
   1.220 +					}
   1.221 +				else
   1.222 +					{
   1.223 +					length--;
   1.224 +					}
   1.225 +				}
   1.226 +			if (start < clipRect.iTl.iX)
   1.227 +				{
   1.228 +				length += start - clipRect.iTl.iX;
   1.229 +				start = clipRect.iTl.iX;
   1.230 +				}
   1.231 +			if ( (start + length) > clipRect.iBr.iX)
   1.232 +				{
   1.233 +				length = clipRect.iBr.iX - start;
   1.234 +				}
   1.235 +
   1.236 +			if (length > 0)
   1.237 +				{
   1.238 +				iDrawDevice->WriteRgbMulti(start, aPt1.iY, length, 1, iPenColor, drawMode);
   1.239 +				}
   1.240 +			}
   1.241 +		else if (aPt1.iX == aPt2.iX && (aPt1.iX >= clipRect.iTl.iX && aPt1.iX < clipRect.iBr.iX))
   1.242 +			{ // single pixel solid vertical line
   1.243 +			TInt start = Min(aPt1.iY,aPt2.iY + 1);
   1.244 +			TInt length = Abs(aPt2.iY - aPt1.iY);
   1.245 +
   1.246 +			if (!aDrawStartPoint)
   1.247 +				{
   1.248 +				if (aPt1.iY < aPt2.iY)
   1.249 +					{
   1.250 +					start++;
   1.251 +					}
   1.252 +				else
   1.253 +					{
   1.254 +					length--;
   1.255 +					}
   1.256 +				}
   1.257 +
   1.258 +			if (start < clipRect.iTl.iY)
   1.259 +				{
   1.260 +				length += start - clipRect.iTl.iY;
   1.261 +				start = clipRect.iTl.iY;
   1.262 +				}
   1.263 +			if (start + length > clipRect.iBr.iY)
   1.264 +				{
   1.265 +				length = clipRect.iBr.iY - start;
   1.266 +				}
   1.267 +
   1.268 +			if (length > 0)
   1.269 +				{			
   1.270 +				iDrawDevice->WriteRgbMulti(aPt1.iX,start,1,length,iPenColor, drawMode);
   1.271 +				}
   1.272 +			}
   1.273 +		else
   1.274 +			{ // single pixel solid diagonal line
   1.275 +			TLinearDDA line;
   1.276 +			line.Construct(aPt1,aPt2);
   1.277 +
   1.278 +			line.JumpToRect(screenRect);
   1.279 +
   1.280 +			if (!aDrawStartPoint)
   1.281 +				{
   1.282 +				line.SingleStep(plotpt);
   1.283 +				}
   1.284 +
   1.285 +			while (!line.SingleStep(plotpt))
   1.286 +				{
   1.287 +				if (clipRect.Contains(plotpt))
   1.288 +					{
   1.289 +					iDrawDevice->WriteRgb(plotpt.iX, plotpt.iY, iPenColor, drawMode);
   1.290 +					}
   1.291 +				}
   1.292 +			}
   1.293 +
   1.294 +		iDrawDevice->UpdateRegion(clipRect);
   1.295 +		}
   1.296 +	}
   1.297 +
   1.298 +/**
   1.299 +Draws a straight line from the start to the end position using pen sizes larger than 1x1 pixel. 
   1.300 +
   1.301 +@param	aPt1 Start position.
   1.302 +@param	aPt2 End position.
   1.303 +@param	aDrawStartPoint	If ETrue, draws the first pixel of the line.
   1.304 +@param  aScreenRect Rectangle representing the screen boundary.
   1.305 +@param aClipRect The rectangle to which the line is clipped.
   1.306 +@see CSwDirectGdiEngine::DrawLine()
   1.307 +*/
   1.308 +void CSwDirectGdiEngine::DoDrawSolidWideLine(const TPoint& aPt1,
   1.309 +									const TPoint& aPt2,
   1.310 +									TBool aDrawStartPoint,
   1.311 +									const TRect& aScreenRect,
   1.312 +									TRect aClipRect)
   1.313 +	{
   1.314 +	CFbsDrawDevice* drawDevice = iDrawDevice;
   1.315 +
   1.316 +	TLinearDDA line;
   1.317 +	line.Construct(aPt1,aPt2);
   1.318 +
   1.319 +	TPoint plotpt(aPt1);
   1.320 +	line.JumpToRect(aScreenRect);
   1.321 +	if (!aDrawStartPoint)
   1.322 +		line.SingleStep(plotpt);
   1.323 +
   1.324 +	TInt* deferred = NULL;
   1.325 +	const TInt doubleheight = iPenSize.iHeight << 1;
   1.326 +
   1.327 +	if (iPenArray)
   1.328 +		{
   1.329 +		deferred = new TInt[doubleheight];
   1.330 +		}
   1.331 +
   1.332 +	if (!iPenArray || !deferred)
   1.333 +		{
   1.334 +		while (!line.SingleStep(plotpt))
   1.335 +			PenDrawClipped(plotpt, aClipRect);
   1.336 +		}
   1.337 +	else
   1.338 +		{
   1.339 +		const TBool down = (aPt2.iY >= aPt1.iY);
   1.340 +
   1.341 +		for (TInt fillcount = 0; fillcount < doubleheight; )
   1.342 +			{
   1.343 +			deferred[fillcount++] = KMaxTInt;
   1.344 +			deferred[fillcount++] = KMinTInt;
   1.345 +			}
   1.346 +
   1.347 +		TInt nextline = 0;
   1.348 +		TInt nexty = plotpt.iY;
   1.349 +		if (down)
   1.350 +			{
   1.351 +			nexty -= ((iPenSize.iHeight - 1) >> 1);
   1.352 +			}
   1.353 +		else
   1.354 +			{
   1.355 +			nexty += (iPenSize.iHeight >> 1);
   1.356 +			}
   1.357 +
   1.358 +		TInt lasty = plotpt.iY;
   1.359 +
   1.360 +		while (!line.SingleStep(plotpt))
   1.361 +			{
   1.362 +			if (plotpt.iY != lasty)
   1.363 +				{
   1.364 +				if (nexty >= aClipRect.iTl.iY && nexty < aClipRect.iBr.iY)
   1.365 +					{
   1.366 +					TInt left = deferred[nextline];
   1.367 +					TInt right = deferred[nextline + 1];
   1.368 +					if (left < aClipRect.iTl.iX)
   1.369 +						{
   1.370 +						left = aClipRect.iTl.iX;
   1.371 +						}
   1.372 +					if (right >= aClipRect.iBr.iX)
   1.373 +						{
   1.374 +						right = aClipRect.iBr.iX - 1;
   1.375 +						}
   1.376 +
   1.377 +					if (left <= right)
   1.378 +						{
   1.379 +						drawDevice->WriteRgbMulti(left,nexty,right - left + 1,1,iPenColor,CGraphicsContext::EDrawModePEN);
   1.380 +						}
   1.381 +					}
   1.382 +
   1.383 +				if (down)
   1.384 +					{
   1.385 +					nexty++;
   1.386 +					}
   1.387 +				else
   1.388 +					{
   1.389 +					nexty--;
   1.390 +					}
   1.391 +				
   1.392 +				lasty = plotpt.iY;
   1.393 +				deferred[nextline++] = KMaxTInt;
   1.394 +				deferred[nextline++] = KMinTInt;
   1.395 +				if (nextline == doubleheight)
   1.396 +					{
   1.397 +					nextline = 0;
   1.398 +					}
   1.399 +				}
   1.400 +
   1.401 +			PenDrawDeferred(plotpt,deferred,nextline);
   1.402 +			}
   1.403 +
   1.404 +		for (TInt restofline = 0; restofline < doubleheight; restofline += 2,nextline += 2)
   1.405 +			{
   1.406 +			if (nextline == doubleheight)
   1.407 +				nextline = 0;
   1.408 +
   1.409 +			if (nexty >= aClipRect.iTl.iY && nexty < aClipRect.iBr.iY)
   1.410 +				{
   1.411 +				TInt left = deferred[nextline];
   1.412 +				TInt right = deferred[nextline+1];
   1.413 +				if (left < aClipRect.iTl.iX)
   1.414 +					{
   1.415 +					left = aClipRect.iTl.iX;
   1.416 +					}
   1.417 +				if (right >= aClipRect.iBr.iX)
   1.418 +					{
   1.419 +					right = aClipRect.iBr.iX-1;
   1.420 +					}
   1.421 +
   1.422 +				if (left <= right)
   1.423 +					{
   1.424 +					drawDevice->WriteRgbMulti(left,nexty,right - left + 1,1,iPenColor,CGraphicsContext::EDrawModePEN);
   1.425 +					}
   1.426 +				}
   1.427 +
   1.428 +			if (down)
   1.429 +				{
   1.430 +				nexty++;
   1.431 +				}
   1.432 +			else
   1.433 +				{
   1.434 +				nexty--;
   1.435 +				}
   1.436 +			}
   1.437 +
   1.438 +		delete[] deferred;
   1.439 +		}
   1.440 +	}
   1.441 +
   1.442 +/**
   1.443 +Draws a dotted straight line from the start to the end position using pen sizes larger than 1x1 pixel.
   1.444 +
   1.445 +@param	aPt1 Start position.
   1.446 +@param	aPt2 End position.
   1.447 +@param	aDrawStartPoint	If ETrue, draws the first pixel of the line.
   1.448 +@param  aScreenRect Rectangle representing the screen boundary.
   1.449 +@param	aClipRect The rectangle to which the line is clipped.
   1.450 +@see CSwDirectGdiEngine::DrawLine()
   1.451 +*/
   1.452 +void CSwDirectGdiEngine::DoDrawDottedWideLine(const TPoint& aPt1,
   1.453 +									 const TPoint& aPt2,
   1.454 +									 TBool aDrawStartPoint,
   1.455 +									 const TRect& aScreenRect,
   1.456 +									 TRect aClipRect)
   1.457 +	{
   1.458 +	TLinearDDA line;
   1.459 +	line.Construct(aPt1,aPt2);
   1.460 +
   1.461 +	TPoint plotpt(aPt1);
   1.462 +	line.JumpToRect(aScreenRect);
   1.463 +	if (!aDrawStartPoint)
   1.464 +		{
   1.465 +		line.SingleStep(plotpt);
   1.466 +		iDotParam += iDotDirection;
   1.467 +		}
   1.468 +	
   1.469 +	const TInt maxdim = Max(iPenSize.iWidth, iPenSize.iHeight);
   1.470 +
   1.471 +	TBool done = EFalse;
   1.472 +	while (!done)
   1.473 +		{
   1.474 +		while (!done && !(iDotMask & (1 << ((iDotParam / maxdim) % iDotLength))))
   1.475 +			{
   1.476 +			done = line.SingleStep(plotpt);
   1.477 +			iDotParam += iDotDirection;
   1.478 +			}
   1.479 +
   1.480 +		TPoint startdash(plotpt);
   1.481 +		TPoint enddash(plotpt);
   1.482 +
   1.483 +		while (!done && (iDotMask & (1 << ((iDotParam / maxdim) % iDotLength))))
   1.484 +			{
   1.485 +			enddash = plotpt;
   1.486 +			done = line.SingleStep(plotpt);
   1.487 +			iDotParam += iDotDirection;
   1.488 +			}
   1.489 +
   1.490 +		DoDrawSolidWideLine(startdash,enddash,ETrue,aScreenRect,aClipRect);
   1.491 +		}
   1.492 +	}
   1.493 +
   1.494 +/**
   1.495 +Fills a polygon defined using an array of points. The first point in the array defines the 
   1.496 +start of the first side of the polygon. The final side of the polygon is drawn using the last point 
   1.497 +from the array. The area is filled with the current brush settings. 
   1.498 +
   1.499 +Self-crossing polygons are filled according to the specified fill rule.
   1.500 +
   1.501 +@param	aPointList	Array of points specifying the vertices of the polygon.
   1.502 +@param	aFillRule	Polygon filling rule.
   1.503 +*/
   1.504 +void CSwDirectGdiEngine::PolyFill(const TArray<TPoint>* aPointList, DirectGdi::TFillRule aFillRule)
   1.505 +	{
   1.506 +	TBool exists;
   1.507 +	TInt scanline;
   1.508 +	TInt pixelRunStart;
   1.509 +	TInt pixelRunEnd;
   1.510 +
   1.511 +	TRect clipRect(0,0,0,0);
   1.512 +	const TInt limit = iDefaultRegionPtr->Count();
   1.513 +	for (TInt count = 0; count < limit; count++)
   1.514 +		{
   1.515 +		clipRect = (*iDefaultRegionPtr)[count];
   1.516 +		CSwDirectGdiPolygonFiller polyfill;
   1.517 +		polyfill.Construct(aPointList,aFillRule);
   1.518 +
   1.519 +		for(polyfill.GetNextPixelRun(exists,scanline,pixelRunStart,pixelRunEnd);exists;
   1.520 +						polyfill.GetNextPixelRun(exists,scanline,pixelRunStart,pixelRunEnd))
   1.521 +			{
   1.522 +			TPoint start(pixelRunStart, scanline);
   1.523 +			TPoint end(pixelRunEnd, scanline);
   1.524 +			start += iOrigin;
   1.525 +			end += iOrigin;
   1.526 +			ClipFillLine(start,end,clipRect);
   1.527 +			}
   1.528 +
   1.529 +		polyfill.Reset();
   1.530 +		iDrawDevice->UpdateRegion(clipRect);
   1.531 +		}
   1.532 +	}
   1.533 +
   1.534 +
   1.535 +/**
   1.536 +Fills a polygon defined using an array of points. The first point in the array defines the 
   1.537 +start of the first side of the polygon. The final side of the polygon is drawn using the last point 
   1.538 +from the array. The area is filled with the current brush settings. Optimized for polygons that are
   1.539 +much larger than the screen.
   1.540 +
   1.541 +Self-crossing polygons are filled according to the specified fill rule.
   1.542 +
   1.543 +@param	aPointList	Array of points specifying the vertices of the polygon.
   1.544 +@param	aFillRule	Polygon filling rule.
   1.545 +*/
   1.546 +void CSwDirectGdiEngine::PolyFillLarge(const TArray<TPoint>* aPointList, DirectGdi::TFillRule aFillRule)
   1.547 +	{
   1.548 +	TBool exists;
   1.549 +	TInt pixelRunStart;
   1.550 +	TInt pixelRunEnd;
   1.551 +	
   1.552 +	TRect clipRect(0,0,0,0);
   1.553 +	const TInt limit = iDefaultRegionPtr->Count();
   1.554 +	for (TInt count = 0; count < limit; count++)
   1.555 +		{
   1.556 +		clipRect = (*iDefaultRegionPtr)[count];
   1.557 +		CSwDirectGdiPolygonFiller polyfill;
   1.558 +		polyfill.Construct(aPointList,aFillRule,CSwDirectGdiPolygonFiller::EGetPixelRunsSequentiallyForSpecifiedScanLines);
   1.559 +		TInt clipRectOffsetStart = clipRect.iTl.iY - iOrigin.iY;
   1.560 +		TInt clipRectOffsetEnd = clipRect.iBr.iY - iOrigin.iY;
   1.561 +
   1.562 +		for (TInt scanline = clipRectOffsetStart; scanline < clipRectOffsetEnd; scanline++)
   1.563 +			{
   1.564 +			polyfill.GetNextPixelRunOnSpecifiedScanLine(exists,scanline,pixelRunStart,pixelRunEnd);
   1.565 +			while (exists)
   1.566 +				{
   1.567 +				TPoint start(pixelRunStart,scanline);
   1.568 +				TPoint end(pixelRunEnd,scanline);
   1.569 +				start += iOrigin;
   1.570 +				end += iOrigin;
   1.571 +				ClipFillLine(start,end,clipRect);
   1.572 +				polyfill.GetNextPixelRunOnSpecifiedScanLine(exists,scanline,pixelRunStart,pixelRunEnd);
   1.573 +				}
   1.574 +			}
   1.575 +
   1.576 +		polyfill.Reset();
   1.577 +		iDrawDevice->UpdateRegion(clipRect);
   1.578 +		}
   1.579 +	}
   1.580 +
   1.581 +/**
   1.582 +Draws a polygon defined by an array of points using the current pen settings. The first point in the array defines the 
   1.583 +start of the first side of the polygon. The final side of the polygon is drawn using the last point 
   1.584 +from the array, and the line is drawn to the start point of the first side.
   1.585 +
   1.586 +@param	aPointList List of points specifying the vertices of the polygon.
   1.587 +*/	
   1.588 +void CSwDirectGdiEngine::PolyOutline(const TArray<TPoint>* aPointList)
   1.589 +	{
   1.590 +	const TInt vertexes = aPointList->Count();
   1.591 +	
   1.592 +	for (TInt count = 0; count < vertexes; count++)
   1.593 +		{
   1.594 +		TPoint point1((*aPointList)[count]);
   1.595 +		TPoint point2((*aPointList)[(count + 1) % vertexes]);
   1.596 +
   1.597 +		if (point1.iY < point2.iY)
   1.598 +			{
   1.599 +			DoDrawLine(point1,point2,ETrue);
   1.600 +			}
   1.601 +		else
   1.602 +			{
   1.603 +			iDotDirection = -1;
   1.604 +			iDotParam += Max(Abs(point2.iX - point1.iX),Abs(point2.iY - point1.iY));
   1.605 +			const TInt dotParam = iDotParam;
   1.606 +			DoDrawLine(point2,point1,EFalse);
   1.607 +
   1.608 +			if (Abs(point2.iX - point1.iX) > Abs(point2.iY - point1.iY))
   1.609 +				{
   1.610 +				if (iPenStyle == DirectGdi::ESolidPen || (iDotMask & (1 << ((iDotParam / iPenSize.iWidth) % iDotLength))))
   1.611 +					DoPlot((*aPointList)[count]);
   1.612 +				}
   1.613 +			else
   1.614 +				{
   1.615 +				if (iPenStyle == DirectGdi::ESolidPen || (iDotMask & (1 << ((iDotParam / iPenSize.iHeight) % iDotLength))))
   1.616 +					DoPlot((*aPointList)[count]);
   1.617 +				}
   1.618 +
   1.619 +			iDotDirection = 1;
   1.620 +			iDotParam = dotParam;
   1.621 +			}
   1.622 +		}
   1.623 +	}