|
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". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // MCOT platform |
|
15 // |
|
16 // |
|
17 |
|
18 #include <hal.h> |
|
19 #include "scdraw.h" |
|
20 #include "ScreenInfo.h" |
|
21 #include <graphics/gdi/gdiconsts.h> |
|
22 |
|
23 /** |
|
24 Creates an instance of CFbsDrawDevice class. |
|
25 @param aScreenNo Screen number |
|
26 @param aDispMode Display mode |
|
27 @param aScreenInfo Screen parameters: video memory address and screen size |
|
28 @return A pointer to the created CFbsDrawDevice object |
|
29 @leave System-wide error code including KErrNoMemory |
|
30 @internalComponent |
|
31 */ |
|
32 static CFbsDrawDevice* CreateInstanceL(TInt aScreenNo, |
|
33 TDisplayMode aDispMode, |
|
34 const TScreenInfo& aScreenInfo) |
|
35 { |
|
36 CFbsDrawDevice* drawDevice = NULL; |
|
37 |
|
38 switch (aDispMode) |
|
39 { |
|
40 case SCREEN_LAYOUT_DISPLAY_MODE: |
|
41 drawDevice = new(ELeave) CDrawScreenBitmap; |
|
42 CleanupStack::PushL(drawDevice); |
|
43 User::LeaveIfError(((CDrawScreenBitmap*)drawDevice)->ConstructScreen(aScreenNo, |
|
44 aScreenInfo.iAddress, |
|
45 aScreenInfo.iSize)); |
|
46 break; |
|
47 default: |
|
48 User::Leave(KErrNotSupported); |
|
49 } |
|
50 |
|
51 CleanupStack::Pop(); // drawDevice |
|
52 return drawDevice; |
|
53 } |
|
54 |
|
55 /** |
|
56 @deprecated Use NewScreenDeviceL(TInt aScreenNo, TDisplayMode aDispMode) |
|
57 */ |
|
58 EXPORT_C CFbsDrawDevice* CFbsDrawDevice::NewScreenDeviceL(TScreenInfoV01 aInfo, |
|
59 TDisplayMode aDispMode) |
|
60 { |
|
61 TScreenInfo screenInfo(aInfo.iScreenAddress, aInfo.iScreenSize); |
|
62 return ::CreateInstanceL(KDefaultScreenNo, aDispMode, screenInfo); |
|
63 } |
|
64 |
|
65 /** |
|
66 Creates a new screen device instance, which implements CFbsDrawDevice interface. |
|
67 The method has to be implemented for each type of supported video hardware. |
|
68 @param aScreenNo Screen number |
|
69 @param aDispMode Requested display mode |
|
70 @return A pointer to just created screen device, which implements CFbsDrawDevice interface |
|
71 @leave KErrNoMemory Not enough memory |
|
72 KErrNotSupported The requested screen device type is not supported |
|
73 */ |
|
74 EXPORT_C CFbsDrawDevice* CFbsDrawDevice::NewScreenDeviceL(TInt aScreenNo, |
|
75 TDisplayMode aDispMode) |
|
76 { |
|
77 TInt address = 0, width = 0, height = 0; |
|
78 User::LeaveIfError(HAL::Get(aScreenNo, HALData::EDisplayMemoryAddress, address)); |
|
79 User::LeaveIfError(HAL::Get(aScreenNo, HALData::EDisplayXPixels, width)); |
|
80 User::LeaveIfError(HAL::Get(aScreenNo, HALData::EDisplayYPixels, height)); |
|
81 __ASSERT_ALWAYS(width > 0 && height > 0 && address != 0, Panic(EScreenDriverPanicInvalidHalValue)); |
|
82 TScreenInfo screenInfo(reinterpret_cast <TAny*> (address), TSize(width, height)); |
|
83 return ::CreateInstanceL(aScreenNo, aDispMode, screenInfo); |
|
84 } |
|
85 |
|
86 /** |
|
87 Depending on the current graphics hardware this |
|
88 will return one of the 16M video modes defined in |
|
89 TDisplayMode, or ENone if a 16M video mode is not supported. |
|
90 @see TDisplayMode |
|
91 @return a 16M display mode or ENone. |
|
92 */ |
|
93 EXPORT_C TDisplayMode CFbsDrawDevice::DisplayMode16M() |
|
94 { |
|
95 return ENone; |
|
96 } |