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".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
19 TInt CDrawFourBppScreenBitmapColor::InitScreen()
22 GetDrawRect(drawRect);
23 RWindows* window = ::WindowHandler(iScreenNo);
24 window->iDisplayMode = DisplayMode();
25 window->iEpocBitmapSize = drawRect.Size();
26 window->iEpocBitmapLinePitch = (iScanLineWords*4);
31 void CDrawFourBppScreenBitmapColor::OrientationsAvailable(TBool aOrientation[4])
33 aOrientation[EOrientationNormal] = ETrue;
34 aOrientation[EOrientationRotated90] = EFalse;
35 aOrientation[EOrientationRotated180] = EFalse;
36 aOrientation[EOrientationRotated270] = EFalse;
39 void CDrawFourBppScreenBitmapColor::UpdateRect(const TRect& aRect) const
41 ASSERT(aRect.iTl.iX >= 0 && aRect.iTl.iY >= 0);
42 ASSERT(aRect.iBr.iX <= iSize.iWidth);
43 ASSERT(aRect.iBr.iY <= iSize.iHeight);
45 TInt lx = aRect.iTl.iX & ~7;
46 TInt rx = (aRect.iBr.iX + 7) & ~7;
48 TUint8* srcePtr = ((TUint8*)(ScanLine(aRect.iTl.iY))) + (lx / 2);
49 TUint8* srcePtrLimit = srcePtr + ((rx - lx) / 2);
51 TInt byteWidth = iScanLineWords * 4;
54 for(TInt row = aRect.iTl.iY; row < aRect.iBr.iY; row++)
56 TUint8* tempSrcePtr = srcePtr;
57 TUint8* destPixel = WinPixelAddress(lx,row);
59 while (tempSrcePtr < srcePtrLimit)
61 TUint8 pixelValue1 = *tempSrcePtr++;
62 TUint8 pixelValue2 = TUint8(pixelValue1 >> 4);
65 pixelColor = TRgb::Color16(pixelValue1);
66 destPixel[0] = TUint8(pixelColor.Blue());
67 destPixel[1] = TUint8(pixelColor.Green());
68 destPixel[2] = TUint8(pixelColor.Red());
70 if (pixelValue2 != pixelValue1)
71 pixelColor = TRgb::Color16(pixelValue2);
73 destPixel[3] = TUint8(pixelColor.Blue());
74 destPixel[4] = TUint8(pixelColor.Green());
75 destPixel[5] = TUint8(pixelColor.Red());
81 srcePtrLimit += byteWidth;