equal
deleted
inserted
replaced
39 // Panic function |
39 // Panic function |
40 void Panic( TInt aPanicCode ) { User::Panic( _L("AnimationDecoder"), aPanicCode ); } |
40 void Panic( TInt aPanicCode ) { User::Panic( _L("AnimationDecoder"), aPanicCode ); } |
41 } |
41 } |
42 |
42 |
43 using namespace WebCore; |
43 using namespace WebCore; |
|
44 CSynDecodeThread *CAnimationDecoder::iSyncDecodeThread = NULL; |
44 |
45 |
45 // ============================ MEMBER FUNCTIONS =============================== |
46 // ============================ MEMBER FUNCTIONS =============================== |
46 // ----------------------------------------------------------------------------- |
47 // ----------------------------------------------------------------------------- |
47 // |
48 // |
48 // C++ default constructor can NOT contain any code, that |
49 // C++ default constructor can NOT contain any code, that |
53 , iObserver(aObs) |
54 , iObserver(aObs) |
54 , iLoopCount( -1 ) |
55 , iLoopCount( -1 ) |
55 , iCurLoopCount( -1 ) |
56 , iCurLoopCount( -1 ) |
56 , iSyncBitmapHandle(-1) |
57 , iSyncBitmapHandle(-1) |
57 , iSyncMaskHandle(-1) |
58 , iSyncMaskHandle(-1) |
58 , iSyncDecodeThread(NULL) |
|
59 , iDecodeInProgress(ETrue) |
59 , iDecodeInProgress(ETrue) |
60 { |
60 { |
61 if (CActiveScheduler::Current()) |
61 if (CActiveScheduler::Current()) |
62 CActiveScheduler::Add( this ); |
62 CActiveScheduler::Add( this ); |
63 } |
63 } |
94 // animated images still being decoded. |
94 // animated images still being decoded. |
95 iDecoder->Cancel(); |
95 iDecoder->Cancel(); |
96 delete iDecoder, iDecoder = NULL; |
96 delete iDecoder, iDecoder = NULL; |
97 } |
97 } |
98 |
98 |
99 delete iSyncDecodeThread; iSyncDecodeThread = NULL; |
|
100 delete iAnimationBitmap, iAnimationBitmap = NULL; |
99 delete iAnimationBitmap, iAnimationBitmap = NULL; |
101 delete iDestination, iDestination = NULL; |
100 delete iDestination, iDestination = NULL; |
102 if(iDrmContent) |
101 if(iDrmContent) |
103 { |
102 { |
104 delete iDrmContent; |
103 delete iDrmContent; |
113 { |
112 { |
114 iSizeAvailable = EFalse; |
113 iSizeAvailable = EFalse; |
115 iRawDataComplete = ETrue; |
114 iRawDataComplete = ETrue; |
116 delete iDestination; |
115 delete iDestination; |
117 iDestination = NULL; |
116 iDestination = NULL; |
118 delete iSyncDecodeThread; |
|
119 iSyncDecodeThread = NULL; |
|
120 |
117 |
121 iSyncDecodeThread = CSynDecodeThread::NewL(); |
118 if(!iSyncDecodeThread) { // first time, create decoder thread |
|
119 iSyncDecodeThread = CSynDecodeThread::NewL(); |
|
120 } |
122 |
121 |
123 TRequestStatus status; |
122 if (iSyncDecodeThread->Decode(aData) == KErrNone) { |
124 if (iSyncDecodeThread->Decode( aData, &status ) == KErrNone) { |
123 iSyncDecodeThread->Handle(iSyncBitmapHandle, iSyncMaskHandle); |
125 User::WaitForRequest(status); |
124 Destination(); // duplicate bitmap handles |
126 if( status == KErrNone ) { |
125 iSizeAvailable = ETrue; |
127 iSyncDecodeThread->Handle(iSyncBitmapHandle, iSyncMaskHandle); |
126 } |
128 iSizeAvailable = ETrue; |
|
129 } |
|
130 } |
|
131 if (!iSizeAvailable) { |
|
132 delete iSyncDecodeThread; |
|
133 iSyncDecodeThread = NULL; |
|
134 } |
|
135 } |
127 } |
136 |
128 |
137 CMaskedBitmap* CAnimationDecoder::Destination() |
129 CMaskedBitmap* CAnimationDecoder::Destination() |
138 { |
130 { |
139 if (iDestination) |
131 if (iDestination) |
149 iDestination->SetFrameIndex(0); |
141 iDestination->SetFrameIndex(0); |
150 iDestination->SetFrameDelay(0); |
142 iDestination->SetFrameDelay(0); |
151 iSyncBitmapHandle = -1; |
143 iSyncBitmapHandle = -1; |
152 iSyncMaskHandle = -1; |
144 iSyncMaskHandle = -1; |
153 } |
145 } |
154 delete iSyncDecodeThread; |
146 |
155 iSyncDecodeThread = NULL; |
|
156 return iDestination; |
147 return iDestination; |
157 } |
148 } |
158 //============================================================================= |
149 //============================================================================= |
159 // DecodeDRMImageContentL : Function for handling the DRM image content |
150 // DecodeDRMImageContentL : Function for handling the DRM image content |
160 //============================================================================= |
151 //============================================================================= |
240 iDecoder->OpenL(buffer,CImageDecoder::EOptionNone); |
231 iDecoder->OpenL(buffer,CImageDecoder::EOptionNone); |
241 } |
232 } |
242 |
233 |
243 iRawDataComplete = aIsComplete; |
234 iRawDataComplete = aIsComplete; |
244 |
235 |
245 if(iDecoder->ValidDecoder() && iDecoder->IsImageHeaderProcessingComplete()) |
236 if(iDecoder && iDecoder->ValidDecoder() && iDecoder->IsImageHeaderProcessingComplete()) |
246 StartDecodingL(); |
237 StartDecodingL(); |
247 else |
238 else |
248 // remove me when incremental image rendering gets supported |
239 // remove me when incremental image rendering gets supported |
249 User::Leave( KErrCorrupt ); |
240 User::Leave( KErrCorrupt ); |
250 |
241 |