1 /* |
1 /* |
2 * Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies). |
2 * Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). |
3 * All rights reserved. |
3 * All rights reserved. |
4 * This component and the accompanying materials are made available |
4 * This component and the accompanying materials are made available |
5 * under the terms of "Eclipse Public License v1.0" |
5 * under the terms of "Eclipse Public License v1.0" |
6 * which accompanies this distribution, and is available |
6 * which accompanies this distribution, and is available |
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
51 * Calls MM2GRenderContext::BindL method. |
51 * Calls MM2GRenderContext::BindL method. |
52 * @since Series S60 3.0 |
52 * @since Series S60 3.0 |
53 * @param aRenderContextHandle Render context handle. |
53 * @param aRenderContextHandle Render context handle. |
54 * @param aTargetHandle Target graphics handle |
54 * @param aTargetHandle Target graphics handle |
55 * @throws exception if not ok |
55 * @throws exception if not ok |
56 |
56 */ |
57 LOCAL_C void DoBindL(TInt aRenderContextHandle, TInt aTargetHandle, TBool aUiToolkit) |
57 |
58 { |
|
59 MM2GRenderContext* rc = JavaUnhand<MM2GRenderContext>(aRenderContextHandle); |
|
60 rc->BindL(aTargetHandle, aUiToolkit); |
|
61 } |
|
62 */ |
|
63 /** |
|
64 * JNI method |
|
65 |
|
66 JNIEXPORT jint JNICALL |
58 JNIEXPORT jint JNICALL |
67 Java_com_nokia_microedition_m2g_M2GScalableGraphics__1bind( |
59 Java_com_nokia_microedition_m2g_M2GScalableGraphics__1bind( |
68 JNIEnv* aJni, |
60 JNIEnv* aJni, |
69 jobject, |
61 jobject, |
70 jint aEventSourceHandle, |
|
71 jint aRenderContextHandle, |
62 jint aRenderContextHandle, |
72 jint aTargetHandle, |
63 jint aTargetHandle) |
73 jboolean aUiToolkit) |
|
74 */ |
|
75 |
|
76 |
|
77 |
|
78 JNIEXPORT jint JNICALL |
|
79 Java_com_nokia_microedition_m2g_M2GScalableGraphics__1bind( |
|
80 JNIEnv* aJni, |
|
81 jobject, |
|
82 jint aRenderContextHandle, |
|
83 jint aTargetHandle ) |
|
84 { |
64 { |
85 M2G_DEBUG_0("M2G_DEBUG: JNI ( M2GScalableGraphics ) _bind - begin"); |
65 M2G_DEBUG_0("M2G_DEBUG: JNI ( M2GScalableGraphics ) _bind - begin"); |
86 |
66 |
87 TInt err = KM2GNotOk; |
67 TInt err = KM2GNotOk; |
88 |
68 |
89 M2G_DO_LOCK |
69 M2G_DO_LOCK |
90 |
70 |
91 if (aRenderContextHandle) |
71 if (aRenderContextHandle) |
92 { |
72 { |
93 MM2GRenderContext* rc = JavaUnhand<MM2GRenderContext>(aRenderContextHandle); |
73 MM2GRenderContext* rc = JavaUnhand<MM2GRenderContext>(aRenderContextHandle); |
94 TRAP(err,rc->BindL(aTargetHandle);); |
74 TRAP(err,rc->BindL(aTargetHandle);); |
95 } |
75 } |
96 |
76 |
97 M2G_DO_UNLOCK(aJni) |
77 M2G_DO_UNLOCK(aJni) |
98 |
78 |
99 M2GGeneral::CheckErrorCode(aJni, err); |
79 M2GGeneral::CheckErrorCode(aJni, err); |
100 M2G_DEBUG_1("M2G_DEBUG: JNI ( M2GScalableGraphics ) _bind: %d - end", err); |
80 M2G_DEBUG_1("M2G_DEBUG: JNI ( M2GScalableGraphics ) _bind: %d - end", err); |
101 |
81 |
102 return err; |
82 return err; |
103 } |
83 } |
104 |
84 |
105 |
85 |
106 |
86 |
107 // ----------------------------------------------------------------------------- |
87 // ----------------------------------------------------------------------------- |
113 * @param aSvgProxyHandle Proxy instance. |
93 * @param aSvgProxyHandle Proxy instance. |
114 * @param aHandle Render context handle. |
94 * @param aHandle Render context handle. |
115 * @throws exception if not ok |
95 * @throws exception if not ok |
116 */ |
96 */ |
117 |
97 |
118 |
|
119 |
|
120 JNIEXPORT jint JNICALL |
98 JNIEXPORT jint JNICALL |
121 Java_com_nokia_microedition_m2g_M2GScalableGraphics__1createRenderContext( |
99 Java_com_nokia_microedition_m2g_M2GScalableGraphics__1createRenderContext( |
122 JNIEnv* aJni, |
100 JNIEnv* aJni, |
123 jobject, |
101 jobject, |
124 jint aSvgProxyHandle ) |
102 jint aSvgProxyHandle) |
125 { |
103 { |
126 M2G_DEBUG_0("M2G_DEBUG: JNI ( M2GScalableGraphics ) _createRenderContext - begin"); |
104 M2G_DEBUG_0("M2G_DEBUG: JNI ( M2GScalableGraphics ) _createRenderContext - begin"); |
127 TInt handle = M2G_INVALID_HANDLE; |
105 TInt handle = M2G_INVALID_HANDLE; |
128 TInt err = KM2GNotOk; |
106 TInt err = KM2GNotOk; |
129 |
107 |
130 M2G_DO_LOCK |
108 M2G_DO_LOCK |
131 |
109 |
132 if (aSvgProxyHandle) |
110 if (aSvgProxyHandle) |
133 { |
111 { |
134 TRAP(err, MM2GRenderContext* rchandle = CM2GRenderContext::NewL(JavaUnhand<MM2GSVGProxy> (aSvgProxyHandle)); handle = JavaMakeHandle(rchandle); ); |
112 TRAP(err, MM2GRenderContext* rchandle = CM2GRenderContext::NewL(JavaUnhand<MM2GSVGProxy> (aSvgProxyHandle)); handle = JavaMakeHandle(rchandle);); |
135 } |
113 } |
136 M2G_DO_UNLOCK(aJni) |
114 M2G_DO_UNLOCK(aJni) |
137 |
115 |
138 handle = M2GGeneral::CheckErrorCodeAndHandle(aJni, err, handle, err); |
116 handle = M2GGeneral::CheckErrorCodeAndHandle(aJni, err, handle, err); |
139 |
117 |
140 M2G_DEBUG_1("M2G_DEBUG: JNI ( M2GScalableGraphics ) _createRenderContext: %d - end", handle); |
118 M2G_DEBUG_1("M2G_DEBUG: JNI ( M2GScalableGraphics ) _createRenderContext: %d - end", handle); |
141 |
119 |
142 |
|
143 |
|
144 return handle; |
120 return handle; |
145 } |
121 } |
146 |
122 |
147 // ----------------------------------------------------------------------------- |
123 // ----------------------------------------------------------------------------- |
148 // Java_com_nokia_microedition_m2g_M2GScalableGraphics::_deleteRenderContext |
124 // Java_com_nokia_microedition_m2g_M2GScalableGraphics::_deleteRenderContext |
157 JNIEnv* aJni, |
133 JNIEnv* aJni, |
158 jobject, |
134 jobject, |
159 jint aRenderContextHandle) |
135 jint aRenderContextHandle) |
160 { |
136 { |
161 M2G_DEBUG_0("M2G_DEBUG: JNI ( M2GScalableGraphics ) _deleteRenderContext - begin"); |
137 M2G_DEBUG_0("M2G_DEBUG: JNI ( M2GScalableGraphics ) _deleteRenderContext - begin"); |
162 |
138 |
163 M2G_DO_LOCK |
139 M2G_DO_LOCK |
164 |
140 |
165 if (aRenderContextHandle) |
141 if (aRenderContextHandle) |
166 { |
142 { |
167 MM2GRenderContext* rc = JavaUnhand<MM2GRenderContext>(aRenderContextHandle); |
143 MM2GRenderContext* rc = JavaUnhand<MM2GRenderContext>(aRenderContextHandle); |
168 delete rc; |
144 delete rc; |
169 } |
145 } |
170 M2G_DO_UNLOCK(aJni) |
146 M2G_DO_UNLOCK(aJni) |
171 |
147 |
172 M2G_DEBUG_0("M2G_DEBUG: JNI ( M2GScalableGraphics ) _deleteRenderContext - end"); |
148 M2G_DEBUG_0("M2G_DEBUG: JNI ( M2GScalableGraphics ) _deleteRenderContext - end"); |
173 } |
149 } |
174 |
150 |
175 // ----------------------------------------------------------------------------- |
151 // ----------------------------------------------------------------------------- |
176 // Java_com_nokia_microedition_m2g_M2GScalableGraphics::_release |
152 // Java_com_nokia_microedition_m2g_M2GScalableGraphics::_release |
180 * @since Series S60 3.0 |
156 * @since Series S60 3.0 |
181 * @param aRenderContextHandle Context handle |
157 * @param aRenderContextHandle Context handle |
182 * @return KM2GOk if ok |
158 * @return KM2GOk if ok |
183 */ |
159 */ |
184 |
160 |
185 |
|
186 /** |
|
187 * JNI method |
|
188 */ |
|
189 JNIEXPORT jint JNICALL |
161 JNIEXPORT jint JNICALL |
190 Java_com_nokia_microedition_m2g_M2GScalableGraphics__1release( |
162 Java_com_nokia_microedition_m2g_M2GScalableGraphics__1release( |
191 JNIEnv* aJni, |
163 JNIEnv* aJni, |
192 jobject, |
164 jobject, |
193 jint aSurfaceHandle, |
165 jint /*aSurfaceHandle*/, |
194 jint aRenderContextHandle) |
166 jint aRenderContextHandle) |
195 { |
167 { |
196 |
168 |
197 // Release used target surface |
169 // Release used target surface |
198 M2G_DEBUG_0("M2G_DEBUG: JNI ( M2GScalableGraphics ) _release - begin"); |
170 M2G_DEBUG_0("M2G_DEBUG: JNI ( M2GScalableGraphics ) _release - begin"); |
199 TInt err = KM2GNotOk; |
171 TInt err = KM2GNotOk; |
200 M2G_DO_LOCK |
172 M2G_DO_LOCK |
201 |
173 |
202 if (aRenderContextHandle) |
174 if (aRenderContextHandle) |
203 { |
175 { |
204 MM2GRenderContext* rc = JavaUnhand<MM2GRenderContext>(aRenderContextHandle); |
176 MM2GRenderContext* rc = JavaUnhand<MM2GRenderContext>(aRenderContextHandle); |
205 TRAP(err,rc->ReleaseL();); |
177 TRAP(err,rc->ReleaseL();); |
206 |
178 } |
207 } |
179 M2G_DO_UNLOCK(aJni) |
208 M2G_DO_UNLOCK(aJni)//TODO Check for M2G_DO_LOCK M2G_DO_UNLOCK |
180 |
209 //TODO just check it pankaj 8/9/2010 |
181 M2GGeneral::CheckErrorCode(aJni, err); |
210 // Java::GFX::WindowSurface* surf = reinterpret_cast<Java::GFX::WindowSurface*>(aSurfaceHandle); |
182 |
211 // surf->release(); //TODO check This windows surface call detected from Graphics3d.inl |
183 return err; |
212 M2GGeneral::CheckErrorCode(aJni, err); |
184 |
213 |
|
214 return err; |
|
215 |
|
216 } |
185 } |
217 // ----------------------------------------------------------------------------- |
186 // ----------------------------------------------------------------------------- |
218 // Java_com_nokia_microedition_m2g_M2GScalableGraphics::_render |
187 // Java_com_nokia_microedition_m2g_M2GScalableGraphics::_render |
219 // ----------------------------------------------------------------------------- |
188 // ----------------------------------------------------------------------------- |
220 /** |
189 /** |
226 * @param aSvgH Svg heigth. |
195 * @param aSvgH Svg heigth. |
227 * @param aCurrentTime Current time. |
196 * @param aCurrentTime Current time. |
228 * @throws Exception if not ok |
197 * @throws Exception if not ok |
229 */ |
198 */ |
230 |
199 |
231 |
|
232 /** |
|
233 * JNI method |
|
234 */ |
|
235 JNIEXPORT jint JNICALL |
200 JNIEXPORT jint JNICALL |
236 Java_com_nokia_microedition_m2g_M2GScalableGraphics__1renderLCDUI( |
201 Java_com_nokia_microedition_m2g_M2GScalableGraphics__1renderLCDUI( |
237 JNIEnv* aJni, |
202 JNIEnv* aJni, |
238 jobject, |
203 jobject, |
239 jint aRenderContextHandle, |
204 jint aRenderContextHandle, |
247 |
212 |
248 TM2GRenderRect rr(aX, aY, aClipX, aClipY, aClipW, aClipH); |
213 TM2GRenderRect rr(aX, aY, aClipX, aClipY, aClipW, aClipH); |
249 TInt err = KM2GNotOk; |
214 TInt err = KM2GNotOk; |
250 |
215 |
251 M2G_DO_LOCK |
216 M2G_DO_LOCK |
252 |
217 |
253 if (aRenderContextHandle && aDocumentHandle) |
218 if (aRenderContextHandle && aDocumentHandle) |
254 { |
219 { |
255 MM2GRenderContext* rc = JavaUnhand<MM2GRenderContext>(aRenderContextHandle); |
220 MM2GRenderContext* rc = JavaUnhand<MM2GRenderContext>(aRenderContextHandle); |
256 TRAP(err,rc->RenderLCDUIL(aDocumentHandle, aCurrentTime, aSvgW, aSvgH, rr);); |
221 TRAP(err,rc->RenderLCDUIL(aDocumentHandle, aCurrentTime, aSvgW, aSvgH, rr);); |
257 } |
222 } |
258 M2G_DO_UNLOCK(aJni) |
223 M2G_DO_UNLOCK(aJni) |
259 |
224 |
260 M2GGeneral::CheckErrorCode(aJni, err); |
225 M2GGeneral::CheckErrorCode(aJni, err); |
261 M2G_DEBUG_1("M2G_DEBUG: JNI ( M2GScalableGraphics ) _render: %d - end", err); |
226 M2G_DEBUG_1("M2G_DEBUG: JNI ( M2GScalableGraphics ) _render: %d - end", err); |
262 return err; |
227 return err; |
263 } |
228 } |
264 |
229 |
265 |
230 |
278 { |
243 { |
279 M2G_DEBUG_1("M2G_DEBUG: JNI ( M2GScalableGraphics ) _render, time:%f - begin", aCurrentTime); |
244 M2G_DEBUG_1("M2G_DEBUG: JNI ( M2GScalableGraphics ) _render, time:%f - begin", aCurrentTime); |
280 TM2GRenderRect rr(aX, aY, aClipX, aClipY, aClipW, aClipH); |
245 TM2GRenderRect rr(aX, aY, aClipX, aClipY, aClipW, aClipH); |
281 TInt err = KM2GNotOk; |
246 TInt err = KM2GNotOk; |
282 jintArray returnDataJava = aJni->NewIntArray(10); |
247 jintArray returnDataJava = aJni->NewIntArray(10); |
283 |
248 |
284 M2G_DO_LOCK |
249 M2G_DO_LOCK |
285 |
250 |
286 TInt returnData[10]; |
251 TInt returnData[10]; |
287 |
252 |
288 if (aRenderContextHandle && aDocumentHandle) |
253 if (aRenderContextHandle && aDocumentHandle) |
289 { |
254 { |
290 MM2GRenderContext* rc = JavaUnhand<MM2GRenderContext>(aRenderContextHandle); |
255 MM2GRenderContext* rc = JavaUnhand<MM2GRenderContext>(aRenderContextHandle); |
291 TRAP(err,rc->RenderESWTL(aDocumentHandle,aCurrentTime,aSvgW,aSvgH,rr,aUseNativeClear,returnData);); |
256 TRAP(err,rc->RenderESWTL(aDocumentHandle,aCurrentTime,aSvgW,aSvgH,rr,aUseNativeClear,returnData);); |
292 } |
257 } |
293 M2G_DO_UNLOCK(aJni) |
258 M2G_DO_UNLOCK(aJni) |
294 |
259 |
295 |
260 |
296 if (returnDataJava != NULL) |
261 if (returnDataJava != NULL) |
297 aJni->SetIntArrayRegion(returnDataJava, 0, 10, const_cast<TInt*>(returnData)); |
262 aJni->SetIntArrayRegion(returnDataJava, 0, 10, const_cast<TInt*>(returnData)); |
298 |
263 |
299 M2GGeneral::CheckErrorCode(aJni, err); |
264 M2GGeneral::CheckErrorCode(aJni, err); |
300 M2G_DEBUG_1("M2G_DEBUG: JNI ( M2GScalableGraphics ) _render: %d - end", err); |
265 M2G_DEBUG_1("M2G_DEBUG: JNI ( M2GScalableGraphics ) _render: %d - end", err); |
301 return returnDataJava; |
266 return returnDataJava; |
302 } |
267 } |
303 // ----------------------------------------------------------------------------- |
268 // ----------------------------------------------------------------------------- |
304 // Java_com_nokia_microedition_m2g_M2GScalableGraphics::_setRenderingQuality |
269 // Java_com_nokia_microedition_m2g_M2GScalableGraphics::_setRenderingQuality |
316 jobject, |
281 jobject, |
317 jint aRenderContextHandle, jint aMode) |
282 jint aRenderContextHandle, jint aMode) |
318 { |
283 { |
319 M2G_DEBUG_0("M2G_DEBUG: JNI ( M2GScalableGraphics ) _setRenderingQuality - begin"); |
284 M2G_DEBUG_0("M2G_DEBUG: JNI ( M2GScalableGraphics ) _setRenderingQuality - begin"); |
320 TInt err = KM2GNotOk; |
285 TInt err = KM2GNotOk; |
321 |
286 |
322 M2G_DO_LOCK |
287 M2G_DO_LOCK |
323 |
288 |
324 if ( aRenderContextHandle) |
289 if (aRenderContextHandle) |
325 { |
290 { |
326 MM2GRenderContext* rc = JavaUnhand<MM2GRenderContext>(aRenderContextHandle); |
291 MM2GRenderContext* rc = JavaUnhand<MM2GRenderContext>(aRenderContextHandle); |
327 TRAP(err,rc->SetRenderingQualityL(aMode);); |
292 TRAP(err,rc->SetRenderingQualityL(aMode);); |
328 } |
293 } |
329 M2G_DO_UNLOCK(aJni) |
294 M2G_DO_UNLOCK(aJni) |
330 |
295 |
331 M2GGeneral::CheckErrorCode(aJni, err); |
296 M2GGeneral::CheckErrorCode(aJni, err); |
332 |
297 |
333 M2G_DEBUG_0("M2G_DEBUG: JNI ( M2GScalableGraphics ) _setRenderingQuality - end"); |
298 M2G_DEBUG_0("M2G_DEBUG: JNI ( M2GScalableGraphics ) _setRenderingQuality - end"); |
334 } |
299 } |
335 |
300 |
349 jint aRenderContextHandle, |
314 jint aRenderContextHandle, |
350 jfloat aAlpha) |
315 jfloat aAlpha) |
351 { |
316 { |
352 M2G_DEBUG_0("M2G_DEBUG: JNI ( M2GScalableGraphics ) _setTransparency - begin"); |
317 M2G_DEBUG_0("M2G_DEBUG: JNI ( M2GScalableGraphics ) _setTransparency - begin"); |
353 TInt err = KM2GNotOk; |
318 TInt err = KM2GNotOk; |
354 |
319 |
355 M2G_DO_LOCK |
320 M2G_DO_LOCK |
356 |
321 |
357 if (aRenderContextHandle) |
322 if (aRenderContextHandle) |
358 { |
323 { |
359 MM2GRenderContext* rc = JavaUnhand<MM2GRenderContext>(aRenderContextHandle); |
324 MM2GRenderContext* rc = JavaUnhand<MM2GRenderContext>(aRenderContextHandle); |
360 TRAP(err,rc->SetTransparency( (TReal32)aAlpha );); |
325 TRAP(err,rc->SetTransparency((TReal32)aAlpha);); |
361 } |
326 } |
362 M2G_DO_UNLOCK(aJni) |
327 M2G_DO_UNLOCK(aJni) |
363 |
328 |
364 M2GGeneral::CheckErrorCode(aJni, err); |
329 M2GGeneral::CheckErrorCode(aJni, err); |
365 |
330 |
366 M2G_DEBUG_0("M2G_DEBUG: JNI ( M2GScalableGraphics ) _setTransparency - end"); |
331 M2G_DEBUG_0("M2G_DEBUG: JNI ( M2GScalableGraphics ) _setTransparency - end"); |
367 } |
332 } |
368 |
333 |