13 * |
13 * |
14 * Description: |
14 * Description: |
15 * |
15 * |
16 */ |
16 */ |
17 |
17 |
|
18 #include <bitdev.h> |
18 #include <graphics/surface.h> |
19 #include <graphics/surface.h> |
19 #include <graphics/surfacemanager.h> |
20 #include <graphics/surfacemanager.h> |
20 #include <graphics/surfaceupdateclient.h> |
21 #include <graphics/surfaceupdateclient.h> |
21 #include <graphics/surface_hints.h> |
22 #include <graphics/surface_hints.h> |
22 #include <e32math.h> |
23 #include <e32math.h> |
23 #include <apgcli.h> |
24 #include <apgcli.h> |
24 #include "alf/alfcompositionclient.h" |
|
25 |
25 |
26 #include <imageconversion.h> |
26 #include <imageconversion.h> |
27 #include <fbs.h> |
27 #include <fbs.h> |
28 #include <glxtracer.h> |
28 #include <glxtracer.h> |
29 #include <glxlog.h> |
29 #include <glxlog.h> |
30 |
30 |
31 #include "glxactivecallback.h" |
31 #include "glxactivecallback.h" |
32 #include "glxhdmisurfaceupdater.h" |
32 #include "glxhdmisurfaceupdater.h" |
33 #include "glxactivedecoder.h" |
33 #include "glxactivedecoder.h" |
34 #include <bitdev.h> |
|
35 |
34 |
36 const TInt KMulFactorToCreateBitmap = 4; |
35 const TInt KMulFactorToCreateBitmap = 4; |
37 const TInt KZoomDelay = 10000; |
36 const TInt KZoomDelay = 10000; |
38 const TInt KAnimationTicker = 26000; |
37 //const TInt KAnimationTicker = 26000; |
39 const TInt KAnimationTickerFadeIn = 45000; |
38 //const TInt KAnimationTickerFadeIn = 45000; |
40 //100 , is decide for 20 steps of zooming , with each step being 5 pixels. |
39 //100 , is decide for 20 steps of zooming , with each step being 5 pixels. |
41 const TInt KMaxZoomLimit = 100; |
40 const TInt KMaxZoomLimit = 100; |
42 //evey time we zoom , there is a increase in the ht amd width by 10 pixels. |
41 //evey time we zoom , there is a increase in the ht amd width by 10 pixels. |
43 const TInt KSingleStepForZoom = 10; |
42 const TInt KSingleStepForZoom = 10; |
44 |
43 |
45 // constants for fade effect |
|
46 const TInt KFadeSteps = 19; |
|
47 const TReal32 KFadeEachStep = 0.05f; |
|
48 const TReal32 KFullTransparent = 0.0f; |
|
49 const TReal32 KFullOpaque = 1.0f; |
|
50 |
|
51 _LIT(KMimeJpeg,"image/jpeg"); |
44 _LIT(KMimeJpeg,"image/jpeg"); |
52 _LIT(KMimeJpg,"image/jpg"); |
45 _LIT(KMimeJpg,"image/jpg"); |
53 |
46 |
54 // ----------------------------------------------------------------------------- |
47 // ----------------------------------------------------------------------------- |
55 // NewLC |
48 // NewLC |
56 // ----------------------------------------------------------------------------- |
49 // ----------------------------------------------------------------------------- |
57 CGlxHdmiSurfaceUpdater* CGlxHdmiSurfaceUpdater::NewL(RWindow* aWindow, const TDesC& aImageFile, |
50 CGlxHdmiSurfaceUpdater* CGlxHdmiSurfaceUpdater::NewL(RWindow* aWindow, const TDesC& aImageFile, |
58 CFbsBitmap* aFsBitmap, |
51 CFbsBitmap* aFsBitmap, |
59 MGlxGenCallback* aCallBack, |
52 MGlxGenCallback* aCallBack) |
60 TBool aEffectsOn) |
|
61 { |
53 { |
62 TRACER("CGlxHdmiSurfaceUpdater* CGlxHdmiSurfaceUpdater::NewL()"); |
54 TRACER("CGlxHdmiSurfaceUpdater* CGlxHdmiSurfaceUpdater::NewL()"); |
63 CGlxHdmiSurfaceUpdater* self = new (ELeave) CGlxHdmiSurfaceUpdater(aWindow, aCallBack, aEffectsOn); |
55 CGlxHdmiSurfaceUpdater* self = new (ELeave) CGlxHdmiSurfaceUpdater(aWindow, aCallBack); |
64 CleanupStack::PushL(self); |
56 CleanupStack::PushL(self); |
65 self->ConstructL(aFsBitmap,aImageFile); |
57 self->ConstructL(aFsBitmap,aImageFile); |
66 CleanupStack::Pop(self); |
58 CleanupStack::Pop(self); |
67 return self; |
59 return self; |
68 } |
60 } |
72 // ----------------------------------------------------------------------------- |
64 // ----------------------------------------------------------------------------- |
73 CGlxHdmiSurfaceUpdater::~CGlxHdmiSurfaceUpdater() |
65 CGlxHdmiSurfaceUpdater::~CGlxHdmiSurfaceUpdater() |
74 { |
66 { |
75 TRACER("CGlxHdmiSurfaceUpdater::~CGlxHdmiSurfaceUpdater()"); |
67 TRACER("CGlxHdmiSurfaceUpdater::~CGlxHdmiSurfaceUpdater()"); |
76 ReleaseContent(); |
68 ReleaseContent(); |
77 if(iAnimTimer && iAnimTimer->IsActive()) // Check for a CPeriodic Instance |
|
78 { |
|
79 GLX_LOG_INFO("CGlxHdmiSurfaceUpdater::~CGlxHdmiSurfaceUpdater() - cancel iAnimTimer"); |
|
80 iAnimTimer->Cancel(); |
|
81 } |
|
82 GLX_LOG_INFO("CGlxHdmiSurfaceUpdater::~CGlxHdmiSurfaceUpdater() - deleteing ialfCompositionSurface"); |
|
83 delete ialfCompositionSurface; |
|
84 if(iWindow) |
69 if(iWindow) |
85 { |
70 { |
86 iWindow->RemoveBackgroundSurface(ETrue); |
71 iWindow->RemoveBackgroundSurface(ETrue); |
87 } |
72 } |
88 if(iTimer && iTimer->IsActive()) // Check for a CPeriodic Instance |
73 if(iTimer && iTimer->IsActive()) // Check for a CPeriodic Instance |
163 |
148 |
164 // ----------------------------------------------------------------------------- |
149 // ----------------------------------------------------------------------------- |
165 // CTor |
150 // CTor |
166 // ----------------------------------------------------------------------------- |
151 // ----------------------------------------------------------------------------- |
167 CGlxHdmiSurfaceUpdater::CGlxHdmiSurfaceUpdater(RWindow* aWindow, |
152 CGlxHdmiSurfaceUpdater::CGlxHdmiSurfaceUpdater(RWindow* aWindow, |
168 MGlxGenCallback* aCallBack,TBool aEffectsOn): |
153 MGlxGenCallback* aCallBack): |
169 iWindow(aWindow), iCallBack(aCallBack), |
154 iWindow(aWindow), iCallBack(aCallBack), |
170 iEffectsOn(aEffectsOn), |
155 iShwFsThumbnail(ETrue), iIsNonJpeg(EFalse) |
171 iShwFsThumbnail(ETrue), iIsNonJpeg(EFalse), |
|
172 iAnimCounter(0) |
|
173 { |
156 { |
174 TRACER("CGlxHdmiSurfaceUpdater::CGlxHdmiSurfaceUpdater()"); |
157 TRACER("CGlxHdmiSurfaceUpdater::CGlxHdmiSurfaceUpdater()"); |
175 // Implement nothing here |
158 // Implement nothing here |
176 } |
159 } |
177 |
160 |
181 void CGlxHdmiSurfaceUpdater::ConstructL(CFbsBitmap* aFsBitmap, const TDesC& aImageFile) |
164 void CGlxHdmiSurfaceUpdater::ConstructL(CFbsBitmap* aFsBitmap, const TDesC& aImageFile) |
182 { |
165 { |
183 TRACER("CGlxHdmiSurfaceUpdater::ConstructL()"); |
166 TRACER("CGlxHdmiSurfaceUpdater::ConstructL()"); |
184 // Initiate the HDMI by assigning the necessary values |
167 // Initiate the HDMI by assigning the necessary values |
185 InitiateHdmiL(aFsBitmap,aImageFile); |
168 InitiateHdmiL(aFsBitmap,aImageFile); |
186 if (iEffectsOn) |
|
187 { |
|
188 GLX_LOG_INFO("CGlxHdmiSurfaceUpdater::ConstructL() Creating iAnimTimer"); |
|
189 iAnimTimer = CPeriodic::NewL( CActive::EPriorityStandard ); |
|
190 } |
|
191 |
169 |
192 TInt error = iFsSession.Connect (); |
170 TInt error = iFsSession.Connect (); |
193 GLX_LOG_INFO1("CGlxHdmiSurfaceUpdater::ConstructL() FsSession Connect error = %d", error); |
171 GLX_LOG_INFO1("CGlxHdmiSurfaceUpdater::ConstructL() FsSession Connect error = %d", error); |
194 User::LeaveIfError(error); |
172 User::LeaveIfError(error); |
195 iShiftToCloning = EFalse; |
173 iShiftToCloning = EFalse; |
750 // ShiftToCloningMode |
728 // ShiftToCloningMode |
751 // ----------------------------------------------------------------------------- |
729 // ----------------------------------------------------------------------------- |
752 void CGlxHdmiSurfaceUpdater::ShiftToCloningMode() |
730 void CGlxHdmiSurfaceUpdater::ShiftToCloningMode() |
753 { |
731 { |
754 TRACER("CGlxHdmiSurfaceUpdater::ShiftToCloningMode()"); |
732 TRACER("CGlxHdmiSurfaceUpdater::ShiftToCloningMode()"); |
755 if (iAnimTimer) |
|
756 { |
|
757 GLX_LOG_INFO("CGlxHdmiSurfaceUpdater::ShiftToCloningMode() - cancel iAnimTimer"); |
|
758 iAnimTimer->Cancel(); |
|
759 delete iAnimTimer; |
|
760 iAnimTimer = NULL; |
|
761 } |
|
762 if (ialfCompositionSurface) |
|
763 { |
|
764 GLX_LOG_INFO("CGlxHdmiSurfaceUpdater::ShiftToCloningMode() - deleteing ialfCompositionSurface"); |
|
765 delete ialfCompositionSurface; |
|
766 ialfCompositionSurface= NULL; |
|
767 } |
|
768 if (iWindow) |
733 if (iWindow) |
769 { |
734 { |
770 GLX_LOG_INFO("CGlxHdmiSurfaceUpdater::ShiftToCloningMode() - window present"); |
735 GLX_LOG_INFO("CGlxHdmiSurfaceUpdater::ShiftToCloningMode() - window present"); |
771 iWindow->RemoveBackgroundSurface(ETrue); |
736 iWindow->RemoveBackgroundSurface(ETrue); |
772 } |
737 } |
814 ScaleDecodedBitmapL(EFSBitmapIndex); |
774 ScaleDecodedBitmapL(EFSBitmapIndex); |
815 // Process the Image to TV |
775 // Process the Image to TV |
816 ProcessTvImage(); |
776 ProcessTvImage(); |
817 // set the surface onto background |
777 // set the surface onto background |
818 iWindow->SetBackgroundSurface(iConfig, ETrue); |
778 iWindow->SetBackgroundSurface(iConfig, ETrue); |
819 if (iEffectsOn) |
|
820 { |
|
821 //Cancel the Animation timer if any |
|
822 if(!iAnimTimer->IsActive()) |
|
823 { |
|
824 iAnimCounter = 0; |
|
825 GLX_LOG_INFO("CGlxHdmiSurfaceUpdater::ShowFsThumbnailL() - Cancel iAnimTimer Timer"); |
|
826 iAnimTimer->Cancel(); |
|
827 } |
|
828 |
|
829 FadeTheSurface(ETrue); |
|
830 } |
|
831 } |
779 } |
832 |
780 |
833 // ----------------------------------------------------------------------------- |
781 // ----------------------------------------------------------------------------- |
834 // ScaleDecodedBitmapL |
782 // ScaleDecodedBitmapL |
835 // ----------------------------------------------------------------------------- |
783 // ----------------------------------------------------------------------------- |
888 iSurfUpdateSession.NotifyWhenAvailable(iSurfBufferAO->iStatus); |
836 iSurfUpdateSession.NotifyWhenAvailable(iSurfBufferAO->iStatus); |
889 TInt err = iSurfUpdateSession.SubmitUpdate(KAllScreens, iSurfId, 0, NULL); |
837 TInt err = iSurfUpdateSession.SubmitUpdate(KAllScreens, iSurfId, 0, NULL); |
890 GLX_LOG_INFO1("CGlxHdmiSurfaceUpdater::ProcessTvImage() Surfaceupdatesession error %d",err); |
838 GLX_LOG_INFO1("CGlxHdmiSurfaceUpdater::ProcessTvImage() Surfaceupdatesession error %d",err); |
891 } |
839 } |
892 } |
840 } |
893 |
|
894 // ----------------------------------------------------------------------------- |
|
895 // FadeTheSurface |
|
896 // ----------------------------------------------------------------------------- |
|
897 void CGlxHdmiSurfaceUpdater::FadeTheSurface(TBool aFadeInOut) |
|
898 { |
|
899 TRACER("CGlxHdmiSurfaceUpdater::FadeTheSurface()"); |
|
900 iFadeIn = aFadeInOut; |
|
901 if (iEffectsOn && !iAnimTimer) |
|
902 { |
|
903 GLX_LOG_INFO("CGlxHdmiSurfaceUpdater::FadeTheSurface() Creating iAnimTimer"); |
|
904 iAnimTimer = CPeriodic::NewL( CActive::EPriorityStandard ); |
|
905 } |
|
906 if (!ialfCompositionSurface) |
|
907 { |
|
908 GLX_LOG_INFO("CGlxHdmiSurfaceUpdater::ShowFsThumbnailL() - Creating alfcompositionsurface"); |
|
909 ialfCompositionSurface = CAlfCompositionSource::NewL(*iWindow); |
|
910 } |
|
911 if(!iAnimTimer->IsActive()) |
|
912 { |
|
913 GLX_LOG_INFO("CGlxHdmiSurfaceUpdater::FadeTheSurface() - Start Timer"); |
|
914 if (iFadeIn) |
|
915 iAnimTimer->Start(0,KAnimationTickerFadeIn,TCallBack( AnimationTimeOut,this )); |
|
916 else |
|
917 { |
|
918 for (TInt i=0;i<=KFadeSteps;i++) |
|
919 { |
|
920 GLX_LOG_INFO1("CGlxHdmiSurfaceUpdater::Animate - Fading Out %d",i); |
|
921 ialfCompositionSurface->SetOpacity(KFullOpaque -(i*KFadeEachStep)); |
|
922 User::After(KAnimationTicker); |
|
923 } |
|
924 } |
|
925 } |
|
926 else |
|
927 { |
|
928 iAnimCounter = 0; |
|
929 // this case can be when fast swipe in Slideshow |
|
930 ialfCompositionSurface->SetOpacity(KFullOpaque); // set the opacity to maximum when fast swipe |
|
931 GLX_LOG_INFO("CGlxHdmiSurfaceUpdater::FadeTheSurface() - cancel iAnimTimer"); |
|
932 iAnimTimer->Cancel(); |
|
933 } |
|
934 } |
|
935 |
|
936 // --------------------------------------------------------------------------- |
|
937 // AnimationTimeOut |
|
938 // --------------------------------------------------------------------------- |
|
939 // |
|
940 TInt CGlxHdmiSurfaceUpdater::AnimationTimeOut(TAny* aSelf) |
|
941 { |
|
942 TRACER("CGlxHdmiSurfaceUpdater::AnimationTimeOut"); |
|
943 if(aSelf) |
|
944 { |
|
945 CGlxHdmiSurfaceUpdater* self = static_cast <CGlxHdmiSurfaceUpdater*> (aSelf); |
|
946 if (self) |
|
947 { |
|
948 self->Animate(); |
|
949 } |
|
950 } |
|
951 return KErrNone; |
|
952 } |
|
953 |
|
954 // ----------------------------------------------------------------------------- |
|
955 // Animate |
|
956 // ----------------------------------------------------------------------------- |
|
957 void CGlxHdmiSurfaceUpdater::Animate() |
|
958 { |
|
959 TRACER("CGlxHdmiSurfaceUpdater::Animate"); |
|
960 iAnimCounter++; |
|
961 if (!ialfCompositionSurface) |
|
962 { |
|
963 // createing alfcompositiosource |
|
964 ialfCompositionSurface = CAlfCompositionSource::NewL(*iWindow); |
|
965 } |
|
966 if (iAnimCounter <=KFadeSteps && iFadeIn) |
|
967 { |
|
968 GLX_LOG_INFO1("CGlxHdmiSurfaceUpdater::Animate - iAnimCounter=%d",iAnimCounter); |
|
969 // gaining brightness |
|
970 GLX_LOG_INFO("CGlxHdmiSurfaceUpdater::Animate - Fading In"); |
|
971 ialfCompositionSurface->SetOpacity( KFullTransparent +(iAnimCounter*KFadeEachStep)); |
|
972 } |
|
973 else |
|
974 { |
|
975 GLX_LOG_INFO("CGlxHdmiSurfaceUpdater::Animate() - cancel iAnimTimer"); |
|
976 iAnimCounter = 0; |
|
977 // end the timer , as animation of fade in/out is complete |
|
978 iAnimTimer->Cancel(); |
|
979 } |
|
980 } |
|
981 |
|