Update contrib.
1 // Copyright (c) 2003-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 CDrawUTwentyFourBppScreenBitmap::InitScreen()
22 GetDrawRect(drawRect);
23 RWindows* window = ::WindowHandler(iScreenNo);
24 window->iDisplayMode = DisplayMode();
25 window->iEpocBitmapSize = drawRect.Size();
26 window->iEpocBitmapLinePitch = iScanLineWords * 4;
31 TBool CDrawUTwentyFourBppScreenBitmap::SetOrientation(TOrientation aOrientation)
33 if (aOrientation == iEmulatorOrientation)
36 SetScreenOrientation(aOrientation);
37 iEmulatorOrientation = aOrientation;
38 iOrientation = aOrientation ;
42 void CDrawUTwentyFourBppScreenBitmap::UpdateRect(const TRect& aRect) const
44 ASSERT(aRect.iTl.iX >= 0 && aRect.iTl.iY >= 0);
48 ASSERT(aRect.iBr.iX <= iSize.iHeight);
49 ASSERT(aRect.iBr.iY <= iSize.iWidth);
53 ASSERT(aRect.iBr.iX <= iSize.iWidth);
54 ASSERT(aRect.iBr.iY <= iSize.iHeight);
57 TInt scanLineLen=iLongWidth*4;
59 TPoint srcStart(aRect.iTl);
62 case CFbsDrawDevice::EOrientationRotated90:
63 srcPixelStep=scanLineLen;
65 srcStart.iX=iSize.iWidth-1-aRect.iTl.iY;
66 srcStart.iY=aRect.iTl.iX;
68 case CFbsDrawDevice::EOrientationRotated180:
70 scanLineLen=-scanLineLen;
71 srcStart.iX=iSize.iWidth-1-aRect.iTl.iX;
72 srcStart.iY=iSize.iHeight-1-aRect.iTl.iY;
74 case CFbsDrawDevice::EOrientationRotated270:
75 srcPixelStep=-scanLineLen;
77 srcStart.iX=aRect.iTl.iY;
78 srcStart.iY=iSize.iHeight-1-aRect.iTl.iX;
81 TUint8* srcePtr = (TUint8*)PixelAddress(srcStart.iX,srcStart.iY);
82 TUint8* srcePtrLimit = srcePtr + aRect.Width()*srcPixelStep;
83 TInt rowMax = aRect.iTl.iY+aRect.Height();
84 srcPixelStep-=3; // as we increment while reading it
85 for(TInt row = aRect.iTl.iY; row < rowMax; row++)
87 TUint8* tempSrcePtr = srcePtr;
88 TUint8* destPixel = WinPixelAddress(aRect.iTl.iX,row);
90 while (tempSrcePtr != srcePtrLimit)
92 *destPixel++=*tempSrcePtr++;
93 *destPixel++=*tempSrcePtr++;
94 *destPixel++=*tempSrcePtr++;
95 tempSrcePtr += srcPixelStep;
98 srcePtrLimit+=scanLineLen;