1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/graphics/graphicsdeviceinterface/screendriver/swins/SCCOL32PMA.CPP Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,100 @@
1.4 +// Copyright (c) 2006-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 CDrawThirtyTwoBppScreenBitmapAlphaPM::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 +TBool CDrawThirtyTwoBppScreenBitmapAlphaPM::SetOrientation(TOrientation aOrientation)
1.35 + {
1.36 + if (aOrientation == iEmulatorOrientation)
1.37 + return ETrue;
1.38 +
1.39 + SetScreenOrientation(aOrientation);
1.40 + iEmulatorOrientation = aOrientation;
1.41 + iOrientation = aOrientation ;
1.42 + return ETrue;
1.43 + }
1.44 +
1.45 +void CDrawThirtyTwoBppScreenBitmapAlphaPM::UpdateRect(const TRect& aRect) const
1.46 + {
1.47 + ASSERT(aRect.iTl.iX >= 0 && aRect.iTl.iY >= 0);
1.48 +#if defined(_DEBUG)
1.49 + if (iOrientation&1)
1.50 + {
1.51 + ASSERT(aRect.iBr.iX <= iSize.iHeight);
1.52 + ASSERT(aRect.iBr.iY <= iSize.iWidth);
1.53 + }
1.54 + else
1.55 + {
1.56 + ASSERT(aRect.iBr.iX <= iSize.iWidth);
1.57 + ASSERT(aRect.iBr.iY <= iSize.iHeight);
1.58 + }
1.59 +#endif
1.60 + TInt scanLineLen=iLongWidth*4;
1.61 + TInt srcPixelStep=4;
1.62 + TPoint srcStart(aRect.iTl);
1.63 + switch(iOrientation)
1.64 + {
1.65 + case CFbsDrawDevice::EOrientationRotated90:
1.66 + srcPixelStep=scanLineLen;
1.67 + scanLineLen=-4;
1.68 + srcStart.iX=iSize.iWidth-1-aRect.iTl.iY;
1.69 + srcStart.iY=aRect.iTl.iX;
1.70 + break;
1.71 + case CFbsDrawDevice::EOrientationRotated180:
1.72 + srcPixelStep=-4;
1.73 + scanLineLen=-scanLineLen;
1.74 + srcStart.iX=iSize.iWidth-1-aRect.iTl.iX;
1.75 + srcStart.iY=iSize.iHeight-1-aRect.iTl.iY;
1.76 + break;
1.77 + case CFbsDrawDevice::EOrientationRotated270:
1.78 + srcPixelStep=-scanLineLen;
1.79 + scanLineLen=4;
1.80 + srcStart.iX=aRect.iTl.iY;
1.81 + srcStart.iY=iSize.iHeight-1-aRect.iTl.iX;
1.82 + break;
1.83 + }
1.84 + TUint8* srcePtr = (TUint8*)PixelAddress(srcStart.iX,srcStart.iY);
1.85 + TUint8* srcePtrLimit = srcePtr + aRect.Width()*srcPixelStep;
1.86 + TInt rowMax = aRect.iTl.iY+aRect.Height();
1.87 + srcPixelStep-=3; // as we increment while reading it
1.88 + for(TInt row = aRect.iTl.iY; row < rowMax; row++)
1.89 + {
1.90 + TUint8* tempSrcePtr = srcePtr;
1.91 + TUint8* destPixel = WinPixelAddress(aRect.iTl.iX,row);
1.92 +
1.93 + while (tempSrcePtr != srcePtrLimit)
1.94 + {
1.95 + *destPixel++=*tempSrcePtr++;
1.96 + *destPixel++=*tempSrcePtr++;
1.97 + *destPixel++=*tempSrcePtr++;
1.98 + tempSrcePtr += srcPixelStep;
1.99 + }
1.100 + srcePtr+=scanLineLen;
1.101 + srcePtrLimit+=scanLineLen;
1.102 + }
1.103 + }