48 #include <uiacceltk/huidisplaybackgrounditem.h> |
48 #include <uiacceltk/huidisplaybackgrounditem.h> |
49 #include "huiskinbackroundlayout.h" |
49 #include "huiskinbackroundlayout.h" |
50 #include "HuiFxEngine.h" |
50 #include "HuiFxEngine.h" |
51 #include "huiextension.h" |
51 #include "huiextension.h" |
52 |
52 |
|
53 #include <e32math.h> |
|
54 |
|
55 //#define DEBUG_SW_MODE_DIRTY_AREAS |
|
56 |
53 const TUid KHuiInternalFbsBitmapBufferGcUid = {0x2000e5a3}; |
57 const TUid KHuiInternalFbsBitmapBufferGcUid = {0x2000e5a3}; |
54 |
58 |
55 //#define HUI_DEBUG_PRINT_PERFORMANCE_INTERVAL |
59 //#define HUI_DEBUG_PRINT_PERFORMANCE_INTERVAL |
56 |
60 |
57 |
61 |
185 |
189 |
186 // When dirty regions are transformed it is possible to avoid |
190 // When dirty regions are transformed it is possible to avoid |
187 // full display refresh in many cases -> better performance. |
191 // full display refresh in many cases -> better performance. |
188 iGc->EnableTransformedClippingRects(iUseTransformedDirtyRegions); |
192 iGc->EnableTransformedClippingRects(iUseTransformedDirtyRegions); |
189 |
193 |
|
194 iDisplaySizeChangePending = EFalse; |
|
195 |
190 HUI_DEBUG1(_L("CHuiDisplay::ConstructL - Free memory when exiting ConstructL: %i"), HuiUtil::FreeMemory()); |
196 HUI_DEBUG1(_L("CHuiDisplay::ConstructL - Free memory when exiting ConstructL: %i"), HuiUtil::FreeMemory()); |
191 } |
197 } |
192 |
198 |
193 |
199 |
194 EXPORT_C CHuiDisplay::~CHuiDisplay() |
200 EXPORT_C CHuiDisplay::~CHuiDisplay() |
882 for(; iCurrentDirtyIndx < iTempDirtyRegions.Count(); ++iCurrentDirtyIndx) |
888 for(; iCurrentDirtyIndx < iTempDirtyRegions.Count(); ++iCurrentDirtyIndx) |
883 { |
889 { |
884 // Set up the clipping rectangle. |
890 // Set up the clipping rectangle. |
885 TRect dirtyRect = iTempDirtyRegions[iCurrentDirtyIndx]; |
891 TRect dirtyRect = iTempDirtyRegions[iCurrentDirtyIndx]; |
886 ClipDirtyRect(dirtyRect, VisibleAreaClippingRect()); |
892 ClipDirtyRect(dirtyRect, VisibleAreaClippingRect()); |
887 |
893 iCurrentDirtyRect = dirtyRect; |
888 iGc->PushClip(); |
894 iGc->PushClip(); |
889 iGc->Clip(dirtyRect); |
895 iGc->Clip(dirtyRect); |
890 |
896 |
891 if ( iForegroundBitmapGc && !RosterImpl().IsVisibleContentFrozen() ) |
897 if ( iForegroundBitmapGc && !RosterImpl().IsVisibleContentFrozen() ) |
892 { |
898 { |
912 |
918 |
913 iForegroundBitmapGc->SetDrawMode(CGraphicsContext::EDrawModeWriteAlpha); |
919 iForegroundBitmapGc->SetDrawMode(CGraphicsContext::EDrawModeWriteAlpha); |
914 iForegroundBitmapGc->SetPenColor(clearColor); |
920 iForegroundBitmapGc->SetPenColor(clearColor); |
915 iForegroundBitmapGc->SetBrushColor(clearColor); |
921 iForegroundBitmapGc->SetBrushColor(clearColor); |
916 iForegroundBitmapGc->SetBrushStyle(CGraphicsContext::ESolidBrush); |
922 iForegroundBitmapGc->SetBrushStyle(CGraphicsContext::ESolidBrush); |
917 iForegroundBitmapGc->Clear(); |
923 iForegroundBitmapGc->Clear(dirtyRect); |
918 iForegroundBitmapGc->Reset(); |
924 iForegroundBitmapGc->Reset(); |
919 } |
925 } |
920 |
926 |
921 for(TInt i = 0; i < iRosterObservers.Count(); i++) |
927 for(TInt i = 0; i < iRosterObservers.Count(); i++) |
922 { |
928 { |
973 iCurrentDirtyRegions = tmp; |
979 iCurrentDirtyRegions = tmp; |
974 } |
980 } |
975 |
981 |
976 // Clear current dirty regions |
982 // Clear current dirty regions |
977 iCurrentDirtyRegions->Reset(); |
983 iCurrentDirtyRegions->Reset(); |
978 |
984 |
979 // Trick to swap gles buffers if we are drawing idle screens before refresh loop is going to |
|
980 // sleep. |
|
981 if( IsRendererHWAccelerated() && !iGotDirtyReports && !iScreenBufferObserver) |
|
982 { |
|
983 //RenderSurface().SwapBuffers(); [ohi] |
|
984 } |
|
985 |
|
986 // Tell the screen buffer observer that the buffer is complete |
|
987 if(iScreenBufferObserver) |
|
988 { |
|
989 SetScreenBufferLock(ETrue); // the observer should do unlock! |
|
990 |
|
991 TRect rect(VisibleArea()); // This is not the real display rect in ALF display case(!) |
|
992 TRect dirtyRect(mergedDirtyRect); |
|
993 |
|
994 // Update screen buffer GC bitmap |
|
995 if (DisplayType() != CHuiDisplay::EDisplayOffScreenBuffer) |
|
996 { |
|
997 TRAP_IGNORE(CHuiStatic::Renderer().UpdateOffScreenBitmapL(*this)); |
|
998 } |
|
999 |
|
1000 if (iScreenBufferObserver->ScreenBufferComplete(iScreenBufferUid, rect, dirtyRect)) |
|
1001 { |
|
1002 SetScreenBufferLock(EFalse); |
|
1003 } |
|
1004 } |
|
1005 |
|
1006 iWholeDisplayAreaIsDirty = EFalse; |
985 iWholeDisplayAreaIsDirty = EFalse; |
1007 |
986 |
1008 HUI_PROBE_PROGRAMFLOW_EXIT(MHuiProbe::EProgramFlowPointRefresh) |
987 HUI_PROBE_PROGRAMFLOW_EXIT(MHuiProbe::EProgramFlowPointRefresh) |
1009 HUI_DEBUGF(_L("CHuiDisplay::Refresh() - Exiting.")); |
988 HUI_DEBUGF(_L("CHuiDisplay::Refresh() - Exiting.")); |
1010 |
989 |
1631 TBool CHuiDisplay::AlfContentChanged() |
1610 TBool CHuiDisplay::AlfContentChanged() |
1632 { |
1611 { |
1633 return iDisplayContainsChangedAlfContent; |
1612 return iDisplayContainsChangedAlfContent; |
1634 } |
1613 } |
1635 |
1614 |
|
1615 EXPORT_C void CHuiDisplay::SetSkinSizeChangePending() |
|
1616 { |
|
1617 iDisplaySizeChangePending = ETrue; |
|
1618 } |
|
1619 |
|
1620 TBool CHuiDisplay::QueryAndResetSkinSizeChangePendingStatus() |
|
1621 { |
|
1622 TBool ret = iDisplaySizeChangePending; |
|
1623 iDisplaySizeChangePending = EFalse; |
|
1624 return ret; |
|
1625 } |
|
1626 |
1636 void CHuiDisplay::ClipDirtyRect(TRect& aRect, TRect aClippingRect) |
1627 void CHuiDisplay::ClipDirtyRect(TRect& aRect, TRect aClippingRect) |
1637 { |
1628 { |
1638 if (aRect.Intersects(aClippingRect)) |
1629 if (aRect.Intersects(aClippingRect)) |
1639 { |
1630 { |
1640 aRect.Intersection(aClippingRect); |
1631 aRect.Intersection(aClippingRect); |
1669 |
1660 |
1670 void CHuiDisplay::UpdateForegroundTexture(const TRect& aRect) |
1661 void CHuiDisplay::UpdateForegroundTexture(const TRect& aRect) |
1671 { |
1662 { |
1672 if (iForegroundTexture && iForegroundBitmap && !aRect.IsEmpty()) |
1663 if (iForegroundTexture && iForegroundBitmap && !aRect.IsEmpty()) |
1673 { |
1664 { |
|
1665 #if defined(DEBUG_SW_MODE_DIRTY_AREAS) |
|
1666 TRgb penColor = TRgb(Math::Random()); |
|
1667 penColor.SetAlpha(128); |
|
1668 iForegroundBitmapGc->SetPenStyle(CGraphicsContext::ESolidPen); |
|
1669 iForegroundBitmapGc->SetBrushStyle(CGraphicsContext::ESolidBrush); |
|
1670 iForegroundBitmapGc->SetPenColor(penColor); |
|
1671 iForegroundBitmapGc->SetBrushColor(penColor); |
|
1672 iForegroundBitmapGc->DrawRect(aRect); |
|
1673 #endif |
1674 TRAP_IGNORE(DoUpdateForegroundTextureL(aRect)); |
1674 TRAP_IGNORE(DoUpdateForegroundTextureL(aRect)); |
1675 } |
1675 } |
1676 } |
1676 } |
1677 |
1677 |
1678 void CHuiDisplay::DoUpdateForegroundTextureL(const TRect& aRect) |
1678 void CHuiDisplay::DoUpdateForegroundTextureL(const TRect& aRect) |