graphicsdeviceinterface/screendriver/swins/SCMON1.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 CDrawOneBppScreenBitmap::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 CDrawOneBppScreenBitmap::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 CDrawOneBppScreenBitmap::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 & ~0x1f;
       
    46 	TInt rx = (aRect.iBr.iX + 31) & ~0x1f;
       
    47 
       
    48 	TUint32* srcePtr = ScanLine(aRect.iTl.iY) + (lx / 32);
       
    49 	TUint32* srcePtrLimit = srcePtr + ((rx - lx) / 32);
       
    50 
       
    51 	for(TInt row = aRect.iTl.iY; row < aRect.iBr.iY; row++)
       
    52 		{
       
    53 		TUint32* tempSrcePtr = srcePtr;
       
    54 		TUint8* destPixel = WinPixelAddress(lx,row);
       
    55 
       
    56 		while (tempSrcePtr < srcePtrLimit)
       
    57 			{
       
    58 			TUint32 data = *tempSrcePtr++;
       
    59 
       
    60 			Mem::Fill(destPixel,96,0xff);
       
    61 
       
    62 			for (TUint32 shift = 1; shift != 0; shift <<= 1)
       
    63 				{
       
    64 				if (!(data & shift))
       
    65 					{
       
    66 					destPixel[0] = 0;
       
    67 					destPixel[1] = 0;
       
    68 					destPixel[2] = 0;
       
    69 					}
       
    70 
       
    71 				destPixel += 3;
       
    72 				}
       
    73 			}
       
    74 		srcePtr += iScanLineWords;
       
    75 		srcePtrLimit += iScanLineWords;
       
    76 		}
       
    77 	}
       
    78