78 TBool iLayerUsesAlphaFlag; |
78 TBool iLayerUsesAlphaFlag; |
79 TRect iLayerExtent; |
79 TRect iLayerExtent; |
80 |
80 |
81 RRegionBuf<5> iShapeRegion; |
81 RRegionBuf<5> iShapeRegion; |
82 TPoint iShapeOrigin; |
82 TPoint iShapeOrigin; |
|
83 |
|
84 // Flag to indicate if this has received commands while inactive |
|
85 TBool iCommandsReceivedWhileNoCache; |
83 }; |
86 }; |
84 |
87 |
85 EXPORT_C CHuiCanvasVisual* CHuiCanvasVisual::AddNewL(CHuiControl& aOwnerControl, |
88 EXPORT_C CHuiCanvasVisual* CHuiCanvasVisual::AddNewL(CHuiControl& aOwnerControl, |
86 CHuiLayout* aParentLayout) |
89 CHuiLayout* aParentLayout) |
87 { |
90 { |
272 CHuiLayout::ExpandRectWithContent(aRect); |
277 CHuiLayout::ExpandRectWithContent(aRect); |
273 } |
278 } |
274 |
279 |
275 void CHuiCanvasVisual::HandleBuffer(TRect& aDisplayRect, TInt aAction, CHuiGc* aGc) const |
280 void CHuiCanvasVisual::HandleBuffer(TRect& aDisplayRect, TInt aAction, CHuiGc* aGc) const |
276 { |
281 { |
|
282 TBool touchCountWasEnabled = EFalse; |
|
283 if (iCanvasVisualData->iCommandsReceivedWhileNoCache) |
|
284 { |
|
285 // Commands were received while this visual didn't keep cache. |
|
286 // So it's possible that some images are still in texture cache but haven't been updated. |
|
287 touchCountWasEnabled = Env().CanvasTextureCache().IsTouchCountCheckEnabled(); |
|
288 Env().CanvasTextureCache().EnableTouchCountCheck(); |
|
289 } |
|
290 |
277 if (iCanvasVisualData->iCommandSetType == ECommandBufferWs || iCanvasVisualData->iCommandSetType == ECommandBufferAlf) |
291 if (iCanvasVisualData->iCommandSetType == ECommandBufferWs || iCanvasVisualData->iCommandSetType == ECommandBufferAlf) |
278 { |
292 { |
279 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())); |
280 if (err) |
294 if (err) |
281 { |
295 { |
318 } |
340 } |
319 |
341 |
320 |
342 |
321 TBool CHuiCanvasVisual::CanSkipDrawing() const |
343 TBool CHuiCanvasVisual::CanSkipDrawing() const |
322 { |
344 { |
323 TBool semiTranparentEffectActive = (Effect() && Effect()->IsSemitransparent()); |
345 if (Effect()) |
324 TBool childWindowEffectActive = (Effect() && EffectIsAppliedToChildren()); |
346 { |
325 TBool invisible = (iOpacity.Now() <= EPSILON && !semiTranparentEffectActive); |
347 TBool semiTranparentEffectActive = Effect()->IsSemitransparent(); |
326 TBool effectAppliedToSurfacePixels = (Effect() && (Effect()->EffectFlags() & KHuiFxEnableBackgroundInAllLayers)); |
348 if ((iOpacity.Now() <= EPSILON && !semiTranparentEffectActive)) |
327 |
349 { |
328 if( invisible || |
350 return ETrue; |
329 (!HasCommandBuffers(ETrue /*include children*/) && |
351 } |
330 !childWindowEffectActive && |
352 TBool childWindowEffectActive = EffectIsAppliedToChildren(); |
331 !IsBackgroundDrawingEnabled() && |
353 TBool effectAppliedToSurfacePixels = (Effect()->EffectFlags() & KHuiFxEnableBackgroundInAllLayers); |
332 !IsExternalContentDrawingEnabled()&& |
354 if( !childWindowEffectActive && |
333 !IsExternalContentDrawingEnabled(ETrue /*include children*/) && |
355 !effectAppliedToSurfacePixels && |
334 !effectAppliedToSurfacePixels |
356 !HasCommandBuffers(ETrue /*include children*/) && |
335 |
357 !IsBackgroundDrawingEnabled() && |
336 )) |
358 !IsExternalContentDrawingEnabled()&& |
337 { |
359 !IsExternalContentDrawingEnabled(ETrue /*include children*/)) |
338 return ETrue; |
360 { |
|
361 return ETrue; |
|
362 } |
339 } |
363 } |
340 else |
364 else |
341 { |
365 { |
342 return EFalse; |
366 if (iOpacity.Now() <= EPSILON || |
343 } |
367 (!HasCommandBuffers(ETrue /*include children*/) && |
|
368 !IsBackgroundDrawingEnabled() && |
|
369 !IsExternalContentDrawingEnabled() && |
|
370 !IsExternalContentDrawingEnabled(ETrue /*include children*/)) ) |
|
371 { |
|
372 return ETrue; |
|
373 } |
|
374 } |
|
375 return EFalse; |
344 } |
376 } |
345 |
377 |
346 void CHuiCanvasVisual::Draw(CHuiGc& aGc) const |
378 void CHuiCanvasVisual::Draw(CHuiGc& aGc) const |
347 { |
379 { |
348 if (Flags() & EHuiVisualFlagDrawOnlyAsExternalContent) |
380 if (Flags() & EHuiVisualFlagDrawOnlyAsExternalContent) |
760 Env().CanvasTextureCache().EnableTouchCountCheck(); |
792 Env().CanvasTextureCache().EnableTouchCountCheck(); |
761 ClearCommandSet(); |
793 ClearCommandSet(); |
762 TRAP_IGNORE(iCanvasVisualData->iCanvasPainter->SetCommandSetL(aCommands)); |
794 TRAP_IGNORE(iCanvasVisualData->iCanvasPainter->SetCommandSetL(aCommands)); |
763 |
795 |
764 // Memory optimization. Do not prepare cache if visual is inactive. |
796 // Memory optimization. Do not prepare cache if visual is inactive. |
765 TBool rosterFrozen = Display() && Display()->Roster().IsVisibleContentFrozen(); |
797 if (KeepNoCache()) |
766 TBool inactive = EFalse; |
798 { |
767 inactive |= Flags() & EHuiVisualFlagInactive; |
799 iCanvasVisualData->iCommandsReceivedWhileNoCache = ETrue; |
768 inactive |= Flags() & EHuiVisualFlagUnderOpaqueHint; |
|
769 |
|
770 if (rosterFrozen || inactive) |
|
771 { |
|
772 ClearCache(); |
800 ClearCache(); |
773 } |
801 } |
774 else |
802 else |
775 { |
803 { |
776 PrepareCache(); |
804 PrepareCache(); |
834 { |
862 { |
835 Env().CanvasTextureCache().EnableTouchCountCheck(); |
863 Env().CanvasTextureCache().EnableTouchCountCheck(); |
836 TRAP_IGNORE(iCanvasVisualData->iCanvasPainter->AddCommandSetL(aMoreCommands)); |
864 TRAP_IGNORE(iCanvasVisualData->iCanvasPainter->AddCommandSetL(aMoreCommands)); |
837 |
865 |
838 // Memory optimization. Do not prepare cache if visual is inactive. |
866 // Memory optimization. Do not prepare cache if visual is inactive. |
839 TBool rosterFrozen = Display() && Display()->Roster().IsVisibleContentFrozen(); |
867 if (KeepNoCache()) |
840 TBool inactive = EFalse; |
868 { |
841 inactive |= Flags() & EHuiVisualFlagInactive; |
869 iCanvasVisualData->iCommandsReceivedWhileNoCache = ETrue; |
842 inactive |= Flags() & EHuiVisualFlagUnderOpaqueHint; |
|
843 |
|
844 if (rosterFrozen || inactive) |
|
845 { |
|
846 ClearCache(); |
870 ClearCache(); |
847 } |
871 } |
848 else |
872 else |
849 { |
873 { |
850 PrepareCache(); |
874 PrepareCache(); |
1527 EXPORT_C TRect CHuiCanvasVisual::CommandBufferCoverage(TInt aOrientation) |
1555 EXPORT_C TRect CHuiCanvasVisual::CommandBufferCoverage(TInt aOrientation) |
1528 { |
1556 { |
1529 return iCanvasVisualData->iCanvasPainter->CommandBufferCoverage(aOrientation); |
1557 return iCanvasVisualData->iCanvasPainter->CommandBufferCoverage(aOrientation); |
1530 } |
1558 } |
1531 |
1559 |
1532 |
1560 EXPORT_C TBool CHuiCanvasVisual::HasTransParentClear() const |
|
1561 { |
|
1562 return iCanvasVisualData->iCanvasPainter->HasCommandBuffers(EHuiCanvasBufferContainsTransparentClear); |
|
1563 } |
|
1564 |
|
1565 TBool CHuiCanvasVisual::KeepNoCache() const |
|
1566 { |
|
1567 TBool rosterFrozen = Display() && Display()->Roster().IsVisibleContentFrozen(); |
|
1568 TBool inactive = EFalse; |
|
1569 inactive |= Flags() & EHuiVisualFlagInactive; |
|
1570 inactive |= Flags() & EHuiVisualFlagUnderOpaqueHint; |
|
1571 |
|
1572 return rosterFrozen || inactive; |
|
1573 } |