|
1 /* |
|
2 * Copyright (c) 2005 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: |
|
15 * |
|
16 */ |
|
17 |
|
18 #ifndef CMIDIMAGEDECODER_H |
|
19 #define CMIDIMAGEDECODER_H |
|
20 |
|
21 #include <e32base.h> |
|
22 #include "lcdgr.h" |
|
23 |
|
24 #include <imageconversion.h> |
|
25 #include "CMIDBitmapImage.h" |
|
26 |
|
27 /** |
|
28 * Peered, probably singleton facade to image operations. |
|
29 * |
|
30 * Methods invoked by server on behalf of java threads: |
|
31 * DecodeL |
|
32 * |
|
33 * expect java thread to block in waitForResult on peer's |
|
34 * condition variable. |
|
35 */ |
|
36 NONSHARABLE_CLASS(CMIDImageDecoder) |
|
37 : public CActive |
|
38 , public MMIDImageDecoder |
|
39 { |
|
40 public: |
|
41 CMIDImageDecoder(RFs& aFileServer, TDisplayMode aDisplayMode); |
|
42 void ConstructL(); |
|
43 ~CMIDImageDecoder(); |
|
44 |
|
45 // |
|
46 // From MMIDImageDecoder |
|
47 // |
|
48 void AppendL(const TDesC8& aBuffer); |
|
49 void DecodeL(MMIDImageObserver* aObserver); |
|
50 void Dispose(); |
|
51 MMIDBitmapImage* BitmapImage() const; |
|
52 |
|
53 private: |
|
54 void Complete(TInt aResult); |
|
55 |
|
56 void ConvertL(); |
|
57 void CreateImageL(); |
|
58 |
|
59 private: |
|
60 void RunL(); |
|
61 TInt RunError(TInt); |
|
62 void DoCancel(); |
|
63 |
|
64 private: |
|
65 enum TState |
|
66 { |
|
67 EStart, |
|
68 EOpenPending, |
|
69 EOpenComplete, |
|
70 EConvertPending, |
|
71 EComplete, |
|
72 ECancelled, |
|
73 EError=-1 |
|
74 }; |
|
75 |
|
76 private: |
|
77 CBufferedImageDecoder* iDecoder; |
|
78 TFrameInfo iFrameInfo; |
|
79 TState iState; |
|
80 CMIDBitmapImage* iBitmapImage; |
|
81 MMIDImageObserver* iCallback; |
|
82 RFs& iRFsSession; |
|
83 TDisplayMode iDisplayMode; // display mode from CMIDGraphicsFactory |
|
84 }; |
|
85 |
|
86 #endif // CMIDIMAGEDECODER_H |