|
1 /* |
|
2 * Copyright (c) 2004-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 CMIDIMAGELOADER_H |
|
19 #define CMIDIMAGELOADER_H |
|
20 |
|
21 #include <mevents.h> |
|
22 #include <fbs.h> |
|
23 #include "CMIDToolkit.h" |
|
24 |
|
25 // |
|
26 // |
|
27 // |
|
28 class CAsyncDecodeEvent; |
|
29 class CMIDImageLoader : public CJavaEventSource<CMIDImageLoader>, private MMIDImageObserver |
|
30 { |
|
31 public: |
|
32 static TInt New(JNIEnv& aJni, jobject aPeer, TJavaEventServer aServer, jint aToolkitHandle); |
|
33 |
|
34 CMIDImageLoader(); |
|
35 void ConstructJniL(JNIEnv& aJni, jobject aPeer, TJavaEventServer aServer, CMIDToolkit*); |
|
36 void ConstructSvrL(CMIDToolkit& aToolkit); |
|
37 void FinalizeSvr(); |
|
38 void FinalizeJni(JNIEnv& aJni); |
|
39 ~CMIDImageLoader(); |
|
40 |
|
41 MMIDImageDecoder* Decoder(); |
|
42 |
|
43 public: |
|
44 /** |
|
45 * Append data to decoder buffer. |
|
46 */ |
|
47 TInt AppendJni(JNIEnv& aJni, jbyteArray aByteArray, jint aByteOffset, jint aByteCount); |
|
48 |
|
49 /** |
|
50 * Initiate asynchronous decode. |
|
51 */ |
|
52 TInt AsyncDecodeJni(JNIEnv& aJni); |
|
53 |
|
54 private: |
|
55 static void InvokeAppendSvrL(CMIDImageLoader*); |
|
56 static void InvokeAsyncDecodeSvrL(CMIDImageLoader*); |
|
57 static void InvokeConstructSvrL(CMIDImageLoader*, CMIDToolkit*); |
|
58 |
|
59 private: |
|
60 void AppendSvrL(); |
|
61 void AsyncDecodeSvrL(); |
|
62 void DecodeComplete(TInt aError); |
|
63 |
|
64 private: |
|
65 CAsyncDecodeEvent* iNotifyEvent; |
|
66 MMIDImageDecoder* iDecoder; |
|
67 TUint8* iBufferArray; |
|
68 TInt iBufferLength; |
|
69 TInt iBufferCount; |
|
70 }; |
|
71 |
|
72 #endif // CMIDIMAGELOADER_H |