|
1 /******************************************************************************* |
|
2 * Copyright (c) 2009, 2010 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. This program and the accompanying materials |
|
4 * are made available under the terms of the Eclipse Public License v1.0 |
|
5 * which accompanies this distribution, and is available at |
|
6 * http://www.eclipse.org/legal/epl-v10.html |
|
7 * |
|
8 * Contributors: |
|
9 * Nokia Corporation - initial API and implementation |
|
10 *******************************************************************************/ |
|
11 #include <QFont> |
|
12 #include <QFontMetrics> |
|
13 #include <QSharedDataPointer> |
|
14 |
|
15 #include <org_eclipse_swt_internal_qt_graphics_OS.h> |
|
16 #include "graphics.h" |
|
17 #include "gfxlog.h" |
|
18 #include "jniutils.h" |
|
19 #include "swtapplication.h" |
|
20 #include "autorelease.h" |
|
21 #include "gfxutils.h" |
|
22 |
|
23 using namespace Java::GFX; |
|
24 |
|
25 #define POINTER_TO_HANDLE(pointer) reinterpret_cast<jint>( pointer ) |
|
26 #define HANDLE_TO_POINTER(type, variable, handle) type variable = reinterpret_cast<type>( handle ) |
|
27 #define ARRAY_CAST(type, variable) reinterpret_cast<type>( variable ) |
|
28 |
|
29 #define GFX_TRY try |
|
30 #define GFX_CATCH \ |
|
31 catch(std::bad_alloc const&) \ |
|
32 { \ |
|
33 GfxException e(EGfxErrorNoMemory, "Bad alloc"); \ |
|
34 swtApp->jniUtils().Throw(aJniEnv, e); \ |
|
35 } \ |
|
36 catch(GfxException e) \ |
|
37 { \ |
|
38 swtApp->jniUtils().Throw(aJniEnv, e); \ |
|
39 } |
|
40 |
|
41 |
|
42 jint JNICALL Java_org_eclipse_swt_internal_qt_graphics_OS_graphicsContext_1get_1windowsurface |
|
43 (JNIEnv* aJniEnv, jclass, jint aHandle) |
|
44 { |
|
45 WindowSurface* ws = NULL; |
|
46 GFX_TRY |
|
47 { |
|
48 GFX_LOG_JNI_CALL(); |
|
49 HANDLE_TO_POINTER(GraphicsContext*, gc, aHandle); |
|
50 ws = gc->getWindowSurface(); |
|
51 } |
|
52 GFX_CATCH |
|
53 |
|
54 return POINTER_TO_HANDLE(ws); |
|
55 } |
|
56 |
|
57 // Creates a new instance of native graphics context (gc) |
|
58 jint JNICALL Java_org_eclipse_swt_internal_qt_graphics_OS_graphicsContext_1init |
|
59 (JNIEnv* aJniEnv , jclass) |
|
60 { |
|
61 GraphicsContext* gc = 0; |
|
62 GFX_TRY |
|
63 { |
|
64 GFX_LOG_JNI_CALL(); |
|
65 gc = GraphicsFactory::createGraphicsContext(); |
|
66 } |
|
67 GFX_CATCH |
|
68 |
|
69 return POINTER_TO_HANDLE(gc); |
|
70 } |
|
71 |
|
72 void JNICALL Java_org_eclipse_swt_internal_qt_graphics_OS_graphicsContext_1dispose |
|
73 (JNIEnv* aJniEnv , jclass, jint aHandle) |
|
74 { |
|
75 GFX_TRY |
|
76 { |
|
77 GFX_LOG_JNI_CALL(); |
|
78 HANDLE_TO_POINTER(GraphicsContext*, gc, aHandle); |
|
79 gc->dispose(); |
|
80 gc = NULL; |
|
81 } |
|
82 GFX_CATCH |
|
83 } |
|
84 |
|
85 void JNICALL Java_org_eclipse_swt_internal_qt_graphics_OS_graphicsContext_1bindTarget |
|
86 (JNIEnv* aJniEnv , jclass, jint aHandle, jint aTarget, jint aType, jint aBufferFlushTargetHandle) |
|
87 { |
|
88 GFX_TRY |
|
89 { |
|
90 GFX_LOG_JNI_CALL(); |
|
91 HANDLE_TO_POINTER(GraphicsContext*, gc, aHandle); |
|
92 gc->bindTarget(aTarget, (TTargetType)aType, static_cast<int>(aBufferFlushTargetHandle)); |
|
93 } |
|
94 GFX_CATCH |
|
95 } |
|
96 |
|
97 void JNICALL Java_org_eclipse_swt_internal_qt_graphics_OS_graphicsContext_1render |
|
98 (JNIEnv* aJniEnv , jclass, jint aHandle, jint aBufferHandle) |
|
99 { |
|
100 GFX_TRY |
|
101 { |
|
102 GFX_LOG_JNI_CALL(); |
|
103 HANDLE_TO_POINTER(GraphicsContext*, gc, aHandle); |
|
104 HANDLE_TO_POINTER(Buffer*, buffer, aBufferHandle); |
|
105 gc->render(buffer); |
|
106 } |
|
107 GFX_CATCH |
|
108 } |
|
109 |
|
110 void JNICALL Java_org_eclipse_swt_internal_qt_graphics_OS_graphicsContext_1releaseTarget |
|
111 (JNIEnv* aJniEnv , jclass, jint aHandle) |
|
112 { |
|
113 GFX_TRY |
|
114 { |
|
115 GFX_LOG_JNI_CALL(); |
|
116 HANDLE_TO_POINTER(GraphicsContext*, gc, aHandle); |
|
117 gc->releaseTarget(); |
|
118 } |
|
119 GFX_CATCH |
|
120 } |
|
121 |
|
122 void JNICALL Java_org_eclipse_swt_internal_qt_graphics_OS_graphicsContext_1copyArea__IIII |
|
123 (JNIEnv* aJniEnv , jclass, jint aHandle, jint aTargetHandle, jint aX, jint aY) |
|
124 { |
|
125 GFX_TRY |
|
126 { |
|
127 GFX_LOG_JNI_CALL(); |
|
128 HANDLE_TO_POINTER(GraphicsContext*, gc, aHandle); |
|
129 HANDLE_TO_POINTER(Image*, image, aTargetHandle); |
|
130 |
|
131 gc->copyArea(image, aX, aY); |
|
132 } |
|
133 GFX_CATCH |
|
134 } |
|
135 |
|
136 void JNICALL Java_org_eclipse_swt_internal_qt_graphics_OS_graphicsContext_1copyArea__IIIIIIIZ |
|
137 (JNIEnv* aJniEnv , jclass, jint aHandle, jint aSrcX, jint aSrcY, jint aWidth, jint aHeight, jint aDestX, jint aDestY, jboolean aPaint) |
|
138 { |
|
139 GFX_TRY |
|
140 { |
|
141 GFX_LOG_JNI_CALL(); |
|
142 HANDLE_TO_POINTER(GraphicsContext*, gc, aHandle); |
|
143 gc->copyArea(aSrcX, aSrcY, aWidth, aHeight, aDestX, aDestY, aPaint == JNI_TRUE ? true : false); |
|
144 } |
|
145 GFX_CATCH |
|
146 } |
|
147 |
|
148 void JNICALL Java_org_eclipse_swt_internal_qt_graphics_OS_graphicsContext_1drawArc |
|
149 (JNIEnv* aJniEnv , jclass, jint aHandle, jint aX, jint aY, jint aWidth, jint aHeight, jint aStartAngle, jint aArcAngle) |
|
150 { |
|
151 GFX_TRY |
|
152 { |
|
153 GFX_LOG_JNI_CALL(); |
|
154 HANDLE_TO_POINTER(GraphicsContext*, gc, aHandle); |
|
155 gc->drawArc(aX, aY, aWidth, aHeight, aStartAngle, aArcAngle); |
|
156 } |
|
157 GFX_CATCH |
|
158 } |
|
159 |
|
160 void JNICALL Java_org_eclipse_swt_internal_qt_graphics_OS_graphicsContext_1drawEllipse |
|
161 (JNIEnv* aJniEnv , jclass, jint aHandle, jint aX, jint aY, jint aWidth, jint aHeight) |
|
162 { |
|
163 GFX_TRY |
|
164 { |
|
165 GFX_LOG_JNI_CALL(); |
|
166 HANDLE_TO_POINTER(GraphicsContext*, gc, aHandle); |
|
167 gc->drawEllipse(aX, aY, aWidth, aHeight); |
|
168 } |
|
169 GFX_CATCH |
|
170 } |
|
171 |
|
172 JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_qt_graphics_OS_graphicsContext_1drawFocus |
|
173 (JNIEnv* aJniEnv , jclass, jint aHandle, jint aX, jint aY, jint aWidth, jint aHeight) |
|
174 { |
|
175 GFX_TRY |
|
176 { |
|
177 GFX_LOG_JNI_CALL(); |
|
178 HANDLE_TO_POINTER(GraphicsContext*, gc, aHandle); |
|
179 gc->drawFocus(aX, aY, aWidth, aHeight); |
|
180 } |
|
181 GFX_CATCH |
|
182 } |
|
183 |
|
184 void JNICALL Java_org_eclipse_swt_internal_qt_graphics_OS_graphicsContext_1drawImage__IIII |
|
185 (JNIEnv* aJniEnv , jclass, jint aHandle, jint aImageHandle, jint aX, jint aY) |
|
186 { |
|
187 GFX_TRY |
|
188 { |
|
189 GFX_LOG_JNI_CALL(); |
|
190 HANDLE_TO_POINTER(GraphicsContext*, gc, aHandle); |
|
191 HANDLE_TO_POINTER(Image*, image, aImageHandle); |
|
192 gc->drawImage(image, aX, aY); |
|
193 } |
|
194 GFX_CATCH |
|
195 } |
|
196 |
|
197 void JNICALL Java_org_eclipse_swt_internal_qt_graphics_OS_graphicsContext_1drawImage__IIIIIIIIIII |
|
198 (JNIEnv* aJniEnv , jclass, jint aHandle, jint aImageHandle, jint aTx, jint aTy, jint aTw, jint aTh, |
|
199 jint aSx, jint aSy, jint aSw, jint aSh, jint aManipulation) |
|
200 { |
|
201 GFX_TRY |
|
202 { |
|
203 GFX_LOG_JNI_CALL(); |
|
204 HANDLE_TO_POINTER(GraphicsContext*, gc, aHandle); |
|
205 HANDLE_TO_POINTER(Image*, image, aImageHandle); |
|
206 gc->drawImage(image, aManipulation, aTx, aTy, aTw, aTh, aSx, aSy, aSw, aSh); |
|
207 } |
|
208 GFX_CATCH |
|
209 } |
|
210 |
|
211 void JNICALL Java_org_eclipse_swt_internal_qt_graphics_OS_graphicsContext_1drawLine |
|
212 (JNIEnv* aJniEnv , jclass, jint aHandle, jint aX1, jint aY1, jint aX2, jint aY2) |
|
213 { |
|
214 GFX_TRY |
|
215 { |
|
216 GFX_LOG_JNI_CALL(); |
|
217 HANDLE_TO_POINTER(GraphicsContext*, gc, aHandle); |
|
218 gc->drawLine(aX1, aY1, aX2, aY2); |
|
219 } |
|
220 GFX_CATCH |
|
221 } |
|
222 |
|
223 void JNICALL Java_org_eclipse_swt_internal_qt_graphics_OS_graphicsContext_1drawPoint |
|
224 (JNIEnv* aJniEnv , jclass, jint aHandle, jint aX, jint aY) |
|
225 { |
|
226 GFX_TRY |
|
227 { |
|
228 GFX_LOG_JNI_CALL(); |
|
229 HANDLE_TO_POINTER(GraphicsContext*, gc, aHandle); |
|
230 gc->drawPoint(aX, aY); |
|
231 } |
|
232 GFX_CATCH |
|
233 } |
|
234 |
|
235 void JNICALL Java_org_eclipse_swt_internal_qt_graphics_OS_graphicsContext_1drawPolygon |
|
236 (JNIEnv* aJniEnv, jclass, jint aHandle, jintArray aPointArray) |
|
237 { |
|
238 GFX_TRY |
|
239 { |
|
240 GFX_LOG_JNI_CALL(); |
|
241 HANDLE_TO_POINTER(GraphicsContext*, gc, aHandle); |
|
242 int length = aJniEnv->GetArrayLength(aPointArray); |
|
243 int* buffer = new int[length]; // might throw bad_alloc |
|
244 AutoRelease<int> release(buffer, true); |
|
245 swtApp->jniUtils().GetJavaIntArrayRegionToIntArray(aJniEnv, aPointArray, 0, length, buffer); // might throw bad_alloc |
|
246 gc->drawPolygon(buffer, length); |
|
247 } |
|
248 GFX_CATCH |
|
249 } |
|
250 |
|
251 void JNICALL Java_org_eclipse_swt_internal_qt_graphics_OS_graphicsContext_1drawPolyline |
|
252 (JNIEnv* aJniEnv, jclass, jint aHandle, jintArray aPointArray) |
|
253 { |
|
254 GFX_TRY |
|
255 { |
|
256 GFX_LOG_JNI_CALL(); |
|
257 HANDLE_TO_POINTER(GraphicsContext*, gc, aHandle); |
|
258 int length = aJniEnv->GetArrayLength(aPointArray); |
|
259 int* buffer = new int[length]; // might throw bad_alloc |
|
260 AutoRelease<int> release(buffer, true); |
|
261 swtApp->jniUtils().GetJavaIntArrayRegionToIntArray(aJniEnv, aPointArray, 0, length, buffer); // might throw bad_alloc |
|
262 gc->drawPolyline(buffer, length); |
|
263 } |
|
264 GFX_CATCH |
|
265 } |
|
266 |
|
267 void JNICALL Java_org_eclipse_swt_internal_qt_graphics_OS_graphicsContext_1drawRect |
|
268 (JNIEnv* aJniEnv , jclass, jint aHandle, jint aX, jint aY, jint aWidth, jint aHeight) |
|
269 { |
|
270 GFX_TRY |
|
271 { |
|
272 GFX_LOG_JNI_CALL(); |
|
273 HANDLE_TO_POINTER(GraphicsContext*, gc, aHandle); |
|
274 gc->drawRect(aX, aY, aWidth, aHeight); |
|
275 } |
|
276 GFX_CATCH |
|
277 } |
|
278 |
|
279 void JNICALL Java_org_eclipse_swt_internal_qt_graphics_OS_graphicsContext_1drawRGB__I_3IIIIIIIZI |
|
280 (JNIEnv* aJniEnv, jclass, jint aHandle, jintArray aRgbData, jint aOffset, jint aScanlength, |
|
281 jint aX, jint aY, jint aWidth, jint aHeight, jboolean aProcessAlpha, jint aManipulation) |
|
282 { |
|
283 GFX_TRY |
|
284 { |
|
285 GFX_LOG_JNI_CALL(); |
|
286 HANDLE_TO_POINTER(GraphicsContext*, gc, aHandle); |
|
287 int length = aJniEnv->GetArrayLength(aRgbData); |
|
288 |
|
289 int* buffer = new int[length]; // might throw bad_alloc |
|
290 AutoRelease<int> release(buffer, true); |
|
291 swtApp->jniUtils().GetJavaIntArrayRegionToIntArray(aJniEnv, aRgbData, 0, length, buffer); // might throw bad_alloc |
|
292 |
|
293 gc->drawRGB(buffer, length, aOffset, aScanlength, aX, aY, aWidth, aHeight, aProcessAlpha, aManipulation); |
|
294 } |
|
295 GFX_CATCH |
|
296 } |
|
297 |
|
298 void JNICALL Java_org_eclipse_swt_internal_qt_graphics_OS_graphicsContext_1drawRGB__I_3B_3BIIIIIIII |
|
299 (JNIEnv *aJniEnv, jclass, jint aHandle, jbyteArray aRgbData, jbyteArray aTransparencyMask, |
|
300 jint aOffset, jint aScanLength, jint aX, jint aY, jint aWidth, jint aHeight, jint aTransform, jint aFormat) |
|
301 { |
|
302 GFX_TRY |
|
303 { |
|
304 GFX_LOG_JNI_CALL(); |
|
305 HANDLE_TO_POINTER(GraphicsContext*, gc, aHandle); |
|
306 |
|
307 int dataLength = aJniEnv->GetArrayLength(aRgbData); |
|
308 int maskLength = aJniEnv->GetArrayLength(aTransparencyMask); |
|
309 |
|
310 char* dataBuffer = new char[dataLength]; // might throw bad_alloc |
|
311 AutoRelease<char> releaseData(dataBuffer, true); |
|
312 swtApp->jniUtils().GetJavaByteArrayRegionToCharArray(aJniEnv, aRgbData, 0, dataLength, dataBuffer); // might throw bad_alloc |
|
313 |
|
314 char* maskBuffer = NULL; |
|
315 AutoRelease<char> releaseMask(NULL, true); // Will delete mask or NULL if there's no mask |
|
316 |
|
317 if(aTransparencyMask) |
|
318 { |
|
319 maskBuffer = new char[maskLength]; // might throw bad_alloc |
|
320 releaseMask.reset(maskBuffer); |
|
321 swtApp->jniUtils().GetJavaByteArrayRegionToCharArray(aJniEnv, aTransparencyMask, 0, maskLength, maskBuffer); // might throw bad_alloc |
|
322 } |
|
323 |
|
324 gc->drawRGB(dataBuffer, maskBuffer, dataLength, aOffset, aScanLength, aX, aY, aWidth, aHeight, aTransform, aFormat); |
|
325 } |
|
326 GFX_CATCH |
|
327 } |
|
328 |
|
329 void JNICALL Java_org_eclipse_swt_internal_qt_graphics_OS_graphicsContext_1drawRGB__I_3SIIIIIIZII |
|
330 (JNIEnv * aJniEnv, jclass, jint aImageHandle, jshortArray aRgbData, jint aOffset, jint aScanlength, |
|
331 jint aX, jint aY, jint aWidth, jint aHeight, jboolean aProcessAlpha, jint aManipulation, jint aFormat) |
|
332 { |
|
333 GFX_TRY |
|
334 { |
|
335 GFX_LOG_JNI_CALL(); |
|
336 HANDLE_TO_POINTER(GraphicsContext*, gc, aImageHandle); |
|
337 |
|
338 int length = aJniEnv->GetArrayLength(aRgbData); |
|
339 |
|
340 short* buffer = new short[length]; |
|
341 AutoRelease<short> release(buffer, true); |
|
342 ::memset(buffer, 0, sizeof(short)*length); |
|
343 |
|
344 swtApp->jniUtils().GetJavaShortArrayRegionToShortArray(aJniEnv, aRgbData, 0, length, buffer); // might throw bad_alloc |
|
345 |
|
346 gc->drawRGB(buffer, length, aOffset, aScanlength, aX, aY, aWidth, aHeight, aProcessAlpha, aManipulation, aFormat); |
|
347 } |
|
348 GFX_CATCH |
|
349 } |
|
350 |
|
351 void JNICALL Java_org_eclipse_swt_internal_qt_graphics_OS_graphicsContext_1drawRoundRect |
|
352 (JNIEnv* aJniEnv , jclass, jint aHandle, jint aX, jint aY, jint aWidth, jint aHeight, jint aArcWidth, jint aArcHeight) |
|
353 { |
|
354 GFX_TRY |
|
355 { |
|
356 GFX_LOG_JNI_CALL(); |
|
357 HANDLE_TO_POINTER(GraphicsContext*, gc, aHandle); |
|
358 gc->drawRoundRect(aX, aY, aWidth, aHeight, aArcWidth, aArcHeight); |
|
359 } |
|
360 GFX_CATCH |
|
361 } |
|
362 |
|
363 void JNICALL Java_org_eclipse_swt_internal_qt_graphics_OS_graphicsContext_1drawString |
|
364 (JNIEnv* aJniEnv, jclass, jint aHandle, jstring aText, jint aX, jint aY, jint aWidth, jint aHeight, |
|
365 jint aAlignments, jint aFlags, jboolean aIsTransparent) |
|
366 { |
|
367 GFX_TRY |
|
368 { |
|
369 GFX_LOG_JNI_CALL(); |
|
370 const jchar* chars; // unsigned short (2 bytes) |
|
371 int length; |
|
372 |
|
373 length = aJniEnv->GetStringLength(aText); |
|
374 chars = aJniEnv->GetStringChars(aText, NULL); |
|
375 AutoReleaseStringChars release(aJniEnv, aText, chars); |
|
376 HANDLE_TO_POINTER(GraphicsContext*, gc, aHandle); |
|
377 gc->drawString( |
|
378 (const unsigned short*)chars, |
|
379 aX, |
|
380 aY, |
|
381 aWidth, |
|
382 aHeight, |
|
383 length, |
|
384 aAlignments, |
|
385 aFlags, |
|
386 aIsTransparent); |
|
387 } |
|
388 GFX_CATCH |
|
389 } |
|
390 |
|
391 void JNICALL Java_org_eclipse_swt_internal_qt_graphics_OS_graphicsContext_1fillArc |
|
392 (JNIEnv* aJniEnv , jclass, jint aHandle, jint aX, jint aY, jint aWidth, jint aHeight, jint aStartAngle, jint aArcAngle) |
|
393 { |
|
394 GFX_TRY |
|
395 { |
|
396 GFX_LOG_JNI_CALL(); |
|
397 HANDLE_TO_POINTER(GraphicsContext*, gc, aHandle); |
|
398 gc->fillArc(aX, aY, aWidth, aHeight, aStartAngle, aArcAngle); |
|
399 } |
|
400 GFX_CATCH |
|
401 } |
|
402 |
|
403 void JNICALL Java_org_eclipse_swt_internal_qt_graphics_OS_graphicsContext_1fillEllipse |
|
404 (JNIEnv* aJniEnv , jclass, jint aHandle, jint aX, jint aY, jint aWidth, jint aHeight) |
|
405 { |
|
406 GFX_TRY |
|
407 { |
|
408 GFX_LOG_JNI_CALL(); |
|
409 HANDLE_TO_POINTER(GraphicsContext*, gc, aHandle); |
|
410 gc->fillEllipse(aX, aY, aWidth, aHeight); |
|
411 } |
|
412 GFX_CATCH |
|
413 } |
|
414 |
|
415 void JNICALL Java_org_eclipse_swt_internal_qt_graphics_OS_graphicsContext_1fillGradientRect |
|
416 (JNIEnv* aJniEnv , jclass, jint aHandle, jint aX, jint aY, jint aWidth, jint aHeight, jboolean aVertical, jboolean aSwapColors) |
|
417 { |
|
418 GFX_TRY |
|
419 { |
|
420 GFX_LOG_JNI_CALL(); |
|
421 HANDLE_TO_POINTER(GraphicsContext*, gc, aHandle); |
|
422 gc->fillGradientRect(aX, aY, aWidth, aHeight, aVertical, aSwapColors); |
|
423 } |
|
424 GFX_CATCH |
|
425 } |
|
426 |
|
427 void JNICALL Java_org_eclipse_swt_internal_qt_graphics_OS_graphicsContext_1fillPolygon |
|
428 (JNIEnv* aJniEnv, jclass, jint aHandle, jintArray aPointArray) |
|
429 { |
|
430 GFX_TRY |
|
431 { |
|
432 GFX_LOG_JNI_CALL(); |
|
433 HANDLE_TO_POINTER(GraphicsContext*, gc, aHandle); |
|
434 int length = aJniEnv->GetArrayLength(aPointArray); |
|
435 |
|
436 int* buffer = new int[length]; // might throw bad_alloc |
|
437 AutoRelease<int> release(buffer, true); |
|
438 swtApp->jniUtils().GetJavaIntArrayRegionToIntArray(aJniEnv, aPointArray, 0, length, buffer); // might throw bad_alloc |
|
439 |
|
440 gc->fillPolygon(buffer, length); |
|
441 } |
|
442 GFX_CATCH |
|
443 } |
|
444 |
|
445 void JNICALL Java_org_eclipse_swt_internal_qt_graphics_OS_graphicsContext_1fillRect |
|
446 (JNIEnv* aJniEnv , jclass, jint aHandle, jint aX, jint aY, jint aWidth, jint aHeight) |
|
447 { |
|
448 GFX_TRY |
|
449 { |
|
450 GFX_LOG_JNI_CALL(); |
|
451 HANDLE_TO_POINTER(GraphicsContext*, gc, aHandle); |
|
452 gc->fillRect(aX, aY, aWidth, aHeight); |
|
453 } |
|
454 GFX_CATCH |
|
455 } |
|
456 |
|
457 void JNICALL Java_org_eclipse_swt_internal_qt_graphics_OS_graphicsContext_1fillRoundRect |
|
458 (JNIEnv* aJniEnv , jclass, jint aHandle, jint aX, jint aY, jint aWidth, jint aHeight, jint aArcWidth, jint aArcHeight) |
|
459 { |
|
460 GFX_TRY |
|
461 { |
|
462 GFX_LOG_JNI_CALL(); |
|
463 HANDLE_TO_POINTER(GraphicsContext*, gc, aHandle); |
|
464 gc->fillRoundRect(aX, aY, aWidth, aHeight, aArcWidth, aArcHeight); |
|
465 } |
|
466 GFX_CATCH |
|
467 } |
|
468 |
|
469 jint JNICALL Java_org_eclipse_swt_internal_qt_graphics_OS_graphicsContext_1getBackgroundAlpha |
|
470 (JNIEnv* aJniEnv , jclass, jint aHandle) |
|
471 { |
|
472 jint bgAlpha = 0; |
|
473 GFX_TRY |
|
474 { |
|
475 GFX_LOG_JNI_CALL(); |
|
476 HANDLE_TO_POINTER(GraphicsContext*, gc, aHandle); |
|
477 bgAlpha = static_cast<jint>( gc->getBackgroundAlpha() ); |
|
478 } |
|
479 GFX_CATCH |
|
480 return bgAlpha; |
|
481 } |
|
482 |
|
483 jint JNICALL Java_org_eclipse_swt_internal_qt_graphics_OS_graphicsContext_1getBackgroundColor |
|
484 (JNIEnv* aJniEnv , jclass, jint aHandle) |
|
485 { |
|
486 jint bgColor = 0; |
|
487 GFX_TRY |
|
488 { |
|
489 GFX_LOG_JNI_CALL(); |
|
490 HANDLE_TO_POINTER(GraphicsContext*, gc, aHandle); |
|
491 bgColor = static_cast<jint>( gc->getBackgroundColor() ); |
|
492 } |
|
493 GFX_CATCH |
|
494 return bgColor; |
|
495 } |
|
496 |
|
497 jint JNICALL Java_org_eclipse_swt_internal_qt_graphics_OS_graphicsContext_1getCharacterWidth |
|
498 (JNIEnv* aJniEnv , jclass, jint aHandle, jchar aCh, jboolean aIsAdvanced) |
|
499 { |
|
500 jint charWidth = 0; |
|
501 GFX_TRY |
|
502 { |
|
503 GFX_LOG_JNI_CALL(); |
|
504 HANDLE_TO_POINTER(GraphicsContext*, gc, aHandle); |
|
505 charWidth = static_cast<jint>( gc->getCharacterWidth(aCh, aIsAdvanced) ); |
|
506 } |
|
507 GFX_CATCH |
|
508 return charWidth; |
|
509 } |
|
510 |
|
511 void JNICALL Java_org_eclipse_swt_internal_qt_graphics_OS_graphicsContext_1getFontMetricsData |
|
512 (JNIEnv* aJniEnv, jclass, jint aHandle, jintArray aDataArray, jint aFontHandle) |
|
513 { |
|
514 GFX_TRY |
|
515 { |
|
516 GFX_LOG_JNI_CALL(); |
|
517 HANDLE_TO_POINTER(GraphicsContext*, gc, aHandle); |
|
518 |
|
519 int length = aJniEnv->GetArrayLength(aDataArray); |
|
520 |
|
521 int* buffer = new int[length]; // might throw bad_alloc |
|
522 AutoRelease<int> release(buffer, true); |
|
523 ::memset(buffer, 0, sizeof(int)*length); |
|
524 |
|
525 if (aFontHandle) |
|
526 { |
|
527 HANDLE_TO_POINTER(QFont*, font, aFontHandle); |
|
528 gc->getFontMetricsData(buffer, *font); |
|
529 } |
|
530 else |
|
531 { |
|
532 QFont font; |
|
533 gc->getFontMetricsData(buffer, font); |
|
534 } |
|
535 // Copy back changes to the Java array |
|
536 swtApp->jniUtils().SetJavaIntArrayRegionFromIntArray(aJniEnv, aDataArray, 0, length, buffer); |
|
537 } |
|
538 GFX_CATCH |
|
539 } |
|
540 |
|
541 jint JNICALL Java_org_eclipse_swt_internal_qt_graphics_OS_graphicsContext_1getBlendingMode |
|
542 (JNIEnv* aJniEnv , jclass, jint aHandle) |
|
543 { |
|
544 jint blendingMode = 0; |
|
545 GFX_TRY |
|
546 { |
|
547 GFX_LOG_JNI_CALL(); |
|
548 HANDLE_TO_POINTER(GraphicsContext*, gc, aHandle); |
|
549 blendingMode = static_cast<jint>( gc->getBlendingMode() ); |
|
550 } |
|
551 GFX_CATCH |
|
552 return blendingMode; |
|
553 } |
|
554 |
|
555 void JNICALL Java_org_eclipse_swt_internal_qt_graphics_OS_graphicsContext_1getClip |
|
556 (JNIEnv* aJniEnv, jclass, jint aHandle, jintArray aClipArray) |
|
557 { |
|
558 GFX_TRY |
|
559 { |
|
560 GFX_LOG_JNI_CALL(); |
|
561 HANDLE_TO_POINTER(GraphicsContext*, gc, aHandle); |
|
562 int length = aJniEnv->GetArrayLength(aClipArray); |
|
563 |
|
564 int* buffer = new int[length]; // might throw bad_alloc |
|
565 AutoRelease<int> release(buffer, true); |
|
566 ::memset(buffer, 0, sizeof(int)*length); |
|
567 |
|
568 gc->getClip(buffer); |
|
569 |
|
570 swtApp->jniUtils().SetJavaIntArrayRegionFromIntArray(aJniEnv, aClipArray, 0, length, buffer); |
|
571 } |
|
572 GFX_CATCH |
|
573 } |
|
574 |
|
575 jint JNICALL Java_org_eclipse_swt_internal_qt_graphics_OS_graphicsContext_1getForegroundAlpha |
|
576 (JNIEnv* aJniEnv , jclass, jint aHandle) |
|
577 { |
|
578 jint fgAlpha = 0; |
|
579 GFX_TRY |
|
580 { |
|
581 GFX_LOG_JNI_CALL(); |
|
582 HANDLE_TO_POINTER(GraphicsContext*, gc, aHandle); |
|
583 fgAlpha = static_cast<jint>( gc->getForegroundAlpha() ); |
|
584 } |
|
585 GFX_CATCH |
|
586 return fgAlpha; |
|
587 } |
|
588 |
|
589 jint JNICALL Java_org_eclipse_swt_internal_qt_graphics_OS_graphicsContext_1getForegroundColor |
|
590 (JNIEnv* aJniEnv , jclass, jint aHandle) |
|
591 { |
|
592 jint fgColor = 0; |
|
593 GFX_TRY |
|
594 { |
|
595 GFX_LOG_JNI_CALL(); |
|
596 HANDLE_TO_POINTER(GraphicsContext*, gc, aHandle); |
|
597 fgColor = static_cast<jint>( gc->getForegroundColor() ); |
|
598 } |
|
599 GFX_CATCH |
|
600 return fgColor; |
|
601 } |
|
602 |
|
603 void JNICALL Java_org_eclipse_swt_internal_qt_graphics_OS_graphicsContext_1getTextBoundingBox |
|
604 (JNIEnv* aJniEnv, jclass, jint aHandle, jintArray aBoundingBox, jstring aText, |
|
605 jint aAlignments, jint aFlags, jint aRectX, jint aRectY, jint aRectWidth, jint aRectHeight) |
|
606 { |
|
607 GFX_TRY |
|
608 { |
|
609 GFX_LOG_JNI_CALL(); |
|
610 HANDLE_TO_POINTER(GraphicsContext*, gc, aHandle); |
|
611 |
|
612 int length = aJniEnv->GetArrayLength(aBoundingBox); |
|
613 |
|
614 int* buffer = new int[length]; // might throw bad_alloc |
|
615 AutoRelease<int> releaseBuffer(buffer, true); |
|
616 ::memset(buffer, 0, sizeof(int)*length); |
|
617 |
|
618 const jchar* textPtr = aJniEnv->GetStringChars(aText, NULL); |
|
619 AutoReleaseStringChars releaseStringChars(aJniEnv, aText, textPtr); |
|
620 |
|
621 jint textLength = aJniEnv->GetStringLength(aText); |
|
622 |
|
623 gc->getTextBoundingBox( |
|
624 buffer, |
|
625 static_cast<const unsigned short*>(textPtr), |
|
626 textLength, |
|
627 aAlignments, |
|
628 aFlags, |
|
629 aRectX, aRectY, aRectWidth, aRectHeight); |
|
630 |
|
631 // Copy changes to boundingBox |
|
632 swtApp->jniUtils().SetJavaIntArrayRegionFromIntArray(aJniEnv, aBoundingBox, 0, length, buffer); |
|
633 } |
|
634 GFX_CATCH |
|
635 } |
|
636 |
|
637 jint JNICALL Java_org_eclipse_swt_internal_qt_graphics_OS_graphicsContext_1getStrokeWidth |
|
638 (JNIEnv* aJniEnv , jclass, jint aHandle) |
|
639 { |
|
640 jint strokeWidth = 0; |
|
641 GFX_TRY |
|
642 { |
|
643 GFX_LOG_JNI_CALL(); |
|
644 HANDLE_TO_POINTER(GraphicsContext*, gc, aHandle); |
|
645 strokeWidth = static_cast<jint>( gc->getStrokeWidth() ); |
|
646 } |
|
647 GFX_CATCH |
|
648 return strokeWidth; |
|
649 } |
|
650 |
|
651 jint JNICALL Java_org_eclipse_swt_internal_qt_graphics_OS_graphicsContext_1getStrokeStyle |
|
652 (JNIEnv* aJniEnv , jclass, jint aHandle) |
|
653 { |
|
654 jint strokeStyle = 0; |
|
655 GFX_TRY |
|
656 { |
|
657 GFX_LOG_JNI_CALL(); |
|
658 HANDLE_TO_POINTER(GraphicsContext*, gc, aHandle); |
|
659 strokeStyle = static_cast<jint>( gc->getStrokeStyle() ); |
|
660 } |
|
661 GFX_CATCH |
|
662 return strokeStyle; |
|
663 } |
|
664 |
|
665 jint JNICALL Java_org_eclipse_swt_internal_qt_graphics_OS_graphicsContext_1getTranslateX |
|
666 (JNIEnv* aJniEnv , jclass, jint aHandle) |
|
667 { |
|
668 jint translateX = 0; |
|
669 GFX_TRY |
|
670 { |
|
671 GFX_LOG_JNI_CALL(); |
|
672 HANDLE_TO_POINTER(GraphicsContext*, gc, aHandle); |
|
673 translateX = static_cast<jint>( gc->getTranslateX() ); |
|
674 } |
|
675 GFX_CATCH |
|
676 return translateX; |
|
677 } |
|
678 |
|
679 jint JNICALL Java_org_eclipse_swt_internal_qt_graphics_OS_graphicsContext_1getTranslateY |
|
680 (JNIEnv* aJniEnv , jclass, jint aHandle) |
|
681 { |
|
682 jint translateY = 0; |
|
683 GFX_TRY |
|
684 { |
|
685 GFX_LOG_JNI_CALL(); |
|
686 HANDLE_TO_POINTER(GraphicsContext*, gc, aHandle); |
|
687 translateY = static_cast<jint>( gc->getTranslateY() ); |
|
688 } |
|
689 GFX_CATCH |
|
690 return translateY; |
|
691 } |
|
692 |
|
693 void JNICALL Java_org_eclipse_swt_internal_qt_graphics_OS_graphicsContext_1setBackgroundAlpha |
|
694 (JNIEnv* aJniEnv , jclass, jint aHandle, jint aAlpha) |
|
695 { |
|
696 GFX_TRY |
|
697 { |
|
698 GFX_LOG_JNI_CALL(); |
|
699 HANDLE_TO_POINTER(GraphicsContext*, gc, aHandle); |
|
700 gc->setBackgroundAlpha(aAlpha); |
|
701 } |
|
702 GFX_CATCH |
|
703 } |
|
704 |
|
705 void JNICALL Java_org_eclipse_swt_internal_qt_graphics_OS_graphicsContext_1setBackgroundColor |
|
706 (JNIEnv* aJniEnv , jclass, jint aHandle, jint aArgb, jboolean aUpdateAlpha) |
|
707 { |
|
708 GFX_TRY |
|
709 { |
|
710 GFX_LOG_JNI_CALL(); |
|
711 HANDLE_TO_POINTER(GraphicsContext*, gc, aHandle); |
|
712 gc->setBackgroundColor(aArgb, aUpdateAlpha); |
|
713 } |
|
714 GFX_CATCH |
|
715 } |
|
716 |
|
717 void JNICALL Java_org_eclipse_swt_internal_qt_graphics_OS_graphicsContext_1setBlendingMode |
|
718 (JNIEnv* aJniEnv , jclass, jint aHandle, jint aMode) |
|
719 { |
|
720 GFX_TRY |
|
721 { |
|
722 GFX_LOG_JNI_CALL(); |
|
723 HANDLE_TO_POINTER(GraphicsContext*, gc, aHandle); |
|
724 gc->setBlendingMode((TBlendingMode)aMode); |
|
725 } |
|
726 GFX_CATCH |
|
727 } |
|
728 |
|
729 jboolean JNICALL Java_org_eclipse_swt_internal_qt_graphics_OS_graphicsContext_1hasClipping |
|
730 (JNIEnv* aJniEnv , jclass, jint aHandle) |
|
731 { |
|
732 jboolean hasClipping = JNI_FALSE; |
|
733 GFX_TRY |
|
734 { |
|
735 GFX_LOG_JNI_CALL(); |
|
736 HANDLE_TO_POINTER(GraphicsContext*, gc, aHandle); |
|
737 hasClipping = static_cast<jboolean>( gc->hasClipping() ); |
|
738 } |
|
739 GFX_CATCH |
|
740 return hasClipping; |
|
741 } |
|
742 |
|
743 void JNICALL Java_org_eclipse_swt_internal_qt_graphics_OS_graphicsContext_1cancelClipping |
|
744 (JNIEnv* aJniEnv , jclass, jint aHandle) |
|
745 { |
|
746 GFX_TRY |
|
747 { |
|
748 GFX_LOG_JNI_CALL(); |
|
749 HANDLE_TO_POINTER(GraphicsContext*, gc, aHandle); |
|
750 gc->cancelClipping(); |
|
751 } |
|
752 GFX_CATCH |
|
753 } |
|
754 |
|
755 void JNICALL Java_org_eclipse_swt_internal_qt_graphics_OS_graphicsContext_1setClip |
|
756 (JNIEnv* aJniEnv , jclass, jint aHandle, jint aX, jint aY, jint aWidth, jint aHeight, jboolean aIntersects) |
|
757 { |
|
758 GFX_TRY |
|
759 { |
|
760 GFX_LOG_JNI_CALL(); |
|
761 HANDLE_TO_POINTER(GraphicsContext*, gc, aHandle); |
|
762 gc->setClip(aX, aY, aWidth, aHeight, aIntersects); |
|
763 } |
|
764 GFX_CATCH |
|
765 } |
|
766 |
|
767 void JNICALL Java_org_eclipse_swt_internal_qt_graphics_OS_graphicsContext_1setFont |
|
768 (JNIEnv* aJniEnv , jclass, jint aHandle, jint aFontHandle) |
|
769 { |
|
770 GFX_TRY |
|
771 { |
|
772 GFX_LOG_JNI_CALL(); |
|
773 HANDLE_TO_POINTER(GraphicsContext*, gc, aHandle); |
|
774 gc->setFont(aFontHandle); |
|
775 } |
|
776 GFX_CATCH |
|
777 } |
|
778 |
|
779 void JNICALL Java_org_eclipse_swt_internal_qt_graphics_OS_graphicsContext_1setForegroundAlpha |
|
780 (JNIEnv* aJniEnv , jclass, jint aHandle, jint aAlpha) |
|
781 { |
|
782 GFX_TRY |
|
783 { |
|
784 GFX_LOG_JNI_CALL(); |
|
785 HANDLE_TO_POINTER(GraphicsContext*, gc, aHandle); |
|
786 gc->setForegroundAlpha(aAlpha); |
|
787 } |
|
788 GFX_CATCH |
|
789 } |
|
790 |
|
791 void JNICALL Java_org_eclipse_swt_internal_qt_graphics_OS_graphicsContext_1setForegroundColor |
|
792 (JNIEnv* aJniEnv , jclass, jint aHandle, jint aArgb, jboolean aUpdateAlpha) |
|
793 { |
|
794 GFX_TRY |
|
795 { |
|
796 GFX_LOG_JNI_CALL(); |
|
797 HANDLE_TO_POINTER(GraphicsContext*, gc, aHandle); |
|
798 gc->setForegroundColor(aArgb, aUpdateAlpha); |
|
799 } |
|
800 GFX_CATCH |
|
801 } |
|
802 |
|
803 void JNICALL Java_org_eclipse_swt_internal_qt_graphics_OS_graphicsContext_1setStrokeWidth |
|
804 (JNIEnv* aJniEnv , jclass, jint aHandle, jint aWidth) |
|
805 { |
|
806 GFX_TRY |
|
807 { |
|
808 GFX_LOG_JNI_CALL(); |
|
809 HANDLE_TO_POINTER(GraphicsContext*, gc, aHandle); |
|
810 gc->setStrokeWidth(aWidth); |
|
811 } |
|
812 GFX_CATCH |
|
813 } |
|
814 |
|
815 void JNICALL Java_org_eclipse_swt_internal_qt_graphics_OS_graphicsContext_1setStrokeStyle |
|
816 (JNIEnv* aJniEnv , jclass, jint aHandle, jint aStyle) |
|
817 { |
|
818 GFX_TRY |
|
819 { |
|
820 GFX_LOG_JNI_CALL(); |
|
821 HANDLE_TO_POINTER(GraphicsContext*, gc, aHandle); |
|
822 gc->setStrokeStyle((TStrokeStyle)aStyle); |
|
823 } |
|
824 GFX_CATCH |
|
825 } |
|
826 |
|
827 JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_qt_graphics_OS_graphicsContext_1translate |
|
828 (JNIEnv* aJniEnv , jclass, jint aHandle, jint aX, jint aY) |
|
829 { |
|
830 GFX_TRY |
|
831 { |
|
832 GFX_LOG_JNI_CALL(); |
|
833 HANDLE_TO_POINTER(GraphicsContext*, gc, aHandle); |
|
834 gc->translate(aX,aY); |
|
835 } |
|
836 GFX_CATCH |
|
837 } |
|
838 |
|
839 JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_qt_graphics_OS_graphicsContext_1scale |
|
840 (JNIEnv* aJniEnv, jclass, jint aHandle, jint aX, jint aY) |
|
841 { |
|
842 GFX_TRY |
|
843 { |
|
844 GFX_LOG_JNI_CALL(); |
|
845 HANDLE_TO_POINTER(GraphicsContext*, gc, aHandle); |
|
846 gc->scale(aX,aY); |
|
847 } |
|
848 GFX_CATCH |
|
849 } |
|
850 |
|
851 |
|
852 JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_qt_graphics_OS_graphicsContext_1resetTransform |
|
853 (JNIEnv* aJniEnv, jclass, jint aHandle) |
|
854 { |
|
855 GFX_TRY |
|
856 { |
|
857 GFX_LOG_JNI_CALL(); |
|
858 HANDLE_TO_POINTER(GraphicsContext*, gc, aHandle); |
|
859 gc->resetTransform(); |
|
860 } |
|
861 GFX_CATCH |
|
862 } |
|
863 |
|
864 void JNICALL Java_org_eclipse_swt_internal_qt_graphics_OS_graphicsContext_1saveSettings |
|
865 (JNIEnv* aJniEnv, jclass, jint aHandle) |
|
866 { |
|
867 GFX_TRY |
|
868 { |
|
869 GFX_LOG_JNI_CALL(); |
|
870 HANDLE_TO_POINTER(GraphicsContext*, gc, aHandle); |
|
871 gc->saveSettings(); |
|
872 } |
|
873 GFX_CATCH |
|
874 } |
|
875 |
|
876 void JNICALL Java_org_eclipse_swt_internal_qt_graphics_OS_graphicsContext_1restoreSettings |
|
877 (JNIEnv* aJniEnv, jclass, jint aHandle) |
|
878 { |
|
879 GFX_TRY |
|
880 { |
|
881 GFX_LOG_JNI_CALL(); |
|
882 HANDLE_TO_POINTER(GraphicsContext*, gc, aHandle); |
|
883 gc->restoreSettings(); |
|
884 } |
|
885 GFX_CATCH |
|
886 } |
|
887 |
|
888 // |
|
889 // Image class JNI calls |
|
890 // |
|
891 |
|
892 jint JNICALL Java_org_eclipse_swt_internal_qt_graphics_OS_image_1create__III |
|
893 (JNIEnv* aJniEnv , jclass, jint aWidth , jint aHeight, jint aFillColor) |
|
894 { |
|
895 Image* img = NULL; |
|
896 GFX_TRY |
|
897 { |
|
898 GFX_LOG_JNI_CALL(); |
|
899 img = GraphicsFactory::createImage(aWidth, aHeight, aFillColor); |
|
900 } |
|
901 GFX_CATCH |
|
902 return POINTER_TO_HANDLE(img); |
|
903 } |
|
904 |
|
905 jint JNICALL Java_org_eclipse_swt_internal_qt_graphics_OS_image_1create__IIIII |
|
906 (JNIEnv* aJniEnv , jclass, jint aImageHandle, jint aX, jint aY, jint aWidth, jint aHeight) |
|
907 { |
|
908 Image* newImage = NULL; |
|
909 GFX_TRY |
|
910 { |
|
911 GFX_LOG_JNI_CALL(); |
|
912 HANDLE_TO_POINTER(Image*, image, aImageHandle); |
|
913 newImage = GraphicsFactory::createImage(image, aX, aY, aWidth, aHeight); |
|
914 } |
|
915 GFX_CATCH |
|
916 return POINTER_TO_HANDLE(newImage); |
|
917 } |
|
918 |
|
919 jint JNICALL Java_org_eclipse_swt_internal_qt_graphics_OS_image_1create___3IIIZ |
|
920 (JNIEnv* aJniEnv, jclass, jintArray aRgbData, jint aWidth, jint aHeight, jboolean aHasAlpha) |
|
921 { |
|
922 Image* img = NULL; |
|
923 GFX_TRY |
|
924 { |
|
925 GFX_LOG_JNI_CALL(); |
|
926 |
|
927 int length = aJniEnv->GetArrayLength(aRgbData); |
|
928 |
|
929 int* buffer = new int[length]; // might throw bad_alloc |
|
930 AutoRelease<int> release(buffer, true); |
|
931 swtApp->jniUtils().GetJavaIntArrayRegionToIntArray(aJniEnv, aRgbData, 0, length, buffer); // might throw bad_alloc |
|
932 |
|
933 img = GraphicsFactory::createImage(buffer, aWidth, aHeight, aHasAlpha); |
|
934 } |
|
935 GFX_CATCH |
|
936 return POINTER_TO_HANDLE(img); |
|
937 } |
|
938 |
|
939 jint JNICALL Java_org_eclipse_swt_internal_qt_graphics_OS_image_1create__Lorg_eclipse_swt_graphics_ImageData_2 |
|
940 (JNIEnv* aJniEnv , jclass, jobject aImageData) |
|
941 { |
|
942 Image* img = NULL; |
|
943 GFX_TRY |
|
944 { |
|
945 GFX_LOG_JNI_CALL(); |
|
946 img = swtApp->jniUtils().CreateImage(aJniEnv, aImageData); |
|
947 } |
|
948 GFX_CATCH |
|
949 return POINTER_TO_HANDLE(img); |
|
950 } |
|
951 |
|
952 jint JNICALL Java_org_eclipse_swt_internal_qt_graphics_OS_image_1getFormat |
|
953 (JNIEnv* aJniEnv, jclass, jint aImageHandle) |
|
954 { |
|
955 jint format = 0; |
|
956 GFX_TRY |
|
957 { |
|
958 GFX_LOG_JNI_CALL(); |
|
959 HANDLE_TO_POINTER(Image*, image, aImageHandle); |
|
960 format = static_cast<jint>( image->getFormat() ); |
|
961 } |
|
962 GFX_CATCH |
|
963 return format; |
|
964 } |
|
965 |
|
966 jint JNICALL Java_org_eclipse_swt_internal_qt_graphics_OS_image_1getHeight |
|
967 (JNIEnv* aJniEnv, jclass, jint aImageHandle) |
|
968 { |
|
969 jint height = 0; |
|
970 GFX_TRY |
|
971 { |
|
972 GFX_LOG_JNI_CALL(); |
|
973 HANDLE_TO_POINTER(Image*, image, aImageHandle); |
|
974 height = static_cast<jint>( image->getHeight() ); |
|
975 } |
|
976 GFX_CATCH |
|
977 return height; |
|
978 } |
|
979 |
|
980 jint JNICALL Java_org_eclipse_swt_internal_qt_graphics_OS_image_1getWidth |
|
981 (JNIEnv* aJniEnv , jclass, jint aImageHandle) |
|
982 { |
|
983 jint width = 0; |
|
984 GFX_TRY |
|
985 { |
|
986 GFX_LOG_JNI_CALL(); |
|
987 HANDLE_TO_POINTER(Image*, image, aImageHandle); |
|
988 width = static_cast<jint>( image->getWidth() ); |
|
989 } |
|
990 GFX_CATCH |
|
991 return width; |
|
992 } |
|
993 |
|
994 void JNICALL Java_org_eclipse_swt_internal_qt_graphics_OS_image_1getRGB__I_3IIIIIII |
|
995 (JNIEnv* aJniEnv, jclass, jint aImageHandle, jintArray aRgbData, jint aOffset, jint aScanlength, jint aX, jint aY, jint aWidth, jint aHeight) |
|
996 { |
|
997 GFX_TRY |
|
998 { |
|
999 GFX_LOG_JNI_CALL(); |
|
1000 HANDLE_TO_POINTER(Image*, image, aImageHandle); |
|
1001 |
|
1002 int length = aJniEnv->GetArrayLength(aRgbData); |
|
1003 |
|
1004 int* buffer = new int[length]; // might throw bad_alloc |
|
1005 AutoRelease<int> release(buffer, true); |
|
1006 ::memset(buffer, 0, sizeof(int)*length); |
|
1007 |
|
1008 // get the data (populated to data array) |
|
1009 image->getRgb(buffer, aOffset, aScanlength, aX, aY, aWidth, aHeight); |
|
1010 |
|
1011 // Copy data back to java |
|
1012 swtApp->jniUtils().SetJavaIntArrayRegionFromIntArray(aJniEnv, aRgbData, 0, length, buffer); |
|
1013 } |
|
1014 GFX_CATCH |
|
1015 } |
|
1016 |
|
1017 void JNICALL Java_org_eclipse_swt_internal_qt_graphics_OS_image_1getRGB__I_3B_3BIIIIIII |
|
1018 (JNIEnv * aJniEnv, jclass, jint aImageHandle, jbyteArray aRgbData, jbyteArray aTransparencyMask, jint aOffset, jint aScanlength, jint aX, jint aY, jint aWidth, jint aHeight, jint aFormat) |
|
1019 { |
|
1020 GFX_TRY |
|
1021 { |
|
1022 GFX_LOG_JNI_CALL(); |
|
1023 HANDLE_TO_POINTER(Image*, image, aImageHandle); |
|
1024 |
|
1025 int dataLength = aJniEnv->GetArrayLength(aRgbData); |
|
1026 int maskLength = aJniEnv->GetArrayLength(aTransparencyMask); |
|
1027 |
|
1028 char* dataBuffer = new char[dataLength]; // might throw bad_alloc |
|
1029 AutoRelease<char> releaseData(dataBuffer, true); |
|
1030 char* maskBuffer = new char[maskLength]; // might throw bad_alloc |
|
1031 AutoRelease<char> releaseMask(maskBuffer, true); |
|
1032 ::memset(dataBuffer, 0, sizeof(char)*dataLength); |
|
1033 ::memset(maskBuffer, 0, sizeof(char)*maskLength); |
|
1034 |
|
1035 // get the data (populated to data array) |
|
1036 image->getRgb(dataBuffer, maskBuffer, aOffset, aScanlength, aX, aY, aWidth, aHeight, aFormat); |
|
1037 |
|
1038 // Copy data back to Java |
|
1039 swtApp->jniUtils().SetJavaByteArrayRegionFromCharArray(aJniEnv, aRgbData, 0, dataLength, dataBuffer); |
|
1040 swtApp->jniUtils().SetJavaByteArrayRegionFromCharArray(aJniEnv, aTransparencyMask, 0, maskLength, maskBuffer); |
|
1041 } |
|
1042 GFX_CATCH |
|
1043 } |
|
1044 |
|
1045 void JNICALL Java_org_eclipse_swt_internal_qt_graphics_OS_image_1getRGB__I_3SIIIIIII |
|
1046 (JNIEnv * aJniEnv, jclass, jint aImageHandle, jshortArray aRgbData, jint aOffset, jint aScanlength, jint aX, jint aY, jint aWidth, jint aHeight, jint aFormat) { |
|
1047 GFX_TRY |
|
1048 { |
|
1049 GFX_LOG_JNI_CALL(); |
|
1050 HANDLE_TO_POINTER(Image*, image, aImageHandle); |
|
1051 |
|
1052 int length = aJniEnv->GetArrayLength(aRgbData); |
|
1053 short* buffer = new short[length]; |
|
1054 AutoRelease<short> release(buffer, true); |
|
1055 ::memset(buffer, 0, sizeof(short)*length); |
|
1056 |
|
1057 // get the data (populated to data array) |
|
1058 image->getRgb(buffer, aOffset, aScanlength, aX, aY, aWidth, aHeight, aFormat); |
|
1059 |
|
1060 // Copy data back to java |
|
1061 swtApp->jniUtils().SetJavaShortArrayRegionFromShortArray(aJniEnv, aRgbData, 0, length, buffer); |
|
1062 } |
|
1063 GFX_CATCH |
|
1064 } |
|
1065 |
|
1066 jobject JNICALL Java_org_eclipse_swt_internal_qt_graphics_OS_image_1getImageData |
|
1067 (JNIEnv* aJniEnv , jclass, jint aImageHandle) |
|
1068 { |
|
1069 GFX_LOG_JNI_CALL(); |
|
1070 jobject imageData = 0; |
|
1071 GFX_TRY |
|
1072 { |
|
1073 ImageDataWrapper* data = NULL; |
|
1074 HANDLE_TO_POINTER(Image*, image, aImageHandle); |
|
1075 data = GraphicsFactory::createImageData(image); |
|
1076 AutoRelease<ImageDataWrapper> release(data, false); |
|
1077 imageData = swtApp->jniUtils().CreateJavaImageData(aJniEnv, *data); |
|
1078 } |
|
1079 GFX_CATCH |
|
1080 return imageData; |
|
1081 } |
|
1082 |
|
1083 void JNICALL Java_org_eclipse_swt_internal_qt_graphics_OS_image_1transform |
|
1084 (JNIEnv* aJniEnv , jclass, jint aImageHandle, jint aTransform) |
|
1085 { |
|
1086 GFX_TRY |
|
1087 { |
|
1088 GFX_LOG_JNI_CALL(); |
|
1089 HANDLE_TO_POINTER(Image*, image, aImageHandle); |
|
1090 image->transform((TTransform)aTransform); |
|
1091 } |
|
1092 GFX_CATCH |
|
1093 } |
|
1094 |
|
1095 void JNICALL Java_org_eclipse_swt_internal_qt_graphics_OS_image_1dispose |
|
1096 (JNIEnv* aJniEnv , jclass, jint aImageHandle) |
|
1097 { |
|
1098 GFX_TRY |
|
1099 { |
|
1100 GFX_LOG_JNI_CALL(); |
|
1101 HANDLE_TO_POINTER(Image*, image, aImageHandle); |
|
1102 image->dispose(); |
|
1103 image = NULL; |
|
1104 } |
|
1105 GFX_CATCH |
|
1106 } |
|
1107 |
|
1108 jint JNICALL Java_org_eclipse_swt_internal_qt_graphics_OS_image_1getPixmapHandle |
|
1109 (JNIEnv* aJniEnv , jclass, jint aImageHandle) |
|
1110 { |
|
1111 jint pixmapHandle = 0; |
|
1112 GFX_TRY |
|
1113 { |
|
1114 GFX_LOG_JNI_CALL(); |
|
1115 HANDLE_TO_POINTER(Image*, image, aImageHandle); |
|
1116 pixmapHandle = POINTER_TO_HANDLE(image->getPixmap()); |
|
1117 } |
|
1118 GFX_CATCH |
|
1119 return pixmapHandle; |
|
1120 } |
|
1121 |
|
1122 jboolean JNICALL Java_org_eclipse_swt_internal_qt_graphics_OS_image_1detectCollision |
|
1123 (JNIEnv* aJniEnv, jclass, jint aImage1PixmapHandle, jint aTransform1, jint aP1x, jint aP1y, jint aR1x1, jint aR1y1, jint aR1x2, jint aR1y2, |
|
1124 jint aImage2PixmapHandle, jint aTransform2, jint aP2x, jint aP2y, jint aR2x1, jint aR2y1, jint aR2x2, jint aR2y2) |
|
1125 { |
|
1126 jboolean collides = JNI_FALSE; |
|
1127 GFX_TRY |
|
1128 { |
|
1129 GFX_LOG_JNI_CALL(); |
|
1130 collides = gfxUtils::detectCollision(aImage1PixmapHandle, aTransform1, aP1x, aP1y, aR1x1, aR1y1, aR1x2, aR1y2, |
|
1131 aImage2PixmapHandle, aTransform2, aP2x, aP2y, aR2x1, aR2y1, aR2x2, aR2y2); |
|
1132 } |
|
1133 GFX_CATCH |
|
1134 return collides; |
|
1135 } |
|
1136 |
|
1137 // |
|
1138 // ImageLoader JNI calls |
|
1139 // |
|
1140 |
|
1141 void JNICALL Java_org_eclipse_swt_internal_qt_graphics_OS_imageLoader_1append |
|
1142 (JNIEnv* aJniEnv, jclass, jint aHandle, jint aLenght, jint aOffset, jbyteArray aImageData) |
|
1143 { |
|
1144 GFX_TRY |
|
1145 { |
|
1146 GFX_LOG_JNI_CALL(); |
|
1147 jbyte* data = NULL; |
|
1148 data = aJniEnv->GetByteArrayElements(aImageData, NULL); |
|
1149 HANDLE_TO_POINTER(ImageLoader*, loader, aHandle); |
|
1150 loader->append(reinterpret_cast<const char*>(data), aLenght, aOffset); |
|
1151 // release arrays, don't copy back |
|
1152 aJniEnv->ReleaseByteArrayElements(aImageData, data, JNI_ABORT); |
|
1153 } |
|
1154 GFX_CATCH |
|
1155 } |
|
1156 |
|
1157 void JNICALL Java_org_eclipse_swt_internal_qt_graphics_OS_imageLoader_1beginStream |
|
1158 (JNIEnv* aJniEnv , jclass, jint aHandle, jint aBufferSize) |
|
1159 { |
|
1160 GFX_TRY |
|
1161 { |
|
1162 GFX_LOG_JNI_CALL(); |
|
1163 HANDLE_TO_POINTER(ImageLoader*, loader, aHandle); |
|
1164 loader->beginStream(aBufferSize); |
|
1165 } |
|
1166 GFX_CATCH |
|
1167 } |
|
1168 |
|
1169 jint JNICALL Java_org_eclipse_swt_internal_qt_graphics_OS_imageLoader_1endStream |
|
1170 (JNIEnv* aJniEnv , jclass, jint aHandle) |
|
1171 { |
|
1172 Image* image = NULL; |
|
1173 GFX_TRY |
|
1174 { |
|
1175 GFX_LOG_JNI_CALL(); |
|
1176 HANDLE_TO_POINTER(ImageLoader*, loader, aHandle); |
|
1177 image = loader->endStream(); |
|
1178 } |
|
1179 GFX_CATCH |
|
1180 return POINTER_TO_HANDLE(image); |
|
1181 } |
|
1182 |
|
1183 jint JNICALL Java_org_eclipse_swt_internal_qt_graphics_OS_imageLoader_1init |
|
1184 (JNIEnv* aJniEnv , jclass) |
|
1185 { |
|
1186 ImageLoader* loader = NULL; |
|
1187 GFX_TRY |
|
1188 { |
|
1189 GFX_LOG_JNI_CALL(); |
|
1190 loader = GraphicsFactory::createImageLoader(); |
|
1191 } |
|
1192 GFX_CATCH |
|
1193 return POINTER_TO_HANDLE(loader); |
|
1194 } |
|
1195 |
|
1196 void JNICALL Java_org_eclipse_swt_internal_qt_graphics_OS_imageLoader_1dispose |
|
1197 (JNIEnv* aJniEnv , jclass, jint aHandle) |
|
1198 { |
|
1199 GFX_TRY |
|
1200 { |
|
1201 GFX_LOG_JNI_CALL(); |
|
1202 HANDLE_TO_POINTER(ImageLoader*, loader, aHandle); |
|
1203 loader->dispose(); |
|
1204 } |
|
1205 GFX_CATCH |
|
1206 } |
|
1207 |
|
1208 jint JNICALL Java_org_eclipse_swt_internal_qt_graphics_OS_imageLoader_1load |
|
1209 (JNIEnv* aJniEnv , jclass, jint aHandle, jstring aFileName) |
|
1210 { |
|
1211 Image* image = NULL; |
|
1212 GFX_TRY |
|
1213 { |
|
1214 GFX_LOG_JNI_CALL(); |
|
1215 HANDLE_TO_POINTER(ImageLoader*, loader, aHandle); |
|
1216 image = loader->load(swtApp->jniUtils().JavaStringToQString(aJniEnv, aFileName)); |
|
1217 } |
|
1218 GFX_CATCH |
|
1219 return POINTER_TO_HANDLE(image); |
|
1220 } |
|
1221 |
|
1222 void JNICALL Java_org_eclipse_swt_internal_qt_graphics_OS_imageLoader_1setLoadSize |
|
1223 (JNIEnv* aJniEnv , jclass, jint aHandle, jint aWidth, jint aHeight) |
|
1224 { |
|
1225 GFX_TRY |
|
1226 { |
|
1227 GFX_LOG_JNI_CALL(); |
|
1228 HANDLE_TO_POINTER(ImageLoader*, loader, aHandle); |
|
1229 loader->setLoadSize(aWidth, aHeight); |
|
1230 } |
|
1231 GFX_CATCH |
|
1232 } |
|
1233 |
|
1234 // |
|
1235 // FontUtils |
|
1236 // |
|
1237 |
|
1238 jint JNICALL Java_org_eclipse_swt_internal_qt_graphics_OS_fontUtils_1getAscent |
|
1239 (JNIEnv* aJniEnv , jclass, jint aFontHandle) |
|
1240 { |
|
1241 jint ascent = 0; |
|
1242 GFX_TRY |
|
1243 { |
|
1244 GFX_LOG_JNI_CALL(); |
|
1245 HANDLE_TO_POINTER(QFont*, font, aFontHandle); |
|
1246 QFontMetrics fm(*font); |
|
1247 ascent = static_cast<jint>( fm.ascent() ); |
|
1248 } |
|
1249 GFX_CATCH |
|
1250 return ascent; |
|
1251 } |
|
1252 |
|
1253 void JNICALL Java_org_eclipse_swt_internal_qt_graphics_OS_fontUtils_1getBoundingRect__I_3ILjava_lang_String_2 |
|
1254 (JNIEnv* aJniEnv, jclass, jint aFontHandle, jintArray aRectArray, jstring aStr) |
|
1255 { |
|
1256 GFX_TRY |
|
1257 { |
|
1258 GFX_LOG_JNI_CALL(); |
|
1259 QString string = swtApp->jniUtils().JavaStringToQString(aJniEnv, aStr); |
|
1260 |
|
1261 int length = aJniEnv->GetArrayLength(aRectArray); |
|
1262 |
|
1263 int* buffer = new int[length]; // might throw bad_alloc |
|
1264 AutoRelease<int> release(buffer, true); |
|
1265 ::memset(buffer, 0, sizeof(int)*length); |
|
1266 |
|
1267 HANDLE_TO_POINTER(QFont*, font, aFontHandle); |
|
1268 QFontMetrics fm(*font); |
|
1269 |
|
1270 buffer[0] = 0; |
|
1271 buffer[1] = 0; |
|
1272 buffer[2] = fm.width(string); |
|
1273 buffer[3] = fm.height(); |
|
1274 |
|
1275 // Copy changes to rectArray |
|
1276 swtApp->jniUtils().SetJavaIntArrayRegionFromIntArray(aJniEnv, aRectArray, 0, length, buffer); |
|
1277 } |
|
1278 GFX_CATCH |
|
1279 } |
|
1280 |
|
1281 void JNICALL Java_org_eclipse_swt_internal_qt_graphics_OS_fontUtils_1getBoundingRect__I_3ILjava_lang_String_2IIIIII |
|
1282 (JNIEnv* aJniEnv, jclass, jint aFontHandle, jintArray aRectArray, jstring aStr, jint /*aRectX*/, jint /*aRectY*/, jint /*aRectW*/, jint /*aRectH*/, jint /*aAlignments*/, jint /*aFlags*/) |
|
1283 { |
|
1284 GFX_TRY |
|
1285 { |
|
1286 GFX_LOG_JNI_CALL(); |
|
1287 QString string = swtApp->jniUtils().JavaStringToQString(aJniEnv, aStr); |
|
1288 int length = aJniEnv->GetArrayLength(aRectArray); |
|
1289 |
|
1290 int* buffer = new int[length]; // might throw bad_alloc |
|
1291 AutoRelease<int> release(buffer, true); |
|
1292 ::memset(buffer, 0, sizeof(int)*length); |
|
1293 |
|
1294 HANDLE_TO_POINTER(QFont*, font, aFontHandle); |
|
1295 QFontMetrics fm(*font); |
|
1296 |
|
1297 buffer[0] = 0; |
|
1298 buffer[1] = 0; |
|
1299 buffer[2] = fm.width(string); |
|
1300 buffer[3] = fm.height(); |
|
1301 |
|
1302 // Copy changes to rectArray |
|
1303 swtApp->jniUtils().SetJavaIntArrayRegionFromIntArray(aJniEnv, aRectArray, 0, length, buffer); |
|
1304 } |
|
1305 GFX_CATCH |
|
1306 } |
|
1307 |
|
1308 jint JNICALL Java_org_eclipse_swt_internal_qt_graphics_OS_fontUtils_1getDescent |
|
1309 (JNIEnv* aJniEnv , jclass, jint aFontHandle) |
|
1310 { |
|
1311 jint descent = 0; |
|
1312 GFX_TRY |
|
1313 { |
|
1314 GFX_LOG_JNI_CALL(); |
|
1315 HANDLE_TO_POINTER(QFont*, font, aFontHandle); |
|
1316 QFontMetrics fm(*font); |
|
1317 descent = static_cast<jint>( fm.descent() ); |
|
1318 } |
|
1319 GFX_CATCH |
|
1320 return descent; |
|
1321 } |
|
1322 |
|
1323 jint JNICALL Java_org_eclipse_swt_internal_qt_graphics_OS_fontUtils_1getStringWidth |
|
1324 (JNIEnv* aJniEnv , jclass, jint aFontHandle, jstring aStr) |
|
1325 { |
|
1326 int strWidth = 0; |
|
1327 GFX_TRY |
|
1328 { |
|
1329 GFX_LOG_JNI_CALL(); |
|
1330 HANDLE_TO_POINTER(QFont*, font, aFontHandle); |
|
1331 QString string = swtApp->jniUtils().JavaStringToQString(aJniEnv, aStr); |
|
1332 QFontMetrics fm(*font); |
|
1333 strWidth = fm.width(string); |
|
1334 } |
|
1335 GFX_CATCH |
|
1336 return static_cast<jint>(strWidth); |
|
1337 } |
|
1338 |
|
1339 // |
|
1340 // Buffer JNI calls |
|
1341 // |
|
1342 |
|
1343 jint JNICALL Java_org_eclipse_swt_internal_qt_graphics_OS_buffer_1init |
|
1344 (JNIEnv* aJniEnv , jclass) |
|
1345 { |
|
1346 Buffer* buffer = 0; |
|
1347 GFX_TRY |
|
1348 { |
|
1349 GFX_LOG_JNI_CALL(); |
|
1350 buffer = GraphicsFactory::createBuffer(); |
|
1351 } |
|
1352 GFX_CATCH |
|
1353 return POINTER_TO_HANDLE(buffer); |
|
1354 } |
|
1355 |
|
1356 void JNICALL Java_org_eclipse_swt_internal_qt_graphics_OS_buffer_1dispose |
|
1357 (JNIEnv* aJniEnv , jclass, jint aHandle) |
|
1358 { |
|
1359 GFX_TRY |
|
1360 { |
|
1361 HANDLE_TO_POINTER(Buffer*, buffer, aHandle); |
|
1362 buffer->dispose(); |
|
1363 } |
|
1364 GFX_CATCH |
|
1365 } |
|
1366 |
|
1367 void JNICALL Java_org_eclipse_swt_internal_qt_graphics_OS_buffer_1getInvalidRect |
|
1368 (JNIEnv* aJniEnv, jclass, jint aHandle, jintArray aRect) |
|
1369 { |
|
1370 GFX_TRY |
|
1371 { |
|
1372 HANDLE_TO_POINTER(Buffer*, buffer, aHandle); |
|
1373 |
|
1374 int length = aJniEnv->GetArrayLength(aRect); |
|
1375 |
|
1376 int* intBuffer = new int[length]; // might throw bad_alloc |
|
1377 AutoRelease<int> release(intBuffer, true); |
|
1378 ::memset(intBuffer, 0, sizeof(int)*length); |
|
1379 |
|
1380 buffer->getInvalidRect(intBuffer); |
|
1381 |
|
1382 // Copy data back to java |
|
1383 swtApp->jniUtils().SetJavaIntArrayRegionFromIntArray(aJniEnv, aRect, 0, length, intBuffer); |
|
1384 } |
|
1385 GFX_CATCH |
|
1386 } |
|
1387 |
|
1388 // |
|
1389 // Windowsurface |
|
1390 // |
|
1391 jint JNICALL Java_org_eclipse_swt_internal_qt_graphics_OS_windowsurface_1create |
|
1392 (JNIEnv* aJniEnv, jclass, jint aHandle, jboolean aAutoRefresh) |
|
1393 { |
|
1394 WindowSurface* surface = 0; |
|
1395 HANDLE_TO_POINTER(QWidget*, widget, aHandle); |
|
1396 GFX_TRY |
|
1397 { |
|
1398 GFX_LOG_JNI_CALL(); |
|
1399 surface = GraphicsFactory::createWindowSurface(widget, aAutoRefresh); |
|
1400 } |
|
1401 GFX_CATCH |
|
1402 |
|
1403 return POINTER_TO_HANDLE(surface); |
|
1404 } |
|
1405 void JNICALL Java_org_eclipse_swt_internal_qt_graphics_OS_windowsurface_1beginPaint |
|
1406 (JNIEnv* aJniEnv, jclass, jint aHandle, jint aX, jint aY, jint aWidth, jint aHeight) |
|
1407 { |
|
1408 HANDLE_TO_POINTER(WindowSurface*, wsurf, aHandle); |
|
1409 GFX_TRY |
|
1410 { |
|
1411 GFX_LOG_JNI_CALL(); |
|
1412 wsurf->beginPaint(aX, aY, aWidth, aHeight); |
|
1413 } |
|
1414 GFX_CATCH |
|
1415 } |
|
1416 |
|
1417 void JNICALL Java_org_eclipse_swt_internal_qt_graphics_OS_windowsurface_1endPaint |
|
1418 (JNIEnv* aJniEnv, jclass, jint aHandle) |
|
1419 { |
|
1420 HANDLE_TO_POINTER(WindowSurface*, wsurf, aHandle); |
|
1421 GFX_TRY |
|
1422 { |
|
1423 GFX_LOG_JNI_CALL(); |
|
1424 wsurf->endPaint(); |
|
1425 } |
|
1426 GFX_CATCH |
|
1427 } |
|
1428 |
|
1429 void JNICALL Java_org_eclipse_swt_internal_qt_graphics_OS_windowsurface_1flush |
|
1430 (JNIEnv* aJniEnv, jclass, jint aHandle) |
|
1431 { |
|
1432 HANDLE_TO_POINTER(WindowSurface*, wsurf, aHandle); |
|
1433 GFX_TRY |
|
1434 { |
|
1435 GFX_LOG_JNI_CALL(); |
|
1436 wsurf->flush(); |
|
1437 } |
|
1438 GFX_CATCH |
|
1439 } |
|
1440 |
|
1441 jint JNICALL Java_org_eclipse_swt_internal_qt_graphics_OS_windowsurface_1getType |
|
1442 (JNIEnv* aJniEnv , jclass, jint aHandle) |
|
1443 { |
|
1444 jint type = 0; |
|
1445 GFX_TRY |
|
1446 { |
|
1447 HANDLE_TO_POINTER(WindowSurface*, wsurf, aHandle); |
|
1448 type = static_cast<jint>( wsurf->getType() ); |
|
1449 } |
|
1450 GFX_CATCH |
|
1451 return type; |
|
1452 } |
|
1453 |
|
1454 void JNICALL Java_org_eclipse_swt_internal_qt_graphics_OS_windowsurface_1dispose |
|
1455 (JNIEnv* aJniEnv , jclass, jint aHandle) |
|
1456 { |
|
1457 GFX_TRY |
|
1458 { |
|
1459 HANDLE_TO_POINTER(WindowSurface*, wsurf, aHandle); |
|
1460 wsurf->dispose(); |
|
1461 } |
|
1462 GFX_CATCH |
|
1463 } |
|
1464 |
|
1465 void JNICALL Java_org_eclipse_swt_internal_qt_graphics_OS_windowsurface_1refresh |
|
1466 (JNIEnv* aJniEnv, jclass, jint aHandle) |
|
1467 { |
|
1468 GFX_TRY |
|
1469 { |
|
1470 HANDLE_TO_POINTER(WindowSurface*, wsurf, aHandle); |
|
1471 wsurf->refresh(); |
|
1472 } |
|
1473 GFX_CATCH |
|
1474 } |
|
1475 |
|
1476 |
|
1477 |
|
1478 |