|
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: Implementation of GlxtnImageDecoderFactory |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 #include "glxtnimagedecoderfactory.h" |
|
21 |
|
22 #include <glxtracer.h> |
|
23 #include <IclExtJpegApi.h> // For CExtJpegDecoder |
|
24 |
|
25 // --------------------------------------------------------------------------- |
|
26 // NewL |
|
27 // --------------------------------------------------------------------------- |
|
28 // |
|
29 CImageDecoder* GlxtnImageDecoderFactory::NewL( RFs& aFs, |
|
30 const TDesC& aFilename ) |
|
31 { |
|
32 TRACER("CImageDecoder* GlxtnImageDecoderFactory::NewL()"); |
|
33 CImageDecoder* decoder = NULL; |
|
34 |
|
35 // Use extended JPEG decoder |
|
36 TRAPD( err, decoder = CExtJpegDecoder::FileNewL( |
|
37 CExtJpegDecoder::EHwImplementation, aFs, aFilename, CImageDecoder::EOptionNone ) ); |
|
38 if ( KErrNone != err ) |
|
39 { |
|
40 TRAP(err,decoder = CExtJpegDecoder::FileNewL( |
|
41 CExtJpegDecoder::ESwImplementation, aFs, aFilename, CImageDecoder::EOptionNone ) ); |
|
42 if ( KErrNone != err ) |
|
43 { |
|
44 // Not a JPEG - use standard decoder |
|
45 decoder = CImageDecoder::FileNewL( aFs, aFilename, CImageDecoder::EOptionNone ); |
|
46 } |
|
47 } |
|
48 |
|
49 return decoder; |
|
50 } |
|
51 |
|
52 // --------------------------------------------------------------------------- |
|
53 // NewL |
|
54 // --------------------------------------------------------------------------- |
|
55 // |
|
56 CImageDecoder* GlxtnImageDecoderFactory::NewL( RFs& aFs, const TDesC8& aData ) |
|
57 { |
|
58 TRACER("CImageDecoder* GlxtnImageDecoderFactory::NewL()"); |
|
59 CImageDecoder* decoder = NULL; |
|
60 |
|
61 TRAPD( err, decoder = CExtJpegDecoder::DataNewL( |
|
62 CExtJpegDecoder::EHwImplementation, aFs, aData ) ); |
|
63 if ( KErrNone != err ) |
|
64 { |
|
65 TRAP(err, decoder = CExtJpegDecoder::DataNewL( |
|
66 CExtJpegDecoder::ESwImplementation, aFs, aData ) ); |
|
67 if ( KErrNone != err ) |
|
68 { |
|
69 // Not a JPEG - use standard decoder |
|
70 decoder = CImageDecoder::DataNewL( aFs, aData, CImageDecoder::EOptionNone ); |
|
71 } |
|
72 } |
|
73 |
|
74 return decoder; |
|
75 } |