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 #include "ScreenInfo.h"
21 #include <graphics/gdi/gdiconsts.h>
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
32 static CFbsDrawDevice* CreateInstanceL(TInt aScreenNo,
33 TDisplayMode aDispMode,
34 const TScreenInfo& aScreenInfo)
36 CFbsDrawDevice* drawDevice = NULL;
40 case SCREEN_LAYOUT_DISPLAY_MODE:
41 drawDevice = new(ELeave) CDrawScreenBitmap;
42 CleanupStack::PushL(drawDevice);
43 User::LeaveIfError(((CDrawScreenBitmap*)drawDevice)->ConstructScreen(aScreenNo,
48 User::Leave(KErrNotSupported);
51 CleanupStack::Pop(); // drawDevice
56 @deprecated Use NewScreenDeviceL(TInt aScreenNo, TDisplayMode aDispMode)
58 EXPORT_C CFbsDrawDevice* CFbsDrawDevice::NewScreenDeviceL(TScreenInfoV01 aInfo,
59 TDisplayMode aDispMode)
61 TScreenInfo screenInfo(aInfo.iScreenAddress, aInfo.iScreenSize);
62 return ::CreateInstanceL(KDefaultScreenNo, aDispMode, screenInfo);
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
74 EXPORT_C CFbsDrawDevice* CFbsDrawDevice::NewScreenDeviceL(TInt aScreenNo,
75 TDisplayMode aDispMode)
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);
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.
91 @return a 16M display mode or ENone.
93 EXPORT_C TDisplayMode CFbsDrawDevice::DisplayMode16M()