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