1 /* |
|
2 * Copyright (c) 2002-2007 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: Base class for converters. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #include <fbs.h> |
|
20 #include "CSatSIconConverter.h" |
|
21 #include "CSatSBasicIconConverter.h" |
|
22 #include "CSatSColorIconConverter.h" |
|
23 #include "SatLog.h" |
|
24 |
|
25 // ======== MEMBER FUNCTIONS ======== |
|
26 |
|
27 // ----------------------------------------------------------------------------- |
|
28 // CSatSIconConverter::CSatSIconConverter |
|
29 // C++ default constructor can NOT contain any code, that |
|
30 // might leave. |
|
31 // ----------------------------------------------------------------------------- |
|
32 // |
|
33 CSatSIconConverter::CSatSIconConverter() |
|
34 { |
|
35 LOG( SIMPLE, |
|
36 "SATENGINE: CSatSIconConverter::CSatSIconConverter calling - exiting" ) |
|
37 } |
|
38 |
|
39 // ----------------------------------------------------------------------------- |
|
40 // CSatSIconConverter::CreateConverterL |
|
41 // Factory method for creating converter. |
|
42 // ----------------------------------------------------------------------------- |
|
43 // |
|
44 CSatSIconConverter* CSatSIconConverter::CreateConverterL( |
|
45 const RSat::TImageCoding& aCoding ) |
|
46 { |
|
47 LOG( SIMPLE, "SATENGINE: CSatSIconConverter::CreateConverterL calling" ) |
|
48 |
|
49 CSatSIconConverter* converter = NULL; |
|
50 LOG2( SIMPLE, "SATENGINE: CSatSIconConverter::CreateConverterL \ |
|
51 aCoding: %d", aCoding ) |
|
52 switch ( aCoding ) |
|
53 { |
|
54 case RSat::KBasic: |
|
55 { |
|
56 converter = new( ELeave )CSatSBasicIconConverter(); |
|
57 break; |
|
58 } |
|
59 |
|
60 case RSat::KColour: |
|
61 { |
|
62 converter = new( ELeave )CSatSColorIconConverter(); |
|
63 break; |
|
64 } |
|
65 |
|
66 default: |
|
67 { |
|
68 User::Leave( KErrNotSupported ); |
|
69 } |
|
70 } |
|
71 |
|
72 LOG( SIMPLE, "SATENGINE: CSatSIconConverter::CreateConverterL exiting" ) |
|
73 return converter; |
|
74 } |
|
75 |
|
76 // ----------------------------------------------------------------------------- |
|
77 // CSatSIconConverter::CreateBitmapL |
|
78 // Creates the bitmap. |
|
79 // ----------------------------------------------------------------------------- |
|
80 // |
|
81 CFbsBitmap* CSatSIconConverter::CreateBitmapL( |
|
82 TUint8 aWidth, |
|
83 TUint8 aHeight, |
|
84 TDisplayMode aDisplayMode ) const |
|
85 { |
|
86 LOG( SIMPLE, "SATENGINE: CSatSIconConverter::CreateBitmapL calling" ) |
|
87 |
|
88 CFbsBitmap* bitmap = new( ELeave )CFbsBitmap(); |
|
89 CleanupStack::PushL( bitmap ); |
|
90 User::LeaveIfError( |
|
91 bitmap->Create( TSize( aWidth, aHeight ), aDisplayMode ) ); |
|
92 CleanupStack::Pop( bitmap ); |
|
93 |
|
94 LOG( SIMPLE, "SATENGINE: CSatSIconConverter::CreateBitmapL exiting" ) |
|
95 return bitmap; |
|
96 } |
|