equal
deleted
inserted
replaced
31 _LIT(KDotBmp, ".bmp"); |
31 _LIT(KDotBmp, ".bmp"); |
32 _LIT(KThreadName, "ImageConverterThread"); |
32 _LIT(KThreadName, "ImageConverterThread"); |
33 _LIT(KSemaphoreName, "ImageConverterSemaphore"); |
33 _LIT(KSemaphoreName, "ImageConverterSemaphore"); |
34 |
34 |
35 // Constant |
35 // Constant |
36 const TUint KDot = '.'; |
36 const TUint KDot = '.'; |
37 |
37 |
38 // ============================ MEMBER FUNCTIONS =================================== |
38 // ============================ MEMBER FUNCTIONS =================================== |
39 |
39 |
40 // --------------------------------------------------------------------------------- |
40 // --------------------------------------------------------------------------------- |
41 // CUpnpSvgImageConverter::NewL |
41 // CUpnpSvgImageConverter::NewL |
129 iBitMapFilePath.Close(); |
129 iBitMapFilePath.Close(); |
130 delete iMask; |
130 delete iMask; |
131 delete iBitmap; |
131 delete iBitmap; |
132 delete iSvgModule; |
132 delete iSvgModule; |
133 iFbsSession.Disconnect(); |
133 iFbsSession.Disconnect(); |
134 iFile.Close(); |
|
135 iFileSession.Close(); |
134 iFileSession.Close(); |
136 OstTraceFunctionExit0( CUPNPSVGIMAGECONVERTER_CUPNPSVGIMAGECONVERTER_EXIT ); |
135 OstTraceFunctionExit0( CUPNPSVGIMAGECONVERTER_CUPNPSVGIMAGECONVERTER_EXIT ); |
137 } |
136 } |
138 |
137 |
139 // ----------------------------------------------------------------------------------- |
138 // ----------------------------------------------------------------------------------- |
152 * uses the same filename to create bitmap file ( eg: abc.bmp ) |
151 * uses the same filename to create bitmap file ( eg: abc.bmp ) |
153 */ |
152 */ |
154 TPtrC iconFileNameWithExtension = aSvgFile.Mid((aSvgFile.LocateReverse(KDirectorySeparator))+1); |
153 TPtrC iconFileNameWithExtension = aSvgFile.Mid((aSvgFile.LocateReverse(KDirectorySeparator))+1); |
155 iBitMapFilePath.Append( iconFileNameWithExtension.Left(iconFileNameWithExtension.LocateReverse(KDot)) ); |
154 iBitMapFilePath.Append( iconFileNameWithExtension.Left(iconFileNameWithExtension.LocateReverse(KDot)) ); |
156 iBitMapFilePath.Append( KDotBmp ); |
155 iBitMapFilePath.Append( KDotBmp ); |
157 |
156 RFile iconFile; |
158 TInt err = iFile.Create(iFileSession,iBitMapFilePath,EFileRead|EFileWrite|EFileShareAny); |
157 TInt err = iconFile.Create(iFileSession,iBitMapFilePath,EFileRead|EFileWrite|EFileShareAny); |
159 OstTrace1( TRACE_NORMAL, CUPNPSVGIMAGECONVERTER_CONVERTTOBITMAPL, "CUpnpSvgImageConverter::ConvertToBitmapL;err=%d", err ); |
158 OstTrace1( TRACE_NORMAL, CUPNPSVGIMAGECONVERTER_CONVERTTOBITMAPL, "CUpnpSvgImageConverter::ConvertToBitmapL;err=%d", err ); |
|
159 iconFile.Close(); |
160 aBitmapFile.Close(); |
160 aBitmapFile.Close(); |
161 if ( err == KErrAlreadyExists ) |
161 if ( err == KErrAlreadyExists ) |
162 { |
162 { |
163 //If the converted file pre-exists, just return the existing filepath. |
163 //If the converted file pre-exists, just return the existing filepath. |
164 aBitmapFile.CreateL(iBitMapFilePath); |
164 aBitmapFile.CreateL(iBitMapFilePath); |
182 *@param domHandle Handle to DOM Tree. |
182 *@param domHandle Handle to DOM Tree. |
183 *@param iBitmap Buffer for drawing the DOM Tree. |
183 *@param iBitmap Buffer for drawing the DOM Tree. |
184 *@param iMask Buffer for mask (alpha values) of framebuffer result |
184 *@param iMask Buffer for mask (alpha values) of framebuffer result |
185 *@return lsvgerr Error object specifying the error occured. |
185 *@return lsvgerr Error object specifying the error occured. |
186 */ |
186 */ |
187 lsvgerr = iSvgModule->UseDom( domHandle ,iBitmap,iMask); |
187 lsvgerr = iSvgModule->UseDom( domHandle ,iBitmap,iMask ); |
188 if ( (! lsvgerr ) || ( lsvgerr && lsvgerr->HasError() &&!lsvgerr->IsWarning() ) ) |
188 if ( (! lsvgerr ) || ( lsvgerr && lsvgerr->HasError() &&!lsvgerr->IsWarning() ) ) |
189 { |
189 { |
190 User::Leave( KErrCancel ); |
190 User::Leave( KErrCancel ); |
191 } |
191 } |
192 /** |
192 /** |
258 CleanupStack::PopAndDestroy(2,&semaphore); |
258 CleanupStack::PopAndDestroy(2,&semaphore); |
259 OstTraceFunctionExit0( CUPNPSVGIMAGECONVERTER_STARTTHREADL_EXIT ); |
259 OstTraceFunctionExit0( CUPNPSVGIMAGECONVERTER_STARTTHREADL_EXIT ); |
260 } |
260 } |
261 |
261 |
262 // --------------------------------------------------------------------------------- |
262 // --------------------------------------------------------------------------------- |
263 // CUpnpSvgImageConverter::FileSession |
|
264 // Method to return the file session. |
|
265 // @return Returns reference to File session. |
|
266 // --------------------------------------------------------------------------------- |
|
267 // |
|
268 RFs& CUpnpSvgImageConverter::FileSession( ) |
|
269 { |
|
270 OstTraceFunctionEntry0( CUPNPSVGIMAGECONVERTER_FILESESSION_ENTRY ); |
|
271 OstTraceFunctionExit0( CUPNPSVGIMAGECONVERTER_FILESESSION_EXIT ); |
|
272 return iFileSession; |
|
273 } |
|
274 |
|
275 // --------------------------------------------------------------------------------- |
|
276 // CUpnpSvgImageConverter::Filepath |
263 // CUpnpSvgImageConverter::Filepath |
277 // Method to return the path of the icon file which needs to be converted. |
264 // Method to return the path of the icon file which needs to be converted. |
278 // @return Returns reference to Bitmap file path. |
265 // @return Returns reference to Bitmap file path. |
279 // --------------------------------------------------------------------------------- |
266 // --------------------------------------------------------------------------------- |
280 // |
267 // |
316 { |
303 { |
317 err = KErrNoMemory; |
304 err = KErrNoMemory; |
318 } |
305 } |
319 else |
306 else |
320 { |
307 { |
321 // Meet up with the starter thread |
|
322 RThread::Rendezvous(KErrNone); |
|
323 TRAP( err, ImageConverterL(*svgConverter) ); |
308 TRAP( err, ImageConverterL(*svgConverter) ); |
324 } |
309 } |
325 // Create a matching semaphore for signalling the waiting semaphore |
310 // Create a matching semaphore for signalling the waiting semaphore |
326 RSemaphore semaphoreStop; |
311 RSemaphore semaphoreStop; |
327 semaphoreStop.OpenGlobal(KSemaphoreName); |
312 semaphoreStop.OpenGlobal(KSemaphoreName); |
349 */ |
334 */ |
350 CActiveScheduler* scheduler = new (ELeave) CActiveScheduler; |
335 CActiveScheduler* scheduler = new (ELeave) CActiveScheduler; |
351 CleanupStack::PushL(scheduler); |
336 CleanupStack::PushL(scheduler); |
352 CActiveScheduler::Install( scheduler ); |
337 CActiveScheduler::Install( scheduler ); |
353 // Opens the bitmap file and supplies it to the active object |
338 // Opens the bitmap file and supplies it to the active object |
|
339 RFs fs; |
|
340 CleanupClosePushL( fs ); |
|
341 User::LeaveIfError(fs.Connect()); |
354 RFile bitmapFile; |
342 RFile bitmapFile; |
355 CleanupClosePushL( bitmapFile ); |
343 CleanupClosePushL( bitmapFile ); |
356 User::LeaveIfError( bitmapFile.Open( aSvgConverter.FileSession(), aSvgConverter.Filepath(), EFileRead|EFileWrite|EFileShareAny)); |
344 User::LeaveIfError( bitmapFile.Open( fs, aSvgConverter.Filepath(), EFileRead|EFileWrite|EFileShareAny )); |
357 |
345 |
358 // Create an active object that is executed in this thread |
346 // Create an active object that is executed in this thread |
359 CUpnpIconConversionActive* active = CUpnpIconConversionActive::NewL( bitmapFile ); |
347 CUpnpIconConversionActive* active = CUpnpIconConversionActive::NewL( bitmapFile ); |
360 CleanupStack::PushL(active); |
348 CleanupStack::PushL(active); |
361 // Invoke the request to the active object |
349 // Invoke the request to the active object |
366 |
354 |
367 /** |
355 /** |
368 * Thread execution ends (waiting for CActiveScheduler::Stop()) |
356 * Thread execution ends (waiting for CActiveScheduler::Stop()) |
369 * Cleanup the active object and scheduler |
357 * Cleanup the active object and scheduler |
370 */ |
358 */ |
371 CleanupStack::PopAndDestroy(UpnpString::KCRLFCRLength,scheduler); |
359 CleanupStack::PopAndDestroy(UpnpString::KDoubleLineFeedLength,scheduler); |
372 OstTraceFunctionExit0( CUPNPSVGIMAGECONVERTER_IMAGECONVERTERL_EXIT ); |
360 OstTraceFunctionExit0( CUPNPSVGIMAGECONVERTER_IMAGECONVERTERL_EXIT ); |
373 } |
361 } |
374 |
362 |
375 // End of File |
363 // End of File |