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 CDrawEightBppScreenBitmapColor::InitScreen()
22 GetDrawRect(drawRect);
23 RWindows* window = ::WindowHandler(iScreenNo);
24 window->iDisplayMode = DisplayMode();
25 window->iEpocBitmapSize = drawRect.Size();
26 window->iEpocBitmapLinePitch = (iScanLineWords*4);
27 window->iPalette = iPalette;
32 TInt CDrawEightBppScreenBitmapColor::SetCustomPalette(const CPalette* aPalette)
34 const TInt ret = CDrawEightBppBitmapColor::SetCustomPalette(aPalette);
36 if(::WindowHandler(iScreenNo)->iDisplayMode==DisplayMode())
37 ::WindowHandler(iScreenNo)->iPalette = iPalette;
41 CFbsDrawDevice* thisPtr = this;
42 TRegionFix<1> rgnSize(iSize);
43 thisPtr->Update(rgnSize); // Can't access Update directly because the most-derived implementation is private.
49 TBool CDrawEightBppScreenBitmapColor::SetOrientation(TOrientation aOrientation)
51 if (aOrientation == iEmulatorOrientation)
54 SetScreenOrientation(aOrientation);
55 iEmulatorOrientation = aOrientation;
56 iOrientation = aOrientation ;
60 void CDrawEightBppScreenBitmapColor::UpdateRect(const TRect& aRect) const
62 ASSERT(aRect.iTl.iX >= 0 && aRect.iTl.iY >= 0);
66 ASSERT(aRect.iBr.iX <= iSize.iHeight);
67 ASSERT(aRect.iBr.iY <= iSize.iWidth);
71 ASSERT(aRect.iBr.iX <= iSize.iWidth);
72 ASSERT(aRect.iBr.iY <= iSize.iHeight);
75 TInt scanLineLen=iLongWidth;
77 TPoint srcStart(aRect.iTl);
80 case CFbsDrawDevice::EOrientationRotated90:
81 srcPixelStep=scanLineLen;
83 srcStart.iX=iSize.iWidth-1-aRect.iTl.iY;
84 srcStart.iY=aRect.iTl.iX;
86 case CFbsDrawDevice::EOrientationRotated180:
88 scanLineLen=-scanLineLen;
89 srcStart.iX=iSize.iWidth-1-aRect.iTl.iX;
90 srcStart.iY=iSize.iHeight-1-aRect.iTl.iY;
92 case CFbsDrawDevice::EOrientationRotated270:
93 srcPixelStep=-scanLineLen;
95 srcStart.iX=aRect.iTl.iY;
96 srcStart.iY=iSize.iHeight-1-aRect.iTl.iX;
99 TUint8* srcePtr = PixelAddress(srcStart.iX,srcStart.iY);
100 TUint8* srcePtrLimit = srcePtr + aRect.Width()*srcPixelStep;
101 TInt rowMax = aRect.iTl.iY+aRect.Height();
102 for(TInt row = aRect.iTl.iY; row < rowMax; row++)
104 TUint8* tempSrcePtr = srcePtr;
105 TUint8* destPixel = WinPixelAddress(aRect.iTl.iX,row);
107 while (tempSrcePtr != srcePtrLimit)
109 TRgb pixelColor = IndexToColor(*tempSrcePtr);
110 destPixel[0] = TUint8(pixelColor.Blue());
111 destPixel[1] = TUint8(pixelColor.Green());
112 destPixel[2] = TUint8(pixelColor.Red());
114 tempSrcePtr+=srcPixelStep;
118 srcePtr += scanLineLen;
119 srcePtrLimit += scanLineLen;