1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/graphics/graphicsdeviceinterface/screendriver/swins/SCMON4.CPP Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,97 @@
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 CDrawFourBppScreenBitmapGray::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 CDrawFourBppScreenBitmapGray::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 CDrawFourBppScreenBitmapGray::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 + TInt wordwidth = (rx - lx) >> 3;
1.51 +
1.52 + for (TInt row = aRect.iTl.iY; row < aRect.iBr.iY; row++)
1.53 + {
1.54 + TUint8* destPixel = WinPixelAddress(lx,row);
1.55 + TInt wordx = lx;
1.56 +
1.57 + for(TInt word = 0; word < wordwidth; word++)
1.58 + {
1.59 + TUint32 data;
1.60 + ReadLine(wordx,row,8,&data);
1.61 +
1.62 + TUint8 grayIndex = TUint8((data & 0xf) * 17);
1.63 + destPixel[0] = grayIndex;
1.64 + destPixel[1] = grayIndex;
1.65 + destPixel[2] = grayIndex;
1.66 + grayIndex = TUint8(((data >> 4) & 0xf) * 17);
1.67 + destPixel[3] = grayIndex;
1.68 + destPixel[4] = grayIndex;
1.69 + destPixel[5] = grayIndex;
1.70 + grayIndex = TUint8(((data >> 8) & 0xf) * 17);
1.71 + destPixel[6] = grayIndex;
1.72 + destPixel[7] = grayIndex;
1.73 + destPixel[8] = grayIndex;
1.74 + grayIndex = TUint8(((data >> 12) & 0xf) * 17);
1.75 + destPixel[9] = grayIndex;
1.76 + destPixel[10] = grayIndex;
1.77 + destPixel[11] = grayIndex;
1.78 + grayIndex = TUint8(((data >> 16) & 0xf) * 17);
1.79 + destPixel[12] = grayIndex;
1.80 + destPixel[13] = grayIndex;
1.81 + destPixel[14] = grayIndex;
1.82 + grayIndex = TUint8(((data >> 20) & 0xf) * 17);
1.83 + destPixel[15] = grayIndex;
1.84 + destPixel[16] = grayIndex;
1.85 + destPixel[17] = grayIndex;
1.86 + grayIndex = TUint8(((data >> 24) & 0xf) * 17);
1.87 + destPixel[18] = grayIndex;
1.88 + destPixel[19] = grayIndex;
1.89 + destPixel[20] = grayIndex;
1.90 + grayIndex = TUint8(((data >> 28) & 0xf) * 17);
1.91 + destPixel[21] = grayIndex;
1.92 + destPixel[22] = grayIndex;
1.93 + destPixel[23] = grayIndex;
1.94 +
1.95 + destPixel += 24;
1.96 + wordx += 8;
1.97 + }
1.98 + }
1.99 + }
1.100 +