os/graphics/graphicsdeviceinterface/directgdiadaptation/swsrc/swdirectgdiengine.cpp
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/graphics/graphicsdeviceinterface/directgdiadaptation/swsrc/swdirectgdiengine.cpp Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,86 @@
1.4 +// Copyright (c) 2007-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 "swdirectgdiengine.h"
1.20 +#include <bitdraworigin.h>
1.21 +#include <bitdrawinterfaceid.h>
1.22 +
1.23 +/**
1.24 +Sets a new pen array
1.25 +
1.26 +@param aPenArray The new array.
1.27 +*/
1.28 +void CSwDirectGdiEngine::SetPenArray(TInt* aPenArray)
1.29 + {
1.30 + delete[] iPenArray;
1.31 + iPenArray = aPenArray;
1.32 + }
1.33 +
1.34 +/**
1.35 +Destroys the current pen array.
1.36 +*/
1.37 +void CSwDirectGdiEngine::ResetPenArray()
1.38 + {
1.39 + delete[] iPenArray;
1.40 + iPenArray = NULL;
1.41 + }
1.42 +
1.43 +/**
1.44 +Truncates the given rectangle.
1.45 +
1.46 +@param aRect The rectangle to truncate.
1.47 + */
1.48 +void CSwDirectGdiEngine::TruncateRect(TRect& aRect)
1.49 + {
1.50 + TInt width = iDrawDevice->SizeInPixels().iWidth << 4;
1.51 + TInt height = iDrawDevice->SizeInPixels().iHeight << 4;
1.52 +
1.53 + aRect.iTl.iX = Min(aRect.iTl.iX,width);
1.54 + aRect.iTl.iY = Min(aRect.iTl.iY,height);
1.55 + aRect.iBr.iX = Min(aRect.iBr.iX,width);
1.56 + aRect.iBr.iY = Min(aRect.iBr.iY,height);
1.57 +
1.58 + width = (-width);
1.59 + height = (-height);
1.60 +
1.61 + aRect.iTl.iX = Max(aRect.iTl.iX,width);
1.62 + aRect.iTl.iY = Max(aRect.iTl.iY,height);
1.63 + aRect.iBr.iX = Max(aRect.iBr.iX,width);
1.64 + aRect.iBr.iY = Max(aRect.iBr.iY,height);
1.65 + }
1.66 +
1.67 +/**
1.68 +@see MDirectGdiEngine::GetInterface()
1.69 +*/
1.70 +TInt CSwDirectGdiEngine::GetInterface(TUid aInterfaceId, TAny*& aInterface)
1.71 + {
1.72 + aInterface = NULL;
1.73 + TInt err = KErrNotSupported;
1.74 +
1.75 + // Extension switch
1.76 + switch (aInterfaceId.iUid)
1.77 + {
1.78 + case KDrawDeviceOriginInterfaceID:
1.79 + {
1.80 + aInterface= (MDrawDeviceOrigin*)this;
1.81 + err=KErrNone;
1.82 + }
1.83 + break;
1.84 + default:;
1.85 + }
1.86 +
1.87 + return err;
1.88 + }
1.89 +