|
1 /* |
|
2 * Copyright (c) 2006 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: |
|
15 * |
|
16 */ |
|
17 |
|
18 #include <alfdecoderserverclient.h> |
|
19 #include <alfstreamerconsts.h> |
|
20 |
|
21 #include <uiacceltk/HuiUtil.h> |
|
22 #include <coemain.h> |
|
23 #include <alf/alfcompositionclient.h> |
|
24 #include "graphics/surfacemanager.h" |
|
25 #include "graphics/surface.h" |
|
26 #include "graphics/surfaceupdateclient.h" |
|
27 #include "graphics/suerror.h" // KAllScreens |
|
28 |
|
29 #include "graphics/surfaceconfiguration.h" // TSurfaceConfiguration |
|
30 |
|
31 #include "alflogger.h" |
|
32 |
|
33 // --------------------------------------------------------------------------- |
|
34 // CAlfCompositionClientBaseData::NewL |
|
35 // --------------------------------------------------------------------------- |
|
36 // |
|
37 CAlfCompositionClientBase::CAlfCompositionClientBaseData* |
|
38 CAlfCompositionClientBase::CAlfCompositionClientBaseData::NewL( |
|
39 TInt aBufferSize, |
|
40 RAlfBridgerClient* aClient) |
|
41 { |
|
42 CAlfCompositionClientBaseData* me = new (ELeave) CAlfCompositionClientBaseData(); |
|
43 CleanupStack::PushL(me); |
|
44 me->ConstructL(aBufferSize, aClient); |
|
45 CleanupStack::Pop(); |
|
46 return me; |
|
47 } |
|
48 |
|
49 // --------------------------------------------------------------------------- |
|
50 // CAlfCompositionClientBaseData::ConstructL |
|
51 // --------------------------------------------------------------------------- |
|
52 // |
|
53 void CAlfCompositionClientBase::CAlfCompositionClientBaseData::ConstructL(TInt /*aBufferSize*/, RAlfBridgerClient* aClient) |
|
54 { |
|
55 if (!aClient) |
|
56 { |
|
57 iClient = new (ELeave) RAlfBridgerClient(); |
|
58 iOwnsClient = ETrue; |
|
59 User::LeaveIfError(iClient->Connect()); |
|
60 } |
|
61 else |
|
62 { |
|
63 iClient = aClient; |
|
64 } |
|
65 } |
|
66 |
|
67 // --------------------------------------------------------------------------- |
|
68 // ~CAlfCompositionClientBaseData |
|
69 // --------------------------------------------------------------------------- |
|
70 // |
|
71 CAlfCompositionClientBase::CAlfCompositionClientBaseData::~CAlfCompositionClientBaseData() |
|
72 { |
|
73 if (iOwnsClient && iClient) |
|
74 { |
|
75 iClient->Close(); |
|
76 delete iClient; |
|
77 } |
|
78 if (iDeleted) |
|
79 { |
|
80 *iDeleted = ETrue; |
|
81 } |
|
82 } |
|
83 // --------------------------------------------------------------------------- |
|
84 // RequestEventL |
|
85 // --------------------------------------------------------------------------- |
|
86 // |
|
87 EXPORT_C void CAlfCompositionClientBase::RequestEventL(TInt aBufferSize, RAlfBridgerClient* aClient) |
|
88 { |
|
89 if (!IsActive()) |
|
90 { |
|
91 if (!iData) |
|
92 { |
|
93 iData = CAlfCompositionClientBaseData::NewL(aBufferSize, aClient); |
|
94 } |
|
95 SetActive(); |
|
96 iData->iClient->SendAsynchronous(KAlfCompOpRequestEvent,TIpcArgs(&iData->iBuffer), iStatus); |
|
97 } |
|
98 } |
|
99 |
|
100 // --------------------------------------------------------------------------- |
|
101 // SendEvent |
|
102 // --------------------------------------------------------------------------- |
|
103 // |
|
104 EXPORT_C TInt CAlfCompositionClientBase::SendEvent(TInt aOp, const TAny* aEventData, TInt aEventSize) |
|
105 { |
|
106 // Todo, should support batching / asynch |
|
107 if (!iData) |
|
108 { |
|
109 TRAPD(err, iData = CAlfCompositionClientBaseData::NewL(aEventSize, 0)) // basically zero buffer would do |
|
110 if (err) |
|
111 { |
|
112 return err; |
|
113 } |
|
114 } |
|
115 |
|
116 TPtrC8 ptr(reinterpret_cast<const TUint8*>(aEventData), aEventSize); |
|
117 |
|
118 return iData->iClient->SendSynch(aOp, ptr); |
|
119 } |
|
120 |
|
121 // --------------------------------------------------------------------------- |
|
122 // HandleEventL |
|
123 // --------------------------------------------------------------------------- |
|
124 // |
|
125 EXPORT_C void CAlfCompositionClientBase::HandleEventL(TInt /*aEventType*/, TAny* /*aEventData*/) |
|
126 { |
|
127 } |
|
128 |
|
129 // --------------------------------------------------------------------------- |
|
130 // NullBoolPtr |
|
131 // --------------------------------------------------------------------------- |
|
132 // |
|
133 void NullBoolPtr(TAny* ptr) |
|
134 { |
|
135 TBool** boolptr = static_cast<TBool**>(ptr); |
|
136 *boolptr = 0; |
|
137 } |
|
138 |
|
139 // --------------------------------------------------------------------------- |
|
140 // RunL |
|
141 // --------------------------------------------------------------------------- |
|
142 // |
|
143 void CAlfCompositionClientBase::RunL() |
|
144 { |
|
145 TInt status = iStatus.Int(); |
|
146 User::LeaveIfError(status); |
|
147 TBool deleted = EFalse; |
|
148 iData->iDeleted = &deleted; |
|
149 CleanupStack::PushL(TCleanupItem(NullBoolPtr, &iData->iDeleted)); |
|
150 HandleEventL(status, (void*)iData->iBuffer.Ptr()); |
|
151 CleanupStack::PopAndDestroy(); |
|
152 if (!deleted) // just small precaution if client deletes itself on callback |
|
153 { |
|
154 RequestEventL(sizeof(TInt)); |
|
155 } |
|
156 } |
|
157 |
|
158 // --------------------------------------------------------------------------- |
|
159 // DoCancel |
|
160 // --------------------------------------------------------------------------- |
|
161 // |
|
162 void CAlfCompositionClientBase::DoCancel() |
|
163 { |
|
164 if (iData) |
|
165 { |
|
166 iData->iClient->SendSynch(KAlfCompOpCancelEventRequest, TIpcArgs(Handle()) ); |
|
167 } |
|
168 } |
|
169 |
|
170 // --------------------------------------------------------------------------- |
|
171 // RunError |
|
172 // --------------------------------------------------------------------------- |
|
173 // |
|
174 EXPORT_C TInt CAlfCompositionClientBase::RunError(TInt aError) |
|
175 { |
|
176 RDebug::Print(_L("CAlfCompositionClientBase::RunError( %d )"),aError); |
|
177 if ( aError == KErrServerTerminated ) |
|
178 { |
|
179 RDebug::Print(_L("CAlfCompositionClientBase::RunError - ALF server has died. Everything is lost. Halting.")); |
|
180 USER_INVARIANT(); |
|
181 } |
|
182 return KErrNone; |
|
183 } |
|
184 |
|
185 // --------------------------------------------------------------------------- |
|
186 // ~CAlfCompositionClientBase |
|
187 // --------------------------------------------------------------------------- |
|
188 // |
|
189 EXPORT_C CAlfCompositionClientBase::~CAlfCompositionClientBase() |
|
190 { |
|
191 Cancel(); |
|
192 delete iData; |
|
193 iData = NULL; |
|
194 } |
|
195 |
|
196 // --------------------------------------------------------------------------- |
|
197 // SetHandleL |
|
198 // --------------------------------------------------------------------------- |
|
199 // |
|
200 EXPORT_C void CAlfCompositionClientBase::SetHandleL(TInt aHandle) |
|
201 { |
|
202 User::LeaveIfError(aHandle); |
|
203 if (!iData) |
|
204 { |
|
205 iData = CAlfCompositionClientBaseData::NewL(sizeof(TInt),0);// basically zero buffer would do |
|
206 } |
|
207 iData->iHandle = aHandle; |
|
208 } |
|
209 |
|
210 // --------------------------------------------------------------------------- |
|
211 // Handle |
|
212 // --------------------------------------------------------------------------- |
|
213 // |
|
214 TInt CAlfCompositionClientBase::Handle() const |
|
215 { |
|
216 return iData?iData->iHandle:0; |
|
217 } |
|
218 |
|
219 // --------------------------------------------------------------------------- |
|
220 // NewL |
|
221 // --------------------------------------------------------------------------- |
|
222 // |
|
223 EXPORT_C CAlfCompositionCntrlClient* CAlfCompositionCntrlClient::NewL(RAlfBridgerClient* aClient, MAlfCompositionController* aController) |
|
224 { |
|
225 CAlfCompositionCntrlClient* me = new (ELeave) CAlfCompositionCntrlClient(aController); |
|
226 me->RequestEventL(60, aClient); // magic, extent with options |
|
227 me->SendEvent(KAlfCompositionWServReady,0,0); |
|
228 return me; |
|
229 } |
|
230 |
|
231 // --------------------------------------------------------------------------- |
|
232 // Destructor |
|
233 // --------------------------------------------------------------------------- |
|
234 // |
|
235 EXPORT_C CAlfCompositionCntrlClient::~CAlfCompositionCntrlClient() |
|
236 { |
|
237 iHostBindingsHash.Close(); |
|
238 iHostPermittedOpsHash.Close(); |
|
239 } |
|
240 |
|
241 // --------------------------------------------------------------------------- |
|
242 // HandleEventL |
|
243 // --------------------------------------------------------------------------- |
|
244 // |
|
245 void CAlfCompositionCntrlClient::HandleEventL(TInt aEventType, TAny* aEventData) |
|
246 { |
|
247 __ASSERT_DEBUG(iController, USER_INVARIANT()); |
|
248 |
|
249 if (aEventType == KAlfCompositionLowOnGraphicsMemory && iController) |
|
250 { |
|
251 iController->LowOnGraphicsMemory(); |
|
252 return; |
|
253 } |
|
254 |
|
255 if (aEventType == KAlfCompositionGoodOnGraphicsMemory && iController) |
|
256 { |
|
257 iController->GraphicsMemoryGood(); |
|
258 return; |
|
259 } |
|
260 |
|
261 TInt* ptr = static_cast<TInt*>(aEventData); |
|
262 TInt target; |
|
263 |
|
264 // find out if target is a host (is binded to some other target) |
|
265 TInt bindedTarget = 0; |
|
266 TInt* tempbind = iHostBindingsHash.Find(*ptr); |
|
267 if(tempbind) |
|
268 bindedTarget = *tempbind; |
|
269 TInt32 permittedOps = 0; |
|
270 if(bindedTarget) |
|
271 { |
|
272 target = bindedTarget; |
|
273 TInt32* tempOps = iHostPermittedOpsHash.Find(*ptr); |
|
274 if(tempOps) |
|
275 permittedOps = *tempOps; |
|
276 } |
|
277 else |
|
278 { |
|
279 target = *ptr; |
|
280 } |
|
281 |
|
282 // SetTargetL is always sent before the actual command. |
|
283 iController->SetTargetL(target); // When this is composition |
|
284 |
|
285 switch (aEventType) |
|
286 { |
|
287 case KAlfCompOpCreateToken: |
|
288 { |
|
289 break; |
|
290 } |
|
291 case KAlfCompOpBindSourceToToken: |
|
292 { |
|
293 RDebug::Print(_L("ptr0: %d, Target %d, Flags %d, combinedtarget"), ptr[0], ptr[1], ptr[2]); |
|
294 if( ptr[1] != 0) // add binding information for new host to given target with permitted operations |
|
295 { |
|
296 iHostBindingsHash.Insert(*ptr, ptr[1]); |
|
297 iHostPermittedOpsHash.Insert(*ptr, ptr[2]); |
|
298 } |
|
299 else // remove old host bindings when the host is being deleted. |
|
300 { |
|
301 iHostBindingsHash.Remove(*ptr); |
|
302 iHostPermittedOpsHash.Remove(*ptr); |
|
303 } |
|
304 break; |
|
305 } |
|
306 case KAlfCompOpCreateSource: |
|
307 { |
|
308 iController->CreateTargetL(target, ptr[2], ptr[3]); |
|
309 break; |
|
310 } |
|
311 case KAlfCompOpEnableAlpha: |
|
312 { |
|
313 if ( !bindedTarget || permittedOps & CAlfCompositionHost::EAlfAllowChangeAlpha) |
|
314 { |
|
315 iController->EnableAlpha(ptr[1]); |
|
316 } |
|
317 break; |
|
318 } |
|
319 case KAlfCompOpSetOpacity: |
|
320 { |
|
321 if ( !bindedTarget || permittedOps & CAlfCompositionHost::EAlfAllowChangeOpacity) |
|
322 { |
|
323 TReal32* opacity = /*static_cast<*/(TReal32*)(++ptr); |
|
324 iController->SetOpacity(*opacity); |
|
325 } |
|
326 break; |
|
327 } |
|
328 case KAlfCompOpSetRotation: |
|
329 { |
|
330 if ( !bindedTarget || permittedOps & CAlfCompositionHost::EAlfAllowChangeRotation) |
|
331 { |
|
332 iController->SetRotation(ptr[1]); |
|
333 } |
|
334 break; |
|
335 } |
|
336 case KAlfCompOpSetZOrder: |
|
337 { |
|
338 TInt newToken = 0; |
|
339 if( ptr[3] != KErrNotFound) |
|
340 { |
|
341 newToken = iController->SetOrder(target,ptr[1],ptr[2],ETrue); // top, below, combineTargets |
|
342 } |
|
343 else |
|
344 { |
|
345 newToken = iController->SetOrder(target,ptr[1],ptr[2],EFalse); // top, below, combineTargets |
|
346 } |
|
347 TInt array[] = {ptr[0], newToken, ptr[3]}; // caller session, newToken, secretKey |
|
348 SendEvent(KAlfCompositionTargetCreated, array, sizeof(array)); |
|
349 break; |
|
350 } |
|
351 |
|
352 case KAlfCompOpSetExtent: |
|
353 { |
|
354 if ( !bindedTarget || permittedOps & CAlfCompositionHost::EAlfAllowChangeExtent) |
|
355 { |
|
356 TRect rect(ptr[1],ptr[2],ptr[3],ptr[4]); |
|
357 TSurfaceId surfaceId; |
|
358 surfaceId.iInternal[0] = ptr[6]; |
|
359 surfaceId.iInternal[1] = ptr[7]; |
|
360 surfaceId.iInternal[2] = ptr[8]; |
|
361 surfaceId.iInternal[3] = ptr[9]; |
|
362 iController->SetExtentSurfaceId(surfaceId); |
|
363 iController->SetExtent(rect, ptr[5]); // rect, screen |
|
364 } |
|
365 break; |
|
366 } |
|
367 case KAlfCompOpSetSRect: |
|
368 { |
|
369 if ( !bindedTarget || permittedOps & CAlfCompositionHost::EAlfAllowChangeExtent) |
|
370 { |
|
371 TRect rect(ptr[1],ptr[2],ptr[3],ptr[4]); |
|
372 iController->SetSourceRect(rect); |
|
373 } |
|
374 break; |
|
375 } |
|
376 case KAlfComOpSetBackgroundAnim: |
|
377 { |
|
378 if ( !bindedTarget || permittedOps & CAlfCompositionHost::EAlfAllowChangeBackgroundAnim) |
|
379 { |
|
380 iController->SetIsBackgroundAnim(ptr[1]); |
|
381 } |
|
382 break; |
|
383 } |
|
384 case KAlfCompOpSessionClosed: |
|
385 { |
|
386 iController->DeleteTarget(target); |
|
387 break; |
|
388 } |
|
389 |
|
390 default: |
|
391 break; |
|
392 } |
|
393 } |
|
394 |
|
395 // --------------------------------------------------------------------------- |
|
396 // RunError |
|
397 // --------------------------------------------------------------------------- |
|
398 // |
|
399 TInt CAlfCompositionCntrlClient::RunError(TInt aError) |
|
400 { |
|
401 CAlfCompositionClientBase::RunError(aError); |
|
402 // reactivate |
|
403 TRAPD(err, RequestEventL(60)); // magic, extent with options |
|
404 return err; |
|
405 } |
|
406 |
|
407 // --------------------------------------------------------------------------- |
|
408 // |
|
409 // --------------------------------------------------------------------------- |
|
410 // |
|
411 NONSHARABLE_CLASS(CAlfCompositionSource::CAlfCompositionSourceData):public CBase |
|
412 { |
|
413 public: |
|
414 static CAlfCompositionSourceData* NewL() |
|
415 { |
|
416 CAlfCompositionSourceData* me = new (ELeave) CAlfCompositionSourceData(); |
|
417 CleanupStack::PushL(me); |
|
418 // jada |
|
419 CleanupStack::Pop(); |
|
420 return me; |
|
421 } |
|
422 |
|
423 ~CAlfCompositionSourceData() |
|
424 { |
|
425 if (iDeleted) |
|
426 { |
|
427 *iDeleted = ETrue; |
|
428 } |
|
429 iObservers.Reset(); |
|
430 } |
|
431 |
|
432 TBool* iDeleted; |
|
433 TSurfaceId iSurfaceId; |
|
434 RPointerArray<MAlfCompositionObserver> iObservers; |
|
435 }; |
|
436 |
|
437 // --------------------------------------------------------------------------- |
|
438 // NewL |
|
439 // --------------------------------------------------------------------------- |
|
440 // |
|
441 EXPORT_C CAlfCompositionSource* CAlfCompositionSource::NewL(RWindow& aClientWindow) |
|
442 { |
|
443 CAlfCompositionSource* me = new (ELeave) CAlfCompositionSource(); |
|
444 CleanupStack::PushL(me); |
|
445 me->ConstructL(aClientWindow); |
|
446 CleanupStack::Pop(me); |
|
447 return me; |
|
448 } |
|
449 |
|
450 // --------------------------------------------------------------------------- |
|
451 // ~CAlfCompositionSource |
|
452 // --------------------------------------------------------------------------- |
|
453 // |
|
454 EXPORT_C CAlfCompositionSource::~CAlfCompositionSource() |
|
455 { |
|
456 delete iData; |
|
457 iData = NULL; |
|
458 } |
|
459 // --------------------------------------------------------------------------- |
|
460 // ConstructL |
|
461 // --------------------------------------------------------------------------- |
|
462 // |
|
463 void CAlfCompositionSource::ConstructL(TInt aWsHandle, TInt aGroupHandle, TInt aScreenNumber) |
|
464 { |
|
465 iData = CAlfCompositionSourceData::NewL(); |
|
466 RDebug::Print(_L("CAlfCompositionClientBase::ConstructL - %d"), iData ); |
|
467 |
|
468 User::LeaveIfError( SendEvent(KAlfCompositionSourceScreenNumber, &aScreenNumber, sizeof(TInt))); |
|
469 |
|
470 TInt array[] = { 0, aWsHandle, aGroupHandle}; |
|
471 TInt handle = SendEvent(KAlfCompOpCreateSource, array, sizeof(array)); |
|
472 SetHandleL(handle); |
|
473 } |
|
474 |
|
475 void CAlfCompositionSource::ConstructL(RWindow& aClientWindow) |
|
476 { |
|
477 ConstructL(aClientWindow.ClientHandle(), aClientWindow.WindowGroupId(), aClientWindow.ScreenNumber()); |
|
478 TSurfaceConfiguration surfaceConfigs; |
|
479 User::LeaveIfError(aClientWindow.GetBackgroundSurface(surfaceConfigs)); |
|
480 surfaceConfigs.GetSurfaceId(iData->iSurfaceId); |
|
481 if(iData->iSurfaceId.IsNull()) |
|
482 { |
|
483 __ALFLOGSTRING( "CAlfCompositionSource::NewL - Window does not have background surface set - Leaving"); |
|
484 User::Leave(KErrNotFound); |
|
485 } |
|
486 } |
|
487 |
|
488 // --------------------------------------------------------------------------- |
|
489 // CreatePermissionToken |
|
490 // --------------------------------------------------------------------------- |
|
491 // |
|
492 EXPORT_C TInt CAlfCompositionSource::CreatePermissionToken(TInt aKey, TInt aPermissionFlags) |
|
493 { |
|
494 TInt array[] = {aKey, aPermissionFlags}; |
|
495 return SendEvent(KAlfCompOpCreateToken, array, sizeof(array)); |
|
496 } |
|
497 |
|
498 // --------------------------------------------------------------------------- |
|
499 // EnableAlpha |
|
500 // --------------------------------------------------------------------------- |
|
501 // |
|
502 EXPORT_C TInt CAlfCompositionSource::EnableAlpha(TBool aEnable) |
|
503 { |
|
504 return SendEvent(KAlfCompOpEnableAlpha, &aEnable, sizeof(TInt)); |
|
505 } |
|
506 |
|
507 // --------------------------------------------------------------------------- |
|
508 // SetOpacity |
|
509 // --------------------------------------------------------------------------- |
|
510 // |
|
511 EXPORT_C TInt CAlfCompositionSource::SetOpacity(TReal32 aOpacity) __SOFTFP |
|
512 { |
|
513 return SendEvent(KAlfCompOpSetOpacity, &aOpacity, sizeof(TReal32)); |
|
514 } |
|
515 |
|
516 // --------------------------------------------------------------------------- |
|
517 // SetRotation |
|
518 // --------------------------------------------------------------------------- |
|
519 // |
|
520 EXPORT_C TInt CAlfCompositionSource::SetRotation(TInt aRotationInDegrees) |
|
521 { |
|
522 return SendEvent(KAlfCompOpSetRotation, &aRotationInDegrees, sizeof(TInt)); |
|
523 } |
|
524 |
|
525 // --------------------------------------------------------------------------- |
|
526 // SetZOrder |
|
527 // --------------------------------------------------------------------------- |
|
528 // |
|
529 EXPORT_C TInt CAlfCompositionSource::SetZOrder(const CAlfCompositionClientBase& aNode, TBool aAbove, TInt aKey) |
|
530 { |
|
531 TInt array[] = {aNode.Handle(), aAbove, aKey}; |
|
532 return SendEvent(KAlfCompOpSetZOrder, array, sizeof(array)); |
|
533 } |
|
534 |
|
535 // --------------------------------------------------------------------------- |
|
536 // SetExtent |
|
537 // --------------------------------------------------------------------------- |
|
538 // |
|
539 EXPORT_C TInt CAlfCompositionSource::SetExtent(const TRect& aRect, TInt aScreen) |
|
540 { |
|
541 TInt array[] = {aRect.iTl.iX,aRect.iTl.iY,aRect.iBr.iX,aRect.iBr.iY, aScreen, |
|
542 iData->iSurfaceId.iInternal[0], iData->iSurfaceId.iInternal[1], iData->iSurfaceId.iInternal[2], |
|
543 iData->iSurfaceId.iInternal[3]}; |
|
544 return SendEvent(KAlfCompOpSetExtent, array, sizeof(array)); |
|
545 } |
|
546 |
|
547 // --------------------------------------------------------------------------- |
|
548 // SetSourceRect |
|
549 // --------------------------------------------------------------------------- |
|
550 // |
|
551 EXPORT_C TInt CAlfCompositionSource::SetSourceRect(const TRect& aRect) |
|
552 { |
|
553 TInt array[] = {aRect.iTl.iX,aRect.iTl.iY,aRect.iBr.iX,aRect.iBr.iY}; |
|
554 return SendEvent(KAlfCompOpSetSRect, array, sizeof(array)); |
|
555 } |
|
556 |
|
557 // --------------------------------------------------------------------------- |
|
558 // AddCompositionObserverL |
|
559 // --------------------------------------------------------------------------- |
|
560 // |
|
561 EXPORT_C void CAlfCompositionSource::AddCompositionObserverL(MAlfCompositionObserver& aObserver, TInt aScreenNumber) |
|
562 { |
|
563 if (iData->iObservers.Count() == 1 || aScreenNumber != 0) |
|
564 { // TODO: support only single observer for now |
|
565 // because we can't currently handle deletion of an observer |
|
566 // during handle event properly (if there were more than one observers present) |
|
567 User::Leave(KErrNotSupported); |
|
568 } |
|
569 |
|
570 TInt index = iData->iObservers.Find(&aObserver); |
|
571 if (index == KErrNotFound) |
|
572 { |
|
573 iData->iObservers.AppendL(&aObserver); |
|
574 } |
|
575 RequestEventL(sizeof(TInt)); // enable notifications if not active yet |
|
576 } |
|
577 |
|
578 // --------------------------------------------------------------------------- |
|
579 // RemoveObserver |
|
580 // --------------------------------------------------------------------------- |
|
581 // |
|
582 EXPORT_C void CAlfCompositionSource::RemoveObserver(MAlfCompositionObserver& aObserver) |
|
583 { |
|
584 TInt index = iData->iObservers.Find(&aObserver); |
|
585 if (index != KErrNotFound) |
|
586 { |
|
587 iData->iObservers.Remove(index); |
|
588 } |
|
589 } |
|
590 |
|
591 // --------------------------------------------------------------------------- |
|
592 // SetIsBackgroundAnim |
|
593 // --------------------------------------------------------------------------- |
|
594 // |
|
595 EXPORT_C void CAlfCompositionSource::SetIsBackgroundAnim(TBool aIsBg) |
|
596 { |
|
597 SendEvent(KAlfComOpSetBackgroundAnim, &aIsBg, sizeof(TBool)); |
|
598 } |
|
599 |
|
600 // --------------------------------------------------------------------------- |
|
601 // EnableKeyboard |
|
602 // --------------------------------------------------------------------------- |
|
603 // |
|
604 EXPORT_C void CAlfCompositionSource::EnableKeyboard(TBool aEnable, TInt aScreen) |
|
605 { |
|
606 TInt array[] = {aEnable, aScreen}; |
|
607 SendEvent(KAlfCompOpEnableKb, array, sizeof(array)); |
|
608 } |
|
609 |
|
610 // --------------------------------------------------------------------------- |
|
611 // HandleEventL |
|
612 // --------------------------------------------------------------------------- |
|
613 // |
|
614 EXPORT_C void CAlfCompositionSource::HandleEventL(TInt aEventType, TAny* aEventData) |
|
615 { |
|
616 switch (aEventType) |
|
617 { |
|
618 case KAlfCompositionFrameReady: |
|
619 { |
|
620 for (TInt i = 0; i < iData->iObservers.Count(); i++) |
|
621 { |
|
622 iData->iObservers[i]->FrameReady(*static_cast<TInt*>(aEventData)); // todo multiple screens |
|
623 } |
|
624 break; |
|
625 } |
|
626 case KAlfCompositionLowOnGraphicsMemory: |
|
627 { |
|
628 for (TInt i = 0; i < iData->iObservers.Count(); i++) |
|
629 { |
|
630 iData->iObservers[i]->RunningLowOnGraphicsMemory(); // todo multiple screens |
|
631 } |
|
632 break; |
|
633 } |
|
634 case KAlfCompositionTargetHidden: |
|
635 { |
|
636 for (TInt i = 0; i < iData->iObservers.Count(); i++) |
|
637 { |
|
638 iData->iObservers[i]->CompositionTargetHidden(); // todo multiple screens |
|
639 } |
|
640 break; |
|
641 } |
|
642 case KAlfCompositionGoodOnGraphicsMemory: |
|
643 { |
|
644 TInt count = iData->iObservers.Count(); |
|
645 for (TInt i = 0; i < count; i++) |
|
646 { |
|
647 iData->iObservers[i]->GraphicsMemoryGood(); |
|
648 } |
|
649 break; |
|
650 } |
|
651 case KAlfCompositionTargetVisible: |
|
652 { |
|
653 for (TInt i = 0; i < iData->iObservers.Count(); i++) |
|
654 { |
|
655 iData->iObservers[i]->CompositionTargetVisible(); // todo multiple screens |
|
656 } |
|
657 break; |
|
658 } |
|
659 |
|
660 default: |
|
661 break; |
|
662 } |
|
663 } |
|
664 |
|
665 // --------------------------------------------------------------------------- |
|
666 // CAlfCompositionHost::NewL |
|
667 // --------------------------------------------------------------------------- |
|
668 // |
|
669 EXPORT_C CAlfCompositionHost* CAlfCompositionHost::NewL(TInt aToken, TInt aKey) |
|
670 { |
|
671 CAlfCompositionHost* me = new (ELeave) CAlfCompositionHost(); |
|
672 CleanupStack::PushL(me); |
|
673 me->ConstructL(aToken, aKey); |
|
674 CleanupStack::Pop(); |
|
675 return me; |
|
676 } |
|
677 |
|
678 // --------------------------------------------------------------------------- |
|
679 // ConstructL |
|
680 // --------------------------------------------------------------------------- |
|
681 // |
|
682 void CAlfCompositionHost::ConstructL(TInt aToken, TInt aKey) |
|
683 { |
|
684 iData = CAlfCompositionSourceData::NewL(); |
|
685 RDebug::Print(_L("CAlfCompositionClientBase::ConstructL - %d"), iData ); |
|
686 |
|
687 TInt array[] = { 0, aToken, aKey }; |
|
688 TInt result = SendEvent(KAlfCompOpBindSourceToToken, array, sizeof(array)); |
|
689 User::LeaveIfError(result); |
|
690 SetHandleL(result); |
|
691 } |
|
692 |
|
693 // --------------------------------------------------------------------------- |
|
694 // |
|
695 // --------------------------------------------------------------------------- |
|
696 // |
|
697 NONSHARABLE_CLASS( CSurfaceUpdateCallback ) : public CActive |
|
698 { |
|
699 public: |
|
700 |
|
701 public: |
|
702 CSurfaceUpdateCallback( CAlfCompositionPixelSource& aPixelSource, TInt aBufferNumber, |
|
703 TInt aPriority): CActive(aPriority), iPixelSource(aPixelSource), |
|
704 iBufferNumber(aBufferNumber) { CActiveScheduler::Add(this); }; |
|
705 ~CSurfaceUpdateCallback() { Cancel(); }; |
|
706 public: |
|
707 |
|
708 void SetActive() {iStatus = KRequestPending; CActive::SetActive();}; |
|
709 |
|
710 void RunL() |
|
711 { |
|
712 if( iStatus == KErrNone ) |
|
713 { |
|
714 SetActive(); |
|
715 if( !iPixelSource.DrawFrameL(iStatus, iBufferNumber) ) |
|
716 { |
|
717 __ALFLOGSTRING( "CSurfaceUpdateCallBack::RunL - DrawFrameL returned EFalse -> Pause"); |
|
718 TRequestStatus* status = &iStatus; |
|
719 User::RequestComplete(status, KErrNone); |
|
720 Cancel(); |
|
721 } |
|
722 } |
|
723 else |
|
724 { |
|
725 __ALFLOGSTRING1("CSurfaceUpdateCallBack::RunL %d", iStatus.Int()); |
|
726 iPixelSource.Suspend(); |
|
727 } |
|
728 |
|
729 |
|
730 }; |
|
731 void DoCancel() { }; |
|
732 |
|
733 private: // Data |
|
734 CAlfCompositionPixelSource& iPixelSource; |
|
735 TInt iBufferNumber; |
|
736 }; |
|
737 |
|
738 // --------------------------------------------------------------------------- |
|
739 // |
|
740 // --------------------------------------------------------------------------- |
|
741 // |
|
742 NONSHARABLE_CLASS(CAlfCompositionPixelSource::CAlfCompositionPixelSourceData):public CBase |
|
743 { |
|
744 public: |
|
745 |
|
746 enum TPixelSourceStatus |
|
747 { |
|
748 EActive = 0, // drawing loop running |
|
749 EPaused = 1, // drawing paused but resources are still reserved |
|
750 ESuspended = 2 // drawing suspended and surface related resources freed until activated again |
|
751 }; |
|
752 |
|
753 static CAlfCompositionPixelSourceData* NewL(MAlfBufferProvider& aProvider) |
|
754 { |
|
755 CAlfCompositionPixelSourceData* me = new (ELeave) CAlfCompositionPixelSourceData(aProvider); |
|
756 return me; |
|
757 } |
|
758 |
|
759 |
|
760 CAlfCompositionPixelSourceData(MAlfBufferProvider& aProvider) : |
|
761 iProvider( aProvider), iSourceStatus(ESuspended) {iSurfaceId.CreateNullId();} |
|
762 |
|
763 ~CAlfCompositionPixelSourceData() |
|
764 { |
|
765 if(iWindow && iSourceStatus != ESuspended) |
|
766 { |
|
767 iWindow->RemoveBackgroundSurface(ETrue); |
|
768 } |
|
769 |
|
770 if(iSourceStatus != ESuspended) |
|
771 { |
|
772 iSurfaceUpdateSession.CancelAllUpdateNotifications(); |
|
773 } |
|
774 |
|
775 iSurfaceUpdateSession.Close(); |
|
776 |
|
777 if(iSurfaceManager) |
|
778 { |
|
779 iSurfaceManager->CloseSurface(iSurfaceId); |
|
780 iSurfaceManager->Close(); |
|
781 delete iSurfaceManager; |
|
782 } |
|
783 |
|
784 if(iSurfaceChunk) |
|
785 { |
|
786 iSurfaceChunk->Close(); |
|
787 delete iSurfaceChunk; |
|
788 } |
|
789 |
|
790 if(iSurfaceUpdateWaiter && iSurfaceUpdateWaiter->IsActive()) |
|
791 { |
|
792 iSurfaceUpdateWaiter->Cancel(); |
|
793 } |
|
794 delete iSurfaceUpdateWaiter; |
|
795 |
|
796 } |
|
797 MAlfBufferProvider& iProvider; |
|
798 |
|
799 TPixelSourceStatus iSourceStatus; |
|
800 |
|
801 RSurfaceUpdateSession iSurfaceUpdateSession; |
|
802 TSurfaceId iSurfaceId; |
|
803 RSurfaceManager* iSurfaceManager; |
|
804 RChunk* iSurfaceChunk; |
|
805 |
|
806 // Not owned |
|
807 RWindow* iWindow; |
|
808 |
|
809 TUint8* iSurfaceBuffer; |
|
810 |
|
811 CSurfaceUpdateCallback* iSurfaceUpdateWaiter; |
|
812 |
|
813 TInt iCurrentBuffer; |
|
814 |
|
815 TRect iSurfaceRect; |
|
816 }; |
|
817 |
|
818 |
|
819 |
|
820 // --------------------------------------------------------------------------- |
|
821 // CAlfCompositionPixelSource::NewL |
|
822 // --------------------------------------------------------------------------- |
|
823 // |
|
824 EXPORT_C CAlfCompositionPixelSource* CAlfCompositionPixelSource::NewL(MAlfBufferProvider& aProvider, RWindow* aWindow) |
|
825 { |
|
826 CAlfCompositionPixelSource* me = new (ELeave) CAlfCompositionPixelSource(); |
|
827 CleanupStack::PushL(me); |
|
828 me->ConstructL(aProvider, aWindow); |
|
829 CleanupStack::Pop(me); |
|
830 return me; |
|
831 } |
|
832 |
|
833 // --------------------------------------------------------------------------- |
|
834 // CAlfCompositionPixelSource::ActivateL |
|
835 // --------------------------------------------------------------------------- |
|
836 // |
|
837 EXPORT_C void CAlfCompositionPixelSource::ActivateL() |
|
838 { |
|
839 if( !iData->iWindow && iData->iSurfaceId.IsNull() ) |
|
840 { |
|
841 User::Leave(KErrNotReady); |
|
842 } |
|
843 |
|
844 if( iData->iSourceStatus == CAlfCompositionPixelSourceData::ESuspended ) |
|
845 { |
|
846 MAlfBufferProvider::TBufferCreationAttributes& creationAttribs = iData->iProvider.BufferAttributes(); |
|
847 |
|
848 iData->iSurfaceRect = TRect(TPoint(0,0), TSize(creationAttribs.iWidth, creationAttribs.iHeight)); |
|
849 |
|
850 ConstructSurfaceL(creationAttribs); |
|
851 |
|
852 iData->iWindow->SetBackgroundSurface(iData->iSurfaceId); |
|
853 |
|
854 TInt array[] = { 0, iData->iWindow->ClientHandle(), iData->iWindow->WindowGroupId() }; |
|
855 TInt handle = SendEvent(KAlfCompOpCreateSource, array, sizeof(array)); |
|
856 CAlfCompositionClientBase::SetHandleL( handle ); |
|
857 |
|
858 User::LeaveIfError( iData->iSurfaceUpdateSession.Connect() ); |
|
859 } |
|
860 |
|
861 if( iData->iSourceStatus != CAlfCompositionPixelSourceData::EActive ) |
|
862 { |
|
863 if( !iData->iSurfaceUpdateWaiter ) |
|
864 { |
|
865 iData->iSurfaceUpdateWaiter = new (ELeave) CSurfaceUpdateCallback( *this, 0, CActive::EPriorityIdle ); |
|
866 } |
|
867 |
|
868 iData->iSurfaceUpdateWaiter->SetActive(); |
|
869 TRequestStatus* status = &iData->iSurfaceUpdateWaiter->iStatus; |
|
870 User::RequestComplete(status, KErrNone); |
|
871 |
|
872 iData->iProvider.OnActivation(); |
|
873 iData->iSourceStatus = CAlfCompositionPixelSourceData::EActive; |
|
874 } |
|
875 |
|
876 // do nothing if content was already active |
|
877 } |
|
878 |
|
879 // --------------------------------------------------------------------------- |
|
880 // CAlfCompositionPixelSource::Suspend |
|
881 // --------------------------------------------------------------------------- |
|
882 // |
|
883 EXPORT_C void CAlfCompositionPixelSource::Suspend() |
|
884 { |
|
885 if(iData->iSourceStatus != CAlfCompositionPixelSourceData::ESuspended) |
|
886 { |
|
887 iData->iProvider.ContextAboutToSuspend(); |
|
888 |
|
889 TInt error = SendEvent(KAlfCompOpSessionClosed,0,0); |
|
890 |
|
891 // todo: what if error != KErrNone |
|
892 |
|
893 FreeSurface(); |
|
894 |
|
895 if(iData->iSurfaceUpdateWaiter && iData->iSurfaceUpdateWaiter->IsActive()) |
|
896 { |
|
897 iData->iSurfaceUpdateWaiter->Cancel(); |
|
898 } |
|
899 |
|
900 |
|
901 iData->iSourceStatus = CAlfCompositionPixelSourceData::ESuspended; |
|
902 } |
|
903 } |
|
904 |
|
905 // --------------------------------------------------------------------------- |
|
906 // CAlfCompositionPixelSource::CAlfCompositionPixelSource |
|
907 // --------------------------------------------------------------------------- |
|
908 // |
|
909 EXPORT_C CAlfCompositionPixelSource::~CAlfCompositionPixelSource() |
|
910 { |
|
911 Suspend(); |
|
912 delete iData; |
|
913 iData = NULL; |
|
914 } |
|
915 |
|
916 // --------------------------------------------------------------------------- |
|
917 // CAlfCompositionPixelSource::SetExtent |
|
918 // --------------------------------------------------------------------------- |
|
919 // |
|
920 EXPORT_C TInt CAlfCompositionPixelSource::SetExtent(const TRect& aRect, TInt aScreen) |
|
921 { |
|
922 TInt error = KErrNone; |
|
923 if(iData->iSurfaceId.IsNull() && !iData->iWindow) |
|
924 { |
|
925 //create surface as client did not supply window |
|
926 MAlfBufferProvider::TBufferCreationAttributes& creationAttribs = iData->iProvider.BufferAttributes(); |
|
927 |
|
928 iData->iSurfaceRect = TRect(TPoint(0,0), TSize(creationAttribs.iWidth, creationAttribs.iHeight)); |
|
929 |
|
930 TRAP(error, ConstructSurfaceL(creationAttribs) ); |
|
931 |
|
932 if( error == KErrNone ) |
|
933 { |
|
934 error = iData->iSurfaceUpdateSession.Connect(); |
|
935 iData->iSourceStatus = CAlfCompositionPixelSourceData::EPaused; |
|
936 } |
|
937 } |
|
938 |
|
939 if( error == KErrNone ) |
|
940 { |
|
941 TInt array[] = {aRect.iTl.iX,aRect.iTl.iY,aRect.iBr.iX,aRect.iBr.iY, aScreen, |
|
942 iData->iSurfaceId.iInternal[0], iData->iSurfaceId.iInternal[1], iData->iSurfaceId.iInternal[2], |
|
943 iData->iSurfaceId.iInternal[3]}; |
|
944 error = SendEvent(KAlfCompOpSetExtent, array, sizeof(array)); |
|
945 } |
|
946 return error; |
|
947 } |
|
948 |
|
949 // --------------------------------------------------------------------------- |
|
950 // CAlfCompositionPixelSource::ConstructL |
|
951 // --------------------------------------------------------------------------- |
|
952 // |
|
953 void CAlfCompositionPixelSource::ConstructL(MAlfBufferProvider& aProvider, RWindow* aWindow) |
|
954 { |
|
955 iData = CAlfCompositionPixelSourceData::NewL( aProvider ); |
|
956 TInt screenNumber = KErrNotFound; |
|
957 if( aWindow ) |
|
958 { |
|
959 iData->iWindow = aWindow; |
|
960 screenNumber = aWindow->ScreenNumber(); |
|
961 } |
|
962 else // let's just initialize baseclass and wait for client to call SetExtent |
|
963 { |
|
964 iData->iWindow = NULL; |
|
965 } |
|
966 // construct the base class |
|
967 CAlfCompositionSource::ConstructL(0, 0, screenNumber); |
|
968 } |
|
969 |
|
970 // --------------------------------------------------------------------------- |
|
971 // CAlfCompositionPixelSource::ConstructSurfaceL |
|
972 // --------------------------------------------------------------------------- |
|
973 // |
|
974 void CAlfCompositionPixelSource::ConstructSurfaceL(MAlfBufferProvider::TBufferCreationAttributes& aCreationAttributes) |
|
975 { |
|
976 TSize size(aCreationAttributes.iWidth, aCreationAttributes.iHeight); |
|
977 |
|
978 TUidPixelFormat surfaceFormat = EUidPixelFormatUnknown; |
|
979 switch (aCreationAttributes.iFormat) |
|
980 { |
|
981 case MAlfBufferProvider::ESourceFormatRGB_565: |
|
982 surfaceFormat = EUidPixelFormatRGB_565; |
|
983 break; |
|
984 case MAlfBufferProvider::ESourceFormatXRGB_8888: |
|
985 surfaceFormat = EUidPixelFormatXRGB_8888; |
|
986 break; |
|
987 case MAlfBufferProvider::ESourceFormatARGB_8888: |
|
988 surfaceFormat = EUidPixelFormatARGB_8888; |
|
989 break; |
|
990 case MAlfBufferProvider::ESourceFormatARGB_8888_PRE: |
|
991 surfaceFormat = EUidPixelFormatARGB_8888_PRE; |
|
992 break; |
|
993 default: |
|
994 User::Leave( KErrNotSupported ); |
|
995 break; |
|
996 } |
|
997 |
|
998 TInt err = KErrNone; |
|
999 if(!iData->iSurfaceManager) |
|
1000 { |
|
1001 iData->iSurfaceManager = new RSurfaceManager(); |
|
1002 User::LeaveIfNull(iData->iSurfaceManager); |
|
1003 |
|
1004 err = iData->iSurfaceManager->Open(); |
|
1005 User::LeaveIfError(err); |
|
1006 |
|
1007 RSurfaceManager::TSurfaceCreationAttributesBuf attributes; |
|
1008 attributes().iPixelFormat = surfaceFormat; |
|
1009 attributes().iSize = size; |
|
1010 attributes().iBuffers = 1; |
|
1011 attributes().iStride = aCreationAttributes.iStride; |
|
1012 attributes().iAlignment = aCreationAttributes.iAlignment; |
|
1013 attributes().iContiguous = ETrue; |
|
1014 attributes().iMappable = ETrue; |
|
1015 |
|
1016 // Create surface |
|
1017 err = iData->iSurfaceManager->CreateSurface(attributes, iData->iSurfaceId); |
|
1018 User::LeaveIfError(err); |
|
1019 } |
|
1020 |
|
1021 if(!iData->iSurfaceChunk) |
|
1022 { |
|
1023 // Map to chunk |
|
1024 iData->iSurfaceChunk = new RChunk(); |
|
1025 User::LeaveIfNull(iData->iSurfaceChunk); |
|
1026 err = iData->iSurfaceManager->MapSurface(iData->iSurfaceId, *iData->iSurfaceChunk); |
|
1027 User::LeaveIfError(err); |
|
1028 } |
|
1029 |
|
1030 // Get the info from the surfaceManager |
|
1031 RSurfaceManager::TInfoBuf info; |
|
1032 err = iData->iSurfaceManager->SurfaceInfo(iData->iSurfaceId, info); |
|
1033 User::LeaveIfError(err); |
|
1034 RSurfaceManager::TSurfaceInfoV01 surfaceInfo = info(); |
|
1035 aCreationAttributes.iStride = surfaceInfo.iStride; |
|
1036 |
|
1037 TInt offset = 0; |
|
1038 iData->iSurfaceManager->GetBufferOffset(iData->iSurfaceId, 0, offset); |
|
1039 |
|
1040 // Store pointer to the pixel data |
|
1041 iData->iSurfaceBuffer = iData->iSurfaceChunk->Base() + offset; |
|
1042 } |
|
1043 |
|
1044 // --------------------------------------------------------------------------- |
|
1045 // CAlfCompositionPixelSource::FreeSurface |
|
1046 // --------------------------------------------------------------------------- |
|
1047 // |
|
1048 void CAlfCompositionPixelSource::FreeSurface() |
|
1049 { |
|
1050 if(iData->iWindow && iData->iSourceStatus != CAlfCompositionPixelSourceData::ESuspended) |
|
1051 { |
|
1052 iData->iWindow->RemoveBackgroundSurface(ETrue); |
|
1053 iData->iWindow->Session()->Flush(); |
|
1054 } |
|
1055 |
|
1056 if(iData->iSourceStatus != CAlfCompositionPixelSourceData::ESuspended) |
|
1057 { |
|
1058 iData->iSurfaceUpdateSession.CancelAllUpdateNotifications(); |
|
1059 } |
|
1060 iData->iSurfaceUpdateSession.Close(); |
|
1061 |
|
1062 if(iData->iSurfaceManager) |
|
1063 { |
|
1064 iData->iSurfaceManager->CloseSurface(iData->iSurfaceId); |
|
1065 iData->iSurfaceManager->Close(); |
|
1066 delete iData->iSurfaceManager; |
|
1067 iData->iSurfaceManager = NULL; |
|
1068 } |
|
1069 |
|
1070 iData->iSurfaceId = TSurfaceId::CreateNullId(); |
|
1071 |
|
1072 if(iData->iSurfaceChunk) |
|
1073 { |
|
1074 iData->iSurfaceChunk->Close(); |
|
1075 delete iData->iSurfaceChunk; |
|
1076 iData->iSurfaceChunk = NULL; |
|
1077 } |
|
1078 } |
|
1079 |
|
1080 // --------------------------------------------------------------------------- |
|
1081 // CAlfCompositionPixelSource::Buffer |
|
1082 // --------------------------------------------------------------------------- |
|
1083 // |
|
1084 TUint8* CAlfCompositionPixelSource::Buffer(TInt /*aBufferNumber*/) |
|
1085 { |
|
1086 return iData->iSurfaceBuffer; |
|
1087 } |
|
1088 |
|
1089 // --------------------------------------------------------------------------- |
|
1090 // CAlfCompositionPixelSource::DrawFrameL |
|
1091 // --------------------------------------------------------------------------- |
|
1092 // |
|
1093 TBool CAlfCompositionPixelSource::DrawFrameL(TRequestStatus& aStatus, TInt aBufferNumber) |
|
1094 { |
|
1095 // Region indicates the currently visible region of the surface. The information is not yet available. |
|
1096 RRegion region; |
|
1097 region.AddRect(iData->iSurfaceRect); |
|
1098 TUint8* buffer = Buffer(aBufferNumber); |
|
1099 TBool draw = iData->iProvider.ProduceNewFrameL(region, buffer); |
|
1100 if(draw) |
|
1101 { |
|
1102 iData->iSurfaceUpdateSession.NotifyWhenAvailable(aStatus); |
|
1103 |
|
1104 iData->iSurfaceUpdateSession.SubmitUpdate(KAllScreens, iData->iSurfaceId, aBufferNumber); |
|
1105 } |
|
1106 else |
|
1107 { |
|
1108 iData->iSourceStatus = CAlfCompositionPixelSourceData::EPaused; |
|
1109 } |
|
1110 region.Close(); |
|
1111 return draw; |
|
1112 } |
|
1113 |
|
1114 // --------------------------------------------------------------------------- |
|
1115 // CAlfCompositionPixelSource::HandleEventL |
|
1116 // --------------------------------------------------------------------------- |
|
1117 // |
|
1118 void CAlfCompositionPixelSource::HandleEventL(TInt aEventType, TAny* aEventData) |
|
1119 { |
|
1120 switch (aEventType) |
|
1121 { |
|
1122 case KAlfCompositionFrameReady: |
|
1123 { |
|
1124 // do nothing for now |
|
1125 } |
|
1126 break; |
|
1127 case KAlfCompositionLowOnGraphicsMemory: |
|
1128 case KAlfCompositionTargetHidden: |
|
1129 { |
|
1130 // suspend drawing |
|
1131 Suspend(); |
|
1132 } |
|
1133 break; |
|
1134 default: |
|
1135 break; |
|
1136 } |
|
1137 // call base class |
|
1138 CAlfCompositionSource::HandleEventL( aEventType, aEventData ); |
|
1139 } |
|
1140 |
|
1141 //end of file |