First public contribution.
1 // Copyright (c) 2007-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 32ap bpp color screen with premultiplied
29 void CDrawThirtyTwoBppScreenBitmapAlphaPM::SetSize(const TSize& aSize)
31 CDrawBitmap::SetSize(aSize);
32 __ASSERT_DEBUG(iSize == aSize, User::Invariant());
33 iLongWidth = iScanLineWords;
36 void CDrawThirtyTwoBppScreenBitmapAlphaPM::SetDisplayMode(CFbsDrawDevice* aDrawDevice)
38 CopyOldSettings(aDrawDevice) ;
42 TInt CDrawThirtyTwoBppScreenBitmapAlphaPM::HorzTwipsPerThousandPixels() const
44 if (iSize.iWidth == 0)
48 TInt r = HAL::Get(iScreenNo, HAL::EDisplayMode, displayMode);
52 TInt width = displayMode;
53 r = HAL::Get(iScreenNo, HAL::EDisplayXTwips, width);
57 return (width * 1000) / iSize.iWidth;
60 TInt CDrawThirtyTwoBppScreenBitmapAlphaPM::VertTwipsPerThousandPixels() const
62 if (iSize.iHeight == 0)
66 TInt r = HAL::Get(iScreenNo, HAL::EDisplayMode, displayMode);
69 TInt height = displayMode;
70 r = HAL::Get(iScreenNo, HAL::EDisplayYTwips, height);
74 return (height * 1000) / iSize.iHeight;
77 TInt CDrawThirtyTwoBppScreenBitmapAlphaPM::InitScreen()
82 TInt CDrawThirtyTwoBppScreenBitmapAlphaPM::ConstructScreenL(TInt aScreenNo, TAny* aBitmapAddress, TSize aSize)
84 iScreenNo = aScreenNo;
86 TInt ret = HAL::Get(aScreenNo, HALData::EDisplayMode, displayMode);
90 TInt linepitchInBytes = displayMode;
91 ret = HAL::Get(aScreenNo,HALData::EDisplayOffsetBetweenLines,linepitchInBytes);
95 iScanLineWords = linepitchInBytes / 4;
96 ret = CDrawThirtyTwoBppBitmapAlphaPM::Construct(aSize);
100 TInt offsetToFirstPixel = displayMode;
101 ret = HAL::Get(aScreenNo,HALData::EDisplayOffsetToFirstPixel, offsetToFirstPixel);
105 iBits = (TUint32*)((TUint32)aBitmapAddress + offsetToFirstPixel);
109 void CDrawThirtyTwoBppScreenBitmapAlphaPM::OrientationsAvailable(TBool aOrientation[4])
111 aOrientation[EOrientationNormal] = ETrue ;
112 aOrientation[EOrientationRotated90] = ETrue ;
113 aOrientation[EOrientationRotated180] = ETrue ;
114 aOrientation[EOrientationRotated270] = ETrue ;
117 TBool CDrawThirtyTwoBppScreenBitmapAlphaPM::SetOrientation(TOrientation aOrientation)
119 iOrientation = aOrientation ;