author | Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> |
Wed, 13 Oct 2010 14:32:09 +0300 | |
branch | RCL_3 |
changeset 75 | 01504893d9cb |
parent 60 | 5b3385a43d68 |
permissions | -rw-r--r-- |
60 | 1 |
/* |
2 |
* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
3 |
* All rights reserved. |
|
4 |
* This component and the accompanying materials are made available |
|
5 |
* under the terms of "Eclipse Public License v1.0" |
|
6 |
* which accompanies this distribution, and is available |
|
7 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 |
* |
|
9 |
* Initial Contributors: |
|
10 |
* Nokia Corporation - initial contribution. |
|
11 |
* |
|
12 |
* Contributors: |
|
13 |
* |
|
14 |
* Description: Texture Manager component/Decodes the Image in step for large images |
|
15 |
* |
|
16 |
*/ |
|
17 |
||
18 |
||
19 |
||
20 |
||
21 |
#ifndef C_GLXBITMAPDECODERWRAPPER_H |
|
22 |
#define C_GLXBITMAPDECODERWRAPPER_H |
|
23 |
||
24 |
// INCLUDE FILES |
|
25 |
#include<alf/alftimedvalue.h> |
|
26 |
#include <IclExtJpegApi.h> // For CExtJpegDecoder |
|
75
01504893d9cb
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
27 |
// For decoding via TNM |
01504893d9cb
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
28 |
#include <thumbnailmanager.h> |
01504893d9cb
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
29 |
#include <thumbnailmanagerobserver.h> |
01504893d9cb
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
30 |
#include <thumbnailobjectsource.h> |
01504893d9cb
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
31 |
#include <thumbnaildata.h> |
01504893d9cb
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
32 |
#include <glxmedia.h> |
60 | 33 |
|
34 |
/** |
|
35 |
* Observer interface used to be notified when texture bitmap is completed. |
|
36 |
*/ |
|
37 |
NONSHARABLE_CLASS( MGlxBitmapDecoderObserver ) |
|
38 |
{ |
|
39 |
public: |
|
40 |
/** |
|
41 |
* Called when the content of the texture is changed. |
|
42 |
* @param aHasContent Whether the texture now has content. |
|
43 |
*/ |
|
44 |
virtual void HandleBitmapDecodedL(TInt aThumbnailIndex,CFbsBitmap* aBitmap) = 0; |
|
45 |
}; |
|
46 |
/** |
|
47 |
* This class does the decoding of the images in steps depending on the size of the images . |
|
48 |
* this is a wrapper class, doesn't actually decode the images. |
|
49 |
*/ |
|
50 |
||
75
01504893d9cb
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
51 |
class CGlxBitmapDecoderWrapper: public CBase |
01504893d9cb
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
52 |
,public MThumbnailManagerObserver |
01504893d9cb
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
53 |
|
60 | 54 |
{ |
55 |
public: |
|
56 |
/*This Enums specifies the state of the Decoding*/ |
|
57 |
enum TDecoderState |
|
58 |
{ |
|
59 |
ESTate0, ESTate1,ESTateFinal |
|
60 |
}; |
|
61 |
/*This Enums specifies the size of the images*/ |
|
62 |
enum TImageLevel |
|
63 |
{ |
|
64 |
ELevel0, ELevel1,ELevel2 |
|
65 |
}; |
|
66 |
/** |
|
67 |
* Two-phased constructor |
|
68 |
* @param aObserver:The Observer contains the CGlxTextureManagerImpl Object |
|
69 |
* @return Constructed object |
|
70 |
*/ |
|
71 |
static CGlxBitmapDecoderWrapper* NewL(MGlxBitmapDecoderObserver* aObserver); |
|
72 |
||
73 |
/** |
|
74 |
* Destructor |
|
75 |
*/ |
|
76 |
~CGlxBitmapDecoderWrapper(); |
|
77 |
||
78 |
/** |
|
79 |
* intiates the Decoding the Image and updates the no:of steps to decode |
|
80 |
* @param aSourceFileName :contains the file name |
|
81 |
* @param aindex:contains the index value |
|
82 |
*/ |
|
75
01504893d9cb
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
83 |
void DoDecodeImageL(const TGlxMedia& aMedia,TInt aIndex); |
60 | 84 |
|
85 |
/** |
|
86 |
* starts the decoding and updates the state of the decoding |
|
87 |
*/ |
|
88 |
void DecodeImageL(); |
|
89 |
/** |
|
90 |
* Request free memory with Out of Memory Monitor |
|
91 |
* @param aBytesRequested : Request for free memory in Bytes |
|
92 |
*/ |
|
93 |
TInt OOMRequestFreeMemoryL( TInt aBytesRequested); |
|
75
01504893d9cb
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
94 |
/** |
01504893d9cb
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
95 |
* Cancels all the pending requests and release resources |
01504893d9cb
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
96 |
*/ |
01504893d9cb
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
97 |
void CancelRequest(); |
60 | 98 |
|
75
01504893d9cb
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
99 |
|
60 | 100 |
private: |
101 |
/** |
|
102 |
* Constructor |
|
103 |
*/ |
|
104 |
CGlxBitmapDecoderWrapper(); |
|
105 |
||
106 |
/** |
|
107 |
* Second-phase constuction |
|
108 |
*/ |
|
109 |
void ConstructL(MGlxBitmapDecoderObserver* aObserver); |
|
110 |
/** |
|
75
01504893d9cb
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
111 |
* Gets Thumbnails from TNM. |
60 | 112 |
*/ |
75
01504893d9cb
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
113 |
void GetThumbnailL( HBufC* aImagePath ); |
60 | 114 |
/** |
75
01504893d9cb
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
115 |
* From MThumbnailManagerObserver, not used |
01504893d9cb
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
116 |
*/ |
01504893d9cb
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
117 |
virtual void ThumbnailPreviewReady( MThumbnailData& aThumbnail, |
01504893d9cb
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
118 |
TThumbnailRequestId aId ); |
01504893d9cb
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
119 |
|
01504893d9cb
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
120 |
/** |
01504893d9cb
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
121 |
* From MThumbnailManagerObserver |
01504893d9cb
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
122 |
*/ |
01504893d9cb
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
123 |
virtual void ThumbnailReady( TInt aError, |
01504893d9cb
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
124 |
MThumbnailData& aThumbnail, |
01504893d9cb
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
125 |
TThumbnailRequestId aId ); |
60 | 126 |
|
127 |
private: |
|
128 |
/* Contains the TextureManagerImpl object,calls the HandleBitmapDecoded*/ |
|
129 |
MGlxBitmapDecoderObserver* iObserver; |
|
130 |
/*Contains the Thumbnail Index*/ |
|
131 |
TInt iThumbnailIndex; |
|
132 |
/*Contains the Bitmap generated*/ |
|
133 |
CFbsBitmap* iBitmap; |
|
134 |
/*contains the original size of the image*/ |
|
135 |
TAlfRealSize iOriginalSize; |
|
136 |
/*To store the target image size*/ |
|
137 |
TSize iTargetBitmapSize; |
|
138 |
/*To store the image uri path*/ |
|
139 |
HBufC* iImagePath; |
|
140 |
#ifdef _DEBUG |
|
141 |
TTime iStartTime; |
|
142 |
TTime iStopTime; |
|
143 |
#endif |
|
75
01504893d9cb
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
144 |
|
01504893d9cb
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
145 |
CThumbnailManager* iTnManager; |
01504893d9cb
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
146 |
TThumbnailRequestId iTnReqId; |
60 | 147 |
}; |
148 |
||
149 |
#endif //C_GLXBITMAPDECODERWRAPPER_H |