|
1 // Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
2 // All rights reserved. |
|
3 // This component and the accompanying materials are made available |
|
4 // under the terms of "Eclipse Public License v1.0" |
|
5 // which accompanies this distribution, and is available |
|
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // |
|
15 |
|
16 #include "swdirectgdiengine.h" |
|
17 #include <bitdraworigin.h> |
|
18 #include <bitdrawinterfaceid.h> |
|
19 |
|
20 /** |
|
21 Sets a new pen array |
|
22 |
|
23 @param aPenArray The new array. |
|
24 */ |
|
25 void CSwDirectGdiEngine::SetPenArray(TInt* aPenArray) |
|
26 { |
|
27 delete[] iPenArray; |
|
28 iPenArray = aPenArray; |
|
29 } |
|
30 |
|
31 /** |
|
32 Destroys the current pen array. |
|
33 */ |
|
34 void CSwDirectGdiEngine::ResetPenArray() |
|
35 { |
|
36 delete[] iPenArray; |
|
37 iPenArray = NULL; |
|
38 } |
|
39 |
|
40 /** |
|
41 Truncates the given rectangle. |
|
42 |
|
43 @param aRect The rectangle to truncate. |
|
44 */ |
|
45 void CSwDirectGdiEngine::TruncateRect(TRect& aRect) |
|
46 { |
|
47 TInt width = iDrawDevice->SizeInPixels().iWidth << 4; |
|
48 TInt height = iDrawDevice->SizeInPixels().iHeight << 4; |
|
49 |
|
50 aRect.iTl.iX = Min(aRect.iTl.iX,width); |
|
51 aRect.iTl.iY = Min(aRect.iTl.iY,height); |
|
52 aRect.iBr.iX = Min(aRect.iBr.iX,width); |
|
53 aRect.iBr.iY = Min(aRect.iBr.iY,height); |
|
54 |
|
55 width = (-width); |
|
56 height = (-height); |
|
57 |
|
58 aRect.iTl.iX = Max(aRect.iTl.iX,width); |
|
59 aRect.iTl.iY = Max(aRect.iTl.iY,height); |
|
60 aRect.iBr.iX = Max(aRect.iBr.iX,width); |
|
61 aRect.iBr.iY = Max(aRect.iBr.iY,height); |
|
62 } |
|
63 |
|
64 /** |
|
65 @see MDirectGdiEngine::GetInterface() |
|
66 */ |
|
67 TInt CSwDirectGdiEngine::GetInterface(TUid aInterfaceId, TAny*& aInterface) |
|
68 { |
|
69 aInterface = NULL; |
|
70 TInt err = KErrNotSupported; |
|
71 |
|
72 // Extension switch |
|
73 switch (aInterfaceId.iUid) |
|
74 { |
|
75 case KDrawDeviceOriginInterfaceID: |
|
76 { |
|
77 aInterface= (MDrawDeviceOrigin*)this; |
|
78 err=KErrNone; |
|
79 } |
|
80 break; |
|
81 default:; |
|
82 } |
|
83 |
|
84 return err; |
|
85 } |
|
86 |