44 #include "Matrix.h" |
44 #include "Matrix.h" |
45 |
45 |
46 |
46 |
47 #include "HuiFxEffect.h" |
47 #include "HuiFxEffect.h" |
48 #include "HuiCmdBufferBrush.h" |
48 #include "HuiCmdBufferBrush.h" |
|
49 #include "huiextension.h" |
|
50 |
|
51 #include "huiwscanvascommands.h" |
49 |
52 |
50 /** Flag to convienintly disable/enable canvas render buffer usage if needed */ |
53 /** Flag to convienintly disable/enable canvas render buffer usage if needed */ |
51 /* Turned to EFalse as DFS77 was having booting problems in wk26 */ |
54 /* Turned to EFalse as DFS77 was having booting problems in wk26 */ |
52 /* Now checked dynamically from CHuiRenderer to allow different behaviour in DFS77 and DFS79 */ |
55 /* Now checked dynamically from CHuiRenderer to allow different behaviour in DFS77 and DFS79 */ |
53 //const TBool KHuiCanvasVisualUseRenderBuffer = EFalse; |
56 //const TBool KHuiCanvasVisualUseRenderBuffer = EFalse; |
91 } |
94 } |
92 |
95 |
93 void CHuiCanvasVisual::ConstructL() |
96 void CHuiCanvasVisual::ConstructL() |
94 { |
97 { |
95 CHuiLayout::ConstructL(); |
98 CHuiLayout::ConstructL(); |
96 |
99 |
|
100 SetFlags(EHuiVisualFlagWserv); |
|
101 |
97 iCanvasVisualData = new (ELeave) THuiCanvasVisualData; |
102 iCanvasVisualData = new (ELeave) THuiCanvasVisualData; |
98 iCanvasVisualData->iCommandSetType = ECommandBufferWs; |
103 iCanvasVisualData->iCommandSetType = ECommandBufferWs; |
99 iCanvasVisualData->iCanvasFlags = 0; |
104 iCanvasVisualData->iCanvasFlags = 0; |
100 iCanvasVisualData->iExternalContentVisual = NULL; |
105 iCanvasVisualData->iExternalContentVisual = NULL; |
101 iCanvasVisualData->iParentCanvas = NULL; |
106 iCanvasVisualData->iParentCanvas = NULL; |
102 iCanvasVisualData->iBackground = NULL; |
107 iCanvasVisualData->iBackground = NULL; |
103 iCanvasVisualData->iCanvasPainter = NULL; |
108 iCanvasVisualData->iCanvasPainter = NULL; |
|
109 iCanvasVisualData->iStoredRenderBuffer = 0; |
104 |
110 |
105 iCanvasVisualData->iBackground = CHuiCanvasBackground::NewL(); |
111 iCanvasVisualData->iBackground = CHuiCanvasBackground::NewL(); |
106 iCanvasVisualData->iBackground->SetVisual(this); |
112 iCanvasVisualData->iBackground->SetVisual(this); |
107 |
113 |
108 iCanvasVisualData->iCanvasPainter = CHuiCanvasWsPainter::NewL(); |
114 iCanvasVisualData->iCanvasPainter = CHuiCanvasWsPainter::NewL(); |
109 iCanvasVisualData->iCanvasPainter->SetVisual(this); |
115 iCanvasVisualData->iCanvasPainter->SetVisual(this); |
110 iCanvasVisualData->iStoredRenderBuffer = 0; |
|
111 |
116 |
112 TBool useCanvasRenderBuffer = CHuiStatic::Renderer().Allows(EHuiRenderPluginAllowVisualPBufferSurfaces); |
117 TBool useCanvasRenderBuffer = CHuiStatic::Renderer().Allows(EHuiRenderPluginAllowVisualPBufferSurfaces); |
113 iCanvasVisualData->iCanvasPainter->EnableRenderBuffer(useCanvasRenderBuffer); |
118 iCanvasVisualData->iCanvasPainter->EnableRenderBuffer(useCanvasRenderBuffer); |
114 |
119 |
115 iCanvasVisualData->iLayerUsesAlphaFlag = EFalse; |
120 iCanvasVisualData->iLayerUsesAlphaFlag = EFalse; |
116 iCanvasVisualData->iLayerExtent = TRect(); |
121 iCanvasVisualData->iLayerExtent = TRect(); |
117 |
122 |
118 // subwindow effects |
123 // subwindow effects |
119 EnableBrushesL(ETrue); |
124 //EnableBrushesL(ETrue); |
120 } |
125 } |
121 |
126 |
122 |
127 |
123 CHuiCanvasVisual::~CHuiCanvasVisual() |
128 CHuiCanvasVisual::~CHuiCanvasVisual() |
124 { |
129 { |
125 FreeRenderBuffer(); |
130 |
126 if(iCanvasVisualData->iExternalContentVisual) |
131 FreeRenderBuffer(); |
127 { |
132 if (iCanvasVisualData) |
128 // Allow the external content visual to be drawn normally |
133 { |
129 iCanvasVisualData->iExternalContentVisual->ClearFlag(EHuiVisualFlagDrawOnlyAsExternalContent); |
134 if(iCanvasVisualData->iExternalContentVisual) |
130 } |
135 { |
|
136 // Allow the external content visual to be drawn normally |
|
137 iCanvasVisualData->iExternalContentVisual->ClearFlag(EHuiVisualFlagDrawOnlyAsExternalContent); |
|
138 } |
|
139 ClearCommandSet(); |
|
140 if ( iCanvasVisualData->iBackground ) |
|
141 { |
|
142 delete iCanvasVisualData->iBackground; |
|
143 iCanvasVisualData->iBackground = NULL; |
|
144 } |
|
145 if ( iCanvasVisualData->iCanvasPainter ) |
|
146 { |
|
147 delete iCanvasVisualData->iCanvasPainter; |
|
148 iCanvasVisualData->iCanvasPainter = NULL; |
|
149 } |
|
150 |
131 |
151 |
132 if (iCanvasVisualData) |
|
133 { |
|
134 ClearCommandSet(); |
|
135 delete iCanvasVisualData->iBackground; |
|
136 iCanvasVisualData->iBackground = NULL; |
|
137 delete iCanvasVisualData->iCanvasPainter; |
|
138 iCanvasVisualData->iCanvasPainter = NULL; |
|
139 iCanvasVisualData->iExternalContentVisual = NULL; |
152 iCanvasVisualData->iExternalContentVisual = NULL; |
140 |
153 |
141 // Tell parent that we are destructed |
154 // Tell parent that we are destructed |
142 if (iCanvasVisualData->iParentCanvas) |
155 if (iCanvasVisualData->iParentCanvas) |
143 { |
156 { |
330 return; |
343 return; |
331 } |
344 } |
332 |
345 |
333 if ((IsDelayedEffectSource() || Freezed())) |
346 if ((IsDelayedEffectSource() || Freezed())) |
334 { |
347 { |
|
348 // Select right draw mode |
|
349 THuiCanvasDrawMode drawMode = (Flags() & EHuiVisualFlagOpaqueHint) ? EHuiCanvasDrawModeNormal : EHuiCanvasDrawModeBlend; |
|
350 |
335 if (StoredRenderBuffer()) |
351 if (StoredRenderBuffer()) |
336 { |
352 { |
337 DrawStoredFullScreenRenderBuffer(aGc); |
353 DrawStoredFullScreenRenderBuffer(drawMode, aGc); |
338 return; |
354 return; |
339 } |
355 } |
340 else if (iCanvasVisualData->iStoredRenderBuffer) |
356 else if (iCanvasVisualData->iStoredRenderBuffer) |
341 { |
357 { |
342 DrawStoredVisualRenderBuffer(); |
358 DrawStoredVisualRenderBuffer(drawMode); |
343 return; |
359 return; |
344 } |
360 } |
345 } |
361 } |
346 |
362 |
347 // If this visual is completely under another visual, then this visual |
363 // If this visual is completely under another visual, then this visual |
490 } |
506 } |
491 } |
507 } |
492 |
508 |
493 if ((IsDelayedEffectSource() || Freezed())) |
509 if ((IsDelayedEffectSource() || Freezed())) |
494 { |
510 { |
|
511 // Select right draw mode |
|
512 THuiCanvasDrawMode drawMode = (Flags() & EHuiVisualFlagOpaqueHint) ? EHuiCanvasDrawModeNormal : EHuiCanvasDrawModeBlend; |
|
513 |
495 if (StoredRenderBuffer()) |
514 if (StoredRenderBuffer()) |
496 { |
515 { |
497 DrawStoredFullScreenRenderBuffer(aGc); |
516 DrawStoredFullScreenRenderBuffer(drawMode, aGc); |
498 return; |
517 return; |
499 } |
518 } |
500 else if (iCanvasVisualData->iStoredRenderBuffer) |
519 else if (iCanvasVisualData->iStoredRenderBuffer) |
501 { |
520 { |
502 DrawStoredVisualRenderBuffer(); |
521 DrawStoredVisualRenderBuffer(drawMode); |
503 return; |
522 return; |
504 } |
523 } |
505 } |
524 } |
506 |
525 |
507 // Use 'under opaque' hint to optimize drawing. |
526 // Use 'under opaque' hint to optimize drawing. |
588 // Draw child windows, begin |
607 // Draw child windows, begin |
589 TBool afterOthers = EFalse; |
608 TBool afterOthers = EFalse; |
590 const TInt count = Count(); |
609 const TInt count = Count(); |
591 for(TInt i = 0; i < count; ++i) |
610 for(TInt i = 0; i < count; ++i) |
592 { |
611 { |
593 // This cast is not really safe, but dynamic cast is slow |
612 CHuiVisual* visual = iHuiLayoutPrivateData->iChildren[i]; |
594 CHuiCanvasVisual* visual = (CHuiCanvasVisual*) iHuiLayoutPrivateData->iChildren[i]; |
613 |
595 //Ignore inactive child visuals |
614 //Ignore inactive child visuals |
596 if ((visual->Flags()& EHuiVisualFlagInactive)) |
615 if ((visual->Flags()& EHuiVisualFlagInactive)) |
597 { |
616 { |
598 continue; |
617 continue; |
599 } |
618 } |
600 |
619 |
601 if (aIncludeCanvasFlags && !(visual->CanvasFlags()& aIncludeCanvasFlags)) |
620 TInt canvasFlags = 0; |
|
621 if (aIncludeCanvasFlags || aExcludeCanvasFlags) |
|
622 { |
|
623 canvasFlags = visual->QueryCanvasFlags(); |
|
624 } |
|
625 |
|
626 if (aIncludeCanvasFlags && !(canvasFlags & aIncludeCanvasFlags)) |
602 { |
627 { |
603 continue; |
628 continue; |
604 } |
629 } |
605 |
630 |
606 if (aExcludeCanvasFlags && (visual->CanvasFlags()& aExcludeCanvasFlags)) |
631 if (aExcludeCanvasFlags && (canvasFlags & aExcludeCanvasFlags)) |
607 { |
632 { |
608 continue; |
633 continue; |
609 } |
634 } |
610 |
635 |
611 if(visual->Flags() & EHuiVisualFlagDrawAfterOthers) |
636 if(visual->Flags() & EHuiVisualFlagDrawAfterOthers) |
647 } |
672 } |
648 |
673 |
649 return hasChanged; |
674 return hasChanged; |
650 } |
675 } |
651 |
676 |
|
677 // Goes through visual hierarchy and checks if any visual has changed. |
|
678 // This method does not modify any visuals. Parameter is not const |
|
679 // because of CanvasVisual method. |
|
680 TBool CHuiCanvasVisual::RecursiveChildTreeChanged(CHuiVisual* aVisual, TInt aExcludeCanvasFlags) |
|
681 { |
|
682 TBool changed = EFalse; |
|
683 |
|
684 // Check wheter we should include this visual or igonre it. |
|
685 if (aExcludeCanvasFlags) |
|
686 { |
|
687 if ( !(aVisual->Flags() & EHuiVisualFlagInactive) ) |
|
688 { |
|
689 TInt canvasFlags = aVisual->QueryCanvasFlags(); |
|
690 |
|
691 if ( !(canvasFlags & aExcludeCanvasFlags) ) |
|
692 { |
|
693 changed |= aVisual->Changed(); |
|
694 } |
|
695 } |
|
696 } |
|
697 |
|
698 if ( !changed ) |
|
699 { |
|
700 const TInt count = aVisual->Count(); |
|
701 for(TInt i = 0; i < count; ++i) |
|
702 { |
|
703 CHuiVisual* visual = &aVisual->Visual(i); |
|
704 changed |= RecursiveChildTreeChanged( visual, aExcludeCanvasFlags ); |
|
705 if ( changed ) |
|
706 { |
|
707 break; |
|
708 } |
|
709 } |
|
710 } |
|
711 return changed; |
|
712 } |
|
713 |
652 TBool CHuiCanvasVisual::ChildTreeChanged(TInt aExcludeCanvasFlags) const |
714 TBool CHuiCanvasVisual::ChildTreeChanged(TInt aExcludeCanvasFlags) const |
653 { |
715 { |
654 // CHuiLayout::Changed() does not check children. |
716 // CHuiLayout::Changed() does not check children. |
655 // This utility method checks whole child tree below this visual. |
717 // This utility method checks whole child tree below this visual. |
656 TBool changed = EFalse; |
718 return RecursiveChildTreeChanged( |
657 |
719 const_cast<CHuiCanvasVisual*>(this), aExcludeCanvasFlags); |
658 // Check wheter we should include this visual or igonre it. |
720 } |
659 if (aExcludeCanvasFlags) |
|
660 { |
|
661 if (!(iCanvasVisualData->iCanvasFlags & aExcludeCanvasFlags)) |
|
662 { |
|
663 changed |= Changed(); |
|
664 } |
|
665 } |
|
666 |
|
667 const TInt count = Count(); |
|
668 for(TInt i = 0; i < count; ++i) |
|
669 { |
|
670 CHuiCanvasVisual* visual = (CHuiCanvasVisual*) iHuiLayoutPrivateData->iChildren[i]; |
|
671 changed |= visual->ChildTreeChanged(aExcludeCanvasFlags); |
|
672 if (changed) |
|
673 { |
|
674 break; |
|
675 } |
|
676 } |
|
677 return changed; |
|
678 } |
|
679 |
|
680 |
721 |
681 EXPORT_C void CHuiCanvasVisual::ClearChanged() |
722 EXPORT_C void CHuiCanvasVisual::ClearChanged() |
682 { |
723 { |
683 iCanvasVisualData->iCanvasPainter->ClearAllBuffersChanged(); |
724 iCanvasVisualData->iCanvasPainter->ClearAllBuffersChanged(); |
684 CHuiLayout::ClearChanged(); |
725 CHuiLayout::ClearChanged(); |
813 return; |
857 return; |
814 } |
858 } |
815 |
859 |
816 if (aCommandType == ECommandBufferAlf) |
860 if (aCommandType == ECommandBufferAlf) |
817 { |
861 { |
|
862 ClearFlags(EHuiVisualFlagWserv); |
818 delete iCanvasVisualData->iCanvasPainter; |
863 delete iCanvasVisualData->iCanvasPainter; |
819 iCanvasVisualData->iCanvasPainter = NULL; |
864 iCanvasVisualData->iCanvasPainter = NULL; |
820 iCanvasVisualData->iCommandSetType = ECommandBufferAlf; |
865 iCanvasVisualData->iCommandSetType = ECommandBufferAlf; |
821 iCanvasVisualData->iCanvasPainter = CHuiCanvasAlfPainter::NewL(); |
866 iCanvasVisualData->iCanvasPainter = CHuiCanvasAlfPainter::NewL(); |
822 iCanvasVisualData->iCanvasPainter->SetVisual(this); |
867 iCanvasVisualData->iCanvasPainter->SetVisual(this); |
823 } |
868 } |
824 else if (aCommandType == ECommandBufferWs) |
869 else if (aCommandType == ECommandBufferWs) |
825 { |
870 { |
|
871 SetFlags(EHuiVisualFlagWserv); |
826 delete iCanvasVisualData->iCanvasPainter; |
872 delete iCanvasVisualData->iCanvasPainter; |
827 iCanvasVisualData->iCanvasPainter = NULL; |
873 iCanvasVisualData->iCanvasPainter = NULL; |
828 iCanvasVisualData->iCommandSetType = ECommandBufferWs; |
874 iCanvasVisualData->iCommandSetType = ECommandBufferWs; |
829 iCanvasVisualData->iCanvasPainter = CHuiCanvasWsPainter::NewL(); |
875 iCanvasVisualData->iCanvasPainter = CHuiCanvasWsPainter::NewL(); |
830 iCanvasVisualData->iCanvasPainter->SetVisual(this); |
876 iCanvasVisualData->iCanvasPainter->SetVisual(this); |
981 drawContent = EFalse; |
1027 drawContent = EFalse; |
982 } |
1028 } |
983 return drawContent; |
1029 return drawContent; |
984 } |
1030 } |
985 |
1031 |
|
1032 // Goes through visual hierarchy and checks if any visual has external content drawing enabled. |
|
1033 TBool CHuiCanvasVisual::RecursiveIsExternalContentDrawingEnabled(CHuiVisual* aVisual) |
|
1034 { |
|
1035 TBool drawExternalContent = EFalse; |
|
1036 |
|
1037 const TInt count = aVisual->Count(); |
|
1038 for(TInt i = 0; i < count; ++i) |
|
1039 { |
|
1040 CHuiVisual* visual = &aVisual->Visual(i); |
|
1041 drawExternalContent |= visual->QueryExternalContentDrawingEnabled(); |
|
1042 if ( drawExternalContent ) |
|
1043 { |
|
1044 break; |
|
1045 } |
|
1046 |
|
1047 drawExternalContent |= RecursiveIsExternalContentDrawingEnabled( visual ); |
|
1048 if ( drawExternalContent ) |
|
1049 { |
|
1050 break; |
|
1051 } |
|
1052 } |
|
1053 |
|
1054 return drawExternalContent; |
|
1055 } |
|
1056 |
986 TBool CHuiCanvasVisual::IsExternalContentDrawingEnabled(TBool aIncludeChildren) const |
1057 TBool CHuiCanvasVisual::IsExternalContentDrawingEnabled(TBool aIncludeChildren) const |
987 { |
1058 { |
988 TBool drawExternalContent = EFalse; |
1059 TBool drawExternalContent = EFalse; |
989 if (iCanvasVisualData->iExternalContentVisual) |
1060 if (iCanvasVisualData->iExternalContentVisual) |
990 { |
1061 { |
991 drawExternalContent = ETrue; |
1062 drawExternalContent = ETrue; |
992 } |
1063 } |
993 if (aIncludeChildren) |
1064 if (aIncludeChildren && !drawExternalContent) |
994 { |
1065 { |
995 for (TInt i=0; !drawExternalContent && i<Count(); i++) |
1066 drawExternalContent |= RecursiveIsExternalContentDrawingEnabled( |
996 { |
1067 const_cast<CHuiCanvasVisual*>(this)); |
997 CHuiCanvasVisual* canvasVisual = (CHuiCanvasVisual*) &Visual(i); |
|
998 drawExternalContent |= canvasVisual->IsExternalContentDrawingEnabled(ETrue); |
|
999 } |
|
1000 } |
1068 } |
1001 return drawExternalContent; |
1069 return drawExternalContent; |
1002 } |
1070 } |
1003 |
1071 |
1004 EXPORT_C void CHuiCanvasVisual::SetParentCanvas(CHuiCanvasVisual* aParent) |
1072 EXPORT_C void CHuiCanvasVisual::SetParentCanvas(CHuiCanvasVisual* aParent) |
1152 iCanvasVisualData->iStoredRenderBuffer->InitializeL(content_rb->Size()); |
1226 iCanvasVisualData->iStoredRenderBuffer->InitializeL(content_rb->Size()); |
1153 iCanvasVisualData->iStoredRenderBuffer->Copy(*content_rb); |
1227 iCanvasVisualData->iStoredRenderBuffer->Copy(*content_rb); |
1154 } |
1228 } |
1155 } |
1229 } |
1156 |
1230 |
1157 void CHuiCanvasVisual::DrawStoredVisualRenderBuffer() const |
1231 void CHuiCanvasVisual::DrawStoredVisualRenderBuffer(TInt aCanvasDrawMode) const |
1158 { |
1232 { |
1159 CHuiCanvasGc& gc = CanvasGc(); |
1233 CHuiCanvasGc& gc = CanvasGc(); |
|
1234 CHuiCanvasVisual* visual = NULL; |
|
1235 TBool transparent = EffectiveOpacity() < 1.0f; |
|
1236 gc.SetDrawMode((THuiCanvasDrawMode)aCanvasDrawMode); |
|
1237 if (transparent) |
|
1238 { |
|
1239 gc.EnableEffectiveOpacity(ETrue); |
|
1240 visual = gc.Visual(); |
|
1241 gc.SetVisual(*this); |
|
1242 gc.SetDrawMode(EHuiCanvasDrawModeBlend); |
|
1243 } |
1160 THuiRealPoint dest_point = DisplayRect().iTl; |
1244 THuiRealPoint dest_point = DisplayRect().iTl; |
1161 CHuiCanvasRenderBuffer *stored = iCanvasVisualData->iStoredRenderBuffer; |
1245 CHuiCanvasRenderBuffer *stored = iCanvasVisualData->iStoredRenderBuffer; |
|
1246 |
1162 gc.DrawImage(*stored, dest_point); |
1247 gc.DrawImage(*stored, dest_point); |
1163 } |
1248 if (transparent) |
1164 |
1249 { |
1165 void CHuiCanvasVisual::DrawStoredFullScreenRenderBuffer(CHuiGc& aGc) const |
1250 gc.SetVisual(*visual); |
|
1251 gc.EnableEffectiveOpacity(EFalse); |
|
1252 } |
|
1253 } |
|
1254 |
|
1255 void CHuiCanvasVisual::DrawStoredFullScreenRenderBuffer(TInt aCanvasDrawMode, CHuiGc& aGc) const |
1166 { |
1256 { |
1167 if (!Display()) return; |
1257 if (!Display()) return; |
|
1258 if (!iHuiLayoutPrivateData->iGc) |
|
1259 { |
|
1260 CHuiRenderPlugin& renderplugin = CHuiStatic::Renderer(); |
|
1261 // deleted in CHuiLayout destructor or CHuiCanvasVisual::FreeRenderBuffer when not needed anymore |
|
1262 iHuiLayoutPrivateData->iGc = renderplugin.CreateCanvasGcL(); |
|
1263 } |
1168 CHuiCanvasGc& gc = *iHuiLayoutPrivateData->iGc; |
1264 CHuiCanvasGc& gc = *iHuiLayoutPrivateData->iGc; |
1169 gc.SetGc(aGc); |
1265 gc.SetGc(aGc); |
1170 gc.SetDefaults(); |
1266 gc.SetDefaults(); |
1171 gc.PushTransformationMatrix(); |
1267 gc.PushTransformationMatrix(); |
1172 |
1268 |
1180 gc.Scale(1.f, -1.f, 1.f); |
1276 gc.Scale(1.f, -1.f, 1.f); |
1181 } |
1277 } |
1182 |
1278 |
1183 THuiRealPoint dest_point = DisplayRect().iTl; |
1279 THuiRealPoint dest_point = DisplayRect().iTl; |
1184 CHuiCanvasRenderBuffer *stored = StoredRenderBuffer(); |
1280 CHuiCanvasRenderBuffer *stored = StoredRenderBuffer(); |
1185 gc.DrawImage(*stored, dest_point); |
1281 TBool transparent = EffectiveOpacity() < 1.0f; |
1186 |
1282 CHuiCanvasVisual* visual = NULL; |
|
1283 gc.SetDrawMode((THuiCanvasDrawMode)aCanvasDrawMode); |
|
1284 if (transparent) |
|
1285 { |
|
1286 |
|
1287 gc.EnableEffectiveOpacity(ETrue); |
|
1288 visual = gc.Visual(); |
|
1289 gc.SetVisual(*this); |
|
1290 gc.SetDrawMode(EHuiCanvasDrawModeBlend); |
|
1291 } |
|
1292 gc.DrawImage(*stored, dest_point); |
|
1293 if (transparent) |
|
1294 { |
|
1295 gc.SetVisual(*visual); |
|
1296 gc.EnableEffectiveOpacity(EFalse); |
|
1297 } |
1187 gc.PopTransformationMatrix(); |
1298 gc.PopTransformationMatrix(); |
1188 } |
1299 } |
1189 |
1300 |
1190 EXPORT_C void CHuiCanvasVisual::FreeRenderBuffer() |
1301 EXPORT_C void CHuiCanvasVisual::FreeRenderBuffer() |
1191 { |
1302 { |
1193 { |
1304 { |
1194 if (iCanvasVisualData->iStoredRenderBuffer) |
1305 if (iCanvasVisualData->iStoredRenderBuffer) |
1195 { |
1306 { |
1196 delete iCanvasVisualData->iStoredRenderBuffer; |
1307 delete iCanvasVisualData->iStoredRenderBuffer; |
1197 iCanvasVisualData->iStoredRenderBuffer = NULL; |
1308 iCanvasVisualData->iStoredRenderBuffer = NULL; |
1198 } |
1309 delete iHuiLayoutPrivateData->iGc; |
1199 } |
1310 iHuiLayoutPrivateData->iGc = NULL; |
|
1311 } |
|
1312 } |
|
1313 } |
|
1314 |
|
1315 // Goes through visual hierarchy and checks if any visual has command buffers |
|
1316 // or other drawable content. |
|
1317 TBool CHuiCanvasVisual::RecursiveHasCommandBuffers(CHuiVisual* aVisual) |
|
1318 { |
|
1319 TBool hasCommandBuffers = EFalse; |
|
1320 |
|
1321 const TInt count = aVisual->Count(); |
|
1322 for(TInt i = 0; i < count; ++i) |
|
1323 { |
|
1324 CHuiVisual* visual = &aVisual->Visual(i); |
|
1325 // If visual is a canvas one, then QueryHasDrawableContent returns |
|
1326 // HasCommandBuffers(EFalse) |
|
1327 hasCommandBuffers |= visual->QueryHasDrawableContent(); |
|
1328 if ( hasCommandBuffers ) |
|
1329 { |
|
1330 break; |
|
1331 } |
|
1332 |
|
1333 hasCommandBuffers |= RecursiveHasCommandBuffers( visual ); |
|
1334 if ( hasCommandBuffers ) |
|
1335 { |
|
1336 break; |
|
1337 } |
|
1338 } |
|
1339 |
|
1340 return hasCommandBuffers; |
1200 } |
1341 } |
1201 |
1342 |
1202 EXPORT_C TBool CHuiCanvasVisual::HasCommandBuffers(TBool aIncludeChildren) const |
1343 EXPORT_C TBool CHuiCanvasVisual::HasCommandBuffers(TBool aIncludeChildren) const |
1203 { |
1344 { |
1204 TBool hasCommandBuffers = iCanvasVisualData->iCanvasPainter->HasCommandBuffers(); |
1345 TBool hasCommandBuffers = iCanvasVisualData->iCanvasPainter->HasCommandBuffers(); |
1205 if (aIncludeChildren) |
1346 if (aIncludeChildren && !hasCommandBuffers) |
1206 { |
1347 { |
1207 for (TInt i=0; i<Count(); i++) |
1348 // Include children branch - just check if there is something to draw. |
1208 { |
1349 hasCommandBuffers |= RecursiveHasCommandBuffers(const_cast<CHuiCanvasVisual*>(this)); |
1209 CHuiCanvasVisual* canvasVisual = (CHuiCanvasVisual*) &Visual(i); // Dynamic cast is too slow for us ;) |
|
1210 hasCommandBuffers |= canvasVisual->HasCommandBuffers(aIncludeChildren); |
|
1211 if (hasCommandBuffers) |
|
1212 { |
|
1213 break; |
|
1214 } |
|
1215 } |
|
1216 } |
1350 } |
1217 return hasCommandBuffers; |
1351 return hasCommandBuffers; |
1218 } |
1352 } |
1219 |
1353 |
1220 |
1354 |
1265 aPos.iTl = InnerTopLeft(); |
1399 aPos.iTl = InnerTopLeft(); |
1266 aPos.iBr = aPos.iTl + THuiRealPoint(innerSize.iWidth, innerSize.iHeight) ; |
1400 aPos.iBr = aPos.iTl + THuiRealPoint(innerSize.iWidth, innerSize.iHeight) ; |
1267 return THuiLayoutChildRectLayoutUpdateNeeded; |
1401 return THuiLayoutChildRectLayoutUpdateNeeded; |
1268 } |
1402 } |
1269 |
1403 |
1270 |
1404 void CHuiCanvasVisual::VisualExtension(const TUid& aExtensionUid, TAny** aExtensionParams) |
|
1405 { |
|
1406 if (aExtensionUid == KHuiVisualQueryUid && aExtensionParams && *aExtensionParams) |
|
1407 { |
|
1408 THuiVisualQueryParams* params = static_cast<THuiVisualQueryParams*>(*aExtensionParams); |
|
1409 switch (params->iQueryType) |
|
1410 { |
|
1411 case THuiVisualQueryParams::EQueryCanvasFlags: |
|
1412 params->iValue = CanvasFlags(); |
|
1413 params->iResult = KErrNone; |
|
1414 break; |
|
1415 case THuiVisualQueryParams::EQueryExternalContentDrawingEnabled: |
|
1416 params->iValue = IsExternalContentDrawingEnabled(EFalse); |
|
1417 params->iResult = KErrNone; |
|
1418 break; |
|
1419 case THuiVisualQueryParams::EQueryHasDrawableContent: |
|
1420 params->iValue = HasCommandBuffers(EFalse); |
|
1421 params->iResult = KErrNone; |
|
1422 break; |
|
1423 default: |
|
1424 break; |
|
1425 } |
|
1426 } |
|
1427 else |
|
1428 { |
|
1429 CHuiVisual::VisualExtension(aExtensionUid, aExtensionParams); |
|
1430 } |
|
1431 } |