56
|
1 |
/*
|
87
|
2 |
* Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
|
56
|
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: Render context
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
#ifndef CM2GRENDERCONTEXT_H
|
|
19 |
#define CM2GRENDERCONTEXT_H
|
|
20 |
|
|
21 |
// INCLUDES
|
|
22 |
#include <fbs.h>
|
|
23 |
#include "MM2GRenderContext.h"
|
|
24 |
#include <graphics.h>
|
|
25 |
|
|
26 |
class CSvgtBitmap;
|
|
27 |
|
|
28 |
M2G_NS_START
|
|
29 |
|
|
30 |
// CONSTANTS
|
|
31 |
|
|
32 |
// MACROS
|
|
33 |
|
|
34 |
// DATA TYPES
|
|
35 |
|
|
36 |
// FUNCTION PROTOTYPES
|
|
37 |
|
|
38 |
// FORWARD DECLARATIONS
|
|
39 |
class MM2GSVGProxy;
|
|
40 |
class CBitmapContext;
|
|
41 |
#ifdef RD_JAVA_NGA_ENABLED
|
|
42 |
class MMIDCanvas;
|
|
43 |
#endif // RD_JAVA_NGA_ENABLED
|
|
44 |
|
|
45 |
// CLASS DECLARATION
|
|
46 |
/**
|
|
47 |
* Render context
|
|
48 |
*/
|
|
49 |
|
|
50 |
|
|
51 |
class CM2GRenderContext : public CBase, public MM2GRenderContext
|
|
52 |
{
|
|
53 |
private: // METHODS
|
|
54 |
/**
|
|
55 |
* C++ default constructor.
|
|
56 |
*/
|
|
57 |
CM2GRenderContext();
|
|
58 |
|
|
59 |
/**
|
|
60 |
* C++ copy constructor
|
|
61 |
*/
|
|
62 |
CM2GRenderContext(const CM2GRenderContext&);
|
|
63 |
|
|
64 |
/**
|
|
65 |
* C++ assignment operator
|
|
66 |
*/
|
|
67 |
CM2GRenderContext& operator=(const CM2GRenderContext&);
|
|
68 |
|
|
69 |
/**
|
|
70 |
* Initialization
|
|
71 |
*/
|
|
72 |
void ConstructL(MM2GSVGProxy* aProxy);
|
|
73 |
|
|
74 |
public: // METHODS
|
|
75 |
/**
|
|
76 |
* Two-phased constructor.
|
|
77 |
*/
|
|
78 |
static CM2GRenderContext* NewL(MM2GSVGProxy* aProxy);
|
|
79 |
|
|
80 |
/**
|
|
81 |
* Destructor.
|
|
82 |
*/
|
|
83 |
virtual ~CM2GRenderContext();
|
|
84 |
|
|
85 |
/**
|
|
86 |
* @see MM2GRenderContext::BindL()
|
|
87 |
*/
|
|
88 |
virtual void BindL(TInt& aGraphicsHandle);
|
|
89 |
|
|
90 |
/**
|
|
91 |
* @see MM2GRenderContext::InitImageBitmapL()
|
|
92 |
*/
|
|
93 |
virtual void InitImageBitmapL();
|
|
94 |
|
|
95 |
/**
|
|
96 |
* @see MM2GRenderContext::BlitToL()
|
|
97 |
*/
|
|
98 |
virtual void ReleaseL();
|
|
99 |
|
|
100 |
/**
|
|
101 |
* @see MM2GRenderContext::RenderL()
|
|
102 |
*/
|
|
103 |
virtual void RenderLCDUIL(
|
|
104 |
TM2GSvgDocumentHandle& aSvgDocumentHandle,
|
|
105 |
const TReal32 aCurrentTime,
|
|
106 |
TInt aSvgW, TInt aSvgH,
|
|
107 |
TM2GRenderRect& aRect);
|
|
108 |
virtual void RenderESWTL(
|
|
109 |
TM2GSvgDocumentHandle& aSvgDocHandle,
|
|
110 |
const TReal32 aCurrentTime,
|
|
111 |
TInt aSvgW, TInt aSvgH,
|
87
|
112 |
TM2GRenderRect& aRect,
|
56
|
113 |
TBool aUseNativeClear,
|
|
114 |
TInt* aReturnData);
|
|
115 |
|
|
116 |
/**
|
|
117 |
* @see MM2GRenderContext::SetRenderingQualityL()
|
|
118 |
*/
|
|
119 |
virtual void SetRenderingQualityL(TInt aMode);
|
|
120 |
|
|
121 |
/**
|
|
122 |
* @see MM2GRenderContext::SetTransparency()
|
|
123 |
*/
|
|
124 |
virtual void SetTransparency(TReal32 aAlpha);
|
|
125 |
|
87
|
126 |
|
56
|
127 |
|
|
128 |
private:
|
|
129 |
/**
|
|
130 |
* Prepare viewbox and anchor
|
|
131 |
*
|
|
132 |
* @param aRr clip area information
|
|
133 |
* @return aViewbox render rectangle area
|
|
134 |
* @return aAnchor recalculated anchor point
|
|
135 |
*/
|
|
136 |
void PrepareViewbox(
|
|
137 |
TM2GRenderRect& aRr,
|
|
138 |
TInt aSvgW, TInt aSvgH,
|
|
139 |
TRect& aViewbox, TPoint& aAnchor);
|
|
140 |
|
|
141 |
/**
|
|
142 |
* Renders a SVG document at a current time.
|
|
143 |
*
|
|
144 |
* <p> The rendering is done in 2 steps:
|
|
145 |
* <li> render the document on an internal SVG buffer (iSvg)
|
|
146 |
* <li> alpha-blend it with the bound graphics target (iGraphicsBitmap)
|
|
147 |
*
|
|
148 |
* @note if transparency factor is not set, iSvg is simply blitted onto iGraphicsTarget
|
|
149 |
*
|
|
150 |
* @param aSvgDocumentHandle handle to SVG document
|
|
151 |
* @param aCurrentTime the current time of the animation
|
|
152 |
* @param aSvgW Svg image viewport width
|
|
153 |
* @param aSvgH Svg image viewport height
|
|
154 |
* @param aRect contains position about the rendered area
|
|
155 |
* @param aAnchor anchor point
|
|
156 |
*
|
|
157 |
* @since S60 3.1
|
|
158 |
*/
|
|
159 |
void RenderLCDUIL(
|
|
160 |
TM2GSvgDocumentHandle& aSvgDocumentHandle,
|
|
161 |
const TReal32 aCurrentTime,
|
|
162 |
const TRect& aViewbox,
|
|
163 |
const TPoint& aAnchor);
|
|
164 |
|
|
165 |
void RenderESWTL(
|
|
166 |
TM2GSvgDocumentHandle& aSvgDocHandle,
|
|
167 |
TReal32 aCurrentTime,
|
|
168 |
const TRect& aViewbox,
|
|
169 |
const TPoint& aAnchor,
|
|
170 |
TBool aUseNativeClear,
|
|
171 |
TInt* aReturnData);
|
|
172 |
|
87
|
173 |
private: // VARIABLES
|
56
|
174 |
|
|
175 |
MM2GSVGProxy* iProxy;
|
|
176 |
|
|
177 |
TM2GSvgEngineHandle iEngineHandle;
|
|
178 |
|
|
179 |
TReal32 iAlpha;
|
|
180 |
TUint8 iScaledAlpha;
|
87
|
181 |
|
56
|
182 |
//for eswt compatibility
|
|
183 |
CFbsBitmap* iImgBmp;
|
|
184 |
RFbsSession iFbsSession;
|
87
|
185 |
|
|
186 |
//For WindowsSurface CFbsBitmap || Qimage
|
|
187 |
Java::GFX::WindowSurface* iWindowSurface;
|
|
188 |
|
|
189 |
|
|
190 |
|
56
|
191 |
// Temporary buffer ( offscreen ) for QImage support
|
|
192 |
QImage* iOffScreenQImage;
|
|
193 |
CFbsBitmap* iOffScreenBitmap;
|
87
|
194 |
|
56
|
195 |
QImage* iTargetQImage;
|
|
196 |
|
|
197 |
Java::GFX::WindowSurfaceType wSurfaceType;
|
|
198 |
CSvgtBitmap * targetBitmap;
|
87
|
199 |
|
56
|
200 |
CFbsBitmap* tempBitmapForMask ;
|
|
201 |
|
87
|
202 |
|
56
|
203 |
private:
|
87
|
204 |
|
56
|
205 |
};
|
|
206 |
/*-----------------------------------------------------------
|
|
207 |
class : CFbsBitmapHack
|
|
208 |
purpose: Class is provided as a solution for double render
|
|
209 |
issue in eSWT
|
|
210 |
*-----------------------------------------------------------*/
|
|
211 |
class CFbsBitmapHack : public CFbsBitmap
|
|
212 |
{
|
|
213 |
public:
|
|
214 |
TInt GetMyHandle()
|
|
215 |
{
|
|
216 |
return iHandle;
|
|
217 |
}
|
|
218 |
};
|
|
219 |
|
|
220 |
|
|
221 |
M2G_NS_END
|
|
222 |
#endif // CM2GRENDERCONTEXT_H
|