367 // ----------------------------------------------------------------------------- |
366 // ----------------------------------------------------------------------------- |
368 // |
367 // |
369 void CHgVgMediaWall::Draw ( const TRect& /*aRect*/ ) const |
368 void CHgVgMediaWall::Draw ( const TRect& /*aRect*/ ) const |
370 { |
369 { |
371 |
370 |
372 if(iFlags & EHgVgMediaWallUninitialized) |
371 if( iFlags & EHgVgMediaWallUninitialized || !iIsForeground ) |
373 { |
372 { |
374 FillSystemGcWithSkin( ); |
373 FillSystemGcWithSkin( ); |
375 return; |
374 return; |
376 } |
375 } |
377 |
376 |
378 CHgVgMediaWall* self = const_cast<CHgVgMediaWall*>(this); |
377 CHgVgMediaWall* self = const_cast<CHgVgMediaWall*>(this); |
379 |
378 |
380 if (iIsForeground) |
379 if( iFlags & EHgVgMediaWallDrawToWindowGC ) |
381 { |
380 { |
382 if( iFlags & EHgVgMediaWallDrawToWindowGC ) |
381 CFbsBitmap* screenshot = NULL; |
383 { |
382 screenshot = self->DrawToBitmap(); |
384 CFbsBitmap* screenshot = NULL; |
383 if (screenshot) |
385 screenshot = self->DrawToBitmap(); |
384 { |
386 if (screenshot) |
385 SystemGc().BitBlt( Rect().iTl,screenshot ); |
387 { |
386 delete screenshot; |
388 SystemGc().BitBlt( Rect().iTl,screenshot ); |
|
389 delete screenshot; |
|
390 } |
|
391 else |
|
392 { |
|
393 FillSystemGcWithSkin( ); |
|
394 } |
|
395 } |
387 } |
396 else |
388 else |
397 { |
389 { |
398 |
390 FillSystemGcWithSkin( ); |
399 // draw with alpha to make a hole to composition layer |
|
400 SystemGc().SetDrawMode(CGraphicsContext::EDrawModeWriteAlpha); |
|
401 SystemGc().SetBrushColor(TRgb(0,0,0,0)); |
|
402 SystemGc().Clear(); |
|
403 |
|
404 DrawOpenVG(); |
|
405 } |
391 } |
406 } |
392 } |
407 else |
393 else |
408 { |
394 { |
409 if (iSurfaceBitmap) |
395 // draw with alpha to make a hole to composition layer |
410 { |
396 SystemGc().SetDrawMode(CGraphicsContext::EDrawModeWriteAlpha); |
411 SystemGc().BitBlt( Rect().iTl, iSurfaceBitmap ); |
397 SystemGc().SetBrushColor(TRgb(0,0,0,0)); |
412 } |
398 SystemGc().Clear(); |
413 else |
399 |
414 { |
400 DrawOpenVG(); |
415 FillSystemGcWithSkin( ); |
401 } |
416 } |
402 } |
417 } |
403 |
418 |
404 // ----------------------------------------------------------------------------- |
419 } |
405 // CHgVgMediaWall::FillSystemGcWithSkin() |
420 |
406 // Draws the display. |
|
407 // ----------------------------------------------------------------------------- |
|
408 // |
421 void CHgVgMediaWall::FillSystemGcWithSkin( ) const |
409 void CHgVgMediaWall::FillSystemGcWithSkin( ) const |
422 { |
410 { |
423 MAknsSkinInstance* skin = AknsUtils::SkinInstance(); |
411 MAknsSkinInstance* skin = AknsUtils::SkinInstance(); |
424 MAknsControlContext* cc = AknsDrawUtils::ControlContext( this ); |
412 MAknsControlContext* cc = AknsDrawUtils::ControlContext( this ); |
425 AknsDrawUtils::DrawBackground( skin, cc, this, SystemGc(), TPoint(0,0), |
413 AknsDrawUtils::DrawBackground( skin, cc, this, SystemGc(), TPoint(0,0), |
1217 // |
1205 // |
1218 void CHgVgMediaWall::HandleGainingForeground() |
1206 void CHgVgMediaWall::HandleGainingForeground() |
1219 { |
1207 { |
1220 if(iIsForeground) return; // don't react to gaining foreground without losing it |
1208 if(iIsForeground) return; // don't react to gaining foreground without losing it |
1221 |
1209 |
1222 // draw previous screenshot |
|
1223 DrawNow(); |
|
1224 |
|
1225 // delete it |
|
1226 delete iSurfaceBitmap; |
|
1227 iSurfaceBitmap = NULL; |
|
1228 |
|
1229 iIsForeground = ETrue; |
1210 iIsForeground = ETrue; |
1230 |
1211 |
1231 // init egl and openvg again |
1212 if(iDelayedInit && !iDelayedInit->IsActive()) |
1232 TRAP_IGNORE( InitRenderingL(EFalse); ) |
1213 iDelayedInit->Start(100000, 1000000, TCallBack(DelayedInit, this)); |
1233 |
|
1234 // reload images to ive |
|
1235 ReloadItemsImages(); |
|
1236 |
|
1237 ClearFlags(EHgVgMediaWallUninitialized); |
|
1238 |
|
1239 // draw using openvg |
|
1240 DrawNow(); |
|
1241 |
|
1242 } |
1214 } |
1243 |
1215 |
1244 // --------------------------------------------------------------------------- |
1216 // --------------------------------------------------------------------------- |
1245 // CHgVgMediaWall::HandleLosingForeground() |
1217 // CHgVgMediaWall::HandleLosingForeground() |
1246 // --------------------------------------------------------------------------- |
1218 // --------------------------------------------------------------------------- |
1266 iAnimationTimer->Cancel(); |
1238 iAnimationTimer->Cancel(); |
1267 } |
1239 } |
1268 |
1240 |
1269 iIsForeground = EFalse; |
1241 iIsForeground = EFalse; |
1270 |
1242 |
1271 // take a screenshot |
|
1272 delete iSurfaceBitmap; |
|
1273 iSurfaceBitmap = NULL; |
|
1274 iSurfaceBitmap = DrawToBitmap(); |
|
1275 |
|
1276 // draw screenshot using window gc, this is needed |
1243 // draw screenshot using window gc, this is needed |
1277 // for nga effects to work |
1244 // for nga effects to work |
1278 DrawNow(); |
1245 DrawNow(); |
1279 |
1246 |
1280 // free textures |
1247 // free textures |
1281 FreeItemsImages(); |
1248 FreeItemsImages(); |
1282 // free other resources |
1249 // free other resources |
1283 DestroyRendering(); |
1250 DestroyRendering(); |
|
1251 |
|
1252 SetFlags( EHgVgMediaWallUninitialized | EHgVgMediaWallDrawToWindowGC ); |
1284 |
1253 |
1285 iCoeEnv->WsSession().Flush(); |
1254 iCoeEnv->WsSession().Flush(); |
1286 |
|
1287 } |
1255 } |
1288 |
1256 |
1289 // --------------------------------------------------------------------------- |
1257 // --------------------------------------------------------------------------- |
1290 // CHgVgMediaWall::DrawOpenVG() |
1258 // CHgVgMediaWall::DrawOpenVG() |
1291 // --------------------------------------------------------------------------- |
1259 // --------------------------------------------------------------------------- |