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 TBool semiTranparentEffectActive = iEffectOpacity < 1.f; |
353 |
|
354 TBool semiTranparentEffectActive = Effect()->IsSemitransparent(); |
354 if ((iOpacity.Now() <= EPSILON && !semiTranparentEffectActive)) |
355 if ((iOpacity.Now() <= EPSILON && !semiTranparentEffectActive)) |
355 { |
356 { |
356 return ETrue; |
357 return ETrue; |
357 } |
358 } |
358 TBool childWindowEffectActive = EffectIsAppliedToChildren(); |
359 TBool childWindowEffectActive = EffectIsAppliedToChildren(); |
447 aGc.Clip(area); |
448 aGc.Clip(area); |
448 } |
449 } |
449 |
450 |
450 // Flag to know what we did |
451 // Flag to know what we did |
451 TBool didDrawEffect = EFalse; |
452 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 |
456 TBool refreshCache = EFalse; |
461 TBool refreshCache = EFalse; |
457 TBool layer = EFalse; |
462 TBool layer = EFalse; |
458 if (EffectIsAppliedToChildren()) |
463 if (EffectIsAppliedToChildren()) |
459 { |
464 { |
460 refreshCache |= ChildTreeChanged(EHuiCanvasFlagExcludeFromParentEffect); |
465 refreshCache |= ChildTreeChanged(EHuiCanvasFlagExcludeFromParentEffect); |
472 |
477 |
473 if(Display()->RosterImpl().AlfEventWindow() == this) |
478 if(Display()->RosterImpl().AlfEventWindow() == this) |
474 { |
479 { |
475 refreshCache |= Display()->RosterImpl().NativeAppsContentChanged(); |
480 refreshCache |= Display()->RosterImpl().NativeAppsContentChanged(); |
476 } |
481 } |
477 Effectable()->EffectSetOpacityAdditive(0.0f, ETrue); |
482 didDrawEffect = Effect()->CachedDraw(aGc, area, refreshCache, !transparent, iCanvasVisualData->iPaintedRegion,layer ); |
478 |
483 |
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 } |
|
511 } |
484 } |
512 |
485 |
513 if ( !didDrawEffect ) |
486 if ( !didDrawEffect ) |
514 { |
487 { |
515 DrawSelf(aGc, area); |
488 DrawSelf(aGc, area); |
523 if (!didDrawEffect) |
496 if (!didDrawEffect) |
524 { |
497 { |
525 // Draw all children |
498 // Draw all children |
526 DrawCanvasChildren(aGc, 0, 0); |
499 DrawCanvasChildren(aGc, 0, 0); |
527 } |
500 } |
528 else if (didDrawEffect && drawChildren && !EffectIsAppliedToChildren()) |
501 else if (didDrawEffect && !EffectIsAppliedToChildren()) |
529 { |
502 { |
530 // Draw all children |
503 // Draw all children |
531 DrawCanvasChildren(aGc, 0, 0); |
504 DrawCanvasChildren(aGc, 0, 0); |
532 } |
505 } |
533 else if (didDrawEffect && drawChildren && EffectIsAppliedToChildren()) |
506 else if (didDrawEffect && EffectIsAppliedToChildren()) |
534 { |
507 { |
535 // Draw only children which do not want to have parent effect applied to them |
508 // Draw only children which do not want to have parent effect applied to them |
536 DrawCanvasChildren(aGc, EHuiCanvasFlagExcludeFromParentEffect, 0); |
509 DrawCanvasChildren(aGc, EHuiCanvasFlagExcludeFromParentEffect, 0); |
537 } |
510 } |
538 |
511 |
1363 void CHuiCanvasVisual::DrawStoredVisualRenderBuffer(TInt aCanvasDrawMode) const |
1336 void CHuiCanvasVisual::DrawStoredVisualRenderBuffer(TInt aCanvasDrawMode) const |
1364 { |
1337 { |
1365 CHuiCanvasGc& gc = CanvasGc(); |
1338 CHuiCanvasGc& gc = CanvasGc(); |
1366 CHuiCanvasVisual* visual = NULL; |
1339 CHuiCanvasVisual* visual = NULL; |
1367 TBool transparent = EffectiveOpacity() < 1.0f; |
1340 TBool transparent = EffectiveOpacity() < 1.0f; |
1368 if(EffectActive()) |
1341 gc.SetDrawMode((THuiCanvasDrawMode)aCanvasDrawMode); |
1369 { |
|
1370 transparent |= iEffectOpacity < 1.0f; |
|
1371 } |
|
1372 gc.SetDrawMode((THuiCanvasDrawMode)aCanvasDrawMode); |
|
1373 if (transparent) |
1342 if (transparent) |
1374 { |
1343 { |
1375 gc.EnableEffectiveOpacity(ETrue); |
1344 gc.EnableEffectiveOpacity(ETrue); |
1376 visual = gc.Visual(); |
1345 visual = gc.Visual(); |
1377 gc.SetVisual(*this); |
1346 gc.SetVisual(*this); |
1413 } |
1382 } |
1414 |
1383 |
1415 THuiRealPoint dest_point = DisplayRect().iTl; |
1384 THuiRealPoint dest_point = DisplayRect().iTl; |
1416 CHuiCanvasRenderBuffer *stored = StoredRenderBuffer(); |
1385 CHuiCanvasRenderBuffer *stored = StoredRenderBuffer(); |
1417 TBool transparent = EffectiveOpacity() < 1.0f; |
1386 TBool transparent = EffectiveOpacity() < 1.0f; |
1418 if(EffectActive()) |
|
1419 { |
|
1420 transparent |= iEffectOpacity < 1.0f; |
|
1421 } |
|
1422 CHuiCanvasVisual* visual = NULL; |
1387 CHuiCanvasVisual* visual = NULL; |
1423 gc.SetDrawMode((THuiCanvasDrawMode)aCanvasDrawMode); |
1388 gc.SetDrawMode((THuiCanvasDrawMode)aCanvasDrawMode); |
1424 if (transparent) |
1389 if (transparent) |
1425 { |
1390 { |
1426 |
1391 |
1632 inactive |= Flags() & EHuiVisualFlagInactive; |
1597 inactive |= Flags() & EHuiVisualFlagInactive; |
1633 inactive |= Flags() & EHuiVisualFlagUnderOpaqueHint; |
1598 inactive |= Flags() & EHuiVisualFlagUnderOpaqueHint; |
1634 |
1599 |
1635 return rosterFrozen || inactive; |
1600 return rosterFrozen || inactive; |
1636 } |
1601 } |
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 } |
|