|
1 /* |
|
2 * Copyright (c) 2004-2008 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: Effect pool class. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 // INCLUDE FILES |
|
20 #include "AknsRlInternalEffectPool.h" |
|
21 |
|
22 #include "AknsRlEffectPluginApplyColor.h" |
|
23 #include "AknsRlEffectPluginApplyGfx.h" |
|
24 #include "AknsRlEffectPluginAdjustChannels.h" |
|
25 #include "AknsRlEffectPluginAlphaBlend.h" |
|
26 #include "AknsRlEffectPluginBlackWhite.h" |
|
27 #include "AknsRlEffectPluginBumpMap.h" |
|
28 #include "AknsRlEffectPluginChannelBlend.h" |
|
29 #include "AknsRlEffectPluginContrast.h" |
|
30 #include "AknsRlEffectPluginConvolution.h" |
|
31 #include "AknsRlEffectPluginGrayscale.h" |
|
32 #include "AknsRlEffectPluginInvert.h" |
|
33 #include "AknsRlEffectPluginMovingLayers.h" |
|
34 #include "AknsRlEffectPluginNoise.h" |
|
35 #include "AknsRlEffectPluginSaturation.h" |
|
36 #include "AknsRlEffectPluginSolarize.h" |
|
37 |
|
38 // ============================ MEMBER FUNCTIONS =============================== |
|
39 |
|
40 // ----------------------------------------------------------------------------- |
|
41 // CAknsRlInternalEffectPool::CAknsRlInternalEffectPool |
|
42 // C++ default constructor can NOT contain any code, that |
|
43 // might leave. |
|
44 // ----------------------------------------------------------------------------- |
|
45 // |
|
46 CAknsRlInternalEffectPool::CAknsRlInternalEffectPool() |
|
47 { |
|
48 } |
|
49 |
|
50 // ----------------------------------------------------------------------------- |
|
51 // Destructor |
|
52 // ----------------------------------------------------------------------------- |
|
53 // |
|
54 CAknsRlInternalEffectPool::~CAknsRlInternalEffectPool() |
|
55 { |
|
56 for( TInt i=0; i<iEffectArray.Count(); i++ ) |
|
57 { |
|
58 iEffectArray[i]->Effect(KAknsRlEffectPluginInterfaceEffect)->Release(); |
|
59 } |
|
60 iEffectArray.ResetAndDestroy(); |
|
61 } |
|
62 |
|
63 // ----------------------------------------------------------------------------- |
|
64 // CAknsRlInternalEffectPool::NewL |
|
65 // ----------------------------------------------------------------------------- |
|
66 // |
|
67 CAknsRlInternalEffectPool* CAknsRlInternalEffectPool::NewL() |
|
68 { |
|
69 CAknsRlInternalEffectPool* self = |
|
70 new (ELeave) CAknsRlInternalEffectPool(); |
|
71 CleanupStack::PushL( self ); |
|
72 self->ConstructL(); |
|
73 CleanupStack::Pop(); // self |
|
74 return self; |
|
75 } |
|
76 |
|
77 // ----------------------------------------------------------------------------- |
|
78 // CAknsRlInternalEffectPool::ConstructL |
|
79 // ----------------------------------------------------------------------------- |
|
80 // |
|
81 void CAknsRlInternalEffectPool::ConstructL() |
|
82 { |
|
83 AddInstanceL( new (ELeave) CAknsRlEffectPluginApplyColor() ); |
|
84 AddInstanceL( new (ELeave) CAknsRlEffectPluginApplyGfx() ); |
|
85 AddInstanceL( new (ELeave) CAknsRlEffectPluginAdjustChannels() ); |
|
86 AddInstanceL( new (ELeave) CAknsRlEffectPluginAlphaBlend() ); |
|
87 AddInstanceL( new (ELeave) CAknsRlEffectPluginBlackWhite() ); |
|
88 AddInstanceL( new (ELeave) CAknsRlEffectPluginBumpMap() ); |
|
89 AddInstanceL( new (ELeave) CAknsRlEffectPluginChannelBlend() ); |
|
90 AddInstanceL( new (ELeave) CAknsRlEffectPluginContrast() ); |
|
91 AddInstanceL( new (ELeave) CAknsRlEffectPluginConvolution() ); |
|
92 AddInstanceL( new (ELeave) CAknsRlEffectPluginGrayscale() ); |
|
93 AddInstanceL( new (ELeave) CAknsRlEffectPluginInvert() ); |
|
94 AddInstanceL( new (ELeave) CAknsRlEffectPluginMovingLayers() ); |
|
95 AddInstanceL( new (ELeave) CAknsRlEffectPluginNoise() ); |
|
96 AddInstanceL( new (ELeave) CAknsRlEffectPluginSaturation() ); |
|
97 AddInstanceL( new (ELeave) CAknsRlEffectPluginSolarize() ); |
|
98 } |
|
99 |
|
100 // ----------------------------------------------------------------------------- |
|
101 // CAknsRlInternalEffectPool::GetEffect |
|
102 // ----------------------------------------------------------------------------- |
|
103 // |
|
104 MAknsRlEffect* CAknsRlInternalEffectPool::GetEffect( const TUid aEffectUid ) |
|
105 { |
|
106 MAknsRlEffect* effect = NULL; |
|
107 for( TInt i=0; i<iEffectArray.Count(); i++ ) |
|
108 { |
|
109 if( iEffectArray[i]->EffectUid() == aEffectUid ) |
|
110 { |
|
111 effect = |
|
112 iEffectArray[i]->Effect(KAknsRlEffectPluginInterfaceEffect); |
|
113 break; |
|
114 } |
|
115 } |
|
116 return effect; |
|
117 } |
|
118 |
|
119 // ----------------------------------------------------------------------------- |
|
120 // CAknsRlInternalEffectPool::AddInstanceL |
|
121 // ----------------------------------------------------------------------------- |
|
122 // |
|
123 void CAknsRlInternalEffectPool::AddInstanceL( CAknsRlEffectPlugin* aPlugin ) |
|
124 { |
|
125 CleanupStack::PushL( aPlugin ); |
|
126 aPlugin->Effect(KAknsRlEffectPluginInterfaceEffect)->InitializeL(); |
|
127 User::LeaveIfError( iEffectArray.Append( aPlugin ) ); |
|
128 CleanupStack::Pop(); // aPlugin |
|
129 } |
|
130 |
|
131 // End of File |