|
1 // Copyright (c) 2006-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". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // This module implements the class for a 32a bpp unpack color screen. |
|
15 // |
|
16 // |
|
17 |
|
18 /** |
|
19 @file |
|
20 */ |
|
21 |
|
22 #include <hal.h> |
|
23 #include <e32std.h> |
|
24 #include <bitdraw.h> |
|
25 #include "scdraw.h" |
|
26 |
|
27 |
|
28 void CDrawThirtyTwoBppScreenBitmapAlpha::SetSize(const TSize& aSize) |
|
29 { |
|
30 CDrawBitmap::SetSize(aSize); |
|
31 __ASSERT_DEBUG(iSize == aSize, User::Invariant()); |
|
32 iLongWidth = iScanLineWords; |
|
33 } |
|
34 |
|
35 void CDrawThirtyTwoBppScreenBitmapAlpha::SetDisplayMode(CFbsDrawDevice* aDrawDevice) |
|
36 { |
|
37 CopyOldSettings(aDrawDevice) ; |
|
38 InitScreen() ; |
|
39 } |
|
40 |
|
41 TInt CDrawThirtyTwoBppScreenBitmapAlpha::HorzTwipsPerThousandPixels() const |
|
42 { |
|
43 if (iSize.iWidth == 0) |
|
44 return 0; |
|
45 |
|
46 TInt displayMode; |
|
47 TInt r = HAL::Get(iScreenNo, HAL::EDisplayMode, displayMode); |
|
48 if (r != KErrNone) |
|
49 return 0; |
|
50 |
|
51 TInt width = displayMode; |
|
52 r = HAL::Get(iScreenNo, HAL::EDisplayXTwips, width); |
|
53 if (r != KErrNone) |
|
54 return 0; |
|
55 |
|
56 return (width * 1000) / iSize.iWidth; |
|
57 } |
|
58 |
|
59 TInt CDrawThirtyTwoBppScreenBitmapAlpha::VertTwipsPerThousandPixels() const |
|
60 { |
|
61 if (iSize.iHeight == 0) |
|
62 return 0; |
|
63 |
|
64 TInt displayMode; |
|
65 TInt r = HAL::Get(iScreenNo, HAL::EDisplayMode, displayMode); |
|
66 if (r != KErrNone) |
|
67 return 0; |
|
68 TInt height = displayMode; |
|
69 r = HAL::Get(iScreenNo, HAL::EDisplayYTwips, height); |
|
70 if (r != KErrNone) |
|
71 return 0; |
|
72 |
|
73 return (height * 1000) / iSize.iHeight; |
|
74 } |
|
75 |
|
76 TInt CDrawThirtyTwoBppScreenBitmapAlpha::InitScreen() |
|
77 { |
|
78 return KErrNone ; |
|
79 } |
|
80 |
|
81 TInt CDrawThirtyTwoBppScreenBitmapAlpha::ConstructScreenL(TInt aScreenNo, TAny* aBitmapAddress, TSize aSize) |
|
82 { |
|
83 iScreenNo = aScreenNo; |
|
84 TInt displayMode; |
|
85 TInt ret = HAL::Get(aScreenNo, HALData::EDisplayMode, displayMode); |
|
86 if (ret != KErrNone) |
|
87 return ret; |
|
88 |
|
89 TInt linepitchInBytes = displayMode; |
|
90 ret = HAL::Get(aScreenNo,HALData::EDisplayOffsetBetweenLines,linepitchInBytes); |
|
91 if (ret != KErrNone) |
|
92 return ret; |
|
93 |
|
94 iScanLineWords = linepitchInBytes / 4; |
|
95 ret = CDrawThirtyTwoBppBitmapAlpha::Construct(aSize); |
|
96 if (ret != KErrNone) |
|
97 return ret; |
|
98 |
|
99 TInt offsetToFirstPixel = displayMode; |
|
100 ret = HAL::Get(aScreenNo,HALData::EDisplayOffsetToFirstPixel, offsetToFirstPixel); |
|
101 if (ret != KErrNone) |
|
102 return ret; |
|
103 |
|
104 iBits = (TUint32*)((TUint32)aBitmapAddress + offsetToFirstPixel); |
|
105 return KErrNone; |
|
106 } |
|
107 |
|
108 void CDrawThirtyTwoBppScreenBitmapAlpha::OrientationsAvailable(TBool aOrientation[4]) |
|
109 { |
|
110 aOrientation[EOrientationNormal] = ETrue ; |
|
111 aOrientation[EOrientationRotated90] = ETrue ; |
|
112 aOrientation[EOrientationRotated180] = ETrue ; |
|
113 aOrientation[EOrientationRotated270] = ETrue ; |
|
114 } |
|
115 |
|
116 TBool CDrawThirtyTwoBppScreenBitmapAlpha::SetOrientation(TOrientation aOrientation) |
|
117 { |
|
118 iOrientation = aOrientation ; |
|
119 return ETrue ; |
|
120 } |
|
121 |
|
122 |