216 iDeletionObservers.Reset(); |
216 iDeletionObservers.Reset(); |
217 iRefreshObservers.Reset(); |
217 iRefreshObservers.Reset(); |
218 iVisibleAreaObservers.Reset(); |
218 iVisibleAreaObservers.Reset(); |
219 iRosterObservers.Reset(); |
219 iRosterObservers.Reset(); |
220 |
220 |
|
221 iTempDirtyRegions.Close(); |
|
222 |
221 iDirtyRegions.Close(); |
223 iDirtyRegions.Close(); |
222 iDirtyRegions2.Close(); |
224 iDirtyRegions2.Close(); |
223 if ( iCurrentDirtyRegions ) |
225 if ( iCurrentDirtyRegions ) |
224 { |
226 { |
225 iCurrentDirtyRegions->Close(); |
227 iCurrentDirtyRegions->Close(); |
647 TBool useDirtyRects = (RenderSurface().Flags() & MHuiRenderSurface::EFlagUseDirtyRects) |
649 TBool useDirtyRects = (RenderSurface().Flags() & MHuiRenderSurface::EFlagUseDirtyRects) |
648 == MHuiRenderSurface::EFlagUseDirtyRects; |
650 == MHuiRenderSurface::EFlagUseDirtyRects; |
649 |
651 |
650 iWholeDisplayAreaIsDirty = EFalse; |
652 iWholeDisplayAreaIsDirty = EFalse; |
651 |
653 |
|
654 // Restore state to defaults. Alf client may have done some NVG drawing outside refresh loop and main drawing context may be wrong |
|
655 iGc->RestoreState(); |
|
656 |
652 if(iUpdateRenderState) |
657 if(iUpdateRenderState) |
653 { |
658 { |
654 // Set state when requested. |
659 // Set state when requested. |
655 iGc->InitState(); |
660 iGc->InitState(); |
656 iGc->SetProjection(); |
661 iGc->SetProjection(); |
732 |
737 |
733 // Form the real list of dirty regions by combining the dirty regions of |
738 // Form the real list of dirty regions by combining the dirty regions of |
734 // this frame and the previous frame (this is needed when buffer swapping |
739 // this frame and the previous frame (this is needed when buffer swapping |
735 // is used; with buffer copying a single list of dirty regions would |
740 // is used; with buffer copying a single list of dirty regions would |
736 // suffice). |
741 // suffice). |
737 RDirtyRegions dirty; |
742 |
|
743 |
|
744 iTempDirtyRegions.Reset(); |
738 for(i = 0; i < iCurrentDirtyRegions->Count(); ++i) |
745 for(i = 0; i < iCurrentDirtyRegions->Count(); ++i) |
739 { |
746 { |
740 dirty.Append((*iCurrentDirtyRegions)[i]); |
747 iTempDirtyRegions.Append((*iCurrentDirtyRegions)[i]); |
741 } |
748 } |
742 if (iPreviousDirtyRegions) |
749 if (iPreviousDirtyRegions) |
743 { |
750 { |
744 for(i = 0; i < iPreviousDirtyRegions->Count(); ++i) |
751 for(i = 0; i < iPreviousDirtyRegions->Count(); ++i) |
745 { |
752 { |
746 AddDirtyRegion((*iPreviousDirtyRegions)[i], dirty, EFalse); |
753 AddDirtyRegion((*iPreviousDirtyRegions)[i], iTempDirtyRegions, EFalse); |
747 } |
754 } |
748 } |
755 } |
749 |
756 |
750 // Do initializations for new frame |
757 // Do initializations for new frame |
751 // initnewframe may clear the screen, and it may be that |
758 // initnewframe may clear the screen, and it may be that |
792 TBool dirtyRegionsCleaned = ETrue; |
799 TBool dirtyRegionsCleaned = ETrue; |
793 |
800 |
794 // Set dirty rect in render surface to minimize screen update |
801 // Set dirty rect in render surface to minimize screen update |
795 // Only implemented for BitGdi renderer for now |
802 // Only implemented for BitGdi renderer for now |
796 TRect mergedDirtyRect; |
803 TRect mergedDirtyRect; |
797 if (dirty.Count() > 0) |
804 if (iTempDirtyRegions.Count() > 0) |
798 { |
805 { |
799 mergedDirtyRect = dirty[0]; |
806 mergedDirtyRect = iTempDirtyRegions[0]; |
800 } |
807 } |
801 |
808 |
802 if (useDirtyRects) |
809 if (useDirtyRects) |
803 { |
810 { |
804 // When Bitgdi renderer used set dirty rect in render surface |
811 // When Bitgdi renderer used set dirty rect in render surface |
805 // to minimize screen update in CHuiBitgdiRenderSurface::SwapBuffers |
812 // to minimize screen update in CHuiBitgdiRenderSurface::SwapBuffers |
806 if (dirty.Count() == 1) |
813 if (iTempDirtyRegions.Count() == 1) |
807 { |
814 { |
808 ClipDirtyRect(mergedDirtyRect, VisibleAreaClippingRect()); |
815 ClipDirtyRect(mergedDirtyRect, VisibleAreaClippingRect()); |
809 iRenderSurface->SetDirtyRect(mergedDirtyRect); |
816 iRenderSurface->SetDirtyRect(mergedDirtyRect); |
810 } |
817 } |
811 else if (dirty.Count() > 1) |
818 else if (iTempDirtyRegions.Count() > 1) |
812 { |
819 { |
813 for(i = 1; i < dirty.Count(); ++i) |
820 for(i = 1; i < iTempDirtyRegions.Count(); ++i) |
814 { |
821 { |
815 TRect r(dirty[i]); |
822 TRect r(iTempDirtyRegions[i]); |
816 // check top left corner to expand or not |
823 // check top left corner to expand or not |
817 if (r.iTl.iX < mergedDirtyRect.iTl.iX) |
824 if (r.iTl.iX < mergedDirtyRect.iTl.iX) |
818 { |
825 { |
819 mergedDirtyRect.iTl.iX = r.iTl.iX; |
826 mergedDirtyRect.iTl.iX = r.iTl.iX; |
820 } |
827 } |
850 } |
857 } |
851 |
858 |
852 // Merge into max one dirty area when HW accelrated drawing is used |
859 // Merge into max one dirty area when HW accelrated drawing is used |
853 if (useDirtyRects && IsRendererHWAccelerated()) |
860 if (useDirtyRects && IsRendererHWAccelerated()) |
854 { |
861 { |
855 dirty.Reset(); |
862 iTempDirtyRegions.Reset(); |
856 dirty.Append(mergedDirtyRect); |
863 iTempDirtyRegions.Append(mergedDirtyRect); |
857 } |
864 } |
858 |
865 |
859 #ifdef HUI_DEBUG_PRINT_PERFORMANCE_INTERVAL |
866 #ifdef HUI_DEBUG_PRINT_PERFORMANCE_INTERVAL |
860 RDebug::Print(_L("CHuiDisplay::Refresh: Merged dirty rect: %d %d %d %d"), |
867 RDebug::Print(_L("CHuiDisplay::Refresh: Merged dirty rect: %d %d %d %d"), |
861 mergedDirtyRect.iTl.iX, |
868 mergedDirtyRect.iTl.iX, |
863 mergedDirtyRect.iBr.iX, |
870 mergedDirtyRect.iBr.iX, |
864 mergedDirtyRect.iBr.iY); |
871 mergedDirtyRect.iBr.iY); |
865 #endif |
872 #endif |
866 |
873 |
867 // Usually there is only one dirty region (if any). |
874 // Usually there is only one dirty region (if any). |
868 for(i = 0; i < dirty.Count(); ++i) |
875 iCurrentDirtyIndx = 0; |
|
876 for(; iCurrentDirtyIndx < iTempDirtyRegions.Count(); ++iCurrentDirtyIndx) |
869 { |
877 { |
870 // Set up the clipping rectangle. |
878 // Set up the clipping rectangle. |
871 TRect dirtyRect = dirty[i]; |
879 TRect dirtyRect = iTempDirtyRegions[iCurrentDirtyIndx]; |
872 ClipDirtyRect(dirtyRect, VisibleAreaClippingRect()); |
880 ClipDirtyRect(dirtyRect, VisibleAreaClippingRect()); |
873 |
881 |
874 iGc->PushClip(); |
882 iGc->PushClip(); |
875 iGc->Clip(dirtyRect); |
883 iGc->Clip(dirtyRect); |
876 |
884 |
884 iBackgroundColor.SetAlpha(0); |
892 iBackgroundColor.SetAlpha(0); |
885 ClearWithColor( dirtyRect ); |
893 ClearWithColor( dirtyRect ); |
886 iBackgroundColor = oldBgColor; |
894 iBackgroundColor = oldBgColor; |
887 } |
895 } |
888 |
896 |
889 // Clear background for the dirty area |
897 |
890 if (iBackgroundItems.Count() != 0) |
|
891 { |
|
892 ClearWithBackgroundItems(dirtyRect); |
|
893 } |
|
894 else |
|
895 { |
|
896 switch (iClearBackground) |
|
897 { |
|
898 case EClearWithColor: |
|
899 { |
|
900 ClearWithColor(dirtyRect); |
|
901 break; |
|
902 } |
|
903 case EClearWithSkinBackground: |
|
904 { |
|
905 ClearWithSkinBackground(dirtyRect); |
|
906 break; |
|
907 } |
|
908 case EClearNone: |
|
909 default: |
|
910 { |
|
911 // Don't do anything |
|
912 break; |
|
913 } |
|
914 } |
|
915 } |
|
916 |
|
917 if ( iForegroundBitmapGc && iForegroundTextureTransparency ) |
898 if ( iForegroundBitmapGc && iForegroundTextureTransparency ) |
918 { |
899 { |
919 // There is ALF content in the background, we have to |
900 // There is ALF content in the background, we have to |
920 // clear foreground bitmap. |
901 // clear foreground bitmap. |
921 |
902 |
963 |
944 |
964 // Return to the clipping rectangle that was in use previously. |
945 // Return to the clipping rectangle that was in use previously. |
965 iGc->PopClip(); |
946 iGc->PopClip(); |
966 } |
947 } |
967 |
948 |
968 dirty.Reset(); |
949 iTempDirtyRegions.Reset(); |
969 |
950 |
970 // There must be no disparity in the number of pushed clipping rectangles. |
951 // There must be no disparity in the number of pushed clipping rectangles. |
971 // (equivalent to __ASSERT_ALWAYS) |
952 // (equivalent to __ASSERT_ALWAYS) |
972 if(iGc->ClipStackCount() > markedClipStackCount) |
953 if(iGc->ClipStackCount() > markedClipStackCount) |
973 { |
954 { |
1785 oldSurface->MakeCurrent(); |
1766 oldSurface->MakeCurrent(); |
1786 } |
1767 } |
1787 |
1768 |
1788 User::LeaveIfError( err ); |
1769 User::LeaveIfError( err ); |
1789 } |
1770 } |
|
1771 |
|
1772 void CHuiDisplay::DoBackgroundClear() |
|
1773 { |
|
1774 if(iForegroundTextureTransparency) // alf application is visible -> clear background as requested |
|
1775 { |
|
1776 // Clear background for the dirty area |
|
1777 TRect dirtyRect = iTempDirtyRegions[iCurrentDirtyIndx]; |
|
1778 if (iBackgroundItems.Count() != 0) |
|
1779 { |
|
1780 ClearWithBackgroundItems(dirtyRect); |
|
1781 } |
|
1782 else |
|
1783 { |
|
1784 switch (iClearBackground) |
|
1785 { |
|
1786 case EClearWithColor: |
|
1787 { |
|
1788 ClearWithColor(dirtyRect); |
|
1789 break; |
|
1790 } |
|
1791 case EClearWithSkinBackground: |
|
1792 { |
|
1793 ClearWithSkinBackground(dirtyRect); |
|
1794 break; |
|
1795 } |
|
1796 case EClearNone: |
|
1797 default: |
|
1798 { |
|
1799 // Don't do anything |
|
1800 break; |
|
1801 } |
|
1802 } |
|
1803 } |
|
1804 } |
|
1805 } |
|
1806 |