os/graphics/graphicsdeviceinterface/screendriver/smint/SCNEW.CPP
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/graphics/graphicsdeviceinterface/screendriver/smint/SCNEW.CPP	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,96 @@
     1.4 +// Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies).
     1.5 +// All rights reserved.
     1.6 +// This component and the accompanying materials are made available
     1.7 +// under the terms of "Eclipse Public License v1.0"
     1.8 +// which accompanies this distribution, and is available
     1.9 +// at the URL "http://www.eclipse.org/legal/epl-v10.html".
    1.10 +//
    1.11 +// Initial Contributors:
    1.12 +// Nokia Corporation - initial contribution.
    1.13 +//
    1.14 +// Contributors:
    1.15 +//
    1.16 +// Description:
    1.17 +// MINT platform
    1.18 +// 
    1.19 +//
    1.20 +
    1.21 +#include <hal.h>
    1.22 +#include "scdraw.h"
    1.23 +#include "ScreenInfo.h"
    1.24 +#include <graphics/gdi/gdiconsts.h>
    1.25 +
    1.26 +/**
    1.27 +Creates an instance of CFbsDrawDevice class.
    1.28 +@param aScreenNo Screen number
    1.29 +@param aDispMode Display mode
    1.30 +@param aScreenInfo Screen parameters: video memory address and screen size
    1.31 +@return A pointer to the created CFbsDrawDevice object
    1.32 +@leave System-wide error code including KErrNoMemory
    1.33 +@internalComponent
    1.34 +*/
    1.35 +static CFbsDrawDevice* CreateInstanceL(TInt aScreenNo,
    1.36 +									   TDisplayMode aDispMode,
    1.37 +									   const TScreenInfo& aScreenInfo)
    1.38 +	{
    1.39 +	CFbsDrawDevice* drawDevice = NULL;
    1.40 +
    1.41 +	switch (aDispMode)
    1.42 +		{
    1.43 +	case SCREEN_LAYOUT_DISPLAY_MODE:
    1.44 +		drawDevice = new(ELeave) CDrawScreenBitmap;
    1.45 +		CleanupStack::PushL(drawDevice);
    1.46 +		User::LeaveIfError(((CDrawScreenBitmap*)drawDevice)->ConstructScreen(aScreenNo,
    1.47 +																aScreenInfo.iAddress,
    1.48 +																aScreenInfo.iSize));
    1.49 +		break;
    1.50 +	default:
    1.51 +		User::Leave(KErrNotSupported);
    1.52 +		}
    1.53 +
    1.54 +	CleanupStack::Pop(); // drawDevice
    1.55 +	return drawDevice;
    1.56 +	}
    1.57 +
    1.58 +/**
    1.59 +@deprecated Use NewScreenDeviceL(TInt aScreenNo, TDisplayMode aDispMode)
    1.60 +*/
    1.61 +EXPORT_C CFbsDrawDevice* CFbsDrawDevice::NewScreenDeviceL(TScreenInfoV01 aInfo,
    1.62 +														  TDisplayMode aDispMode)
    1.63 +	{
    1.64 +	TScreenInfo screenInfo(aInfo.iScreenAddress, aInfo.iScreenSize);
    1.65 +	return ::CreateInstanceL(KDefaultScreenNo, aDispMode, screenInfo);
    1.66 +	}
    1.67 +
    1.68 +/**
    1.69 +Creates a new screen device instance, which implements CFbsDrawDevice interface.
    1.70 +The method has to be implemented for each type of supported video hardware.
    1.71 +@param aScreenNo Screen number
    1.72 +@param aDispMode Requested display mode
    1.73 +@return A pointer to just created screen device, which implements CFbsDrawDevice interface
    1.74 +@leave KErrNoMemory Not enough memory
    1.75 +	   KErrNotSupported The requested screen device type is not supported
    1.76 +*/
    1.77 +EXPORT_C CFbsDrawDevice* CFbsDrawDevice::NewScreenDeviceL(TInt aScreenNo,
    1.78 +														  TDisplayMode aDispMode)
    1.79 +	{
    1.80 +	TInt address = 0, width = 0, height = 0;
    1.81 +	User::LeaveIfError(HAL::Get(aScreenNo, HALData::EDisplayMemoryAddress, address));
    1.82 +	User::LeaveIfError(HAL::Get(aScreenNo, HALData::EDisplayXPixels, width));
    1.83 +	User::LeaveIfError(HAL::Get(aScreenNo, HALData::EDisplayYPixels, height));
    1.84 +	__ASSERT_ALWAYS(width > 0 && height > 0 && address != 0, Panic(EScreenDriverPanicInvalidHalValue));
    1.85 +	TScreenInfo screenInfo(reinterpret_cast <TAny*> (address), TSize(width, height));
    1.86 +	return ::CreateInstanceL(aScreenNo, aDispMode, screenInfo);
    1.87 +	}
    1.88 +
    1.89 +/**
    1.90 +Depending on the current graphics hardware this 
    1.91 +will return one of the 16M video modes defined in
    1.92 +TDisplayMode, or ENone if a 16M video mode is not supported.
    1.93 +@see TDisplayMode
    1.94 +@return	a 16M display mode or ENone.
    1.95 +*/
    1.96 +EXPORT_C TDisplayMode CFbsDrawDevice::DisplayMode16M()
    1.97 +	{
    1.98 +	return ENone;
    1.99 +	}