288 Env().CanvasTextureCache().EnableTouchCountCheck(); |
288 Env().CanvasTextureCache().EnableTouchCountCheck(); |
289 } |
289 } |
290 |
290 |
291 if (iCanvasVisualData->iCommandSetType == ECommandBufferWs || iCanvasVisualData->iCommandSetType == ECommandBufferAlf) |
291 if (iCanvasVisualData->iCommandSetType == ECommandBufferWs || iCanvasVisualData->iCommandSetType == ECommandBufferAlf) |
292 { |
292 { |
293 TRAPD(err, iCanvasVisualData->iCanvasPainter->HandleBufferL(aDisplayRect, aAction, *this, aGc, DisplayRect().iTl.Round())); |
293 TRAPD(err, iCanvasVisualData->iCanvasPainter->HandleBufferL(aDisplayRect, aAction, *this, aGc, DisplayRect().iTl.Round())); |
294 if (err) |
294 if (err) |
295 { |
295 { |
296 HUI_DEBUG2(_L("CHuiCanvasVisual::HandleBufferL returned:%d command type was: %d"), err,iCanvasVisualData->iCommandSetType); |
296 HUI_DEBUG2(_L("CHuiCanvasVisual::HandleBufferL returned:%d command type was: %d"), err,iCanvasVisualData->iCommandSetType); |
297 } |
297 } |
298 } |
298 } |
348 } |
348 } |
349 |
349 |
350 if (Effect()) |
350 if (Effect()) |
351 { |
351 { |
352 TBool hasStoredContent = (IsDelayedEffectSource() || Freezed()) && (StoredRenderBuffer() || iCanvasVisualData->iStoredRenderBuffer); |
352 TBool hasStoredContent = (IsDelayedEffectSource() || Freezed()) && (StoredRenderBuffer() || iCanvasVisualData->iStoredRenderBuffer); |
353 |
353 TBool semiTranparentEffectActive = iEffectOpacity < 1.f; |
354 TBool semiTranparentEffectActive = Effect()->IsSemitransparent(); |
|
355 if ((iOpacity.Now() <= EPSILON && !semiTranparentEffectActive)) |
354 if ((iOpacity.Now() <= EPSILON && !semiTranparentEffectActive)) |
356 { |
355 { |
357 return ETrue; |
356 return ETrue; |
358 } |
357 } |
359 TBool childWindowEffectActive = EffectIsAppliedToChildren(); |
358 TBool childWindowEffectActive = EffectIsAppliedToChildren(); |
448 aGc.Clip(area); |
447 aGc.Clip(area); |
449 } |
448 } |
450 |
449 |
451 // Flag to know what we did |
450 // Flag to know what we did |
452 TBool didDrawEffect = EFalse; |
451 TBool didDrawEffect = EFalse; |
|
452 TBool drawChildren = ETrue; // only if didDrawEffect holds |
453 |
453 |
454 if (EffectActive()) |
454 if (EffectActive()) |
455 { |
455 { |
456 // Note that EHuiVisualFlagOpaqueHint improves performance a lot in cached effect drawing |
|
457 TBool transparent = EFalse; |
|
458 transparent |= (!(Flags() & EHuiVisualFlagOpaqueHint)); // Does not have opaque hint -> always transparent |
|
459 transparent |= iOpacity.Now() < 1.0f; // Opacity less than 1.0f -> always transparent |
|
460 |
|
461 TBool refreshCache = EFalse; |
456 TBool refreshCache = EFalse; |
462 TBool layer = EFalse; |
457 TBool layer = EFalse; |
463 if (EffectIsAppliedToChildren()) |
458 if (EffectIsAppliedToChildren()) |
464 { |
459 { |
465 refreshCache |= ChildTreeChanged(EHuiCanvasFlagExcludeFromParentEffect); |
460 refreshCache |= ChildTreeChanged(EHuiCanvasFlagExcludeFromParentEffect); |
477 |
472 |
478 if(Display()->RosterImpl().AlfEventWindow() == this) |
473 if(Display()->RosterImpl().AlfEventWindow() == this) |
479 { |
474 { |
480 refreshCache |= Display()->RosterImpl().NativeAppsContentChanged(); |
475 refreshCache |= Display()->RosterImpl().NativeAppsContentChanged(); |
481 } |
476 } |
482 didDrawEffect = Effect()->CachedDraw(aGc, area, refreshCache, !transparent, iCanvasVisualData->iPaintedRegion,layer ); |
477 Effectable()->EffectSetOpacityAdditive(0.0f, ETrue); |
483 |
478 |
|
479 // PrepareDraw will update iEffectOpacity to correct opacity for this effect frame |
|
480 if(Effect()->PrepareDrawL(aGc, area)) |
|
481 { |
|
482 // let's still check if effect is making visual fully transparent |
|
483 if(!CanSkipDrawing()) |
|
484 { |
|
485 // Note that EHuiVisualFlagOpaqueHint improves performance a lot in cached effect drawing |
|
486 TBool transparent = EFalse; |
|
487 |
|
488 // This is special case, only child below group visual. |
|
489 // Workaround - can be removed once opaque & transparent visual hierarchies are handled better. |
|
490 if ( !Layout() && Count() == 1 ) |
|
491 { |
|
492 const CHuiVisual* visual = &Visual(0); |
|
493 |
|
494 transparent |= (!(visual->Flags() & EHuiVisualFlagOpaqueHint)); // Does not have opaque hint -> always transparent |
|
495 transparent |= visual->iOpacity.Now() < 1.0f; // Opacity less than 1.0f -> always transparent |
|
496 transparent |= visual->Effect() && !visual->LoadingEffect() && (visual->iEffectOpacity < 1.0f); // effect opacity is less than 1.0f |
|
497 } |
|
498 |
|
499 transparent |= (!(Flags() & EHuiVisualFlagOpaqueHint)); // Does not have opaque hint -> always transparent |
|
500 transparent |= iOpacity.Now() < 1.0f; // Opacity less than 1.0f -> always transparent |
|
501 transparent |= iEffectOpacity < 1.0f; // effect opacity is less than 1.0f |
|
502 |
|
503 didDrawEffect = Effect()->CachedDraw(aGc, area, refreshCache, !transparent, iCanvasVisualData->iPaintedRegion, layer ); |
|
504 } |
|
505 else |
|
506 { |
|
507 didDrawEffect = ETrue; |
|
508 drawChildren = EFalse; |
|
509 } |
|
510 } |
484 } |
511 } |
485 |
512 |
486 if ( !didDrawEffect ) |
513 if ( !didDrawEffect ) |
487 { |
514 { |
488 DrawSelf(aGc, area); |
515 DrawSelf(aGc, area); |
496 if (!didDrawEffect) |
523 if (!didDrawEffect) |
497 { |
524 { |
498 // Draw all children |
525 // Draw all children |
499 DrawCanvasChildren(aGc, 0, 0); |
526 DrawCanvasChildren(aGc, 0, 0); |
500 } |
527 } |
501 else if (didDrawEffect && !EffectIsAppliedToChildren()) |
528 else if (didDrawEffect && drawChildren && !EffectIsAppliedToChildren()) |
502 { |
529 { |
503 // Draw all children |
530 // Draw all children |
504 DrawCanvasChildren(aGc, 0, 0); |
531 DrawCanvasChildren(aGc, 0, 0); |
505 } |
532 } |
506 else if (didDrawEffect && EffectIsAppliedToChildren()) |
533 else if (didDrawEffect && drawChildren && EffectIsAppliedToChildren()) |
507 { |
534 { |
508 // Draw only children which do not want to have parent effect applied to them |
535 // Draw only children which do not want to have parent effect applied to them |
509 DrawCanvasChildren(aGc, EHuiCanvasFlagExcludeFromParentEffect, 0); |
536 DrawCanvasChildren(aGc, EHuiCanvasFlagExcludeFromParentEffect, 0); |
510 } |
537 } |
511 |
538 |
1336 void CHuiCanvasVisual::DrawStoredVisualRenderBuffer(TInt aCanvasDrawMode) const |
1363 void CHuiCanvasVisual::DrawStoredVisualRenderBuffer(TInt aCanvasDrawMode) const |
1337 { |
1364 { |
1338 CHuiCanvasGc& gc = CanvasGc(); |
1365 CHuiCanvasGc& gc = CanvasGc(); |
1339 CHuiCanvasVisual* visual = NULL; |
1366 CHuiCanvasVisual* visual = NULL; |
1340 TBool transparent = EffectiveOpacity() < 1.0f; |
1367 TBool transparent = EffectiveOpacity() < 1.0f; |
1341 gc.SetDrawMode((THuiCanvasDrawMode)aCanvasDrawMode); |
1368 if(EffectActive()) |
|
1369 { |
|
1370 transparent |= iEffectOpacity < 1.0f; |
|
1371 } |
|
1372 gc.SetDrawMode((THuiCanvasDrawMode)aCanvasDrawMode); |
1342 if (transparent) |
1373 if (transparent) |
1343 { |
1374 { |
1344 gc.EnableEffectiveOpacity(ETrue); |
1375 gc.EnableEffectiveOpacity(ETrue); |
1345 visual = gc.Visual(); |
1376 visual = gc.Visual(); |
1346 gc.SetVisual(*this); |
1377 gc.SetVisual(*this); |
1382 } |
1413 } |
1383 |
1414 |
1384 THuiRealPoint dest_point = DisplayRect().iTl; |
1415 THuiRealPoint dest_point = DisplayRect().iTl; |
1385 CHuiCanvasRenderBuffer *stored = StoredRenderBuffer(); |
1416 CHuiCanvasRenderBuffer *stored = StoredRenderBuffer(); |
1386 TBool transparent = EffectiveOpacity() < 1.0f; |
1417 TBool transparent = EffectiveOpacity() < 1.0f; |
|
1418 if(EffectActive()) |
|
1419 { |
|
1420 transparent |= iEffectOpacity < 1.0f; |
|
1421 } |
1387 CHuiCanvasVisual* visual = NULL; |
1422 CHuiCanvasVisual* visual = NULL; |
1388 gc.SetDrawMode((THuiCanvasDrawMode)aCanvasDrawMode); |
1423 gc.SetDrawMode((THuiCanvasDrawMode)aCanvasDrawMode); |
1389 if (transparent) |
1424 if (transparent) |
1390 { |
1425 { |
1391 |
1426 |
1597 inactive |= Flags() & EHuiVisualFlagInactive; |
1632 inactive |= Flags() & EHuiVisualFlagInactive; |
1598 inactive |= Flags() & EHuiVisualFlagUnderOpaqueHint; |
1633 inactive |= Flags() & EHuiVisualFlagUnderOpaqueHint; |
1599 |
1634 |
1600 return rosterFrozen || inactive; |
1635 return rosterFrozen || inactive; |
1601 } |
1636 } |
|
1637 |
|
1638 TBool CHuiCanvasVisual::EffectReadyToDrawNextFrame() const |
|
1639 { |
|
1640 // if the visual is drawn ans a external content it is probably already inactive |
|
1641 if (Flags() & EHuiVisualFlagDrawOnlyAsExternalContent) |
|
1642 { |
|
1643 if (Display() && Display()->RosterImpl().IsDrawingExternalContent()) |
|
1644 { |
|
1645 return ETrue; |
|
1646 } |
|
1647 } |
|
1648 |
|
1649 // other checks to |
|
1650 TBool rdyToDraw = EFalse; |
|
1651 if(Display()->RosterImpl().AlfEventWindow() == this) |
|
1652 { |
|
1653 rdyToDraw |= ETrue; |
|
1654 } |
|
1655 |
|
1656 rdyToDraw |= (IsDelayedEffectSource() || Freezed()) && |
|
1657 (StoredRenderBuffer() || iCanvasVisualData->iStoredRenderBuffer); |
|
1658 rdyToDraw |= (Effect()->EffectFlags() & KHuiFxEnableBackgroundInAllLayers); |
|
1659 rdyToDraw |= EffectIsAppliedToChildren(); |
|
1660 rdyToDraw |= IsExternalContentDrawingEnabled() || IsExternalContentDrawingEnabled(ETrue); |
|
1661 rdyToDraw |= IsBackgroundDrawingEnabled(); |
|
1662 |
|
1663 rdyToDraw |= HasCommandBuffers(ETrue); |
|
1664 |
|
1665 // visual must be active (seen) and have content |
|
1666 return (!(Flags() & EHuiVisualFlagInactive) && rdyToDraw); |
|
1667 } |