os/graphics/graphicsdeviceinterface/screendriver/swins/SCCOL4.CPP
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/graphics/graphicsdeviceinterface/screendriver/swins/SCCOL4.CPP	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,84 @@
     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 +//
    1.18 +
    1.19 +#include "SCDRAW.H"
    1.20 +#include "_WININC.H"
    1.21 +
    1.22 +TInt CDrawFourBppScreenBitmapColor::InitScreen()
    1.23 +	{
    1.24 +	TRect drawRect;
    1.25 +	GetDrawRect(drawRect);
    1.26 +    RWindows* window = ::WindowHandler(iScreenNo);
    1.27 +	window->iDisplayMode = DisplayMode();
    1.28 +	window->iEpocBitmapSize = drawRect.Size();
    1.29 +	window->iEpocBitmapLinePitch = (iScanLineWords*4);
    1.30 +
    1.31 +	return KErrNone;
    1.32 +	}
    1.33 +
    1.34 +void CDrawFourBppScreenBitmapColor::OrientationsAvailable(TBool aOrientation[4])
    1.35 +	{
    1.36 +	aOrientation[EOrientationNormal] = ETrue;
    1.37 +	aOrientation[EOrientationRotated90] = EFalse;
    1.38 +	aOrientation[EOrientationRotated180] = EFalse;
    1.39 +	aOrientation[EOrientationRotated270] = EFalse;
    1.40 +	}
    1.41 +
    1.42 +void CDrawFourBppScreenBitmapColor::UpdateRect(const TRect& aRect) const
    1.43 +	{
    1.44 +	ASSERT(aRect.iTl.iX >= 0 && aRect.iTl.iY >= 0);
    1.45 +	ASSERT(aRect.iBr.iX <= iSize.iWidth);
    1.46 +	ASSERT(aRect.iBr.iY <= iSize.iHeight);
    1.47 +
    1.48 +	TInt lx = aRect.iTl.iX & ~7;
    1.49 +	TInt rx = (aRect.iBr.iX + 7) & ~7;
    1.50 +
    1.51 +	TUint8* srcePtr = ((TUint8*)(ScanLine(aRect.iTl.iY))) + (lx / 2);
    1.52 +	TUint8* srcePtrLimit = srcePtr + ((rx - lx) / 2);
    1.53 +
    1.54 +	TInt byteWidth = iScanLineWords * 4;
    1.55 +	TRgb pixelColor;
    1.56 +
    1.57 +	for(TInt row = aRect.iTl.iY; row < aRect.iBr.iY; row++)
    1.58 +		{
    1.59 +		TUint8* tempSrcePtr = srcePtr;
    1.60 +		TUint8* destPixel = WinPixelAddress(lx,row);
    1.61 +
    1.62 +		while (tempSrcePtr < srcePtrLimit)
    1.63 +			{
    1.64 +			TUint8 pixelValue1 = *tempSrcePtr++;
    1.65 +			TUint8 pixelValue2 = TUint8(pixelValue1 >> 4);
    1.66 +			pixelValue1 &= 0xf;
    1.67 +
    1.68 +			pixelColor = TRgb::Color16(pixelValue1);
    1.69 +			destPixel[0] = TUint8(pixelColor.Blue());
    1.70 +			destPixel[1] = TUint8(pixelColor.Green());
    1.71 +			destPixel[2] = TUint8(pixelColor.Red());
    1.72 +
    1.73 +			if (pixelValue2 != pixelValue1)
    1.74 +				pixelColor = TRgb::Color16(pixelValue2);
    1.75 +
    1.76 +			destPixel[3] = TUint8(pixelColor.Blue());
    1.77 +			destPixel[4] = TUint8(pixelColor.Green());
    1.78 +			destPixel[5] = TUint8(pixelColor.Red());
    1.79 +
    1.80 +			destPixel += 6;
    1.81 +			}
    1.82 +
    1.83 +		srcePtr += byteWidth;
    1.84 +		srcePtrLimit += byteWidth;
    1.85 +		}
    1.86 +	}
    1.87 +