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.
20 Constructs the CDrawScreenBitmap object.
21 @param aScreenNo Screen number. It will be used in HAL::Get() calls.
22 @param aBitmapAddress The screen memory address.
23 @param aSize Screen size
24 @return System-wide error codes, KErrNone if the construction was successfull.
26 TInt CDrawScreenBitmap::ConstructScreen(TInt aScreenNo, TAny* aBitmapAddress,TSize aSize)
28 iScreenNo = aScreenNo;
29 TInt ret = SCREEN_LAYOUT_BASE_BITMAP::Construct(aSize);
33 //fixup for emulating smaller screen
35 ret = HAL::Get(iScreenNo, HALData::EDisplayOffsetBetweenLines, offset);
36 if (ret == KErrNone && (offset != aSize.iWidth))
39 iScanLineWords = iLongWidth / 4;
40 User::Heap().Free(iScanLineBuffer);
41 iScanLineBuffer = (TUint32*)(User::Heap().Alloc(offset));
42 if(iScanLineBuffer == NULL)
45 //fixup for emulating smaller screen
47 offset = 0; // Pass in display mode
48 ret = HAL::Get(iScreenNo, HALData::EDisplayOffsetToFirstPixel,offset);
49 iBits = (TUint32*)aBitmapAddress;
50 iBits += offset / sizeof(TUint32);
54 void CDrawScreenBitmap::SetDisplayMode(CFbsDrawDevice* aDrawDevice)
56 CopyOldSettings(aDrawDevice);
59 void CDrawScreenBitmap::OrientationsAvailable(TBool aOrientation[4])
61 aOrientation[EOrientationNormal] = ETrue;
62 aOrientation[EOrientationRotated90] = ETrue;
63 aOrientation[EOrientationRotated180] = ETrue;
64 aOrientation[EOrientationRotated270] = ETrue;
67 TBool CDrawScreenBitmap::SetOrientation(TOrientation aOrientation)
69 iOrientation = aOrientation;
73 TInt CDrawScreenBitmap::HorzTwipsPerThousandPixels() const
75 if (iSize.iWidth == 0)
79 HAL::Get(iScreenNo, HALData::EDisplayXTwips,twips);
81 return twips * 1000 / iSize.iWidth; // iSize gets iWidth and iHeight swapped by changing the orientation so always use iWidth
84 TInt CDrawScreenBitmap::VertTwipsPerThousandPixels() const
86 if (iSize.iHeight == 0)
90 HAL::Get(iScreenNo, HALData::EDisplayYTwips,twips);
92 return twips * 1000 / iSize.iHeight;