60
|
1 |
/* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
|
|
2 |
* All rights reserved.
|
|
3 |
* This component and the accompanying materials are made available
|
|
4 |
* under the terms of "Eclipse Public License v1.0"
|
|
5 |
* which accompanies this distribution, and is available
|
|
6 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
|
7 |
*
|
|
8 |
* Initial Contributors:
|
|
9 |
* Nokia Corporation - initial contribution.
|
|
10 |
*
|
|
11 |
* Contributors:
|
|
12 |
*
|
|
13 |
* Description: Handles & propogates UI state change notifications.
|
|
14 |
*
|
|
15 |
*/
|
|
16 |
|
|
17 |
#ifndef GLXHDMISURFACEUPDATER_H_
|
|
18 |
#define GLXHDMISURFACEUPDATER_H_
|
|
19 |
|
|
20 |
#include <w32std.h>
|
|
21 |
#include <fbs.h>
|
|
22 |
|
|
23 |
// GCE Surface
|
|
24 |
#include "graphics/surfacemanager.h"
|
|
25 |
#include "graphics/surface.h"
|
|
26 |
#include "graphics/surfaceupdateclient.h"
|
|
27 |
#include <graphics/surfaceconfiguration.h>
|
|
28 |
#include "mglxhdmidecoderobserver.h" //For MGlxHDMIDecoderObserver
|
|
29 |
|
|
30 |
// forward decleration
|
|
31 |
class CGlxActiveCallBack;
|
|
32 |
class CGlxHdmiDecoderAO;
|
|
33 |
class CImageDecoder;
|
|
34 |
class TSurfaceConfiguration;
|
|
35 |
class MGlxGenCallback
|
|
36 |
{
|
|
37 |
public:
|
|
38 |
virtual void DoGenCallback() = 0;
|
|
39 |
};
|
|
40 |
|
|
41 |
class CGlxHdmiSurfaceUpdater: public CBase
|
|
42 |
{
|
|
43 |
public:
|
|
44 |
/*
|
|
45 |
* NewL
|
|
46 |
*/
|
|
47 |
static CGlxHdmiSurfaceUpdater* NewL(RWindow* aWindow,
|
|
48 |
const TDesC& aImageFile, const TDesC& aNextImageFile,
|
|
49 |
CFbsBitmap* aFsBitmap, MGlxGenCallback* aCallBack,
|
|
50 |
MGlxHDMIDecoderObserver& aDecoderObserver);
|
|
51 |
|
|
52 |
/*
|
|
53 |
* Destructor
|
|
54 |
*/
|
|
55 |
~CGlxHdmiSurfaceUpdater();
|
|
56 |
|
|
57 |
public:
|
|
58 |
/*
|
|
59 |
* This is to cancel the active object from decoding
|
|
60 |
*/
|
|
61 |
void HandleRunL(TRequestStatus& aStatus);
|
|
62 |
|
|
63 |
/*
|
|
64 |
* This updates the new image.
|
|
65 |
*/
|
|
66 |
void UpdateNewImageL(const TDesC& aImageFile,
|
|
67 |
const TDesC& aNextImageFile, CFbsBitmap* aFsBitmap);
|
|
68 |
|
|
69 |
/*
|
|
70 |
* Activate Zoom
|
|
71 |
*/
|
|
72 |
void ActivateZoom(TBool aAutoZoomOut);
|
|
73 |
/*
|
|
74 |
* Deactivate Zoom
|
|
75 |
*/
|
|
76 |
void DeactivateZoom();
|
|
77 |
/*
|
|
78 |
* Zoom in our out depending on parameter
|
|
79 |
*/
|
|
80 |
void Zoom(TBool aZoom);
|
|
81 |
|
|
82 |
/*
|
|
83 |
ShiftToCloningMOde
|
|
84 |
*/
|
|
85 |
void ShiftToCloningMode();
|
|
86 |
|
|
87 |
/*
|
|
88 |
ShiftToPostingMode
|
|
89 |
*/
|
|
90 |
void ShiftToPostingMode();
|
|
91 |
|
|
92 |
private:
|
|
93 |
/*
|
|
94 |
* Constructor
|
|
95 |
*/
|
|
96 |
CGlxHdmiSurfaceUpdater(RWindow* aWindow, MGlxGenCallback* aCallBack,
|
|
97 |
MGlxHDMIDecoderObserver& aDecoderObserver);
|
|
98 |
|
|
99 |
/*
|
|
100 |
* ConstructL()
|
|
101 |
*/
|
|
102 |
void ConstructL(CFbsBitmap* aFsBitmap, const TDesC& aImageFile,
|
|
103 |
const TDesC& aNextImageFile);
|
|
104 |
|
|
105 |
/*
|
|
106 |
* Create a New surface with given size
|
|
107 |
*/
|
|
108 |
void CreateSurfaceL();
|
|
109 |
/*
|
|
110 |
* @param1 size
|
|
111 |
*/
|
|
112 |
void MapSurfaceL();
|
|
113 |
|
|
114 |
/*
|
|
115 |
* This fundtion wont be called , could be used if double buffering is planned in future
|
|
116 |
* to start the second decoder AO and update the surface with a new session.
|
|
117 |
*/
|
|
118 |
static TInt SurfBuffer0ReadyL(TAny* aObject);
|
|
119 |
|
|
120 |
/*
|
|
121 |
* Call a refresh on the screen
|
|
122 |
*/
|
|
123 |
void Refresh();
|
|
124 |
|
|
125 |
/*
|
|
126 |
* Dump the buffer on to the surface stride
|
|
127 |
*/
|
|
128 |
void SwapBuffers();
|
|
129 |
|
|
130 |
/*
|
|
131 |
* Release contents
|
|
132 |
*/
|
|
133 |
void ReleaseContent();
|
|
134 |
|
|
135 |
/*
|
|
136 |
* Create bitmap
|
|
137 |
*/
|
|
138 |
void CreateBitmapL();
|
|
139 |
|
|
140 |
/*
|
|
141 |
* Create an image decoder with given file
|
|
142 |
* @param1 - Image file
|
|
143 |
*/
|
|
144 |
void CreateImageDecoderL();
|
|
145 |
|
|
146 |
/*
|
|
147 |
* Creating all enablers for HDMI
|
|
148 |
* @param1 if creating a surface is required,
|
|
149 |
* by default it is not required
|
|
150 |
*/
|
|
151 |
void CreateHdmiL(TBool aCreateSurface = ETrue);
|
|
152 |
|
|
153 |
/*
|
|
154 |
* This if for zoom timer timeout
|
|
155 |
*/
|
|
156 |
static TInt TimeOut(TAny* aSelf);
|
|
157 |
|
|
158 |
/*
|
|
159 |
* ModifySurface positions of the surface to be displayed on screen
|
|
160 |
*/
|
|
161 |
void ModifySurfacePostion();
|
|
162 |
|
|
163 |
/*
|
|
164 |
* Process the image for TV
|
|
165 |
*/
|
|
166 |
void ProcessTvImage();
|
|
167 |
|
|
168 |
/*
|
|
169 |
* Shows the FS thumbnail first before showing
|
|
170 |
* Decoded HD image
|
|
171 |
*/
|
|
172 |
void ShowFsThumbnailL();
|
|
173 |
|
|
174 |
/*
|
|
175 |
* Recalculate the size for png/bmp as decoder fails to
|
|
176 |
* decode for desired size
|
|
177 |
*/
|
|
178 |
TSize ReCalculateSizeL();
|
|
179 |
|
|
180 |
/*
|
|
181 |
* If the image format is non jpeg, then we need to calculate as per
|
|
182 |
* reduction factor and reduced size as what the decoder is going to return us
|
|
183 |
* This function returns if that needs to be done.
|
|
184 |
*/
|
|
185 |
TBool DoesMimeTypeNeedsRecalculateL();
|
|
186 |
|
|
187 |
/*
|
|
188 |
* If the image format is non jpeg, then we need to scale the bitmap after it is
|
|
189 |
* decoded, as the return value would not fit the screen
|
|
190 |
*/
|
|
191 |
void ScaleDecodedBitmapL(TInt aBitmapIndex);
|
|
192 |
|
|
193 |
/*
|
|
194 |
* Initiate HDMI
|
|
195 |
*/
|
|
196 |
void InitiateHdmiL(CFbsBitmap* aFsBitmap, const TDesC& aImageFile,
|
|
197 |
const TDesC& aNextImageFile);
|
|
198 |
|
|
199 |
void DecodeNextImageL();
|
|
200 |
|
|
201 |
private:
|
|
202 |
RWindow* iWindow; // window object
|
|
203 |
CFbsBitmap* iFsBitmap; // FS bitmap
|
|
204 |
MGlxGenCallback* iCallBack; // callback to the HdmiContainer window
|
|
205 |
HBufC* iImagePath; // To store the image uri path
|
|
206 |
HBufC* iNextImagePath; // To store the image uri path
|
|
207 |
|
|
208 |
// GCE Surface
|
|
209 |
RSurfaceUpdateSession iSurfUpdateSession;
|
|
210 |
TSurfaceId iSurfId; // TSurfaceId
|
|
211 |
RSurfaceManager* iSurfManager; // RSurfaceManager
|
|
212 |
RChunk* iSurfChunk; // RChunk
|
|
213 |
TInt iSurfaceStride; // surface stride
|
|
214 |
TSurfaceConfiguration iConfig; // surface configuration for zoom
|
|
215 |
|
|
216 |
CFbsBitmap* iDecodedBitmap[3]; // Array of Decoded bitmaps of the focussed image
|
|
217 |
// 1 - contains FS/Grid Thumbnail, 2- HD image,
|
|
218 |
// (optional)3-Scaled png/bmp images
|
|
219 |
|
|
220 |
void* iSurfBuffer; // Surface buffer
|
|
221 |
CGlxActiveCallBack* iSurfBufferAO; // Surface buffer AO
|
|
222 |
|
|
223 |
//ICL
|
|
224 |
CGlxHdmiDecoderAO* iGlxDecoderAO; // Internal Image decoder AO
|
|
225 |
CImageDecoder* iImageDecoder; // Image Decoder
|
|
226 |
RFs iFsSession; // RFs
|
|
227 |
|
|
228 |
TPoint iLeftCornerForZoom; //
|
|
229 |
CPeriodic* iTimer; // Timer for Zoom
|
|
230 |
|
|
231 |
// Various objects to store sizes and count
|
|
232 |
TSize iTvScreenSize; // to store the Tv screen size
|
|
233 |
TSize iTargetBitmapSize; // To Store the target bitmap size to display(as per Aspect Ratio)
|
|
234 |
|
|
235 |
// Various flags to store values
|
|
236 |
TBool iZoom; // Is zoomed
|
|
237 |
TBool iBitmapReady; // If the bitmap is decoded and ready
|
|
238 |
TBool iAutoZoomOut; // If the UI has asked for auto zoomout
|
|
239 |
TBool iSurfSessionConnected; // If surface session is connected
|
|
240 |
TBool iShiftToCloning;
|
|
241 |
TBool iShwFsThumbnail; // If the Fs thumbnail is to be shown before decoding HD images
|
|
242 |
TBool iIsNonJpeg; // If the item is non jpeg
|
|
243 |
MGlxHDMIDecoderObserver& iDecoderObserver; // doesn't own
|
|
244 |
TBool iDecodingCurrent; // Decoding Current Image
|
|
245 |
TBool iDecodingNext; // Decoding Next Image
|
|
246 |
TBool iDecodingNextFailed; // Decoding Next Image
|
|
247 |
|
|
248 |
#ifdef _DEBUG
|
|
249 |
TTime iStartTime;
|
|
250 |
TTime iStopTime;
|
|
251 |
#endif
|
|
252 |
// The bitmap index in the array of bitmaps
|
|
253 |
enum {
|
|
254 |
EFSBitmapIndex = 0,
|
|
255 |
EJpgDecodedBitmapIndex,
|
|
256 |
ENonJpgDecodedBitmapIndex
|
|
257 |
};
|
|
258 |
};
|
|
259 |
#endif /* GLXHDMISURFACEUPDATER_H_ */
|