sl@0: // Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies). sl@0: // All rights reserved. sl@0: // This component and the accompanying materials are made available sl@0: // under the terms of "Eclipse Public License v1.0" sl@0: // which accompanies this distribution, and is available sl@0: // at the URL "http://www.eclipse.org/legal/epl-v10.html". sl@0: // sl@0: // Initial Contributors: sl@0: // Nokia Corporation - initial contribution. sl@0: // sl@0: // Contributors: sl@0: // sl@0: // Description: sl@0: // This module implements the class for a 32ap bpp color screen with premultiplied sl@0: // alpha. sl@0: // sl@0: // sl@0: sl@0: /** sl@0: @file sl@0: */ sl@0: sl@0: #include sl@0: #include sl@0: #include sl@0: #include "scdraw.h" sl@0: sl@0: sl@0: void CDrawThirtyTwoBppScreenBitmapAlphaPM::SetSize(const TSize& aSize) sl@0: { sl@0: CDrawBitmap::SetSize(aSize); sl@0: __ASSERT_DEBUG(iSize == aSize, User::Invariant()); sl@0: iLongWidth = iScanLineWords; sl@0: } sl@0: sl@0: void CDrawThirtyTwoBppScreenBitmapAlphaPM::SetDisplayMode(CFbsDrawDevice* aDrawDevice) sl@0: { sl@0: CopyOldSettings(aDrawDevice) ; sl@0: InitScreen() ; sl@0: } sl@0: sl@0: TInt CDrawThirtyTwoBppScreenBitmapAlphaPM::HorzTwipsPerThousandPixels() const sl@0: { sl@0: if (iSize.iWidth == 0) sl@0: return 0; sl@0: sl@0: TInt displayMode; sl@0: TInt r = HAL::Get(iScreenNo, HAL::EDisplayMode, displayMode); sl@0: if (r != KErrNone) sl@0: return 0; sl@0: sl@0: TInt width = displayMode; sl@0: r = HAL::Get(iScreenNo, HAL::EDisplayXTwips, width); sl@0: if (r != KErrNone) sl@0: return 0; sl@0: sl@0: return (width * 1000) / iSize.iWidth; sl@0: } sl@0: sl@0: TInt CDrawThirtyTwoBppScreenBitmapAlphaPM::VertTwipsPerThousandPixels() const sl@0: { sl@0: if (iSize.iHeight == 0) sl@0: return 0; sl@0: sl@0: TInt displayMode; sl@0: TInt r = HAL::Get(iScreenNo, HAL::EDisplayMode, displayMode); sl@0: if (r != KErrNone) sl@0: return 0; sl@0: TInt height = displayMode; sl@0: r = HAL::Get(iScreenNo, HAL::EDisplayYTwips, height); sl@0: if (r != KErrNone) sl@0: return 0; sl@0: sl@0: return (height * 1000) / iSize.iHeight; sl@0: } sl@0: sl@0: TInt CDrawThirtyTwoBppScreenBitmapAlphaPM::InitScreen() sl@0: { sl@0: return KErrNone ; sl@0: } sl@0: sl@0: TInt CDrawThirtyTwoBppScreenBitmapAlphaPM::ConstructScreenL(TInt aScreenNo, TAny* aBitmapAddress, TSize aSize) sl@0: { sl@0: iScreenNo = aScreenNo; sl@0: TInt displayMode; sl@0: TInt ret = HAL::Get(aScreenNo, HALData::EDisplayMode, displayMode); sl@0: if (ret != KErrNone) sl@0: return ret; sl@0: sl@0: TInt linepitchInBytes = displayMode; sl@0: ret = HAL::Get(aScreenNo,HALData::EDisplayOffsetBetweenLines,linepitchInBytes); sl@0: if (ret != KErrNone) sl@0: return ret; sl@0: sl@0: iScanLineWords = linepitchInBytes / 4; sl@0: ret = CDrawThirtyTwoBppBitmapAlphaPM::Construct(aSize); sl@0: if (ret != KErrNone) sl@0: return ret; sl@0: sl@0: TInt offsetToFirstPixel = displayMode; sl@0: ret = HAL::Get(aScreenNo,HALData::EDisplayOffsetToFirstPixel, offsetToFirstPixel); sl@0: if (ret != KErrNone) sl@0: return ret; sl@0: sl@0: iBits = (TUint32*)((TUint32)aBitmapAddress + offsetToFirstPixel); sl@0: return KErrNone; sl@0: } sl@0: sl@0: void CDrawThirtyTwoBppScreenBitmapAlphaPM::OrientationsAvailable(TBool aOrientation[4]) sl@0: { sl@0: aOrientation[EOrientationNormal] = ETrue ; sl@0: aOrientation[EOrientationRotated90] = ETrue ; sl@0: aOrientation[EOrientationRotated180] = ETrue ; sl@0: aOrientation[EOrientationRotated270] = ETrue ; sl@0: } sl@0: sl@0: TBool CDrawThirtyTwoBppScreenBitmapAlphaPM::SetOrientation(TOrientation aOrientation) sl@0: { sl@0: iOrientation = aOrientation ; sl@0: return ETrue ; sl@0: } sl@0: sl@0: sl@0: sl@0: sl@0: