os/graphics/graphicsdeviceinterface/screendriver/swins/SCMON4.CPP
author sl
Tue, 10 Jun 2014 14:32:02 +0200
changeset 1 260cb5ec6c19
permissions -rw-r--r--
Update contrib.
sl@0
     1
// Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies).
sl@0
     2
// All rights reserved.
sl@0
     3
// This component and the accompanying materials are made available
sl@0
     4
// under the terms of "Eclipse Public License v1.0"
sl@0
     5
// which accompanies this distribution, and is available
sl@0
     6
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
sl@0
     7
//
sl@0
     8
// Initial Contributors:
sl@0
     9
// Nokia Corporation - initial contribution.
sl@0
    10
//
sl@0
    11
// Contributors:
sl@0
    12
//
sl@0
    13
// Description:
sl@0
    14
//
sl@0
    15
sl@0
    16
#include "SCDRAW.H"
sl@0
    17
#include "_WININC.H"
sl@0
    18
sl@0
    19
TInt CDrawFourBppScreenBitmapGray::InitScreen()
sl@0
    20
	{
sl@0
    21
	TRect drawRect;
sl@0
    22
	GetDrawRect(drawRect);
sl@0
    23
    RWindows* window = ::WindowHandler(iScreenNo);
sl@0
    24
	window->iDisplayMode = DisplayMode();
sl@0
    25
	window->iEpocBitmapSize = drawRect.Size();
sl@0
    26
	window->iEpocBitmapLinePitch = (iScanLineWords*4);
sl@0
    27
sl@0
    28
	return KErrNone;
sl@0
    29
	}
sl@0
    30
sl@0
    31
void CDrawFourBppScreenBitmapGray::OrientationsAvailable(TBool aOrientation[4])
sl@0
    32
	{
sl@0
    33
	aOrientation[EOrientationNormal] = ETrue;
sl@0
    34
	aOrientation[EOrientationRotated90] = EFalse;
sl@0
    35
	aOrientation[EOrientationRotated180] = EFalse;
sl@0
    36
	aOrientation[EOrientationRotated270] = EFalse;
sl@0
    37
	}
sl@0
    38
sl@0
    39
void CDrawFourBppScreenBitmapGray::UpdateRect(const TRect& aRect) const
sl@0
    40
	{
sl@0
    41
	ASSERT(aRect.iTl.iX >= 0 && aRect.iTl.iY >= 0);
sl@0
    42
	ASSERT(aRect.iBr.iX <= iSize.iWidth);
sl@0
    43
	ASSERT(aRect.iBr.iY <= iSize.iHeight);
sl@0
    44
sl@0
    45
	TInt lx = aRect.iTl.iX & ~7;
sl@0
    46
	TInt rx = (aRect.iBr.iX + 7) & ~7;
sl@0
    47
	TInt wordwidth = (rx - lx) >> 3;
sl@0
    48
sl@0
    49
	for (TInt row = aRect.iTl.iY; row < aRect.iBr.iY; row++)
sl@0
    50
		{
sl@0
    51
		TUint8* destPixel = WinPixelAddress(lx,row);
sl@0
    52
		TInt wordx = lx;
sl@0
    53
sl@0
    54
		for(TInt word = 0; word < wordwidth; word++)
sl@0
    55
			{
sl@0
    56
			TUint32 data;
sl@0
    57
			ReadLine(wordx,row,8,&data);
sl@0
    58
sl@0
    59
			TUint8 grayIndex = TUint8((data & 0xf) * 17);
sl@0
    60
			destPixel[0] = grayIndex;
sl@0
    61
			destPixel[1] = grayIndex;
sl@0
    62
			destPixel[2] = grayIndex;
sl@0
    63
			grayIndex = TUint8(((data >> 4) & 0xf) * 17);
sl@0
    64
			destPixel[3] = grayIndex;
sl@0
    65
			destPixel[4] = grayIndex;
sl@0
    66
			destPixel[5] = grayIndex;
sl@0
    67
			grayIndex = TUint8(((data >> 8) & 0xf) * 17);
sl@0
    68
			destPixel[6] = grayIndex;
sl@0
    69
			destPixel[7] = grayIndex;
sl@0
    70
			destPixel[8] = grayIndex;
sl@0
    71
			grayIndex = TUint8(((data >> 12) & 0xf) * 17);
sl@0
    72
			destPixel[9] = grayIndex;
sl@0
    73
			destPixel[10] = grayIndex;
sl@0
    74
			destPixel[11] = grayIndex;
sl@0
    75
			grayIndex = TUint8(((data >> 16) & 0xf) * 17);
sl@0
    76
			destPixel[12] = grayIndex;
sl@0
    77
			destPixel[13] = grayIndex;
sl@0
    78
			destPixel[14] = grayIndex;
sl@0
    79
			grayIndex = TUint8(((data >> 20) & 0xf) * 17);
sl@0
    80
			destPixel[15] = grayIndex;
sl@0
    81
			destPixel[16] = grayIndex;
sl@0
    82
			destPixel[17] = grayIndex;
sl@0
    83
			grayIndex = TUint8(((data >> 24) & 0xf) * 17);
sl@0
    84
			destPixel[18] = grayIndex;
sl@0
    85
			destPixel[19] = grayIndex;
sl@0
    86
			destPixel[20] = grayIndex;
sl@0
    87
			grayIndex = TUint8(((data >> 28) & 0xf) * 17);
sl@0
    88
			destPixel[21] = grayIndex;
sl@0
    89
			destPixel[22] = grayIndex;
sl@0
    90
			destPixel[23] = grayIndex;
sl@0
    91
sl@0
    92
			destPixel += 24;
sl@0
    93
			wordx += 8;
sl@0
    94
			}
sl@0
    95
		}
sl@0
    96
	}
sl@0
    97