graphicsdeviceinterface/screendriver/swins/SCMON4.CPP
changeset 0 5d03bc08d59c
equal deleted inserted replaced
-1:000000000000 0:5d03bc08d59c
       
     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 //
       
    15 
       
    16 #include "SCDRAW.H"
       
    17 #include "_WININC.H"
       
    18 
       
    19 TInt CDrawFourBppScreenBitmapGray::InitScreen()
       
    20 	{
       
    21 	TRect drawRect;
       
    22 	GetDrawRect(drawRect);
       
    23     RWindows* window = ::WindowHandler(iScreenNo);
       
    24 	window->iDisplayMode = DisplayMode();
       
    25 	window->iEpocBitmapSize = drawRect.Size();
       
    26 	window->iEpocBitmapLinePitch = (iScanLineWords*4);
       
    27 
       
    28 	return KErrNone;
       
    29 	}
       
    30 
       
    31 void CDrawFourBppScreenBitmapGray::OrientationsAvailable(TBool aOrientation[4])
       
    32 	{
       
    33 	aOrientation[EOrientationNormal] = ETrue;
       
    34 	aOrientation[EOrientationRotated90] = EFalse;
       
    35 	aOrientation[EOrientationRotated180] = EFalse;
       
    36 	aOrientation[EOrientationRotated270] = EFalse;
       
    37 	}
       
    38 
       
    39 void CDrawFourBppScreenBitmapGray::UpdateRect(const TRect& aRect) const
       
    40 	{
       
    41 	ASSERT(aRect.iTl.iX >= 0 && aRect.iTl.iY >= 0);
       
    42 	ASSERT(aRect.iBr.iX <= iSize.iWidth);
       
    43 	ASSERT(aRect.iBr.iY <= iSize.iHeight);
       
    44 
       
    45 	TInt lx = aRect.iTl.iX & ~7;
       
    46 	TInt rx = (aRect.iBr.iX + 7) & ~7;
       
    47 	TInt wordwidth = (rx - lx) >> 3;
       
    48 
       
    49 	for (TInt row = aRect.iTl.iY; row < aRect.iBr.iY; row++)
       
    50 		{
       
    51 		TUint8* destPixel = WinPixelAddress(lx,row);
       
    52 		TInt wordx = lx;
       
    53 
       
    54 		for(TInt word = 0; word < wordwidth; word++)
       
    55 			{
       
    56 			TUint32 data;
       
    57 			ReadLine(wordx,row,8,&data);
       
    58 
       
    59 			TUint8 grayIndex = TUint8((data & 0xf) * 17);
       
    60 			destPixel[0] = grayIndex;
       
    61 			destPixel[1] = grayIndex;
       
    62 			destPixel[2] = grayIndex;
       
    63 			grayIndex = TUint8(((data >> 4) & 0xf) * 17);
       
    64 			destPixel[3] = grayIndex;
       
    65 			destPixel[4] = grayIndex;
       
    66 			destPixel[5] = grayIndex;
       
    67 			grayIndex = TUint8(((data >> 8) & 0xf) * 17);
       
    68 			destPixel[6] = grayIndex;
       
    69 			destPixel[7] = grayIndex;
       
    70 			destPixel[8] = grayIndex;
       
    71 			grayIndex = TUint8(((data >> 12) & 0xf) * 17);
       
    72 			destPixel[9] = grayIndex;
       
    73 			destPixel[10] = grayIndex;
       
    74 			destPixel[11] = grayIndex;
       
    75 			grayIndex = TUint8(((data >> 16) & 0xf) * 17);
       
    76 			destPixel[12] = grayIndex;
       
    77 			destPixel[13] = grayIndex;
       
    78 			destPixel[14] = grayIndex;
       
    79 			grayIndex = TUint8(((data >> 20) & 0xf) * 17);
       
    80 			destPixel[15] = grayIndex;
       
    81 			destPixel[16] = grayIndex;
       
    82 			destPixel[17] = grayIndex;
       
    83 			grayIndex = TUint8(((data >> 24) & 0xf) * 17);
       
    84 			destPixel[18] = grayIndex;
       
    85 			destPixel[19] = grayIndex;
       
    86 			destPixel[20] = grayIndex;
       
    87 			grayIndex = TUint8(((data >> 28) & 0xf) * 17);
       
    88 			destPixel[21] = grayIndex;
       
    89 			destPixel[22] = grayIndex;
       
    90 			destPixel[23] = grayIndex;
       
    91 
       
    92 			destPixel += 24;
       
    93 			wordx += 8;
       
    94 			}
       
    95 		}
       
    96 	}
       
    97