equal
deleted
inserted
replaced
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 { |
122 |
125 |
123 iCanvasVisualData->iLayerUsesAlphaFlag = EFalse; |
126 iCanvasVisualData->iLayerUsesAlphaFlag = EFalse; |
124 iCanvasVisualData->iLayerExtent = TRect(); |
127 iCanvasVisualData->iLayerExtent = TRect(); |
125 |
128 |
126 iCanvasVisualData->iShapeOrigin = TPoint(); |
129 iCanvasVisualData->iShapeOrigin = TPoint(); |
|
130 |
|
131 iCanvasVisualData->iCommandsReceivedWhileNoCache = EFalse; |
127 |
132 |
128 // subwindow effects |
133 // subwindow effects |
129 //EnableBrushesL(ETrue); |
134 //EnableBrushesL(ETrue); |
130 } |
135 } |
131 |
136 |
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 { |
285 else |
299 else |
286 { |
300 { |
287 // do nothing |
301 // do nothing |
288 } |
302 } |
289 |
303 |
|
304 if (iCanvasVisualData->iCommandsReceivedWhileNoCache) |
|
305 { |
|
306 Env().CanvasTextureCache().EnableTouchCountCheck( touchCountWasEnabled ); |
|
307 if ( !KeepNoCache() && aAction == EDrawBuffer ) |
|
308 { |
|
309 iCanvasVisualData->iCommandsReceivedWhileNoCache = EFalse; |
|
310 } |
|
311 } |
290 } |
312 } |
291 |
313 |
292 |
314 |
293 TBool CHuiCanvasVisual::PrepareDrawL() |
315 TBool CHuiCanvasVisual::PrepareDrawL() |
294 { |
316 { |
770 Env().CanvasTextureCache().EnableTouchCountCheck(); |
792 Env().CanvasTextureCache().EnableTouchCountCheck(); |
771 ClearCommandSet(); |
793 ClearCommandSet(); |
772 TRAP_IGNORE(iCanvasVisualData->iCanvasPainter->SetCommandSetL(aCommands)); |
794 TRAP_IGNORE(iCanvasVisualData->iCanvasPainter->SetCommandSetL(aCommands)); |
773 |
795 |
774 // Memory optimization. Do not prepare cache if visual is inactive. |
796 // Memory optimization. Do not prepare cache if visual is inactive. |
775 TBool rosterFrozen = Display() && Display()->Roster().IsVisibleContentFrozen(); |
797 if (KeepNoCache()) |
776 TBool inactive = EFalse; |
798 { |
777 inactive |= Flags() & EHuiVisualFlagInactive; |
799 iCanvasVisualData->iCommandsReceivedWhileNoCache = ETrue; |
778 inactive |= Flags() & EHuiVisualFlagUnderOpaqueHint; |
|
779 |
|
780 if (rosterFrozen || inactive) |
|
781 { |
|
782 ClearCache(); |
800 ClearCache(); |
783 } |
801 } |
784 else |
802 else |
785 { |
803 { |
786 PrepareCache(); |
804 PrepareCache(); |
844 { |
862 { |
845 Env().CanvasTextureCache().EnableTouchCountCheck(); |
863 Env().CanvasTextureCache().EnableTouchCountCheck(); |
846 TRAP_IGNORE(iCanvasVisualData->iCanvasPainter->AddCommandSetL(aMoreCommands)); |
864 TRAP_IGNORE(iCanvasVisualData->iCanvasPainter->AddCommandSetL(aMoreCommands)); |
847 |
865 |
848 // Memory optimization. Do not prepare cache if visual is inactive. |
866 // Memory optimization. Do not prepare cache if visual is inactive. |
849 TBool rosterFrozen = Display() && Display()->Roster().IsVisibleContentFrozen(); |
867 if (KeepNoCache()) |
850 TBool inactive = EFalse; |
868 { |
851 inactive |= Flags() & EHuiVisualFlagInactive; |
869 iCanvasVisualData->iCommandsReceivedWhileNoCache = ETrue; |
852 inactive |= Flags() & EHuiVisualFlagUnderOpaqueHint; |
|
853 |
|
854 if (rosterFrozen || inactive) |
|
855 { |
|
856 ClearCache(); |
870 ClearCache(); |
857 } |
871 } |
858 else |
872 else |
859 { |
873 { |
860 PrepareCache(); |
874 PrepareCache(); |
996 if (aIndex == 0) |
1010 if (aIndex == 0) |
997 { |
1011 { |
998 background.iPaintedRect = DisplayRect(); |
1012 background.iPaintedRect = DisplayRect(); |
999 background.iPaintType = /*(iCanvasVisualData->iBackground->BackgroundColor().Alpha() == 255) ?*/ EHuiCanvasPaintTypeOpaque;// : EHuiCanvasPaintTypeTransparent; |
1013 background.iPaintType = /*(iCanvasVisualData->iBackground->BackgroundColor().Alpha() == 255) ?*/ EHuiCanvasPaintTypeOpaque;// : EHuiCanvasPaintTypeTransparent; |
1000 return background; |
1014 return background; |
1001 } |
1015 } |
|
1016 else |
|
1017 { |
|
1018 aIndex--; |
|
1019 } |
1002 } |
1020 } |
1003 } |
1021 } |
1004 |
1022 |
1005 return iCanvasVisualData->iCanvasPainter->PaintedArea(aIndex); |
1023 return iCanvasVisualData->iCanvasPainter->PaintedArea(aIndex); |
1006 } |
1024 } |
1541 |
1559 |
1542 EXPORT_C TBool CHuiCanvasVisual::HasTransParentClear() const |
1560 EXPORT_C TBool CHuiCanvasVisual::HasTransParentClear() const |
1543 { |
1561 { |
1544 return iCanvasVisualData->iCanvasPainter->HasCommandBuffers(EHuiCanvasBufferContainsTransparentClear); |
1562 return iCanvasVisualData->iCanvasPainter->HasCommandBuffers(EHuiCanvasBufferContainsTransparentClear); |
1545 } |
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 } |