|
1 /* |
|
2 * Copyright (c) 2010 Ixonos Plc. |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of the "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 * Ixonos Plc |
|
14 * |
|
15 * Description: |
|
16 * |
|
17 */ |
|
18 |
|
19 |
|
20 #ifndef __CFILTERJPEGSOURCE_H__ |
|
21 #define __CFILTERJPEGSOURCE_H__ |
|
22 |
|
23 #include <e32base.h> |
|
24 #include "MImageFilter.h" |
|
25 #include "TBitmapHandle.h" |
|
26 |
|
27 |
|
28 class MJpegLoad; |
|
29 |
|
30 class TBlockEntry |
|
31 { |
|
32 public: |
|
33 inline ~TBlockEntry() |
|
34 { |
|
35 delete iBitmap.iData; |
|
36 } |
|
37 public: |
|
38 TRect iRect; |
|
39 TBitmapHandle iBitmap; |
|
40 }; |
|
41 |
|
42 |
|
43 |
|
44 class CFilterJpegSource |
|
45 : public CBase |
|
46 , public MImageFilter |
|
47 { |
|
48 public: |
|
49 IMPORT_C static TInt Create(); |
|
50 virtual ~CFilterJpegSource(); |
|
51 |
|
52 private: |
|
53 static CFilterJpegSource* NewL(); |
|
54 CFilterJpegSource(); |
|
55 void ConstructL(); |
|
56 |
|
57 public: // MImageFilter |
|
58 virtual TRect Rect(); |
|
59 virtual TReal Scale(); |
|
60 virtual TSize ViewPortSize(); |
|
61 virtual TBlock * GetBlockL ( const TRect & aRect ); |
|
62 virtual void SetParent( MImageFilter* aParent ); |
|
63 virtual void SetChild( MImageFilter* aChild ); |
|
64 virtual TInt CmdL( const TDesC16& aCmd ); |
|
65 virtual const char* Type(); |
|
66 |
|
67 void LoadRectL(); |
|
68 |
|
69 private: // Data |
|
70 |
|
71 enum TOutputState |
|
72 { |
|
73 EDirect, |
|
74 EBuffer, |
|
75 } iOutputState; |
|
76 |
|
77 /// decoder instance |
|
78 MJpegLoad * iJpeg; |
|
79 // file name |
|
80 TFileName iFileName; |
|
81 // macroblock size |
|
82 TSize iBlockSize; |
|
83 // image size in macroblocks |
|
84 TSize iSizeInBlocks; |
|
85 // image rectangle |
|
86 TRect iRect; |
|
87 // scaled visible image rectangle |
|
88 TRect iScaledRect; |
|
89 // image size |
|
90 TSize iFullSize; |
|
91 |
|
92 // destination size |
|
93 TSize iDestSize; |
|
94 // destination buffer |
|
95 TUint32 * iDestBuffer; |
|
96 // relative scale |
|
97 TReal iRelScale; |
|
98 |
|
99 TBlockEntry ** iBlockBuffer; |
|
100 TInt iXAnd; |
|
101 TInt iYAnd; |
|
102 TUint32 iLastBlock; |
|
103 TInt * iIndexMap; |
|
104 TInt iOldestBlock; |
|
105 |
|
106 }; |
|
107 |
|
108 #endif |