First public contribution.
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.
14 // This module implements the class for a 16 bpp color screen.
22 /********************************************************************/
28 /********************************************************************/
29 /* Implementation of CDrawSixteenBppScreenBitmap class */
30 /********************************************************************/
31 void CDrawSixteenBppScreenBitmap::SetSize(const TSize& aSize)
33 CDrawBitmap::SetSize(aSize);
34 __ASSERT_DEBUG(iSize == aSize, User::Invariant());
35 iLongWidth = iScanLineWords *2;
37 void CDrawSixteenBppScreenBitmap::SetDisplayMode(CFbsDrawDevice* aDrawDevice)
39 CopyOldSettings(aDrawDevice) ;
43 TInt CDrawSixteenBppScreenBitmap::HorzTwipsPerThousandPixels() const
45 if (iSize.iWidth == 0)
47 TMachineInfoV1Buf miBuf ;
48 UserHal::MachineInfo(miBuf) ;
49 return miBuf().iPhysicalScreenSize.iWidth * 1000 / iSize.iWidth ;
52 TInt CDrawSixteenBppScreenBitmap::VertTwipsPerThousandPixels() const
54 if (iSize.iHeight == 0)
57 TMachineInfoV1Buf miBuf ;
58 UserHal::MachineInfo(miBuf) ;
59 return miBuf().iPhysicalScreenSize.iHeight * 1000 / iSize.iHeight ;
63 This function initialize the palette. In this mode, there is no palette
66 TInt CDrawSixteenBppScreenBitmap::InitScreen()
72 Constructs the CDrawSixteenBppScreenBitmap object.
73 @param aScreenNo Screen number. It will be used in HAL::Get() calls.
74 @param aBitmapAddress The screen memory address.
75 @param aSize Screen size
76 @return System-wide error codes, KErrNone if the construction was successfull.
78 TInt CDrawSixteenBppScreenBitmap::ConstructScreenL(TInt aScreenNo, TAny* aBitmapAddress, TSize aSize)
80 iScreenNo = aScreenNo;
83 TInt ret = HAL::Get(aScreenNo, HALData::EDisplayMode, displayMode);
87 TInt linepitchInBytes = displayMode;
88 ret = HAL::Get(aScreenNo,HALData::EDisplayOffsetBetweenLines,linepitchInBytes);
92 CDrawBitmap::iScanLineWords = linepitchInBytes / 4;
93 ret = CDrawSixteenBppBitmap::Construct(aSize);
97 /* Set the pointer on the first pixel */
98 TInt offsetToFirstPixel = displayMode;
99 ret = HAL::Get(aScreenNo,HALData::EDisplayOffsetToFirstPixel, offsetToFirstPixel);
102 iBits = (TUint32*)((TUint32)aBitmapAddress + offsetToFirstPixel);
108 Define the screen orientation available
110 void CDrawSixteenBppScreenBitmap::OrientationsAvailable(TBool aOrientation[4])
112 aOrientation[EOrientationNormal] = ETrue ;
113 aOrientation[EOrientationRotated90] = ETrue ;
114 aOrientation[EOrientationRotated180] = ETrue ;
115 aOrientation[EOrientationRotated270] = ETrue ;
119 Set the current display orientation
121 TBool CDrawSixteenBppScreenBitmap::SetOrientation(TOrientation aOrientation)
123 iOrientation = aOrientation ;