os/graphics/graphicsdeviceinterface/screendriver/sbit/BMDRAW8C.CPP
author sl
Tue, 10 Jun 2014 14:32:02 +0200
changeset 1 260cb5ec6c19
permissions -rw-r--r--
Update contrib.
     1 // Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies).
     2 // All rights reserved.
     3 // This component and the accompanying materials are made available
     4 // under the terms of "Eclipse Public License v1.0"
     5 // which accompanies this distribution, and is available
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
     7 //
     8 // Initial Contributors:
     9 // Nokia Corporation - initial contribution.
    10 //
    11 // Contributors:
    12 //
    13 // Description:
    14 //
    15 
    16 #include "BMDRAW.H"
    17 
    18 const TInt KEightBppPaletteSize = 256;
    19 const TInt KEightBppInversePaletteSize = 4096;
    20 
    21 GLREF_D const TUint8 color256shadowlutab[256];
    22 
    23 // CDrawEightBppBitmapColor
    24 
    25 TInt CDrawEightBppBitmapColor::Construct(TSize aSize)
    26 	{
    27 	return Construct(aSize, (aSize.iWidth + 3) & ~3);
    28 	}
    29 
    30 TInt CDrawEightBppBitmapColor::Construct(TSize aSize, TInt aStride)
    31 	{
    32 	iDispMode = EColor256;
    33 	iShadowIndex = (TUint8*)color256shadowlutab;
    34 
    35 	return CDrawEightBppBitmapCommon::Construct(aSize, aStride);
    36 	}
    37 
    38 CDrawEightBppBitmapColor::~CDrawEightBppBitmapColor()
    39 	{
    40 	delete[] iPalette;
    41 	delete[] iColor4KIndex;
    42 	if (iShadowIndex != color256shadowlutab)
    43 		delete[] iShadowIndex;
    44 	}
    45 
    46 TInt CDrawEightBppBitmapColor::SetCustomPalette(const CPalette* aPalette)
    47 	{
    48 	if (aPalette)
    49 		{
    50 		if (!iPalette)
    51 			iPalette = new TRgb[KEightBppPaletteSize];
    52 		if (!iColor4KIndex)
    53 			iColor4KIndex = new TUint8[KEightBppInversePaletteSize];
    54 		if (iShadowIndex == color256shadowlutab)
    55 			iShadowIndex = new TUint8[KEightBppPaletteSize];
    56 
    57 		if (iPalette && iColor4KIndex && iShadowIndex)
    58 			{
    59 			TInt index = 0;
    60 			TRgb* palettePtr = iPalette;
    61 			const TRgb* const palettePtrLimit = iPalette + Min(aPalette->Entries(),KEightBppPaletteSize);
    62 
    63 			while (palettePtr < palettePtrLimit)
    64 				*palettePtr++ = aPalette->GetEntry(index++);
    65 
    66 			index = 0;
    67 			TUint8* inversePtr = iColor4KIndex;
    68 			const TUint8* const inversePtrLimit = iColor4KIndex + KEightBppInversePaletteSize;
    69 
    70 			while (inversePtr < inversePtrLimit)
    71 				*inversePtr++ = TUint8(aPalette->NearestIndex(TRgb::_Color4K(index++)));
    72 
    73 			index = 0;
    74 			TUint8* shadowPtr = iShadowIndex;
    75 			const TUint8* const shadowPtrLimit = iShadowIndex + KEightBppPaletteSize;
    76 			TRgb color;
    77 
    78 			while (shadowPtr < shadowPtrLimit)
    79 				{
    80 				color = iPalette[index++];
    81 				const TInt red = Max(color.Red() - 0x33,0) >> 4;
    82 				const TInt green = Max(color.Green() - 0x33,0) >> 4;
    83 				const TInt blue = Max(color.Blue() - 0x33,0) >> 4;
    84 				*shadowPtr++ = iColor4KIndex[(red << 8) | (green << 4) | blue];
    85 				}
    86 
    87 			return KErrNone;
    88 			}
    89 
    90 		// Fall through to cleanup
    91 		}
    92 
    93 	delete[] iPalette;
    94 	iPalette = NULL;
    95 	delete[] iColor4KIndex;
    96 	iColor4KIndex = NULL;
    97 	if (iShadowIndex != color256shadowlutab)
    98 		{
    99 		delete[] iShadowIndex;
   100 		iShadowIndex = (TUint8*)color256shadowlutab;
   101 		}
   102 
   103 	return aPalette ? KErrNoMemory : KErrNone;
   104 	}
   105 
   106 TInt CDrawEightBppBitmapColor::GetCustomPalette(CPalette*& aPalette)
   107 	{
   108 	TRAPD(err, aPalette = CPalette::NewDefaultL(EColor256));
   109 
   110 	if (err == KErrNone && iPalette)
   111 		{
   112 		for (TInt index = 0; index < KEightBppPaletteSize; index++)
   113 			aPalette->SetEntry(index, iPalette[index]);
   114 		}
   115 
   116 	return err;
   117 	}
   118 
   119 TUint8 CDrawEightBppBitmapColor::ColorToIndex(TRgb aColor) const
   120 	{
   121 	if (iColor4KIndex)
   122 		return iColor4KIndex[aColor._Color4K()];
   123 
   124 	return TUint8(aColor.Color256());
   125 	}
   126 
   127 TRgb CDrawEightBppBitmapColor::IndexToColor(TInt aIndex) const
   128 	{
   129 	if (iPalette)
   130 		return iPalette[aIndex];
   131 
   132 	return TRgb::Color256(aIndex);
   133 	}
   134 
   135 void CDrawEightBppBitmapColor::Shadow(TRgb& aColor)
   136 	{
   137 	if (iShadowMode & EFade)
   138 		aColor = FadeRgb(IndexToColor(ColorToIndex(aColor)));
   139 
   140 	if (iShadowMode & EShadow)
   141 		aColor = IndexToColor(iShadowIndex[ColorToIndex(aColor)]);
   142 	}
   143 
   144 //aX, aY - physical coordinates
   145 TRgb CDrawEightBppBitmapColor::ReadRgbNormal(TInt aX,TInt aY) const
   146 	{
   147 	return IndexToColor(*PixelAddress(aX,aY));
   148 	}
   149 
   150 //aRect - logical coordinates
   151 void CDrawEightBppBitmapColor::ShadowArea(const TRect& aRect)
   152 	{
   153 	const TRect rect(DeOrientate(aRect));//rect - physical coordinates
   154 
   155 	__ASSERT_DEBUG(rect.iTl.iX>=0 && rect.iBr.iX<=iSize.iWidth,Panic(EScreenDriverPanicOutOfBounds));
   156 	__ASSERT_DEBUG(rect.iTl.iY>=0 && rect.iBr.iY<=iSize.iHeight,Panic(EScreenDriverPanicOutOfBounds));
   157 
   158 	const TInt longWidth = iLongWidth;
   159 	TUint8* pixelPtr = PixelAddress(rect.iTl.iX,rect.iTl.iY);
   160 	const TUint8* pixelRowPtrLimit = pixelPtr + (rect.Height() * longWidth);
   161 	TRgb color;
   162 	register const TUint8* bitsEnd = 
   163 		reinterpret_cast <const TUint8*> (iBits) + iLongWidth * iSize.iHeight;
   164 
   165 	if(pixelRowPtrLimit >= bitsEnd)
   166 		{
   167 		pixelRowPtrLimit = bitsEnd;
   168 		}
   169 	
   170 	if (iShadowMode & EFade)
   171 		{
   172 		TUint8* pixelRowPtr = pixelPtr;
   173 		TUint8* pixelPtrLimit = pixelPtr + rect.Width();
   174 
   175 		while (pixelRowPtr < pixelRowPtrLimit)
   176 			{
   177 			TUint8* tempPixelPtr = pixelRowPtr;
   178 
   179 			while (tempPixelPtr < pixelPtrLimit)
   180 				{
   181 				color = IndexToColor(*tempPixelPtr);
   182 				color = FadeRgb(color);
   183 				*tempPixelPtr++ = ColorToIndex(color);
   184 				}
   185 
   186 			pixelRowPtr += longWidth;
   187 			pixelPtrLimit += longWidth;
   188 			}
   189 		}
   190 
   191 	if (iShadowMode & EShadow)
   192 		{
   193 		TUint8* pixelRowPtr = pixelPtr;
   194 		TUint8* pixelPtrLimit = pixelPtr + rect.Width();
   195 
   196 		while (pixelRowPtr < pixelRowPtrLimit)
   197 			{
   198 			TUint8* tempPixelPtr = pixelRowPtr;
   199 
   200 			while (tempPixelPtr < pixelPtrLimit)
   201 				{
   202 				*tempPixelPtr = iShadowIndex[*tempPixelPtr];
   203 				++tempPixelPtr;
   204 				}
   205 
   206 			pixelRowPtr += longWidth;
   207 			pixelPtrLimit += longWidth;
   208 			}
   209 		}
   210 	}
   211 
   212 void CDrawEightBppBitmapColor::ShadowBuffer(TInt aLength,TUint32* aBuffer)
   213 	{
   214 	__ASSERT_DEBUG(aLength>0,Panic(EScreenDriverPanicInvalidParameter));
   215 	__ASSERT_DEBUG(aBuffer!=NULL,Panic(EScreenDriverPanicInvalidParameter));
   216 
   217 	const TUint8* limit = ((TUint8*)aBuffer) + aLength;
   218 
   219 	if (iShadowMode & EFade)
   220 		{
   221 		TUint8* buffer = (TUint8*)aBuffer;
   222 		TRgb color;
   223 		
   224 		while (buffer < limit)
   225 			{
   226 			color = FadeRgb(IndexToColor(*buffer));
   227 			*buffer++ = ColorToIndex(color);
   228 			}
   229 		}
   230 
   231 	if (iShadowMode & EShadow)
   232 		{
   233 		TUint8* buffer = (TUint8*)aBuffer;
   234 
   235 		while (buffer < limit)
   236 			{
   237 			*buffer = iShadowIndex[*buffer];
   238 			++buffer;
   239 			}
   240 		}
   241 	}
   242 
   243 //aX, aY - physical coordinates
   244 void CDrawEightBppBitmapColor::WriteRgb(TInt aX,TInt aY,TRgb aColor)
   245 	{
   246 	CDrawEightBppBitmapCommon::WriteRgb(aX,aY,ColorToIndex(aColor));
   247 	}
   248 
   249 //aX, aY - physical coordinates
   250 void CDrawEightBppBitmapColor::WriteBinary(TInt aX,TInt aY,TUint32* aData,TInt aLength,TInt aHeight,TRgb aColor)
   251 	{
   252 	CDrawEightBppBitmapCommon::WriteBinary(aX,aY,aData,aLength,aHeight,ColorToIndex(aColor));
   253 	}
   254 
   255 //aX, aY - physical coordinates
   256 void CDrawEightBppBitmapColor::WriteBinaryOp(TInt aX,TInt aY,TUint32* aData,TInt aLength,TInt aHeight,TRgb aColor,CGraphicsContext::TDrawMode aDrawMode)
   257 	{
   258 	CDrawEightBppBitmapCommon::WriteBinaryOp(aX,aY,aData,aLength,aHeight,ColorToIndex(aColor),aDrawMode);
   259 	}
   260 
   261 //aX, aY - physical coordinates
   262 void CDrawEightBppBitmapColor::WriteBinaryLineVertical(TInt aX,TInt aY,TUint32* aData,TInt aLength,TRgb aColor,TBool aUp)
   263 	{
   264 	CDrawEightBppBitmapCommon::WriteBinaryLineVertical(aX,aY,aData,aLength,ColorToIndex(aColor),aUp);
   265 	}
   266 
   267 /**
   268 MAlphaBlend::WriteRgbAlphaLine() implementation.
   269 @see MAlphaBlend::WriteRgbAlphaLine()
   270 */
   271 void CDrawEightBppBitmapColor::WriteRgbAlphaLine(TInt aX, TInt aY, TInt aLength,
   272                                                  const TUint8* aRgbBuffer,
   273                                                  const TUint8* aMaskBuffer,
   274                                                  MAlphaBlend::TShadowing aShadowing,
   275                                                  CGraphicsContext::TDrawMode /*aDrawMode*/)
   276     {
   277 	DeOrientate(aX,aY);//aX, aY - physical coordinates
   278 	TUint8* pixelPtr = PixelAddress(aX,aY);
   279 	register TInt pixelPtrInc = LogicalPixelAddressIncrement();
   280 	const TUint8* maskBufferPtrLimit = aMaskBuffer + aLength;
   281 	TRgb pixelColor;
   282 
   283 	if(iScalingOff)
   284 		{
   285 		while (aMaskBuffer < maskBufferPtrLimit)
   286 			{
   287             TRgb srcColor(aRgbBuffer[2],aRgbBuffer[1],aRgbBuffer[0]);
   288             if(aShadowing == MAlphaBlend::EShdwBefore)
   289                 {
   290 		        Shadow(srcColor);
   291                 }
   292             pixelColor = ::AlphaBlend(srcColor,IndexToColor(pixelPtr[0]),aMaskBuffer[0]);
   293             if(aShadowing == MAlphaBlend::EShdwAfter)
   294                 {
   295 		        Shadow(pixelColor);
   296                 }
   297 			MapColorToUserDisplayMode(pixelColor);
   298 			pixelPtr[0] = ColorToIndex(pixelColor);
   299 			pixelPtr += pixelPtrInc;
   300 			aRgbBuffer += 4;
   301 			aMaskBuffer++;
   302 			}
   303 		}
   304 	else
   305 		{
   306 		const TUint8* bitsStart = reinterpret_cast <const TUint8*> (iBits);
   307 		const TUint8* bitsEnd = bitsStart + iLongWidth * iSize.iHeight;
   308 		while (aMaskBuffer < maskBufferPtrLimit)
   309 			{
   310             TRgb srcColor(aRgbBuffer[2],aRgbBuffer[1],aRgbBuffer[0]);
   311             if(aShadowing == MAlphaBlend::EShdwBefore)
   312                 {
   313 		        Shadow(srcColor);
   314                 }
   315             pixelColor = ::AlphaBlend(srcColor,IndexToColor(pixelPtr[0]),aMaskBuffer[0]);
   316             if(aShadowing == MAlphaBlend::EShdwAfter)
   317                 {
   318 		        Shadow(pixelColor);
   319                 }
   320 			MapColorToUserDisplayMode(pixelColor);
   321 			const TUint8* pixelRowPtrLimit = bitsStart + (aY + 1) * iLongWidth;
   322 			SetPixels(pixelPtr, ColorToIndex(pixelColor), pixelRowPtrLimit, bitsStart, bitsEnd);
   323 			pixelPtr += pixelPtrInc;
   324 			aRgbBuffer += 4;
   325 			aMaskBuffer++;
   326 			IncScaledY(aY);
   327 			}
   328 		}
   329 	}
   330 
   331 void CDrawEightBppBitmapColor::WriteRgbMulti(TInt aX,TInt aY,TInt aLength,TInt aRows,TRgb aColor)
   332 	{
   333 	CDrawEightBppBitmapCommon::WriteRgbMulti(aX,aY,aLength,aRows,ColorToIndex(aColor));
   334 	}
   335 
   336 void CDrawEightBppBitmapColor::WriteRgbMultiXOR(TInt aX,TInt aY,TInt aLength,TInt aRows,TRgb aColor)
   337 	{
   338 	CDrawEightBppBitmapCommon::WriteRgbMultiXOR(aX,aY,aLength,aRows,ColorToIndex(aColor));
   339 	}
   340 
   341 void CDrawEightBppBitmapColor::WriteRgbMultiAND(TInt aX,TInt aY,TInt aLength,TInt aRows,TRgb aColor)
   342 	{
   343 	CDrawEightBppBitmapCommon::WriteRgbMultiAND(aX,aY,aLength,aRows,ColorToIndex(aColor));
   344 	}
   345 
   346 void CDrawEightBppBitmapColor::WriteRgbMultiOR(TInt aX,TInt aY,TInt aLength,TInt aRows,TRgb aColor)
   347 	{
   348 	CDrawEightBppBitmapCommon::WriteRgbMultiOR(aX,aY,aLength,aRows,ColorToIndex(aColor));
   349 	}
   350 
   351 //aX, aY - not deorientated
   352 //aLength - not scaled
   353 void CDrawEightBppBitmapColor::WriteRgbAlphaMulti(TInt aX,TInt aY,TInt aLength,
   354 												  TRgb aColor,const TUint8* aMaskBuffer)
   355 	{
   356 	DeOrientate(aX,aY);//aX, aY - scaled and deorientated
   357 	register TUint8* pixelPtr = PixelAddress(aX,aY);
   358 	register TInt pixelPtrInc = LogicalPixelAddressIncrement();
   359 	const TUint8* maskBufferPtrLimit = aMaskBuffer + aLength;
   360 
   361 	if (iShadowMode)
   362 		Shadow(aColor);
   363 
   364 	register TInt red = aColor.Red();
   365 	register TInt green = aColor.Green();
   366 	register TInt blue = aColor.Blue();
   367 	TRgb pixelColor;
   368 
   369 	if(iScalingOff)
   370 		{
   371 		while(aMaskBuffer < maskBufferPtrLimit)
   372 			{
   373 			pixelColor = AlphaBlend(red, green, blue, IndexToColor(pixelPtr[0]), aMaskBuffer[0]);
   374 			pixelPtr[0] = ColorToIndex(pixelColor);
   375 			pixelPtr += pixelPtrInc;
   376 			aMaskBuffer++;
   377 			}
   378 		}
   379 	else
   380 		{
   381 		const TUint8* bitsStart = reinterpret_cast <const TUint8*> (iBits);
   382 		const TUint8* bitsEnd = bitsStart + iLongWidth * iSize.iHeight;
   383 		while(aMaskBuffer < maskBufferPtrLimit)
   384 			{
   385 			pixelColor = AlphaBlend(red, green, blue, IndexToColor(pixelPtr[0]), aMaskBuffer[0]);
   386 			const TUint8* pixelRowPtrLimit = bitsStart + (aY + 1) * iLongWidth;
   387 			SetPixels(pixelPtr, ColorToIndex(pixelColor), pixelRowPtrLimit, bitsStart, bitsEnd);
   388 			pixelPtr += pixelPtrInc;
   389 			aMaskBuffer++;
   390 			IncScaledY(aY);
   391 			}
   392 		}
   393 	}
   394 
   395 
   396 void CDrawEightBppBitmapColor::MapColorToUserDisplayMode(TRgb& aColor)
   397 	{
   398 	switch (iUserDispMode)
   399 		{
   400 	case EGray2:
   401 		aColor = TRgb::_Gray2(aColor._Gray2());
   402 		break;
   403 	case EGray4:
   404 		aColor = TRgb::_Gray4(aColor._Gray4());
   405 		break;
   406 	case EGray16:
   407 	case EGray256:// EGray256 can't be done - nearest is EGray16
   408 		aColor = TRgb::_Gray16(aColor._Gray16());
   409 		break;
   410 	case EColor16:
   411 		aColor = TRgb::Color16(aColor.Color16());
   412 		break;
   413 	default:
   414 		break;
   415 		}
   416 	}
   417 
   418 void CDrawEightBppBitmapColor::MapBufferToUserDisplayMode(TInt aLength,TUint32* aBuffer)
   419 	{
   420 	TUint8* bufferPtr = (TUint8*)aBuffer;
   421 	const TUint8* bufferLimit = bufferPtr + aLength;
   422 	TRgb color;
   423 	
   424 	switch (iUserDispMode)
   425 		{
   426 	case EGray2:
   427 		while (bufferPtr < bufferLimit)
   428 			{
   429 			color = IndexToColor(*bufferPtr);
   430 			color = TRgb::_Gray2(color._Gray2());
   431 			*bufferPtr++ = ColorToIndex(color);
   432 			}
   433 		break;
   434 	case EGray4:
   435 		while (bufferPtr < bufferLimit)
   436 			{
   437 			color = IndexToColor(*bufferPtr);
   438 			color = TRgb::_Gray4(color._Gray4());
   439 			*bufferPtr++ = ColorToIndex(color);
   440 			}
   441 		break;
   442 	case EGray16:
   443 	case EGray256:// EGray256 can't be done - nearest is EGray16
   444 		while (bufferPtr < bufferLimit)
   445 			{
   446 			color = IndexToColor(*bufferPtr);
   447 			color = TRgb::_Gray16(color._Gray16());
   448 			*bufferPtr++ = ColorToIndex(color);
   449 			}
   450 		break;
   451 	case EColor16:
   452 		while (bufferPtr < bufferLimit)
   453 			{
   454 			color = IndexToColor(*bufferPtr);
   455 			color = TRgb::Color16(color.Color16());
   456 			*bufferPtr++ = ColorToIndex(color);
   457 			}
   458 		break;
   459 	default:
   460 		break;
   461 		}
   462 	}
   463 
   464 TInt CDrawEightBppBitmapColor::WriteRgbOutlineAndShadow(TInt aX, TInt aY, const TInt aLength,
   465 	                                   TUint32 aOutlinePenColor, TUint32 aShadowColor,
   466 	                                   TUint32 aFillColor, const TUint8* aDataBuffer)
   467 	{
   468 	//This is non-optimised since this screen mode is rarely used and is usually 
   469 	//fast enough without optimisation.
   470 	DeOrientate(aX,aY);
   471 	TUint8* pixelPtr = PixelAddress(aX,aY);
   472 	const TInt pixelPtrInc = LogicalPixelAddressIncrement();
   473 	const TUint8* dataBufferPtrLimit = aDataBuffer + aLength;
   474 	TInt blendedRedColor;
   475 	TInt blendedGreenColor;
   476 	TInt blendedBlueColor;
   477 	TUint8 index = 0;
   478 	TRgb finalColor;
   479 
   480 	TRgb outlinePenColor;
   481 	outlinePenColor.SetInternal(aOutlinePenColor);
   482 	TRgb shadowColor;
   483 	shadowColor.SetInternal(aShadowColor);
   484 	TRgb fillColor;
   485 	fillColor.SetInternal(aFillColor);
   486 
   487 	const TInt redOutlinePenColor = outlinePenColor.Red();
   488 	const TInt redShadowColor = shadowColor.Red();
   489 	const TInt redFillColor = fillColor.Red();
   490 
   491 	const TInt greenOutlinePenColor = outlinePenColor.Green();
   492 	const TInt greenShadowColor = shadowColor.Green();
   493 	const TInt greenFillColor = fillColor.Green();
   494 
   495 	const TInt blueOutlinePenColor = outlinePenColor.Blue();
   496 	const TInt blueShadowColor = shadowColor.Blue();
   497 	const TInt blueFillColor = fillColor.Blue();
   498 	
   499 	while (aDataBuffer < dataBufferPtrLimit)
   500 		{
   501 		index = *aDataBuffer++;
   502 		if (255 == FourColorBlendLookup[index][KBackgroundColorIndex])
   503 			{
   504 			//background colour
   505 			//No drawing required so move on to next pixel.
   506 			pixelPtr += pixelPtrInc;
   507 			continue;
   508 			}
   509 		else if (255 == FourColorBlendLookup[index][KFillColorIndex])
   510 			{
   511 			//fill colour
   512 			finalColor.SetInternal(aFillColor);
   513 			}
   514 		else if (255 == FourColorBlendLookup[index][KShadowColorIndex])
   515 			{
   516 			//Shadow colour
   517 			finalColor.SetInternal(aShadowColor);
   518 			}
   519 		else if (255 == FourColorBlendLookup[index][KOutlineColorIndex])
   520 			{
   521 			//Outline colour
   522 			finalColor.SetInternal(aOutlinePenColor);
   523 			}
   524 		else
   525 			{
   526 			TRgb backgroundColor = TRgb::Color256(*pixelPtr);
   527 	
   528 			blendedRedColor = (redOutlinePenColor * FourColorBlendLookup[index][KOutlineColorIndex] + 
   529 						   		redShadowColor * FourColorBlendLookup[index][KShadowColorIndex] +
   530 						  		redFillColor * FourColorBlendLookup[index][KFillColorIndex] + 
   531 						  		backgroundColor.Red() * FourColorBlendLookup[index][KBackgroundColorIndex]) >> 8;
   532 
   533 			blendedGreenColor = (greenOutlinePenColor * FourColorBlendLookup[index][KOutlineColorIndex] + 
   534 								greenShadowColor * FourColorBlendLookup[index][KShadowColorIndex] +
   535 								greenFillColor * FourColorBlendLookup[index][KFillColorIndex] + 
   536 								backgroundColor.Green() * FourColorBlendLookup[index][KBackgroundColorIndex]) >> 8;
   537 
   538 			blendedBlueColor = (blueOutlinePenColor * FourColorBlendLookup[index][KOutlineColorIndex] + 
   539 								blueShadowColor * FourColorBlendLookup[index][KShadowColorIndex] +
   540 								blueFillColor * FourColorBlendLookup[index][KFillColorIndex] + 
   541 								backgroundColor.Blue() * FourColorBlendLookup[index][KBackgroundColorIndex]) >> 8;
   542 
   543 			finalColor = TRgb(blendedRedColor, blendedGreenColor, blendedBlueColor);
   544 			}
   545 
   546 		*pixelPtr = TUint8(finalColor.Color256());
   547 		pixelPtr += pixelPtrInc;
   548 		}
   549 	return KErrNone;
   550 	}
   551