38 swtApp->jniUtils().Throw(aJniEnv, e); \ |
38 swtApp->jniUtils().Throw(aJniEnv, e); \ |
39 } |
39 } |
40 |
40 |
41 |
41 |
42 jint JNICALL Java_org_eclipse_swt_internal_qt_graphics_OS_graphicsContext_1get_1windowsurface |
42 jint JNICALL Java_org_eclipse_swt_internal_qt_graphics_OS_graphicsContext_1get_1windowsurface |
43 (JNIEnv* aJniEnv, jclass, jint aHandle) |
43 (JNIEnv* aJniEnv, jclass, jint aHandle) |
44 { |
44 { |
45 WindowSurface* ws = NULL; |
45 WindowSurface* ws = NULL; |
46 GFX_TRY |
46 GFX_TRY |
47 { |
47 { |
48 GFX_LOG_JNI_CALL(); |
48 SWT_LOG_JNI_CALL(); |
49 HANDLE_TO_POINTER(GraphicsContext*, gc, aHandle); |
49 HANDLE_TO_POINTER(GraphicsContext*, gc, aHandle); |
50 ws = gc->getWindowSurface(); |
50 ws = gc->getWindowSurface(); |
51 } |
51 } |
52 GFX_CATCH |
52 GFX_CATCH |
53 |
53 |
54 return POINTER_TO_HANDLE(ws); |
54 return POINTER_TO_HANDLE(ws); |
55 } |
55 } |
56 |
56 |
57 // Creates a new instance of native graphics context (gc) |
57 // Creates a new instance of native graphics context (gc) |
58 jint JNICALL Java_org_eclipse_swt_internal_qt_graphics_OS_graphicsContext_1init |
58 jint JNICALL Java_org_eclipse_swt_internal_qt_graphics_OS_graphicsContext_1init |
59 (JNIEnv* aJniEnv , jclass) |
59 (JNIEnv* aJniEnv , jclass) |
60 { |
60 { |
61 GraphicsContext* gc = 0; |
61 GraphicsContext* gc = 0; |
62 GFX_TRY |
62 GFX_TRY |
63 { |
63 { |
64 GFX_LOG_JNI_CALL(); |
64 SWT_LOG_JNI_CALL(); |
65 gc = GraphicsFactory::createGraphicsContext(); |
65 gc = GraphicsFactory::createGraphicsContext(); |
66 } |
66 } |
67 GFX_CATCH |
67 GFX_CATCH |
68 |
68 |
69 return POINTER_TO_HANDLE(gc); |
69 return POINTER_TO_HANDLE(gc); |
70 } |
70 } |
71 |
71 |
72 void JNICALL Java_org_eclipse_swt_internal_qt_graphics_OS_graphicsContext_1dispose |
72 void JNICALL Java_org_eclipse_swt_internal_qt_graphics_OS_graphicsContext_1dispose |
73 (JNIEnv* aJniEnv , jclass, jint aHandle) |
73 (JNIEnv* aJniEnv , jclass, jint aHandle) |
74 { |
74 { |
75 GFX_TRY |
75 GFX_TRY |
76 { |
76 { |
77 GFX_LOG_JNI_CALL(); |
77 SWT_LOG_JNI_CALL(); |
78 HANDLE_TO_POINTER(GraphicsContext*, gc, aHandle); |
78 HANDLE_TO_POINTER(GraphicsContext*, gc, aHandle); |
79 gc->dispose(); |
79 gc->dispose(); |
80 gc = NULL; |
80 gc = NULL; |
81 } |
81 } |
82 GFX_CATCH |
82 GFX_CATCH |
83 } |
83 } |
122 void JNICALL Java_org_eclipse_swt_internal_qt_graphics_OS_graphicsContext_1copyArea__IIII |
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) |
123 (JNIEnv* aJniEnv , jclass, jint aHandle, jint aTargetHandle, jint aX, jint aY) |
124 { |
124 { |
125 GFX_TRY |
125 GFX_TRY |
126 { |
126 { |
127 GFX_LOG_JNI_CALL(); |
127 SWT_LOG_JNI_CALL(); |
128 HANDLE_TO_POINTER(GraphicsContext*, gc, aHandle); |
128 HANDLE_TO_POINTER(GraphicsContext*, gc, aHandle); |
129 HANDLE_TO_POINTER(Image*, image, aTargetHandle); |
129 HANDLE_TO_POINTER(Image*, image, aTargetHandle); |
130 |
130 |
131 gc->copyArea(image, aX, aY); |
131 gc->copyArea(image, aX, aY); |
132 } |
132 } |
133 GFX_CATCH |
133 GFX_CATCH |
134 } |
134 } |
135 |
135 |
136 void JNICALL Java_org_eclipse_swt_internal_qt_graphics_OS_graphicsContext_1copyArea__IIIIIIIZ |
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) |
137 (JNIEnv* aJniEnv , jclass, jint aHandle, jint aSrcX, jint aSrcY, jint aWidth, jint aHeight, jint aDestX, jint aDestY, jboolean aPaint) |
138 { |
138 { |
139 GFX_TRY |
139 GFX_TRY |
140 { |
140 { |
141 GFX_LOG_JNI_CALL(); |
141 SWT_LOG_JNI_CALL(); |
142 HANDLE_TO_POINTER(GraphicsContext*, gc, aHandle); |
142 HANDLE_TO_POINTER(GraphicsContext*, gc, aHandle); |
143 gc->copyArea(aSrcX, aSrcY, aWidth, aHeight, aDestX, aDestY, aPaint == JNI_TRUE ? true : false); |
143 gc->copyArea(aSrcX, aSrcY, aWidth, aHeight, aDestX, aDestY, aPaint == JNI_TRUE ? true : false); |
144 } |
144 } |
145 GFX_CATCH |
145 GFX_CATCH |
146 } |
146 } |
184 void JNICALL Java_org_eclipse_swt_internal_qt_graphics_OS_graphicsContext_1drawImage__IIII |
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) |
185 (JNIEnv* aJniEnv , jclass, jint aHandle, jint aImageHandle, jint aX, jint aY) |
186 { |
186 { |
187 GFX_TRY |
187 GFX_TRY |
188 { |
188 { |
189 GFX_LOG_JNI_CALL(); |
189 SWT_LOG_JNI_CALL(); |
190 HANDLE_TO_POINTER(GraphicsContext*, gc, aHandle); |
190 HANDLE_TO_POINTER(GraphicsContext*, gc, aHandle); |
191 HANDLE_TO_POINTER(Image*, image, aImageHandle); |
191 HANDLE_TO_POINTER(Image*, image, aImageHandle); |
192 gc->drawImage(image, aX, aY); |
192 gc->drawImage(image, aX, aY); |
193 } |
193 } |
194 GFX_CATCH |
194 GFX_CATCH |
195 } |
195 } |
196 |
196 |
197 void JNICALL Java_org_eclipse_swt_internal_qt_graphics_OS_graphicsContext_1drawImage__IIIIIIIIIII |
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, |
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) |
199 jint aSx, jint aSy, jint aSw, jint aSh, jint aManipulation) |
200 { |
200 { |
201 GFX_TRY |
201 GFX_TRY |
202 { |
202 { |
203 GFX_LOG_JNI_CALL(); |
203 SWT_LOG_JNI_CALL(); |
204 HANDLE_TO_POINTER(GraphicsContext*, gc, aHandle); |
204 HANDLE_TO_POINTER(GraphicsContext*, gc, aHandle); |
205 HANDLE_TO_POINTER(Image*, image, aImageHandle); |
205 HANDLE_TO_POINTER(Image*, image, aImageHandle); |
206 gc->drawImage(image, aManipulation, aTx, aTy, aTw, aTh, aSx, aSy, aSw, aSh); |
206 gc->drawImage(image, aManipulation, aTx, aTy, aTw, aTh, aSx, aSy, aSw, aSh); |
207 } |
207 } |
208 GFX_CATCH |
208 GFX_CATCH |
267 void JNICALL Java_org_eclipse_swt_internal_qt_graphics_OS_graphicsContext_1drawRect |
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) |
268 (JNIEnv* aJniEnv , jclass, jint aHandle, jint aX, jint aY, jint aWidth, jint aHeight) |
269 { |
269 { |
270 GFX_TRY |
270 GFX_TRY |
271 { |
271 { |
272 GFX_LOG_JNI_CALL(); |
272 SWT_LOG_JNI_CALL(); |
273 HANDLE_TO_POINTER(GraphicsContext*, gc, aHandle); |
273 HANDLE_TO_POINTER(GraphicsContext*, gc, aHandle); |
274 gc->drawRect(aX, aY, aWidth, aHeight); |
274 gc->drawRect(aX, aY, aWidth, aHeight); |
275 } |
275 } |
276 GFX_CATCH |
276 GFX_CATCH |
277 } |
277 } |
278 |
278 |
279 void JNICALL Java_org_eclipse_swt_internal_qt_graphics_OS_graphicsContext_1drawRGB__I_3IIIIIIIZI |
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, |
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) |
281 jint aX, jint aY, jint aWidth, jint aHeight, jboolean aProcessAlpha, jint aManipulation) |
282 { |
282 { |
283 GFX_TRY |
283 GFX_TRY |
284 { |
284 { |
285 GFX_LOG_JNI_CALL(); |
285 SWT_LOG_JNI_CALL(); |
286 HANDLE_TO_POINTER(GraphicsContext*, gc, aHandle); |
286 HANDLE_TO_POINTER(GraphicsContext*, gc, aHandle); |
287 int length = aJniEnv->GetArrayLength(aRgbData); |
287 int length = aJniEnv->GetArrayLength(aRgbData); |
288 |
288 |
289 int* buffer = new int[length]; // might throw bad_alloc |
289 int* buffer = new int[length]; // might throw bad_alloc |
290 AutoRelease<int> release(buffer, true); |
290 AutoRelease<int> release(buffer, true); |
291 swtApp->jniUtils().GetJavaIntArrayRegionToIntArray(aJniEnv, aRgbData, 0, length, buffer); // might throw bad_alloc |
291 swtApp->jniUtils().GetJavaIntArrayRegionToIntArray(aJniEnv, aRgbData, 0, length, buffer); // might throw bad_alloc |
292 |
292 |
293 gc->drawRGB(buffer, length, aOffset, aScanlength, aX, aY, aWidth, aHeight, aProcessAlpha, aManipulation); |
293 gc->drawRGB(buffer, length, aOffset, aScanlength, aX, aY, aWidth, aHeight, aProcessAlpha, aManipulation); |
294 } |
294 } |
295 GFX_CATCH |
295 GFX_CATCH |
296 } |
296 } |
297 |
297 |
298 void JNICALL Java_org_eclipse_swt_internal_qt_graphics_OS_graphicsContext_1drawRGB__I_3B_3BIIIIIIII |
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, |
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) |
300 jint aOffset, jint aScanLength, jint aX, jint aY, jint aWidth, jint aHeight, jint aTransform, jint aFormat) |
301 { |
301 { |
302 GFX_TRY |
302 GFX_TRY |
303 { |
303 { |
304 GFX_LOG_JNI_CALL(); |
304 SWT_LOG_JNI_CALL(); |
305 HANDLE_TO_POINTER(GraphicsContext*, gc, aHandle); |
305 HANDLE_TO_POINTER(GraphicsContext*, gc, aHandle); |
306 |
306 |
307 int dataLength = aJniEnv->GetArrayLength(aRgbData); |
307 int dataLength = aJniEnv->GetArrayLength(aRgbData); |
308 int maskLength = aJniEnv->GetArrayLength(aTransparencyMask); |
308 int maskLength = aJniEnv->GetArrayLength(aTransparencyMask); |
309 |
309 |
310 char* dataBuffer = new char[dataLength]; // might throw bad_alloc |
310 char* dataBuffer = new char[dataLength]; // might throw bad_alloc |
311 AutoRelease<char> releaseData(dataBuffer, true); |
311 AutoRelease<char> releaseData(dataBuffer, true); |
312 swtApp->jniUtils().GetJavaByteArrayRegionToCharArray(aJniEnv, aRgbData, 0, dataLength, dataBuffer); // might throw bad_alloc |
312 swtApp->jniUtils().GetJavaByteArrayRegionToCharArray(aJniEnv, aRgbData, 0, dataLength, dataBuffer); // might throw bad_alloc |
313 |
313 |
314 char* maskBuffer = NULL; |
314 char* maskBuffer = NULL; |
315 AutoRelease<char> releaseMask(NULL, true); // Will delete mask or NULL if there's no mask |
315 AutoRelease<char> releaseMask(NULL, true); // Will delete mask or NULL if there's no mask |
316 |
316 |
317 if(aTransparencyMask) |
317 if(aTransparencyMask) |
318 { |
318 { |
319 maskBuffer = new char[maskLength]; // might throw bad_alloc |
319 maskBuffer = new char[maskLength]; // might throw bad_alloc |
320 releaseMask.reset(maskBuffer); |
320 releaseMask.reset(maskBuffer); |
321 swtApp->jniUtils().GetJavaByteArrayRegionToCharArray(aJniEnv, aTransparencyMask, 0, maskLength, maskBuffer); // might throw bad_alloc |
321 swtApp->jniUtils().GetJavaByteArrayRegionToCharArray(aJniEnv, aTransparencyMask, 0, maskLength, maskBuffer); // might throw bad_alloc |
322 } |
322 } |
323 |
323 |
324 gc->drawRGB(dataBuffer, maskBuffer, dataLength, aOffset, aScanLength, aX, aY, aWidth, aHeight, aTransform, aFormat); |
324 gc->drawRGB(dataBuffer, maskBuffer, dataLength, aOffset, aScanLength, aX, aY, aWidth, aHeight, aTransform, aFormat); |
325 } |
325 } |
326 GFX_CATCH |
326 GFX_CATCH |
327 } |
327 } |
328 |
328 |
330 (JNIEnv * aJniEnv, jclass, jint aImageHandle, jshortArray aRgbData, jint aOffset, jint aScanlength, |
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) |
331 jint aX, jint aY, jint aWidth, jint aHeight, jboolean aProcessAlpha, jint aManipulation, jint aFormat) |
332 { |
332 { |
333 GFX_TRY |
333 GFX_TRY |
334 { |
334 { |
335 GFX_LOG_JNI_CALL(); |
335 SWT_LOG_JNI_CALL(); |
336 HANDLE_TO_POINTER(GraphicsContext*, gc, aImageHandle); |
336 HANDLE_TO_POINTER(GraphicsContext*, gc, aImageHandle); |
337 |
337 |
338 int length = aJniEnv->GetArrayLength(aRgbData); |
338 int length = aJniEnv->GetArrayLength(aRgbData); |
339 |
339 |
340 short* buffer = new short[length]; |
340 short* buffer = new short[length]; |
341 AutoRelease<short> release(buffer, true); |
341 AutoRelease<short> release(buffer, true); |
342 ::memset(buffer, 0, sizeof(short)*length); |
342 ::memset(buffer, 0, sizeof(short)*length); |
343 |
343 |
344 swtApp->jniUtils().GetJavaShortArrayRegionToShortArray(aJniEnv, aRgbData, 0, length, buffer); // might throw bad_alloc |
344 swtApp->jniUtils().GetJavaShortArrayRegionToShortArray(aJniEnv, aRgbData, 0, length, buffer); // might throw bad_alloc |
345 |
345 |
346 gc->drawRGB(buffer, length, aOffset, aScanlength, aX, aY, aWidth, aHeight, aProcessAlpha, aManipulation, aFormat); |
346 gc->drawRGB(buffer, length, aOffset, aScanlength, aX, aY, aWidth, aHeight, aProcessAlpha, aManipulation, aFormat); |
347 } |
347 } |
348 GFX_CATCH |
348 GFX_CATCH |
349 } |
349 } |
350 |
350 |
351 void JNICALL Java_org_eclipse_swt_internal_qt_graphics_OS_graphicsContext_1drawRoundRect |
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) |
352 (JNIEnv* aJniEnv , jclass, jint aHandle, jint aX, jint aY, jint aWidth, jint aHeight, jint aArcWidth, jint aArcHeight) |
353 { |
353 { |
354 GFX_TRY |
354 GFX_TRY |
355 { |
355 { |
356 GFX_LOG_JNI_CALL(); |
356 SWT_LOG_JNI_CALL(); |
357 HANDLE_TO_POINTER(GraphicsContext*, gc, aHandle); |
357 HANDLE_TO_POINTER(GraphicsContext*, gc, aHandle); |
358 gc->drawRoundRect(aX, aY, aWidth, aHeight, aArcWidth, aArcHeight); |
358 gc->drawRoundRect(aX, aY, aWidth, aHeight, aArcWidth, aArcHeight); |
359 } |
359 } |
360 GFX_CATCH |
360 GFX_CATCH |
361 } |
361 } |
362 |
362 |
363 void JNICALL Java_org_eclipse_swt_internal_qt_graphics_OS_graphicsContext_1drawString |
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, |
364 (JNIEnv* aJniEnv, jclass, jint aHandle, jstring aText, jint aX, jint aY, jint aWidth, jint aHeight, |
365 jint aAlignments, jint aFlags, jboolean aIsTransparent) |
365 jint aAlignments, jint aFlags, jboolean aIsTransparent) |
366 { |
366 { |
367 GFX_TRY |
367 GFX_TRY |
368 { |
368 { |
369 GFX_LOG_JNI_CALL(); |
369 SWT_LOG_JNI_CALL(); |
370 const jchar* chars; // unsigned short (2 bytes) |
370 const jchar* chars; // unsigned short (2 bytes) |
371 int length; |
371 int length; |
372 |
372 |
373 length = aJniEnv->GetStringLength(aText); |
373 length = aJniEnv->GetStringLength(aText); |
374 chars = aJniEnv->GetStringChars(aText, NULL); |
374 chars = aJniEnv->GetStringChars(aText, NULL); |
375 AutoReleaseStringChars release(aJniEnv, aText, chars); |
375 AutoReleaseStringChars release(aJniEnv, aText, chars); |
376 HANDLE_TO_POINTER(GraphicsContext*, gc, aHandle); |
376 HANDLE_TO_POINTER(GraphicsContext*, gc, aHandle); |
377 gc->drawString( |
377 gc->drawString( |
378 (const unsigned short*)chars, |
378 (const unsigned short*)chars, |
379 aX, |
379 aX, |
380 aY, |
380 aY, |
381 aWidth, |
381 aWidth, |
382 aHeight, |
382 aHeight, |
383 length, |
383 length, |
384 aAlignments, |
384 aAlignments, |
385 aFlags, |
385 aFlags, |
386 aIsTransparent); |
386 aIsTransparent); |
387 } |
387 } |
388 GFX_CATCH |
388 GFX_CATCH |
389 } |
389 } |
390 |
390 |
391 JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_qt_graphics_OS_graphicsContext_1drawWindowSurface |
391 JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_qt_graphics_OS_graphicsContext_1drawWindowSurface |
392 (JNIEnv* aJniEnv, jclass, jint aHandle, jint aSurfaceHandle, jint aX, jint aY, jint aWidth, jint aHeight) |
392 (JNIEnv* aJniEnv, jclass, jint aHandle, jint aSurfaceHandle, jint aX, jint aY, jint aWidth, jint aHeight) |
393 { |
393 { |
394 GFX_TRY |
394 GFX_TRY |
395 { |
395 { |
396 GFX_LOG_JNI_CALL(); |
396 SWT_LOG_JNI_CALL(); |
397 HANDLE_TO_POINTER(GraphicsContext*, gc, aHandle); |
397 HANDLE_TO_POINTER(GraphicsContext*, gc, aHandle); |
398 HANDLE_TO_POINTER(WindowSurface*, surface, aSurfaceHandle); |
398 HANDLE_TO_POINTER(WindowSurface*, surface, aSurfaceHandle); |
399 gc->drawWindowSurface(surface, aX, aY, aWidth, aHeight); |
399 gc->drawWindowSurface(surface, aX, aY, aWidth, aHeight); |
400 } |
400 } |
401 GFX_CATCH |
401 GFX_CATCH |
404 void JNICALL Java_org_eclipse_swt_internal_qt_graphics_OS_graphicsContext_1fillArc |
404 void JNICALL Java_org_eclipse_swt_internal_qt_graphics_OS_graphicsContext_1fillArc |
405 (JNIEnv* aJniEnv , jclass, jint aHandle, jint aX, jint aY, jint aWidth, jint aHeight, jint aStartAngle, jint aArcAngle) |
405 (JNIEnv* aJniEnv , jclass, jint aHandle, jint aX, jint aY, jint aWidth, jint aHeight, jint aStartAngle, jint aArcAngle) |
406 { |
406 { |
407 GFX_TRY |
407 GFX_TRY |
408 { |
408 { |
409 GFX_LOG_JNI_CALL(); |
409 SWT_LOG_JNI_CALL(); |
410 HANDLE_TO_POINTER(GraphicsContext*, gc, aHandle); |
410 HANDLE_TO_POINTER(GraphicsContext*, gc, aHandle); |
411 gc->fillArc(aX, aY, aWidth, aHeight, aStartAngle, aArcAngle); |
411 gc->fillArc(aX, aY, aWidth, aHeight, aStartAngle, aArcAngle); |
412 } |
412 } |
413 GFX_CATCH |
413 GFX_CATCH |
414 } |
414 } |
415 |
415 |
416 void JNICALL Java_org_eclipse_swt_internal_qt_graphics_OS_graphicsContext_1fillEllipse |
416 void JNICALL Java_org_eclipse_swt_internal_qt_graphics_OS_graphicsContext_1fillEllipse |
417 (JNIEnv* aJniEnv , jclass, jint aHandle, jint aX, jint aY, jint aWidth, jint aHeight) |
417 (JNIEnv* aJniEnv , jclass, jint aHandle, jint aX, jint aY, jint aWidth, jint aHeight) |
418 { |
418 { |
419 GFX_TRY |
419 GFX_TRY |
420 { |
420 { |
421 GFX_LOG_JNI_CALL(); |
421 SWT_LOG_JNI_CALL(); |
422 HANDLE_TO_POINTER(GraphicsContext*, gc, aHandle); |
422 HANDLE_TO_POINTER(GraphicsContext*, gc, aHandle); |
423 gc->fillEllipse(aX, aY, aWidth, aHeight); |
423 gc->fillEllipse(aX, aY, aWidth, aHeight); |
424 } |
424 } |
425 GFX_CATCH |
425 GFX_CATCH |
426 } |
426 } |
427 |
427 |
428 void JNICALL Java_org_eclipse_swt_internal_qt_graphics_OS_graphicsContext_1fillGradientRect |
428 void JNICALL Java_org_eclipse_swt_internal_qt_graphics_OS_graphicsContext_1fillGradientRect |
429 (JNIEnv* aJniEnv , jclass, jint aHandle, jint aX, jint aY, jint aWidth, jint aHeight, jboolean aVertical, jboolean aSwapColors) |
429 (JNIEnv* aJniEnv , jclass, jint aHandle, jint aX, jint aY, jint aWidth, jint aHeight, jboolean aVertical, jboolean aSwapColors) |
430 { |
430 { |
431 GFX_TRY |
431 GFX_TRY |
432 { |
432 { |
433 GFX_LOG_JNI_CALL(); |
433 SWT_LOG_JNI_CALL(); |
434 HANDLE_TO_POINTER(GraphicsContext*, gc, aHandle); |
434 HANDLE_TO_POINTER(GraphicsContext*, gc, aHandle); |
435 gc->fillGradientRect(aX, aY, aWidth, aHeight, aVertical, aSwapColors); |
435 gc->fillGradientRect(aX, aY, aWidth, aHeight, aVertical, aSwapColors); |
436 } |
436 } |
437 GFX_CATCH |
437 GFX_CATCH |
438 } |
438 } |
439 |
439 |
440 void JNICALL Java_org_eclipse_swt_internal_qt_graphics_OS_graphicsContext_1fillPolygon |
440 void JNICALL Java_org_eclipse_swt_internal_qt_graphics_OS_graphicsContext_1fillPolygon |
441 (JNIEnv* aJniEnv, jclass, jint aHandle, jintArray aPointArray) |
441 (JNIEnv* aJniEnv, jclass, jint aHandle, jintArray aPointArray) |
442 { |
442 { |
443 GFX_TRY |
443 GFX_TRY |
444 { |
444 { |
445 GFX_LOG_JNI_CALL(); |
445 SWT_LOG_JNI_CALL(); |
446 HANDLE_TO_POINTER(GraphicsContext*, gc, aHandle); |
446 HANDLE_TO_POINTER(GraphicsContext*, gc, aHandle); |
447 int length = aJniEnv->GetArrayLength(aPointArray); |
447 int length = aJniEnv->GetArrayLength(aPointArray); |
448 |
448 |
449 int* buffer = new int[length]; // might throw bad_alloc |
449 int* buffer = new int[length]; // might throw bad_alloc |
450 AutoRelease<int> release(buffer, true); |
450 AutoRelease<int> release(buffer, true); |
451 swtApp->jniUtils().GetJavaIntArrayRegionToIntArray(aJniEnv, aPointArray, 0, length, buffer); // might throw bad_alloc |
451 swtApp->jniUtils().GetJavaIntArrayRegionToIntArray(aJniEnv, aPointArray, 0, length, buffer); // might throw bad_alloc |
452 |
452 |
453 gc->fillPolygon(buffer, length); |
453 gc->fillPolygon(buffer, length); |
454 } |
454 } |
455 GFX_CATCH |
455 GFX_CATCH |
456 } |
456 } |
457 |
457 |
458 void JNICALL Java_org_eclipse_swt_internal_qt_graphics_OS_graphicsContext_1fillRect |
458 void JNICALL Java_org_eclipse_swt_internal_qt_graphics_OS_graphicsContext_1fillRect |
459 (JNIEnv* aJniEnv , jclass, jint aHandle, jint aX, jint aY, jint aWidth, jint aHeight) |
459 (JNIEnv* aJniEnv , jclass, jint aHandle, jint aX, jint aY, jint aWidth, jint aHeight) |
460 { |
460 { |
461 GFX_TRY |
461 GFX_TRY |
462 { |
462 { |
463 GFX_LOG_JNI_CALL(); |
463 SWT_LOG_JNI_CALL(); |
464 HANDLE_TO_POINTER(GraphicsContext*, gc, aHandle); |
464 HANDLE_TO_POINTER(GraphicsContext*, gc, aHandle); |
465 gc->fillRect(aX, aY, aWidth, aHeight); |
465 gc->fillRect(aX, aY, aWidth, aHeight); |
466 } |
466 } |
467 GFX_CATCH |
467 GFX_CATCH |
468 } |
468 } |
469 |
469 |
470 void JNICALL Java_org_eclipse_swt_internal_qt_graphics_OS_graphicsContext_1fillRoundRect |
470 void JNICALL Java_org_eclipse_swt_internal_qt_graphics_OS_graphicsContext_1fillRoundRect |
471 (JNIEnv* aJniEnv , jclass, jint aHandle, jint aX, jint aY, jint aWidth, jint aHeight, jint aArcWidth, jint aArcHeight) |
471 (JNIEnv* aJniEnv , jclass, jint aHandle, jint aX, jint aY, jint aWidth, jint aHeight, jint aArcWidth, jint aArcHeight) |
472 { |
472 { |
473 GFX_TRY |
473 GFX_TRY |
474 { |
474 { |
475 GFX_LOG_JNI_CALL(); |
475 SWT_LOG_JNI_CALL(); |
476 HANDLE_TO_POINTER(GraphicsContext*, gc, aHandle); |
476 HANDLE_TO_POINTER(GraphicsContext*, gc, aHandle); |
477 gc->fillRoundRect(aX, aY, aWidth, aHeight, aArcWidth, aArcHeight); |
477 gc->fillRoundRect(aX, aY, aWidth, aHeight, aArcWidth, aArcHeight); |
478 } |
478 } |
479 GFX_CATCH |
479 GFX_CATCH |
480 } |
480 } |
511 (JNIEnv* aJniEnv , jclass, jint aHandle, jchar aCh, jboolean aIsAdvanced) |
511 (JNIEnv* aJniEnv , jclass, jint aHandle, jchar aCh, jboolean aIsAdvanced) |
512 { |
512 { |
513 jint charWidth = 0; |
513 jint charWidth = 0; |
514 GFX_TRY |
514 GFX_TRY |
515 { |
515 { |
516 GFX_LOG_JNI_CALL(); |
516 SWT_LOG_JNI_CALL(); |
517 HANDLE_TO_POINTER(GraphicsContext*, gc, aHandle); |
517 HANDLE_TO_POINTER(GraphicsContext*, gc, aHandle); |
518 charWidth = static_cast<jint>( gc->getCharacterWidth(aCh, aIsAdvanced) ); |
518 charWidth = static_cast<jint>( gc->getCharacterWidth(aCh, aIsAdvanced) ); |
519 } |
519 } |
520 GFX_CATCH |
520 GFX_CATCH |
521 return charWidth; |
521 return charWidth; |
522 } |
522 } |
523 |
523 |
524 void JNICALL Java_org_eclipse_swt_internal_qt_graphics_OS_graphicsContext_1getFontMetricsData |
524 void JNICALL Java_org_eclipse_swt_internal_qt_graphics_OS_graphicsContext_1getFontMetricsData |
525 (JNIEnv* aJniEnv, jclass, jint aHandle, jintArray aDataArray, jint aFontHandle) |
525 (JNIEnv* aJniEnv, jclass, jint aHandle, jintArray aDataArray, jint aFontHandle) |
526 { |
526 { |
527 GFX_TRY |
527 GFX_TRY |
528 { |
528 { |
529 GFX_LOG_JNI_CALL(); |
529 SWT_LOG_JNI_CALL(); |
530 HANDLE_TO_POINTER(GraphicsContext*, gc, aHandle); |
530 HANDLE_TO_POINTER(GraphicsContext*, gc, aHandle); |
531 |
531 |
532 int length = aJniEnv->GetArrayLength(aDataArray); |
532 int length = aJniEnv->GetArrayLength(aDataArray); |
533 |
533 |
534 int* buffer = new int[length]; // might throw bad_alloc |
534 int* buffer = new int[length]; // might throw bad_alloc |
568 void JNICALL Java_org_eclipse_swt_internal_qt_graphics_OS_graphicsContext_1getClip |
568 void JNICALL Java_org_eclipse_swt_internal_qt_graphics_OS_graphicsContext_1getClip |
569 (JNIEnv* aJniEnv, jclass, jint aHandle, jintArray aClipArray) |
569 (JNIEnv* aJniEnv, jclass, jint aHandle, jintArray aClipArray) |
570 { |
570 { |
571 GFX_TRY |
571 GFX_TRY |
572 { |
572 { |
573 GFX_LOG_JNI_CALL(); |
573 SWT_LOG_JNI_CALL(); |
574 HANDLE_TO_POINTER(GraphicsContext*, gc, aHandle); |
574 HANDLE_TO_POINTER(GraphicsContext*, gc, aHandle); |
575 int length = aJniEnv->GetArrayLength(aClipArray); |
575 int length = aJniEnv->GetArrayLength(aClipArray); |
576 |
576 |
577 int* buffer = new int[length]; // might throw bad_alloc |
577 int* buffer = new int[length]; // might throw bad_alloc |
578 AutoRelease<int> release(buffer, true); |
578 AutoRelease<int> release(buffer, true); |
579 ::memset(buffer, 0, sizeof(int)*length); |
579 ::memset(buffer, 0, sizeof(int)*length); |
580 |
580 |
581 gc->getClip(buffer); |
581 gc->getClip(buffer); |
582 |
582 |
583 swtApp->jniUtils().SetJavaIntArrayRegionFromIntArray(aJniEnv, aClipArray, 0, length, buffer); |
583 swtApp->jniUtils().SetJavaIntArrayRegionFromIntArray(aJniEnv, aClipArray, 0, length, buffer); |
584 } |
584 } |
585 GFX_CATCH |
585 GFX_CATCH |
586 } |
586 } |
587 |
587 |
589 (JNIEnv* aJniEnv , jclass, jint aHandle) |
589 (JNIEnv* aJniEnv , jclass, jint aHandle) |
590 { |
590 { |
591 jint fgAlpha = 0; |
591 jint fgAlpha = 0; |
592 GFX_TRY |
592 GFX_TRY |
593 { |
593 { |
594 GFX_LOG_JNI_CALL(); |
594 SWT_LOG_JNI_CALL(); |
595 HANDLE_TO_POINTER(GraphicsContext*, gc, aHandle); |
595 HANDLE_TO_POINTER(GraphicsContext*, gc, aHandle); |
596 fgAlpha = static_cast<jint>( gc->getForegroundAlpha() ); |
596 fgAlpha = static_cast<jint>( gc->getForegroundAlpha() ); |
597 } |
597 } |
598 GFX_CATCH |
598 GFX_CATCH |
599 return fgAlpha; |
599 return fgAlpha; |
600 } |
600 } |
601 |
601 |
602 jint JNICALL Java_org_eclipse_swt_internal_qt_graphics_OS_graphicsContext_1getForegroundColor |
602 jint JNICALL Java_org_eclipse_swt_internal_qt_graphics_OS_graphicsContext_1getForegroundColor |
603 (JNIEnv* aJniEnv , jclass, jint aHandle) |
603 (JNIEnv* aJniEnv , jclass, jint aHandle) |
604 { |
604 { |
605 jint fgColor = 0; |
605 jint fgColor = 0; |
606 GFX_TRY |
606 GFX_TRY |
607 { |
607 { |
608 GFX_LOG_JNI_CALL(); |
608 SWT_LOG_JNI_CALL(); |
609 HANDLE_TO_POINTER(GraphicsContext*, gc, aHandle); |
609 HANDLE_TO_POINTER(GraphicsContext*, gc, aHandle); |
610 fgColor = static_cast<jint>( gc->getForegroundColor() ); |
610 fgColor = static_cast<jint>( gc->getForegroundColor() ); |
611 } |
611 } |
612 GFX_CATCH |
612 GFX_CATCH |
613 return fgColor; |
613 return fgColor; |
614 } |
614 } |
615 |
615 |
616 void JNICALL Java_org_eclipse_swt_internal_qt_graphics_OS_graphicsContext_1getTextBoundingBox |
616 void JNICALL Java_org_eclipse_swt_internal_qt_graphics_OS_graphicsContext_1getTextBoundingBox |
617 (JNIEnv* aJniEnv, jclass, jint aHandle, jintArray aBoundingBox, jstring aText, |
617 (JNIEnv* aJniEnv, jclass, jint aHandle, jintArray aBoundingBox, jstring aText, |
618 jint aAlignments, jint aFlags, jint aRectX, jint aRectY, jint aRectWidth, jint aRectHeight) |
618 jint aAlignments, jint aFlags, jint aRectX, jint aRectY, jint aRectWidth, jint aRectHeight) |
619 { |
619 { |
620 GFX_TRY |
620 GFX_TRY |
621 { |
621 { |
622 GFX_LOG_JNI_CALL(); |
622 SWT_LOG_JNI_CALL(); |
623 HANDLE_TO_POINTER(GraphicsContext*, gc, aHandle); |
623 HANDLE_TO_POINTER(GraphicsContext*, gc, aHandle); |
624 |
624 |
625 int length = aJniEnv->GetArrayLength(aBoundingBox); |
625 int length = aJniEnv->GetArrayLength(aBoundingBox); |
626 |
626 |
627 int* buffer = new int[length]; // might throw bad_alloc |
627 int* buffer = new int[length]; // might throw bad_alloc |
628 AutoRelease<int> releaseBuffer(buffer, true); |
628 AutoRelease<int> releaseBuffer(buffer, true); |
629 ::memset(buffer, 0, sizeof(int)*length); |
629 ::memset(buffer, 0, sizeof(int)*length); |
630 |
630 |
631 const jchar* textPtr = aJniEnv->GetStringChars(aText, NULL); |
631 const jchar* textPtr = aJniEnv->GetStringChars(aText, NULL); |
632 AutoReleaseStringChars releaseStringChars(aJniEnv, aText, textPtr); |
632 AutoReleaseStringChars releaseStringChars(aJniEnv, aText, textPtr); |
633 |
633 |
634 jint textLength = aJniEnv->GetStringLength(aText); |
634 jint textLength = aJniEnv->GetStringLength(aText); |
635 |
635 |
636 gc->getTextBoundingBox( |
636 gc->getTextBoundingBox( |
637 buffer, |
637 buffer, |
638 static_cast<const unsigned short*>(textPtr), |
638 static_cast<const unsigned short*>(textPtr), |
639 textLength, |
639 textLength, |
640 aAlignments, |
640 aAlignments, |
641 aFlags, |
641 aFlags, |
642 aRectX, aRectY, aRectWidth, aRectHeight); |
642 aRectX, aRectY, aRectWidth, aRectHeight); |
643 |
643 |
718 void JNICALL Java_org_eclipse_swt_internal_qt_graphics_OS_graphicsContext_1setBackgroundColor |
718 void JNICALL Java_org_eclipse_swt_internal_qt_graphics_OS_graphicsContext_1setBackgroundColor |
719 (JNIEnv* aJniEnv , jclass, jint aHandle, jint aArgb, jboolean aUpdateAlpha) |
719 (JNIEnv* aJniEnv , jclass, jint aHandle, jint aArgb, jboolean aUpdateAlpha) |
720 { |
720 { |
721 GFX_TRY |
721 GFX_TRY |
722 { |
722 { |
723 GFX_LOG_JNI_CALL(); |
723 SWT_LOG_JNI_CALL(); |
724 HANDLE_TO_POINTER(GraphicsContext*, gc, aHandle); |
724 HANDLE_TO_POINTER(GraphicsContext*, gc, aHandle); |
725 gc->setBackgroundColor(aArgb, aUpdateAlpha); |
725 gc->setBackgroundColor(aArgb, aUpdateAlpha); |
726 } |
726 } |
727 GFX_CATCH |
727 GFX_CATCH |
728 } |
728 } |
729 |
729 |
730 void JNICALL Java_org_eclipse_swt_internal_qt_graphics_OS_graphicsContext_1setBlendingMode |
730 void JNICALL Java_org_eclipse_swt_internal_qt_graphics_OS_graphicsContext_1setBlendingMode |
731 (JNIEnv* aJniEnv , jclass, jint aHandle, jint aMode) |
731 (JNIEnv* aJniEnv , jclass, jint aHandle, jint aMode) |
732 { |
732 { |
733 GFX_TRY |
733 GFX_TRY |
734 { |
734 { |
735 GFX_LOG_JNI_CALL(); |
735 SWT_LOG_JNI_CALL(); |
736 HANDLE_TO_POINTER(GraphicsContext*, gc, aHandle); |
736 HANDLE_TO_POINTER(GraphicsContext*, gc, aHandle); |
737 gc->setBlendingMode((TBlendingMode)aMode); |
737 gc->setBlendingMode((TBlendingMode)aMode); |
738 } |
738 } |
739 GFX_CATCH |
739 GFX_CATCH |
740 } |
740 } |
906 (JNIEnv* aJniEnv , jclass, jint aWidth , jint aHeight, jint aFillColor) |
906 (JNIEnv* aJniEnv , jclass, jint aWidth , jint aHeight, jint aFillColor) |
907 { |
907 { |
908 Image* img = NULL; |
908 Image* img = NULL; |
909 GFX_TRY |
909 GFX_TRY |
910 { |
910 { |
911 GFX_LOG_JNI_CALL(); |
911 SWT_LOG_JNI_CALL(); |
912 img = GraphicsFactory::createImage(aWidth, aHeight, aFillColor); |
912 img = GraphicsFactory::createImage(aWidth, aHeight, aFillColor); |
913 } |
913 } |
914 GFX_CATCH |
914 GFX_CATCH |
915 return POINTER_TO_HANDLE(img); |
915 return POINTER_TO_HANDLE(img); |
916 } |
916 } |
917 |
917 |
918 jint JNICALL Java_org_eclipse_swt_internal_qt_graphics_OS_image_1create__IIIII |
918 jint JNICALL Java_org_eclipse_swt_internal_qt_graphics_OS_image_1create__IIIII |
919 (JNIEnv* aJniEnv , jclass, jint aImageHandle, jint aX, jint aY, jint aWidth, jint aHeight) |
919 (JNIEnv* aJniEnv , jclass, jint aImageHandle, jint aX, jint aY, jint aWidth, jint aHeight) |
920 { |
920 { |
921 Image* newImage = NULL; |
921 Image* newImage = NULL; |
922 GFX_TRY |
922 GFX_TRY |
923 { |
923 { |
924 GFX_LOG_JNI_CALL(); |
924 SWT_LOG_JNI_CALL(); |
925 HANDLE_TO_POINTER(Image*, image, aImageHandle); |
925 HANDLE_TO_POINTER(Image*, image, aImageHandle); |
926 newImage = GraphicsFactory::createImage(image, aX, aY, aWidth, aHeight); |
926 newImage = GraphicsFactory::createImage(image, aX, aY, aWidth, aHeight); |
927 } |
927 } |
928 GFX_CATCH |
928 GFX_CATCH |
929 return POINTER_TO_HANDLE(newImage); |
929 return POINTER_TO_HANDLE(newImage); |
933 (JNIEnv* aJniEnv, jclass, jintArray aRgbData, jint aWidth, jint aHeight, jboolean aHasAlpha) |
933 (JNIEnv* aJniEnv, jclass, jintArray aRgbData, jint aWidth, jint aHeight, jboolean aHasAlpha) |
934 { |
934 { |
935 Image* img = NULL; |
935 Image* img = NULL; |
936 GFX_TRY |
936 GFX_TRY |
937 { |
937 { |
938 GFX_LOG_JNI_CALL(); |
938 SWT_LOG_JNI_CALL(); |
939 |
939 |
940 int length = aJniEnv->GetArrayLength(aRgbData); |
940 int length = aJniEnv->GetArrayLength(aRgbData); |
941 |
941 |
942 int* buffer = new int[length]; // might throw bad_alloc |
942 int* buffer = new int[length]; // might throw bad_alloc |
943 AutoRelease<int> release(buffer, true); |
943 AutoRelease<int> release(buffer, true); |
944 swtApp->jniUtils().GetJavaIntArrayRegionToIntArray(aJniEnv, aRgbData, 0, length, buffer); // might throw bad_alloc |
944 swtApp->jniUtils().GetJavaIntArrayRegionToIntArray(aJniEnv, aRgbData, 0, length, buffer); // might throw bad_alloc |
945 |
945 |
946 img = GraphicsFactory::createImage(buffer, aWidth, aHeight, aHasAlpha); |
946 img = GraphicsFactory::createImage(buffer, aWidth, aHeight, aHasAlpha); |
947 } |
947 } |
948 GFX_CATCH |
948 GFX_CATCH |
949 return POINTER_TO_HANDLE(img); |
949 return POINTER_TO_HANDLE(img); |
950 } |
950 } |
951 |
951 |
952 jint JNICALL Java_org_eclipse_swt_internal_qt_graphics_OS_image_1create__Lorg_eclipse_swt_graphics_ImageData_2 |
952 jint JNICALL Java_org_eclipse_swt_internal_qt_graphics_OS_image_1create__Lorg_eclipse_swt_graphics_ImageData_2 |
953 (JNIEnv* aJniEnv , jclass, jobject aImageData) |
953 (JNIEnv* aJniEnv , jclass, jobject aImageData) |
954 { |
954 { |
955 Image* img = NULL; |
955 Image* img = NULL; |
956 GFX_TRY |
956 GFX_TRY |
957 { |
957 { |
958 GFX_LOG_JNI_CALL(); |
958 SWT_LOG_JNI_CALL(); |
959 img = swtApp->jniUtils().CreateImage(aJniEnv, aImageData); |
959 img = swtApp->jniUtils().CreateImage(aJniEnv, aImageData); |
960 } |
960 } |
961 GFX_CATCH |
961 GFX_CATCH |
962 return POINTER_TO_HANDLE(img); |
962 return POINTER_TO_HANDLE(img); |
963 } |
963 } |
1007 void JNICALL Java_org_eclipse_swt_internal_qt_graphics_OS_image_1getRGB__I_3IIIIIII |
1007 void JNICALL Java_org_eclipse_swt_internal_qt_graphics_OS_image_1getRGB__I_3IIIIIII |
1008 (JNIEnv* aJniEnv, jclass, jint aImageHandle, jintArray aRgbData, jint aOffset, jint aScanlength, jint aX, jint aY, jint aWidth, jint aHeight) |
1008 (JNIEnv* aJniEnv, jclass, jint aImageHandle, jintArray aRgbData, jint aOffset, jint aScanlength, jint aX, jint aY, jint aWidth, jint aHeight) |
1009 { |
1009 { |
1010 GFX_TRY |
1010 GFX_TRY |
1011 { |
1011 { |
1012 GFX_LOG_JNI_CALL(); |
1012 SWT_LOG_JNI_CALL(); |
1013 HANDLE_TO_POINTER(Image*, image, aImageHandle); |
1013 HANDLE_TO_POINTER(Image*, image, aImageHandle); |
1014 |
1014 |
1015 int length = aJniEnv->GetArrayLength(aRgbData); |
1015 int length = aJniEnv->GetArrayLength(aRgbData); |
1016 |
1016 |
1017 int* buffer = new int[length]; // might throw bad_alloc |
1017 int* buffer = new int[length]; // might throw bad_alloc |
1018 AutoRelease<int> release(buffer, true); |
1018 AutoRelease<int> release(buffer, true); |
1019 ::memset(buffer, 0, sizeof(int)*length); |
1019 ::memset(buffer, 0, sizeof(int)*length); |
1020 |
1020 |
1021 // get the data (populated to data array) |
1021 // get the data (populated to data array) |
1022 image->getRgb(buffer, aOffset, aScanlength, aX, aY, aWidth, aHeight); |
1022 image->getRgb(buffer, aOffset, aScanlength, aX, aY, aWidth, aHeight); |
1023 |
1023 |
1024 // Copy data back to java |
1024 // Copy data back to java |
1025 swtApp->jniUtils().SetJavaIntArrayRegionFromIntArray(aJniEnv, aRgbData, 0, length, buffer); |
1025 swtApp->jniUtils().SetJavaIntArrayRegionFromIntArray(aJniEnv, aRgbData, 0, length, buffer); |
1026 } |
1026 } |
1027 GFX_CATCH |
1027 GFX_CATCH |
1028 } |
1028 } |
1030 void JNICALL Java_org_eclipse_swt_internal_qt_graphics_OS_image_1getRGB__I_3B_3BIIIIIII |
1030 void JNICALL Java_org_eclipse_swt_internal_qt_graphics_OS_image_1getRGB__I_3B_3BIIIIIII |
1031 (JNIEnv * aJniEnv, jclass, jint aImageHandle, jbyteArray aRgbData, jbyteArray aTransparencyMask, jint aOffset, jint aScanlength, jint aX, jint aY, jint aWidth, jint aHeight, jint aFormat) |
1031 (JNIEnv * aJniEnv, jclass, jint aImageHandle, jbyteArray aRgbData, jbyteArray aTransparencyMask, jint aOffset, jint aScanlength, jint aX, jint aY, jint aWidth, jint aHeight, jint aFormat) |
1032 { |
1032 { |
1033 GFX_TRY |
1033 GFX_TRY |
1034 { |
1034 { |
1035 GFX_LOG_JNI_CALL(); |
1035 SWT_LOG_JNI_CALL(); |
1036 HANDLE_TO_POINTER(Image*, image, aImageHandle); |
1036 HANDLE_TO_POINTER(Image*, image, aImageHandle); |
1037 |
1037 |
1038 int dataLength = aJniEnv->GetArrayLength(aRgbData); |
1038 int dataLength = aJniEnv->GetArrayLength(aRgbData); |
1039 int maskLength = aJniEnv->GetArrayLength(aTransparencyMask); |
1039 int maskLength = aJniEnv->GetArrayLength(aTransparencyMask); |
1040 |
1040 |
1041 char* dataBuffer = new char[dataLength]; // might throw bad_alloc |
1041 char* dataBuffer = new char[dataLength]; // might throw bad_alloc |
1042 AutoRelease<char> releaseData(dataBuffer, true); |
1042 AutoRelease<char> releaseData(dataBuffer, true); |
1043 char* maskBuffer = new char[maskLength]; // might throw bad_alloc |
1043 char* maskBuffer = new char[maskLength]; // might throw bad_alloc |
1044 AutoRelease<char> releaseMask(maskBuffer, true); |
1044 AutoRelease<char> releaseMask(maskBuffer, true); |
1045 ::memset(dataBuffer, 0, sizeof(char)*dataLength); |
1045 ::memset(dataBuffer, 0, sizeof(char)*dataLength); |
1046 ::memset(maskBuffer, 0, sizeof(char)*maskLength); |
1046 ::memset(maskBuffer, 0, sizeof(char)*maskLength); |
1047 |
1047 |
1048 // get the data (populated to data array) |
1048 // get the data (populated to data array) |
1049 image->getRgb(dataBuffer, maskBuffer, aOffset, aScanlength, aX, aY, aWidth, aHeight, aFormat); |
1049 image->getRgb(dataBuffer, maskBuffer, aOffset, aScanlength, aX, aY, aWidth, aHeight, aFormat); |
1050 |
1050 |
1051 // Copy data back to Java |
1051 // Copy data back to Java |
1052 swtApp->jniUtils().SetJavaByteArrayRegionFromCharArray(aJniEnv, aRgbData, 0, dataLength, dataBuffer); |
1052 swtApp->jniUtils().SetJavaByteArrayRegionFromCharArray(aJniEnv, aRgbData, 0, dataLength, dataBuffer); |
1053 swtApp->jniUtils().SetJavaByteArrayRegionFromCharArray(aJniEnv, aTransparencyMask, 0, maskLength, maskBuffer); |
1053 swtApp->jniUtils().SetJavaByteArrayRegionFromCharArray(aJniEnv, aTransparencyMask, 0, maskLength, maskBuffer); |
1054 } |
1054 } |
1055 GFX_CATCH |
1055 GFX_CATCH |
1057 |
1057 |
1058 void JNICALL Java_org_eclipse_swt_internal_qt_graphics_OS_image_1getRGB__I_3SIIIIIII |
1058 void JNICALL Java_org_eclipse_swt_internal_qt_graphics_OS_image_1getRGB__I_3SIIIIIII |
1059 (JNIEnv * aJniEnv, jclass, jint aImageHandle, jshortArray aRgbData, jint aOffset, jint aScanlength, jint aX, jint aY, jint aWidth, jint aHeight, jint aFormat) { |
1059 (JNIEnv * aJniEnv, jclass, jint aImageHandle, jshortArray aRgbData, jint aOffset, jint aScanlength, jint aX, jint aY, jint aWidth, jint aHeight, jint aFormat) { |
1060 GFX_TRY |
1060 GFX_TRY |
1061 { |
1061 { |
1062 GFX_LOG_JNI_CALL(); |
1062 SWT_LOG_JNI_CALL(); |
1063 HANDLE_TO_POINTER(Image*, image, aImageHandle); |
1063 HANDLE_TO_POINTER(Image*, image, aImageHandle); |
1064 |
1064 |
1065 int length = aJniEnv->GetArrayLength(aRgbData); |
1065 int length = aJniEnv->GetArrayLength(aRgbData); |
1066 short* buffer = new short[length]; |
1066 short* buffer = new short[length]; |
1067 AutoRelease<short> release(buffer, true); |
1067 AutoRelease<short> release(buffer, true); |
1068 ::memset(buffer, 0, sizeof(short)*length); |
1068 ::memset(buffer, 0, sizeof(short)*length); |
1069 |
1069 |
1070 // get the data (populated to data array) |
1070 // get the data (populated to data array) |
1071 image->getRgb(buffer, aOffset, aScanlength, aX, aY, aWidth, aHeight, aFormat); |
1071 image->getRgb(buffer, aOffset, aScanlength, aX, aY, aWidth, aHeight, aFormat); |
1072 |
1072 |
1073 // Copy data back to java |
1073 // Copy data back to java |
1074 swtApp->jniUtils().SetJavaShortArrayRegionFromShortArray(aJniEnv, aRgbData, 0, length, buffer); |
1074 swtApp->jniUtils().SetJavaShortArrayRegionFromShortArray(aJniEnv, aRgbData, 0, length, buffer); |
1075 } |
1075 } |
1076 GFX_CATCH |
1076 GFX_CATCH |
1077 } |
1077 } |
1078 |
1078 |
1079 jobject JNICALL Java_org_eclipse_swt_internal_qt_graphics_OS_image_1getImageData |
1079 jobject JNICALL Java_org_eclipse_swt_internal_qt_graphics_OS_image_1getImageData |
1080 (JNIEnv* aJniEnv , jclass, jint aImageHandle) |
1080 (JNIEnv* aJniEnv , jclass, jint aImageHandle) |
1081 { |
1081 { |
1082 GFX_LOG_JNI_CALL(); |
1082 SWT_LOG_JNI_CALL(); |
1083 jobject imageData = 0; |
1083 jobject imageData = 0; |
1084 GFX_TRY |
1084 GFX_TRY |
1085 { |
1085 { |
1086 ImageDataWrapper* data = NULL; |
1086 ImageDataWrapper* data = NULL; |
1087 HANDLE_TO_POINTER(Image*, image, aImageHandle); |
1087 HANDLE_TO_POINTER(Image*, image, aImageHandle); |
1088 data = GraphicsFactory::createImageData(image); |
1088 data = GraphicsFactory::createImageData(image); |
1089 AutoRelease<ImageDataWrapper> release(data, false); |
1089 AutoRelease<ImageDataWrapper> release(data, false); |
1090 imageData = swtApp->jniUtils().CreateJavaImageData(aJniEnv, *data); |
1090 imageData = swtApp->jniUtils().CreateJavaImageData(aJniEnv, *data); |
1091 } |
1091 } |
1092 GFX_CATCH |
1092 GFX_CATCH |
1093 return imageData; |
1093 return imageData; |
1094 } |
1094 } |
1134 |
1134 |
1135 jboolean JNICALL Java_org_eclipse_swt_internal_qt_graphics_OS_image_1detectCollision |
1135 jboolean JNICALL Java_org_eclipse_swt_internal_qt_graphics_OS_image_1detectCollision |
1136 (JNIEnv* aJniEnv, jclass, jint aImage1PixmapHandle, jint aTransform1, jint aP1x, jint aP1y, jint aR1x1, jint aR1y1, jint aR1x2, jint aR1y2, |
1136 (JNIEnv* aJniEnv, jclass, jint aImage1PixmapHandle, jint aTransform1, jint aP1x, jint aP1y, jint aR1x1, jint aR1y1, jint aR1x2, jint aR1y2, |
1137 jint aImage2PixmapHandle, jint aTransform2, jint aP2x, jint aP2y, jint aR2x1, jint aR2y1, jint aR2x2, jint aR2y2) |
1137 jint aImage2PixmapHandle, jint aTransform2, jint aP2x, jint aP2y, jint aR2x1, jint aR2y1, jint aR2x2, jint aR2y2) |
1138 { |
1138 { |
1139 jboolean collides = JNI_FALSE; |
1139 jboolean collides = JNI_FALSE; |
1140 GFX_TRY |
1140 GFX_TRY |
1141 { |
1141 { |
1142 GFX_LOG_JNI_CALL(); |
1142 SWT_LOG_JNI_CALL(); |
1143 collides = gfxUtils::detectCollision(aImage1PixmapHandle, aTransform1, aP1x, aP1y, aR1x1, aR1y1, aR1x2, aR1y2, |
1143 collides = gfxUtils::detectCollision(aImage1PixmapHandle, aTransform1, aP1x, aP1y, aR1x1, aR1y1, aR1x2, aR1y2, |
1144 aImage2PixmapHandle, aTransform2, aP2x, aP2y, aR2x1, aR2y1, aR2x2, aR2y2); |
1144 aImage2PixmapHandle, aTransform2, aP2x, aP2y, aR2x1, aR2y1, aR2x2, aR2y2); |
1145 } |
1145 } |
1146 GFX_CATCH |
1146 GFX_CATCH |
1147 return collides; |
1147 return collides; |
1148 } |
1148 } |
1149 |
1149 |
1154 void JNICALL Java_org_eclipse_swt_internal_qt_graphics_OS_imageLoader_1append |
1154 void JNICALL Java_org_eclipse_swt_internal_qt_graphics_OS_imageLoader_1append |
1155 (JNIEnv* aJniEnv, jclass, jint aHandle, jint aLenght, jint aOffset, jbyteArray aImageData) |
1155 (JNIEnv* aJniEnv, jclass, jint aHandle, jint aLenght, jint aOffset, jbyteArray aImageData) |
1156 { |
1156 { |
1157 GFX_TRY |
1157 GFX_TRY |
1158 { |
1158 { |
1159 GFX_LOG_JNI_CALL(); |
1159 SWT_LOG_JNI_CALL(); |
1160 jbyte* data = NULL; |
1160 jbyte* data = NULL; |
1161 data = aJniEnv->GetByteArrayElements(aImageData, NULL); |
1161 data = aJniEnv->GetByteArrayElements(aImageData, NULL); |
1162 HANDLE_TO_POINTER(ImageLoader*, loader, aHandle); |
1162 HANDLE_TO_POINTER(ImageLoader*, loader, aHandle); |
1163 loader->append(reinterpret_cast<const char*>(data), aLenght, aOffset); |
1163 loader->append(reinterpret_cast<const char*>(data), aLenght, aOffset); |
1164 // release arrays, don't copy back |
1164 // release arrays, don't copy back |
1165 aJniEnv->ReleaseByteArrayElements(aImageData, data, JNI_ABORT); |
1165 aJniEnv->ReleaseByteArrayElements(aImageData, data, JNI_ABORT); |
1166 } |
1166 } |
1167 GFX_CATCH |
1167 GFX_CATCH |
1168 } |
1168 } |
1169 |
1169 |
1170 void JNICALL Java_org_eclipse_swt_internal_qt_graphics_OS_imageLoader_1beginStream |
1170 void JNICALL Java_org_eclipse_swt_internal_qt_graphics_OS_imageLoader_1beginStream |
1171 (JNIEnv* aJniEnv , jclass, jint aHandle, jint aBufferSize) |
1171 (JNIEnv* aJniEnv , jclass, jint aHandle, jint aBufferSize) |
1172 { |
1172 { |
1173 GFX_TRY |
1173 GFX_TRY |
1174 { |
1174 { |
1175 GFX_LOG_JNI_CALL(); |
1175 SWT_LOG_JNI_CALL(); |
1176 HANDLE_TO_POINTER(ImageLoader*, loader, aHandle); |
1176 HANDLE_TO_POINTER(ImageLoader*, loader, aHandle); |
1177 loader->beginStream(aBufferSize); |
1177 loader->beginStream(aBufferSize); |
1178 } |
1178 } |
1179 GFX_CATCH |
1179 GFX_CATCH |
1180 } |
1180 } |
1181 |
1181 |
1182 jint JNICALL Java_org_eclipse_swt_internal_qt_graphics_OS_imageLoader_1endStream |
1182 jint JNICALL Java_org_eclipse_swt_internal_qt_graphics_OS_imageLoader_1endStream |
1183 (JNIEnv* aJniEnv , jclass, jint aHandle) |
1183 (JNIEnv* aJniEnv , jclass, jint aHandle) |
1184 { |
1184 { |
1185 Image* image = NULL; |
1185 Image* image = NULL; |
1186 GFX_TRY |
1186 GFX_TRY |
1187 { |
1187 { |
1188 GFX_LOG_JNI_CALL(); |
1188 SWT_LOG_JNI_CALL(); |
1189 HANDLE_TO_POINTER(ImageLoader*, loader, aHandle); |
1189 HANDLE_TO_POINTER(ImageLoader*, loader, aHandle); |
1190 image = loader->endStream(); |
1190 image = loader->endStream(); |
1191 } |
1191 } |
1192 GFX_CATCH |
1192 GFX_CATCH |
1193 return POINTER_TO_HANDLE(image); |
1193 return POINTER_TO_HANDLE(image); |
1194 } |
1194 } |
1195 |
1195 |
1196 jint JNICALL Java_org_eclipse_swt_internal_qt_graphics_OS_imageLoader_1init |
1196 jint JNICALL Java_org_eclipse_swt_internal_qt_graphics_OS_imageLoader_1init |
1197 (JNIEnv* aJniEnv , jclass) |
1197 (JNIEnv* aJniEnv , jclass) |
1198 { |
1198 { |
1199 ImageLoader* loader = NULL; |
1199 ImageLoader* loader = NULL; |
1200 GFX_TRY |
1200 GFX_TRY |
1201 { |
1201 { |
1202 GFX_LOG_JNI_CALL(); |
1202 SWT_LOG_JNI_CALL(); |
1203 loader = GraphicsFactory::createImageLoader(); |
1203 loader = GraphicsFactory::createImageLoader(); |
1204 } |
1204 } |
1205 GFX_CATCH |
1205 GFX_CATCH |
1206 return POINTER_TO_HANDLE(loader); |
1206 return POINTER_TO_HANDLE(loader); |
1207 } |
1207 } |
1208 |
1208 |
1209 void JNICALL Java_org_eclipse_swt_internal_qt_graphics_OS_imageLoader_1dispose |
1209 void JNICALL Java_org_eclipse_swt_internal_qt_graphics_OS_imageLoader_1dispose |
1210 (JNIEnv* aJniEnv , jclass, jint aHandle) |
1210 (JNIEnv* aJniEnv , jclass, jint aHandle) |
1211 { |
1211 { |
1212 GFX_TRY |
1212 GFX_TRY |
1213 { |
1213 { |
1214 GFX_LOG_JNI_CALL(); |
1214 SWT_LOG_JNI_CALL(); |
1215 HANDLE_TO_POINTER(ImageLoader*, loader, aHandle); |
1215 HANDLE_TO_POINTER(ImageLoader*, loader, aHandle); |
1216 loader->dispose(); |
1216 loader->dispose(); |
1217 } |
1217 } |
1218 GFX_CATCH |
1218 GFX_CATCH |
1219 } |
1219 } |
1220 |
1220 |
1221 jint JNICALL Java_org_eclipse_swt_internal_qt_graphics_OS_imageLoader_1load |
1221 jint JNICALL Java_org_eclipse_swt_internal_qt_graphics_OS_imageLoader_1load |
1222 (JNIEnv* aJniEnv , jclass, jint aHandle, jstring aFileName) |
1222 (JNIEnv* aJniEnv , jclass, jint aHandle, jstring aFileName) |
1223 { |
1223 { |
1224 Image* image = NULL; |
1224 Image* image = NULL; |
1225 GFX_TRY |
1225 GFX_TRY |
1226 { |
1226 { |
1227 GFX_LOG_JNI_CALL(); |
1227 SWT_LOG_JNI_CALL(); |
1228 HANDLE_TO_POINTER(ImageLoader*, loader, aHandle); |
1228 HANDLE_TO_POINTER(ImageLoader*, loader, aHandle); |
1229 image = loader->load(swtApp->jniUtils().JavaStringToQString(aJniEnv, aFileName)); |
1229 image = loader->load(swtApp->jniUtils().JavaStringToQString(aJniEnv, aFileName)); |
1230 } |
1230 } |
1231 GFX_CATCH |
1231 GFX_CATCH |
1232 return POINTER_TO_HANDLE(image); |
1232 return POINTER_TO_HANDLE(image); |
1233 } |
1233 } |
1234 |
1234 |
1235 void JNICALL Java_org_eclipse_swt_internal_qt_graphics_OS_imageLoader_1setLoadSize |
1235 void JNICALL Java_org_eclipse_swt_internal_qt_graphics_OS_imageLoader_1setLoadSize |
1236 (JNIEnv* aJniEnv , jclass, jint aHandle, jint aWidth, jint aHeight) |
1236 (JNIEnv* aJniEnv , jclass, jint aHandle, jint aWidth, jint aHeight) |
1237 { |
1237 { |
1238 GFX_TRY |
1238 GFX_TRY |
1239 { |
1239 { |
1240 GFX_LOG_JNI_CALL(); |
1240 SWT_LOG_JNI_CALL(); |
1241 HANDLE_TO_POINTER(ImageLoader*, loader, aHandle); |
1241 HANDLE_TO_POINTER(ImageLoader*, loader, aHandle); |
1242 loader->setLoadSize(aWidth, aHeight); |
1242 loader->setLoadSize(aWidth, aHeight); |
1243 } |
1243 } |
1244 GFX_CATCH |
1244 GFX_CATCH |
1245 } |
1245 } |
1264 } |
1264 } |
1265 |
1265 |
1266 void JNICALL Java_org_eclipse_swt_internal_qt_graphics_OS_fontUtils_1getBoundingRect__I_3ILjava_lang_String_2 |
1266 void JNICALL Java_org_eclipse_swt_internal_qt_graphics_OS_fontUtils_1getBoundingRect__I_3ILjava_lang_String_2 |
1267 (JNIEnv* aJniEnv, jclass, jint aFontHandle, jintArray aRectArray, jstring aStr) |
1267 (JNIEnv* aJniEnv, jclass, jint aFontHandle, jintArray aRectArray, jstring aStr) |
1268 { |
1268 { |
1269 GFX_TRY |
1269 GFX_TRY |
1270 { |
1270 { |
1271 GFX_LOG_JNI_CALL(); |
1271 SWT_LOG_JNI_CALL(); |
1272 QString string = swtApp->jniUtils().JavaStringToQString(aJniEnv, aStr); |
1272 QString string = swtApp->jniUtils().JavaStringToQString(aJniEnv, aStr); |
1273 |
1273 |
1274 int length = aJniEnv->GetArrayLength(aRectArray); |
1274 int length = aJniEnv->GetArrayLength(aRectArray); |
1275 |
1275 |
1276 int* buffer = new int[length]; // might throw bad_alloc |
1276 int* buffer = new int[length]; // might throw bad_alloc |
1277 AutoRelease<int> release(buffer, true); |
1277 AutoRelease<int> release(buffer, true); |
1278 ::memset(buffer, 0, sizeof(int)*length); |
1278 ::memset(buffer, 0, sizeof(int)*length); |
1279 |
1279 |
1280 HANDLE_TO_POINTER(QFont*, font, aFontHandle); |
1280 HANDLE_TO_POINTER(QFont*, font, aFontHandle); |
1281 QFontMetrics fm(*font); |
1281 QFontMetrics fm(*font); |
1282 |
1282 |
1283 buffer[0] = 0; |
1283 buffer[0] = 0; |
1284 buffer[1] = 0; |
1284 buffer[1] = 0; |
1285 buffer[2] = fm.width(string); |
1285 buffer[2] = fm.width(string); |
1286 buffer[3] = fm.height(); |
1286 buffer[3] = fm.height(); |
1287 |
1287 |
1292 } |
1292 } |
1293 |
1293 |
1294 void JNICALL Java_org_eclipse_swt_internal_qt_graphics_OS_fontUtils_1getBoundingRect__I_3ILjava_lang_String_2IIIIII |
1294 void JNICALL Java_org_eclipse_swt_internal_qt_graphics_OS_fontUtils_1getBoundingRect__I_3ILjava_lang_String_2IIIIII |
1295 (JNIEnv* aJniEnv, jclass, jint aFontHandle, jintArray aRectArray, jstring aStr, jint /*aRectX*/, jint /*aRectY*/, jint /*aRectW*/, jint /*aRectH*/, jint /*aAlignments*/, jint /*aFlags*/) |
1295 (JNIEnv* aJniEnv, jclass, jint aFontHandle, jintArray aRectArray, jstring aStr, jint /*aRectX*/, jint /*aRectY*/, jint /*aRectW*/, jint /*aRectH*/, jint /*aAlignments*/, jint /*aFlags*/) |
1296 { |
1296 { |
1297 GFX_TRY |
1297 GFX_TRY |
1298 { |
1298 { |
1299 GFX_LOG_JNI_CALL(); |
1299 SWT_LOG_JNI_CALL(); |
1300 QString string = swtApp->jniUtils().JavaStringToQString(aJniEnv, aStr); |
1300 QString string = swtApp->jniUtils().JavaStringToQString(aJniEnv, aStr); |
1301 int length = aJniEnv->GetArrayLength(aRectArray); |
1301 int length = aJniEnv->GetArrayLength(aRectArray); |
1302 |
1302 |
1303 int* buffer = new int[length]; // might throw bad_alloc |
1303 int* buffer = new int[length]; // might throw bad_alloc |
1304 AutoRelease<int> release(buffer, true); |
1304 AutoRelease<int> release(buffer, true); |
1305 ::memset(buffer, 0, sizeof(int)*length); |
1305 ::memset(buffer, 0, sizeof(int)*length); |
1306 |
1306 |
1307 HANDLE_TO_POINTER(QFont*, font, aFontHandle); |
1307 HANDLE_TO_POINTER(QFont*, font, aFontHandle); |
1308 QFontMetrics fm(*font); |
1308 QFontMetrics fm(*font); |
1309 |
1309 |
1310 buffer[0] = 0; |
1310 buffer[0] = 0; |
1311 buffer[1] = 0; |
1311 buffer[1] = 0; |
1312 buffer[2] = fm.width(string); |
1312 buffer[2] = fm.width(string); |
1313 buffer[3] = fm.height(); |
1313 buffer[3] = fm.height(); |
1314 |
1314 |
1315 // Copy changes to rectArray |
1315 // Copy changes to rectArray |
1316 swtApp->jniUtils().SetJavaIntArrayRegionFromIntArray(aJniEnv, aRectArray, 0, length, buffer); |
1316 swtApp->jniUtils().SetJavaIntArrayRegionFromIntArray(aJniEnv, aRectArray, 0, length, buffer); |
1317 } |
1317 } |
1318 GFX_CATCH |
1318 GFX_CATCH |
1319 } |
1319 } |
1369 void JNICALL Java_org_eclipse_swt_internal_qt_graphics_OS_buffer_1dispose |
1369 void JNICALL Java_org_eclipse_swt_internal_qt_graphics_OS_buffer_1dispose |
1370 (JNIEnv* aJniEnv , jclass, jint aHandle) |
1370 (JNIEnv* aJniEnv , jclass, jint aHandle) |
1371 { |
1371 { |
1372 GFX_TRY |
1372 GFX_TRY |
1373 { |
1373 { |
|
1374 SWT_LOG_JNI_CALL(); |
1374 HANDLE_TO_POINTER(Buffer*, buffer, aHandle); |
1375 HANDLE_TO_POINTER(Buffer*, buffer, aHandle); |
1375 buffer->dispose(); |
1376 buffer->dispose(); |
1376 } |
1377 } |
1377 GFX_CATCH |
1378 GFX_CATCH |
1378 } |
1379 } |
1379 |
1380 |
1380 void JNICALL Java_org_eclipse_swt_internal_qt_graphics_OS_buffer_1getInvalidRect |
1381 void JNICALL Java_org_eclipse_swt_internal_qt_graphics_OS_buffer_1getInvalidRect |
1381 (JNIEnv* aJniEnv, jclass, jint aHandle, jintArray aRect) |
1382 (JNIEnv* aJniEnv, jclass, jint aHandle, jintArray aRect) |
1382 { |
1383 { |
1383 GFX_TRY |
1384 GFX_TRY |
1384 { |
1385 { |
|
1386 SWT_LOG_JNI_CALL(); |
1385 HANDLE_TO_POINTER(Buffer*, buffer, aHandle); |
1387 HANDLE_TO_POINTER(Buffer*, buffer, aHandle); |
1386 |
1388 |
1387 int length = aJniEnv->GetArrayLength(aRect); |
1389 int length = aJniEnv->GetArrayLength(aRect); |
1388 |
1390 |
1389 int* intBuffer = new int[length]; // might throw bad_alloc |
1391 int* intBuffer = new int[length]; // might throw bad_alloc |
1390 AutoRelease<int> release(intBuffer, true); |
1392 AutoRelease<int> release(intBuffer, true); |
1391 ::memset(intBuffer, 0, sizeof(int)*length); |
1393 ::memset(intBuffer, 0, sizeof(int)*length); |
1392 |
1394 |
1393 buffer->getInvalidRect(intBuffer); |
1395 buffer->getInvalidRect(intBuffer); |
1394 |
1396 |
1395 // Copy data back to java |
1397 // Copy data back to java |
1396 swtApp->jniUtils().SetJavaIntArrayRegionFromIntArray(aJniEnv, aRect, 0, length, intBuffer); |
1398 swtApp->jniUtils().SetJavaIntArrayRegionFromIntArray(aJniEnv, aRect, 0, length, intBuffer); |
1397 } |
1399 } |