javauis/eswt_qt/org.eclipse.swt/Eclipse_SWT_PI/qt/library/graphics/gfxos.cpp
changeset 49 35baca0e7a2e
parent 35 85266cc22c7f
child 56 abc41079b313
child 61 bf7ee68962da
equal deleted inserted replaced
35:85266cc22c7f 49:35baca0e7a2e
    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 }
    85 void JNICALL Java_org_eclipse_swt_internal_qt_graphics_OS_graphicsContext_1bindTarget
    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)
    86   (JNIEnv* aJniEnv , jclass, jint aHandle, jint aTarget, jint aType, jint aBufferFlushTargetHandle)
    87 {
    87 {
    88     GFX_TRY
    88     GFX_TRY
    89     {
    89     {
    90         GFX_LOG_JNI_CALL();
    90         SWT_LOG_JNI_CALL();
    91         HANDLE_TO_POINTER(GraphicsContext*, gc, aHandle);
    91         HANDLE_TO_POINTER(GraphicsContext*, gc, aHandle);
    92         gc->bindTarget(aTarget, (TTargetType)aType, static_cast<int>(aBufferFlushTargetHandle));
    92         gc->bindTarget(aTarget, (TTargetType)aType, static_cast<int>(aBufferFlushTargetHandle));
    93     }
    93     }
    94     GFX_CATCH
    94     GFX_CATCH
    95 }
    95 }
    97 void JNICALL Java_org_eclipse_swt_internal_qt_graphics_OS_graphicsContext_1render
    97 void JNICALL Java_org_eclipse_swt_internal_qt_graphics_OS_graphicsContext_1render
    98   (JNIEnv* aJniEnv , jclass, jint aHandle, jint aBufferHandle)
    98   (JNIEnv* aJniEnv , jclass, jint aHandle, jint aBufferHandle)
    99 {
    99 {
   100     GFX_TRY
   100     GFX_TRY
   101     {
   101     {
   102         GFX_LOG_JNI_CALL();
   102         SWT_LOG_JNI_CALL();
   103         HANDLE_TO_POINTER(GraphicsContext*, gc, aHandle);
   103         HANDLE_TO_POINTER(GraphicsContext*, gc, aHandle);
   104         HANDLE_TO_POINTER(Buffer*, buffer, aBufferHandle);
   104         HANDLE_TO_POINTER(Buffer*, buffer, aBufferHandle);
   105         gc->render(buffer);
   105         gc->render(buffer);
   106     }
   106     }
   107     GFX_CATCH
   107     GFX_CATCH
   108 }
   108 }
   109 
   109 
   110 void JNICALL Java_org_eclipse_swt_internal_qt_graphics_OS_graphicsContext_1releaseTarget
   110 void JNICALL Java_org_eclipse_swt_internal_qt_graphics_OS_graphicsContext_1releaseTarget
   111   (JNIEnv* aJniEnv , jclass, jint aHandle) 
   111   (JNIEnv* aJniEnv , jclass, jint aHandle)
   112 {
   112 {
   113     GFX_TRY
   113     GFX_TRY
   114     {
   114     {
   115         GFX_LOG_JNI_CALL();
   115         SWT_LOG_JNI_CALL();
   116         HANDLE_TO_POINTER(GraphicsContext*, gc, aHandle);
   116         HANDLE_TO_POINTER(GraphicsContext*, gc, aHandle);
   117         gc->releaseTarget();
   117         gc->releaseTarget();
   118     }
   118     }
   119     GFX_CATCH
   119     GFX_CATCH
   120 }
   120 }
   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 }
   148 void JNICALL Java_org_eclipse_swt_internal_qt_graphics_OS_graphicsContext_1drawArc
   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)
   149   (JNIEnv* aJniEnv , jclass, jint aHandle, jint aX, jint aY, jint aWidth, jint aHeight, jint aStartAngle, jint aArcAngle)
   150 {
   150 {
   151     GFX_TRY
   151     GFX_TRY
   152     {
   152     {
   153         GFX_LOG_JNI_CALL();
   153         SWT_LOG_JNI_CALL();
   154         HANDLE_TO_POINTER(GraphicsContext*, gc, aHandle);
   154         HANDLE_TO_POINTER(GraphicsContext*, gc, aHandle);
   155         gc->drawArc(aX, aY, aWidth, aHeight, aStartAngle, aArcAngle);
   155         gc->drawArc(aX, aY, aWidth, aHeight, aStartAngle, aArcAngle);
   156     }
   156     }
   157     GFX_CATCH
   157     GFX_CATCH
   158 }
   158 }
   160 void JNICALL Java_org_eclipse_swt_internal_qt_graphics_OS_graphicsContext_1drawEllipse
   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)
   161   (JNIEnv* aJniEnv , jclass, jint aHandle, jint aX, jint aY, jint aWidth, jint aHeight)
   162 {
   162 {
   163     GFX_TRY
   163     GFX_TRY
   164     {
   164     {
   165         GFX_LOG_JNI_CALL();
   165         SWT_LOG_JNI_CALL();
   166         HANDLE_TO_POINTER(GraphicsContext*, gc, aHandle);
   166         HANDLE_TO_POINTER(GraphicsContext*, gc, aHandle);
   167         gc->drawEllipse(aX, aY, aWidth, aHeight);
   167         gc->drawEllipse(aX, aY, aWidth, aHeight);
   168     }
   168     }
   169     GFX_CATCH
   169     GFX_CATCH
   170 }
   170 }
   172 JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_qt_graphics_OS_graphicsContext_1drawFocus
   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)
   173   (JNIEnv* aJniEnv , jclass, jint aHandle, jint aX, jint aY, jint aWidth, jint aHeight)
   174 {
   174 {
   175     GFX_TRY
   175     GFX_TRY
   176     {
   176     {
   177         GFX_LOG_JNI_CALL();
   177         SWT_LOG_JNI_CALL();
   178         HANDLE_TO_POINTER(GraphicsContext*, gc, aHandle);
   178         HANDLE_TO_POINTER(GraphicsContext*, gc, aHandle);
   179         gc->drawFocus(aX, aY, aWidth, aHeight);
   179         gc->drawFocus(aX, aY, aWidth, aHeight);
   180     }
   180     }
   181     GFX_CATCH
   181     GFX_CATCH
   182 }
   182 }
   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
   211 void JNICALL Java_org_eclipse_swt_internal_qt_graphics_OS_graphicsContext_1drawLine
   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)
   212   (JNIEnv* aJniEnv , jclass, jint aHandle, jint aX1, jint aY1, jint aX2, jint aY2)
   213 {
   213 {
   214     GFX_TRY
   214     GFX_TRY
   215     {
   215     {
   216         GFX_LOG_JNI_CALL();
   216         SWT_LOG_JNI_CALL();
   217         HANDLE_TO_POINTER(GraphicsContext*, gc, aHandle);
   217         HANDLE_TO_POINTER(GraphicsContext*, gc, aHandle);
   218         gc->drawLine(aX1, aY1, aX2, aY2);
   218         gc->drawLine(aX1, aY1, aX2, aY2);
   219     }
   219     }
   220     GFX_CATCH
   220     GFX_CATCH
   221 }
   221 }
   223 void JNICALL Java_org_eclipse_swt_internal_qt_graphics_OS_graphicsContext_1drawPoint
   223 void JNICALL Java_org_eclipse_swt_internal_qt_graphics_OS_graphicsContext_1drawPoint
   224   (JNIEnv* aJniEnv , jclass, jint aHandle, jint aX, jint aY)
   224   (JNIEnv* aJniEnv , jclass, jint aHandle, jint aX, jint aY)
   225 {
   225 {
   226     GFX_TRY
   226     GFX_TRY
   227     {
   227     {
   228         GFX_LOG_JNI_CALL();
   228         SWT_LOG_JNI_CALL();
   229         HANDLE_TO_POINTER(GraphicsContext*, gc, aHandle);
   229         HANDLE_TO_POINTER(GraphicsContext*, gc, aHandle);
   230         gc->drawPoint(aX, aY);
   230         gc->drawPoint(aX, aY);
   231     }
   231     }
   232     GFX_CATCH
   232     GFX_CATCH
   233 }
   233 }
   235 void JNICALL Java_org_eclipse_swt_internal_qt_graphics_OS_graphicsContext_1drawPolygon
   235 void JNICALL Java_org_eclipse_swt_internal_qt_graphics_OS_graphicsContext_1drawPolygon
   236   (JNIEnv* aJniEnv, jclass, jint aHandle, jintArray aPointArray)
   236   (JNIEnv* aJniEnv, jclass, jint aHandle, jintArray aPointArray)
   237 {
   237 {
   238     GFX_TRY
   238     GFX_TRY
   239     {
   239     {
   240         GFX_LOG_JNI_CALL();
   240         SWT_LOG_JNI_CALL();
   241         HANDLE_TO_POINTER(GraphicsContext*, gc, aHandle);
   241         HANDLE_TO_POINTER(GraphicsContext*, gc, aHandle);
   242         int length = aJniEnv->GetArrayLength(aPointArray);
   242         int length = aJniEnv->GetArrayLength(aPointArray);
   243         int* buffer = new int[length]; // might throw bad_alloc
   243         int* buffer = new int[length]; // might throw bad_alloc
   244         AutoRelease<int> release(buffer, true);
   244         AutoRelease<int> release(buffer, true);
   245         swtApp->jniUtils().GetJavaIntArrayRegionToIntArray(aJniEnv, aPointArray, 0, length, buffer); // might throw bad_alloc
   245         swtApp->jniUtils().GetJavaIntArrayRegionToIntArray(aJniEnv, aPointArray, 0, length, buffer); // might throw bad_alloc
   251 void JNICALL Java_org_eclipse_swt_internal_qt_graphics_OS_graphicsContext_1drawPolyline
   251 void JNICALL Java_org_eclipse_swt_internal_qt_graphics_OS_graphicsContext_1drawPolyline
   252   (JNIEnv* aJniEnv, jclass, jint aHandle, jintArray aPointArray)
   252   (JNIEnv* aJniEnv, jclass, jint aHandle, jintArray aPointArray)
   253 {
   253 {
   254     GFX_TRY
   254     GFX_TRY
   255     {
   255     {
   256         GFX_LOG_JNI_CALL();
   256         SWT_LOG_JNI_CALL();
   257         HANDLE_TO_POINTER(GraphicsContext*, gc, aHandle);
   257         HANDLE_TO_POINTER(GraphicsContext*, gc, aHandle);
   258         int length = aJniEnv->GetArrayLength(aPointArray);
   258         int length = aJniEnv->GetArrayLength(aPointArray);
   259         int* buffer = new int[length]; // might throw bad_alloc
   259         int* buffer = new int[length]; // might throw bad_alloc
   260         AutoRelease<int> release(buffer, true);
   260         AutoRelease<int> release(buffer, true);
   261         swtApp->jniUtils().GetJavaIntArrayRegionToIntArray(aJniEnv, aPointArray, 0, length, buffer); // might throw bad_alloc
   261         swtApp->jniUtils().GetJavaIntArrayRegionToIntArray(aJniEnv, aPointArray, 0, length, buffer); // might throw bad_alloc
   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 }
   483   (JNIEnv* aJniEnv , jclass, jint aHandle)
   483   (JNIEnv* aJniEnv , jclass, jint aHandle)
   484 {
   484 {
   485     jint bgAlpha = 0;
   485     jint bgAlpha = 0;
   486     GFX_TRY
   486     GFX_TRY
   487     {
   487     {
   488         GFX_LOG_JNI_CALL();
   488         SWT_LOG_JNI_CALL();
   489         HANDLE_TO_POINTER(GraphicsContext*, gc, aHandle);
   489         HANDLE_TO_POINTER(GraphicsContext*, gc, aHandle);
   490         bgAlpha = static_cast<jint>( gc->getBackgroundAlpha() );
   490         bgAlpha = static_cast<jint>( gc->getBackgroundAlpha() );
   491     }
   491     }
   492     GFX_CATCH
   492     GFX_CATCH
   493     return bgAlpha;
   493     return bgAlpha;
   497   (JNIEnv* aJniEnv , jclass, jint aHandle)
   497   (JNIEnv* aJniEnv , jclass, jint aHandle)
   498 {
   498 {
   499     jint bgColor = 0;
   499     jint bgColor = 0;
   500     GFX_TRY
   500     GFX_TRY
   501     {
   501     {
   502         GFX_LOG_JNI_CALL();
   502         SWT_LOG_JNI_CALL();
   503         HANDLE_TO_POINTER(GraphicsContext*, gc, aHandle);
   503         HANDLE_TO_POINTER(GraphicsContext*, gc, aHandle);
   504         bgColor = static_cast<jint>( gc->getBackgroundColor() );
   504         bgColor = static_cast<jint>( gc->getBackgroundColor() );
   505     }
   505     }
   506     GFX_CATCH
   506     GFX_CATCH
   507     return bgColor;
   507     return bgColor;
   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
   553 
   553 
   554 jint JNICALL Java_org_eclipse_swt_internal_qt_graphics_OS_graphicsContext_1getBlendingMode
   554 jint JNICALL Java_org_eclipse_swt_internal_qt_graphics_OS_graphicsContext_1getBlendingMode
   555   (JNIEnv* aJniEnv , jclass, jint aHandle)
   555   (JNIEnv* aJniEnv , jclass, jint aHandle)
   556 {
   556 {
   557     jint blendingMode = 0;
   557     jint blendingMode = 0;
   558     GFX_TRY 
   558     GFX_TRY
   559     {
   559     {
   560         GFX_LOG_JNI_CALL();
   560         SWT_LOG_JNI_CALL();
   561         HANDLE_TO_POINTER(GraphicsContext*, gc, aHandle);
   561         HANDLE_TO_POINTER(GraphicsContext*, gc, aHandle);
   562         blendingMode = static_cast<jint>( gc->getBlendingMode() );
   562         blendingMode = static_cast<jint>( gc->getBlendingMode() );
   563     }
   563     }
   564     GFX_CATCH
   564     GFX_CATCH
   565     return blendingMode;
   565     return blendingMode;
   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 
   651   (JNIEnv* aJniEnv , jclass, jint aHandle)
   651   (JNIEnv* aJniEnv , jclass, jint aHandle)
   652 {
   652 {
   653     jint strokeWidth = 0;
   653     jint strokeWidth = 0;
   654     GFX_TRY
   654     GFX_TRY
   655     {
   655     {
   656         GFX_LOG_JNI_CALL();
   656         SWT_LOG_JNI_CALL();
   657         HANDLE_TO_POINTER(GraphicsContext*, gc, aHandle);
   657         HANDLE_TO_POINTER(GraphicsContext*, gc, aHandle);
   658         strokeWidth = static_cast<jint>( gc->getStrokeWidth() );
   658         strokeWidth = static_cast<jint>( gc->getStrokeWidth() );
   659     }
   659     }
   660     GFX_CATCH
   660     GFX_CATCH
   661     return strokeWidth;
   661     return strokeWidth;
   665   (JNIEnv* aJniEnv , jclass, jint aHandle)
   665   (JNIEnv* aJniEnv , jclass, jint aHandle)
   666 {
   666 {
   667     jint strokeStyle = 0;
   667     jint strokeStyle = 0;
   668     GFX_TRY
   668     GFX_TRY
   669     {
   669     {
   670         GFX_LOG_JNI_CALL();
   670         SWT_LOG_JNI_CALL();
   671         HANDLE_TO_POINTER(GraphicsContext*, gc, aHandle);
   671         HANDLE_TO_POINTER(GraphicsContext*, gc, aHandle);
   672         strokeStyle = static_cast<jint>( gc->getStrokeStyle() );
   672         strokeStyle = static_cast<jint>( gc->getStrokeStyle() );
   673     }
   673     }
   674     GFX_CATCH
   674     GFX_CATCH
   675     return strokeStyle;
   675     return strokeStyle;
   679   (JNIEnv* aJniEnv , jclass, jint aHandle)
   679   (JNIEnv* aJniEnv , jclass, jint aHandle)
   680 {
   680 {
   681     jint translateX = 0;
   681     jint translateX = 0;
   682     GFX_TRY
   682     GFX_TRY
   683     {
   683     {
   684         GFX_LOG_JNI_CALL();
   684         SWT_LOG_JNI_CALL();
   685         HANDLE_TO_POINTER(GraphicsContext*, gc, aHandle);
   685         HANDLE_TO_POINTER(GraphicsContext*, gc, aHandle);
   686         translateX = static_cast<jint>( gc->getTranslateX() );
   686         translateX = static_cast<jint>( gc->getTranslateX() );
   687     }
   687     }
   688     GFX_CATCH
   688     GFX_CATCH
   689     return translateX;
   689     return translateX;
   693   (JNIEnv* aJniEnv , jclass, jint aHandle)
   693   (JNIEnv* aJniEnv , jclass, jint aHandle)
   694 {
   694 {
   695     jint translateY = 0;
   695     jint translateY = 0;
   696     GFX_TRY
   696     GFX_TRY
   697     {
   697     {
   698         GFX_LOG_JNI_CALL();
   698         SWT_LOG_JNI_CALL();
   699         HANDLE_TO_POINTER(GraphicsContext*, gc, aHandle);
   699         HANDLE_TO_POINTER(GraphicsContext*, gc, aHandle);
   700         translateY = static_cast<jint>( gc->getTranslateY() );
   700         translateY = static_cast<jint>( gc->getTranslateY() );
   701     }
   701     }
   702     GFX_CATCH
   702     GFX_CATCH
   703     return translateY;
   703     return translateY;
   706 void JNICALL Java_org_eclipse_swt_internal_qt_graphics_OS_graphicsContext_1setBackgroundAlpha
   706 void JNICALL Java_org_eclipse_swt_internal_qt_graphics_OS_graphicsContext_1setBackgroundAlpha
   707   (JNIEnv* aJniEnv , jclass, jint aHandle, jint aAlpha)
   707   (JNIEnv* aJniEnv , jclass, jint aHandle, jint aAlpha)
   708 {
   708 {
   709     GFX_TRY
   709     GFX_TRY
   710     {
   710     {
   711         GFX_LOG_JNI_CALL();
   711         SWT_LOG_JNI_CALL();
   712         HANDLE_TO_POINTER(GraphicsContext*, gc, aHandle);
   712         HANDLE_TO_POINTER(GraphicsContext*, gc, aHandle);
   713         gc->setBackgroundAlpha(aAlpha);
   713         gc->setBackgroundAlpha(aAlpha);
   714     }
   714     }
   715     GFX_CATCH
   715     GFX_CATCH
   716 }
   716 }
   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 }
   743   (JNIEnv* aJniEnv , jclass, jint aHandle)
   743   (JNIEnv* aJniEnv , jclass, jint aHandle)
   744 {
   744 {
   745     jboolean hasClipping = JNI_FALSE;
   745     jboolean hasClipping = JNI_FALSE;
   746     GFX_TRY
   746     GFX_TRY
   747     {
   747     {
   748         GFX_LOG_JNI_CALL();
   748         SWT_LOG_JNI_CALL();
   749         HANDLE_TO_POINTER(GraphicsContext*, gc, aHandle);
   749         HANDLE_TO_POINTER(GraphicsContext*, gc, aHandle);
   750         hasClipping = static_cast<jboolean>( gc->hasClipping() );
   750         hasClipping = static_cast<jboolean>( gc->hasClipping() );
   751     }
   751     }
   752     GFX_CATCH
   752     GFX_CATCH
   753     return hasClipping;
   753     return hasClipping;
   756 void JNICALL Java_org_eclipse_swt_internal_qt_graphics_OS_graphicsContext_1cancelClipping
   756 void JNICALL Java_org_eclipse_swt_internal_qt_graphics_OS_graphicsContext_1cancelClipping
   757   (JNIEnv* aJniEnv , jclass, jint aHandle)
   757   (JNIEnv* aJniEnv , jclass, jint aHandle)
   758 {
   758 {
   759     GFX_TRY
   759     GFX_TRY
   760     {
   760     {
   761         GFX_LOG_JNI_CALL();
   761         SWT_LOG_JNI_CALL();
   762         HANDLE_TO_POINTER(GraphicsContext*, gc, aHandle);
   762         HANDLE_TO_POINTER(GraphicsContext*, gc, aHandle);
   763         gc->cancelClipping();
   763         gc->cancelClipping();
   764     }
   764     }
   765     GFX_CATCH
   765     GFX_CATCH
   766 }
   766 }
   768 void JNICALL Java_org_eclipse_swt_internal_qt_graphics_OS_graphicsContext_1setClip
   768 void JNICALL Java_org_eclipse_swt_internal_qt_graphics_OS_graphicsContext_1setClip
   769  (JNIEnv* aJniEnv , jclass, jint aHandle, jint aX, jint aY, jint aWidth, jint aHeight, jboolean aIntersects)
   769  (JNIEnv* aJniEnv , jclass, jint aHandle, jint aX, jint aY, jint aWidth, jint aHeight, jboolean aIntersects)
   770 {
   770 {
   771     GFX_TRY
   771     GFX_TRY
   772     {
   772     {
   773         GFX_LOG_JNI_CALL();
   773         SWT_LOG_JNI_CALL();
   774         HANDLE_TO_POINTER(GraphicsContext*, gc, aHandle);
   774         HANDLE_TO_POINTER(GraphicsContext*, gc, aHandle);
   775         gc->setClip(aX, aY, aWidth, aHeight, aIntersects);
   775         gc->setClip(aX, aY, aWidth, aHeight, aIntersects);
   776     }
   776     }
   777     GFX_CATCH
   777     GFX_CATCH
   778 }
   778 }
   780 void JNICALL Java_org_eclipse_swt_internal_qt_graphics_OS_graphicsContext_1setFont
   780 void JNICALL Java_org_eclipse_swt_internal_qt_graphics_OS_graphicsContext_1setFont
   781   (JNIEnv* aJniEnv , jclass, jint aHandle, jint aFontHandle)
   781   (JNIEnv* aJniEnv , jclass, jint aHandle, jint aFontHandle)
   782 {
   782 {
   783     GFX_TRY
   783     GFX_TRY
   784     {
   784     {
   785         GFX_LOG_JNI_CALL();
   785         SWT_LOG_JNI_CALL();
   786         HANDLE_TO_POINTER(GraphicsContext*, gc, aHandle);
   786         HANDLE_TO_POINTER(GraphicsContext*, gc, aHandle);
   787         gc->setFont(aFontHandle);
   787         gc->setFont(aFontHandle);
   788     }
   788     }
   789     GFX_CATCH
   789     GFX_CATCH
   790 }
   790 }
   792 void JNICALL Java_org_eclipse_swt_internal_qt_graphics_OS_graphicsContext_1setForegroundAlpha
   792 void JNICALL Java_org_eclipse_swt_internal_qt_graphics_OS_graphicsContext_1setForegroundAlpha
   793   (JNIEnv* aJniEnv , jclass, jint aHandle, jint aAlpha)
   793   (JNIEnv* aJniEnv , jclass, jint aHandle, jint aAlpha)
   794 {
   794 {
   795     GFX_TRY
   795     GFX_TRY
   796     {
   796     {
   797         GFX_LOG_JNI_CALL();
   797         SWT_LOG_JNI_CALL();
   798         HANDLE_TO_POINTER(GraphicsContext*, gc, aHandle);
   798         HANDLE_TO_POINTER(GraphicsContext*, gc, aHandle);
   799         gc->setForegroundAlpha(aAlpha);
   799         gc->setForegroundAlpha(aAlpha);
   800     }
   800     }
   801     GFX_CATCH
   801     GFX_CATCH
   802 }
   802 }
   804 void JNICALL Java_org_eclipse_swt_internal_qt_graphics_OS_graphicsContext_1setForegroundColor
   804 void JNICALL Java_org_eclipse_swt_internal_qt_graphics_OS_graphicsContext_1setForegroundColor
   805   (JNIEnv* aJniEnv , jclass, jint aHandle, jint aArgb, jboolean aUpdateAlpha)
   805   (JNIEnv* aJniEnv , jclass, jint aHandle, jint aArgb, jboolean aUpdateAlpha)
   806 {
   806 {
   807     GFX_TRY
   807     GFX_TRY
   808     {
   808     {
   809         GFX_LOG_JNI_CALL();
   809         SWT_LOG_JNI_CALL();
   810         HANDLE_TO_POINTER(GraphicsContext*, gc, aHandle);
   810         HANDLE_TO_POINTER(GraphicsContext*, gc, aHandle);
   811         gc->setForegroundColor(aArgb, aUpdateAlpha);
   811         gc->setForegroundColor(aArgb, aUpdateAlpha);
   812     }
   812     }
   813     GFX_CATCH
   813     GFX_CATCH
   814 }
   814 }
   816 void JNICALL Java_org_eclipse_swt_internal_qt_graphics_OS_graphicsContext_1setStrokeWidth
   816 void JNICALL Java_org_eclipse_swt_internal_qt_graphics_OS_graphicsContext_1setStrokeWidth
   817   (JNIEnv* aJniEnv , jclass, jint aHandle, jint aWidth)
   817   (JNIEnv* aJniEnv , jclass, jint aHandle, jint aWidth)
   818 {
   818 {
   819     GFX_TRY
   819     GFX_TRY
   820     {
   820     {
   821         GFX_LOG_JNI_CALL();
   821         SWT_LOG_JNI_CALL();
   822         HANDLE_TO_POINTER(GraphicsContext*, gc, aHandle);
   822         HANDLE_TO_POINTER(GraphicsContext*, gc, aHandle);
   823         gc->setStrokeWidth(aWidth);
   823         gc->setStrokeWidth(aWidth);
   824     }
   824     }
   825     GFX_CATCH
   825     GFX_CATCH
   826 }
   826 }
   827 
   827 
   828 void JNICALL Java_org_eclipse_swt_internal_qt_graphics_OS_graphicsContext_1setStrokeStyle
   828 void JNICALL Java_org_eclipse_swt_internal_qt_graphics_OS_graphicsContext_1setStrokeStyle
   829   (JNIEnv* aJniEnv , jclass, jint aHandle, jint aStyle) 
   829   (JNIEnv* aJniEnv , jclass, jint aHandle, jint aStyle)
   830 {
   830 {
   831     GFX_TRY
   831     GFX_TRY
   832     {
   832     {
   833         GFX_LOG_JNI_CALL();
   833         SWT_LOG_JNI_CALL();
   834         HANDLE_TO_POINTER(GraphicsContext*, gc, aHandle);
   834         HANDLE_TO_POINTER(GraphicsContext*, gc, aHandle);
   835         gc->setStrokeStyle((TStrokeStyle)aStyle);
   835         gc->setStrokeStyle((TStrokeStyle)aStyle);
   836     }
   836     }
   837     GFX_CATCH
   837     GFX_CATCH
   838 }
   838 }
   840 JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_qt_graphics_OS_graphicsContext_1translate
   840 JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_qt_graphics_OS_graphicsContext_1translate
   841   (JNIEnv* aJniEnv , jclass, jint aHandle, jint aX, jint aY)
   841   (JNIEnv* aJniEnv , jclass, jint aHandle, jint aX, jint aY)
   842 {
   842 {
   843     GFX_TRY
   843     GFX_TRY
   844     {
   844     {
   845         GFX_LOG_JNI_CALL();
   845         SWT_LOG_JNI_CALL();
   846         HANDLE_TO_POINTER(GraphicsContext*, gc, aHandle);
   846         HANDLE_TO_POINTER(GraphicsContext*, gc, aHandle);
   847         gc->translate(aX,aY);
   847         gc->translate(aX,aY);
   848     }
   848     }
   849     GFX_CATCH
   849     GFX_CATCH
   850 }
   850 }
   852 JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_qt_graphics_OS_graphicsContext_1scale
   852 JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_qt_graphics_OS_graphicsContext_1scale
   853   (JNIEnv* aJniEnv, jclass, jint aHandle, jint aX, jint aY)
   853   (JNIEnv* aJniEnv, jclass, jint aHandle, jint aX, jint aY)
   854 {
   854 {
   855     GFX_TRY
   855     GFX_TRY
   856     {
   856     {
   857         GFX_LOG_JNI_CALL();
   857         SWT_LOG_JNI_CALL();
   858         HANDLE_TO_POINTER(GraphicsContext*, gc, aHandle);
   858         HANDLE_TO_POINTER(GraphicsContext*, gc, aHandle);
   859         gc->scale(aX,aY);
   859         gc->scale(aX,aY);
   860     }
   860     }
   861     GFX_CATCH
   861     GFX_CATCH
   862 }
   862 }
   865 JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_qt_graphics_OS_graphicsContext_1resetTransform
   865 JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_qt_graphics_OS_graphicsContext_1resetTransform
   866   (JNIEnv* aJniEnv, jclass, jint aHandle)
   866   (JNIEnv* aJniEnv, jclass, jint aHandle)
   867 {
   867 {
   868     GFX_TRY
   868     GFX_TRY
   869     {
   869     {
   870         GFX_LOG_JNI_CALL();
   870         SWT_LOG_JNI_CALL();
   871         HANDLE_TO_POINTER(GraphicsContext*, gc, aHandle);
   871         HANDLE_TO_POINTER(GraphicsContext*, gc, aHandle);
   872         gc->resetTransform();
   872         gc->resetTransform();
   873     }
   873     }
   874     GFX_CATCH
   874     GFX_CATCH
   875 }
   875 }
   877 void JNICALL Java_org_eclipse_swt_internal_qt_graphics_OS_graphicsContext_1saveSettings
   877 void JNICALL Java_org_eclipse_swt_internal_qt_graphics_OS_graphicsContext_1saveSettings
   878   (JNIEnv* aJniEnv, jclass, jint aHandle)
   878   (JNIEnv* aJniEnv, jclass, jint aHandle)
   879 {
   879 {
   880     GFX_TRY
   880     GFX_TRY
   881     {
   881     {
   882         GFX_LOG_JNI_CALL();
   882         SWT_LOG_JNI_CALL();
   883         HANDLE_TO_POINTER(GraphicsContext*, gc, aHandle);
   883         HANDLE_TO_POINTER(GraphicsContext*, gc, aHandle);
   884         gc->saveSettings();
   884         gc->saveSettings();
   885     }
   885     }
   886     GFX_CATCH
   886     GFX_CATCH
   887 }
   887 }
   889 void JNICALL Java_org_eclipse_swt_internal_qt_graphics_OS_graphicsContext_1restoreSettings
   889 void JNICALL Java_org_eclipse_swt_internal_qt_graphics_OS_graphicsContext_1restoreSettings
   890   (JNIEnv* aJniEnv, jclass, jint aHandle)
   890   (JNIEnv* aJniEnv, jclass, jint aHandle)
   891 {
   891 {
   892     GFX_TRY
   892     GFX_TRY
   893     {
   893     {
   894         GFX_LOG_JNI_CALL();
   894         SWT_LOG_JNI_CALL();
   895         HANDLE_TO_POINTER(GraphicsContext*, gc, aHandle);
   895         HANDLE_TO_POINTER(GraphicsContext*, gc, aHandle);
   896         gc->restoreSettings();
   896         gc->restoreSettings();
   897     }
   897     }
   898     GFX_CATCH
   898     GFX_CATCH
   899 }
   899 }
   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 }
   966   (JNIEnv* aJniEnv, jclass, jint aImageHandle)
   966   (JNIEnv* aJniEnv, jclass, jint aImageHandle)
   967 {
   967 {
   968     jint format = 0;
   968     jint format = 0;
   969     GFX_TRY
   969     GFX_TRY
   970     {
   970     {
   971         GFX_LOG_JNI_CALL();
   971         SWT_LOG_JNI_CALL();
   972         HANDLE_TO_POINTER(Image*, image, aImageHandle);
   972         HANDLE_TO_POINTER(Image*, image, aImageHandle);
   973         format = static_cast<jint>( image->getFormat() );
   973         format = static_cast<jint>( image->getFormat() );
   974     }
   974     }
   975     GFX_CATCH
   975     GFX_CATCH
   976     return format;
   976     return format;
   980   (JNIEnv* aJniEnv, jclass, jint aImageHandle)
   980   (JNIEnv* aJniEnv, jclass, jint aImageHandle)
   981 {
   981 {
   982     jint height = 0;
   982     jint height = 0;
   983     GFX_TRY
   983     GFX_TRY
   984     {
   984     {
   985         GFX_LOG_JNI_CALL();
   985         SWT_LOG_JNI_CALL();
   986         HANDLE_TO_POINTER(Image*, image, aImageHandle);
   986         HANDLE_TO_POINTER(Image*, image, aImageHandle);
   987         height = static_cast<jint>( image->getHeight() );
   987         height = static_cast<jint>( image->getHeight() );
   988     }
   988     }
   989     GFX_CATCH
   989     GFX_CATCH
   990     return height;
   990     return height;
   991 }
   991 }
   992 
   992 
   993 jint JNICALL Java_org_eclipse_swt_internal_qt_graphics_OS_image_1getWidth
   993 jint JNICALL Java_org_eclipse_swt_internal_qt_graphics_OS_image_1getWidth
   994   (JNIEnv* aJniEnv , jclass, jint aImageHandle) 
   994   (JNIEnv* aJniEnv , jclass, jint aImageHandle)
   995 {
   995 {
   996     jint width = 0;
   996     jint width = 0;
   997     GFX_TRY
   997     GFX_TRY
   998     {
   998     {
   999         GFX_LOG_JNI_CALL();
   999         SWT_LOG_JNI_CALL();
  1000         HANDLE_TO_POINTER(Image*, image, aImageHandle);
  1000         HANDLE_TO_POINTER(Image*, image, aImageHandle);
  1001         width = static_cast<jint>( image->getWidth() );
  1001         width = static_cast<jint>( image->getWidth() );
  1002     }
  1002     }
  1003     GFX_CATCH
  1003     GFX_CATCH
  1004     return width;
  1004     return width;
  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 }
  1096 void JNICALL Java_org_eclipse_swt_internal_qt_graphics_OS_image_1transform
  1096 void JNICALL Java_org_eclipse_swt_internal_qt_graphics_OS_image_1transform
  1097   (JNIEnv* aJniEnv , jclass, jint aImageHandle, jint aTransform)
  1097   (JNIEnv* aJniEnv , jclass, jint aImageHandle, jint aTransform)
  1098 {
  1098 {
  1099     GFX_TRY
  1099     GFX_TRY
  1100     {
  1100     {
  1101         GFX_LOG_JNI_CALL();
  1101         SWT_LOG_JNI_CALL();
  1102         HANDLE_TO_POINTER(Image*, image, aImageHandle);
  1102         HANDLE_TO_POINTER(Image*, image, aImageHandle);
  1103         image->transform((TTransform)aTransform);
  1103         image->transform((TTransform)aTransform);
  1104     }
  1104     }
  1105     GFX_CATCH
  1105     GFX_CATCH
  1106 }
  1106 }
  1107 
  1107 
  1108 void JNICALL Java_org_eclipse_swt_internal_qt_graphics_OS_image_1dispose
  1108 void JNICALL Java_org_eclipse_swt_internal_qt_graphics_OS_image_1dispose
  1109   (JNIEnv* aJniEnv , jclass, jint aImageHandle) 
  1109   (JNIEnv* aJniEnv , jclass, jint aImageHandle)
  1110 {
  1110 {
  1111     GFX_TRY
  1111     GFX_TRY
  1112     {
  1112     {
  1113         GFX_LOG_JNI_CALL();
  1113         SWT_LOG_JNI_CALL();
  1114         HANDLE_TO_POINTER(Image*, image, aImageHandle);
  1114         HANDLE_TO_POINTER(Image*, image, aImageHandle);
  1115         image->dispose();
  1115         image->dispose();
  1116         image = NULL;
  1116         image = NULL;
  1117     }
  1117     }
  1118     GFX_CATCH
  1118     GFX_CATCH
  1122   (JNIEnv* aJniEnv , jclass, jint aImageHandle)
  1122   (JNIEnv* aJniEnv , jclass, jint aImageHandle)
  1123 {
  1123 {
  1124     jint pixmapHandle = 0;
  1124     jint pixmapHandle = 0;
  1125     GFX_TRY
  1125     GFX_TRY
  1126     {
  1126     {
  1127         GFX_LOG_JNI_CALL();
  1127         SWT_LOG_JNI_CALL();
  1128         HANDLE_TO_POINTER(Image*, image, aImageHandle);
  1128         HANDLE_TO_POINTER(Image*, image, aImageHandle);
  1129         pixmapHandle = POINTER_TO_HANDLE(image->getPixmap());
  1129         pixmapHandle = POINTER_TO_HANDLE(image->getPixmap());
  1130     }
  1130     }
  1131     GFX_CATCH
  1131     GFX_CATCH
  1132     return pixmapHandle;
  1132     return pixmapHandle;
  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 }
  1252   (JNIEnv* aJniEnv , jclass, jint aFontHandle)
  1252   (JNIEnv* aJniEnv , jclass, jint aFontHandle)
  1253 {
  1253 {
  1254     jint ascent = 0;
  1254     jint ascent = 0;
  1255     GFX_TRY
  1255     GFX_TRY
  1256     {
  1256     {
  1257         GFX_LOG_JNI_CALL();
  1257         SWT_LOG_JNI_CALL();
  1258         HANDLE_TO_POINTER(QFont*, font, aFontHandle);
  1258         HANDLE_TO_POINTER(QFont*, font, aFontHandle);
  1259         QFontMetrics fm(*font);
  1259         QFontMetrics fm(*font);
  1260         ascent = static_cast<jint>( fm.ascent() );
  1260         ascent = static_cast<jint>( fm.ascent() );
  1261     }
  1261     }
  1262     GFX_CATCH
  1262     GFX_CATCH
  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 }
  1322   (JNIEnv* aJniEnv , jclass, jint aFontHandle)
  1322   (JNIEnv* aJniEnv , jclass, jint aFontHandle)
  1323 {
  1323 {
  1324     jint descent = 0;
  1324     jint descent = 0;
  1325     GFX_TRY
  1325     GFX_TRY
  1326     {
  1326     {
  1327         GFX_LOG_JNI_CALL();
  1327         SWT_LOG_JNI_CALL();
  1328         HANDLE_TO_POINTER(QFont*, font, aFontHandle); 
  1328         HANDLE_TO_POINTER(QFont*, font, aFontHandle);
  1329         QFontMetrics fm(*font);
  1329         QFontMetrics fm(*font);
  1330         descent = static_cast<jint>( fm.descent() );
  1330         descent = static_cast<jint>( fm.descent() );
  1331     }
  1331     }
  1332     GFX_CATCH
  1332     GFX_CATCH
  1333     return descent;
  1333     return descent;
  1335 
  1335 
  1336 jint JNICALL Java_org_eclipse_swt_internal_qt_graphics_OS_fontUtils_1getStringWidth
  1336 jint JNICALL Java_org_eclipse_swt_internal_qt_graphics_OS_fontUtils_1getStringWidth
  1337   (JNIEnv* aJniEnv , jclass, jint aFontHandle, jstring aStr)
  1337   (JNIEnv* aJniEnv , jclass, jint aFontHandle, jstring aStr)
  1338 {
  1338 {
  1339     int strWidth = 0;
  1339     int strWidth = 0;
  1340     GFX_TRY 
  1340     GFX_TRY
  1341     {
  1341     {
  1342         GFX_LOG_JNI_CALL();
  1342         SWT_LOG_JNI_CALL();
  1343         HANDLE_TO_POINTER(QFont*, font, aFontHandle); 
  1343         HANDLE_TO_POINTER(QFont*, font, aFontHandle);
  1344         QString string = swtApp->jniUtils().JavaStringToQString(aJniEnv,  aStr);
  1344         QString string = swtApp->jniUtils().JavaStringToQString(aJniEnv,  aStr);
  1345         QFontMetrics fm(*font);
  1345         QFontMetrics fm(*font);
  1346         strWidth = fm.width(string);
  1346         strWidth = fm.width(string);
  1347     }
  1347     }
  1348     GFX_CATCH
  1348     GFX_CATCH
  1357   (JNIEnv* aJniEnv , jclass)
  1357   (JNIEnv* aJniEnv , jclass)
  1358 {
  1358 {
  1359     Buffer* buffer = 0;
  1359     Buffer* buffer = 0;
  1360     GFX_TRY
  1360     GFX_TRY
  1361     {
  1361     {
  1362         GFX_LOG_JNI_CALL();
  1362         SWT_LOG_JNI_CALL();
  1363         buffer = GraphicsFactory::createBuffer();
  1363         buffer = GraphicsFactory::createBuffer();
  1364     }
  1364     }
  1365     GFX_CATCH
  1365     GFX_CATCH
  1366     return POINTER_TO_HANDLE(buffer);
  1366     return POINTER_TO_HANDLE(buffer);
  1367 }
  1367 }
  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     }
  1406 {
  1408 {
  1407     WindowSurface* surface = 0;
  1409     WindowSurface* surface = 0;
  1408     HANDLE_TO_POINTER(QWidget*, widget, aHandle);
  1410     HANDLE_TO_POINTER(QWidget*, widget, aHandle);
  1409     GFX_TRY
  1411     GFX_TRY
  1410     {
  1412     {
  1411         GFX_LOG_JNI_CALL();
  1413         SWT_LOG_JNI_CALL();
  1412         surface = GraphicsFactory::createWindowSurface(widget, aAutoRefresh);
  1414         surface = GraphicsFactory::createWindowSurface(widget, aAutoRefresh);
  1413     }
  1415     }
  1414     GFX_CATCH
  1416     GFX_CATCH
  1415 
  1417 
  1416     return POINTER_TO_HANDLE(surface);
  1418     return POINTER_TO_HANDLE(surface);
  1419   (JNIEnv* aJniEnv, jclass, jint aHandle, jint aX, jint aY, jint aWidth, jint aHeight)
  1421   (JNIEnv* aJniEnv, jclass, jint aHandle, jint aX, jint aY, jint aWidth, jint aHeight)
  1420 {
  1422 {
  1421     HANDLE_TO_POINTER(WindowSurface*, wsurf, aHandle);
  1423     HANDLE_TO_POINTER(WindowSurface*, wsurf, aHandle);
  1422     GFX_TRY
  1424     GFX_TRY
  1423     {
  1425     {
  1424         GFX_LOG_JNI_CALL();
  1426         SWT_LOG_JNI_CALL();
  1425         wsurf->beginPaint(aX, aY, aWidth, aHeight);
  1427         wsurf->beginPaint(aX, aY, aWidth, aHeight);
  1426     }
  1428     }
  1427     GFX_CATCH
  1429     GFX_CATCH
  1428 }
  1430 }
  1429 
  1431 
  1431   (JNIEnv* aJniEnv, jclass, jint aHandle)
  1433   (JNIEnv* aJniEnv, jclass, jint aHandle)
  1432 {
  1434 {
  1433     HANDLE_TO_POINTER(WindowSurface*, wsurf, aHandle);
  1435     HANDLE_TO_POINTER(WindowSurface*, wsurf, aHandle);
  1434     GFX_TRY
  1436     GFX_TRY
  1435     {
  1437     {
  1436         GFX_LOG_JNI_CALL();
  1438         SWT_LOG_JNI_CALL();
  1437         wsurf->endPaint();
  1439         wsurf->endPaint();
  1438     }
  1440     }
  1439     GFX_CATCH
  1441     GFX_CATCH
  1440 }
  1442 }
  1441 
  1443 
  1443   (JNIEnv* aJniEnv, jclass, jint aHandle)
  1445   (JNIEnv* aJniEnv, jclass, jint aHandle)
  1444 {
  1446 {
  1445     HANDLE_TO_POINTER(WindowSurface*, wsurf, aHandle);
  1447     HANDLE_TO_POINTER(WindowSurface*, wsurf, aHandle);
  1446     GFX_TRY
  1448     GFX_TRY
  1447     {
  1449     {
  1448         GFX_LOG_JNI_CALL();
  1450         SWT_LOG_JNI_CALL();
  1449         wsurf->flush();
  1451         wsurf->flush();
  1450     }
  1452     }
  1451     GFX_CATCH
  1453     GFX_CATCH
  1452 }
  1454 }
  1453 
  1455 
  1455   (JNIEnv* aJniEnv , jclass, jint aHandle)
  1457   (JNIEnv* aJniEnv , jclass, jint aHandle)
  1456 {
  1458 {
  1457     jint type = 0;
  1459     jint type = 0;
  1458     GFX_TRY
  1460     GFX_TRY
  1459     {
  1461     {
       
  1462         SWT_LOG_JNI_CALL();
  1460         HANDLE_TO_POINTER(WindowSurface*, wsurf, aHandle);
  1463         HANDLE_TO_POINTER(WindowSurface*, wsurf, aHandle);
  1461         type = static_cast<jint>( wsurf->getType() );
  1464         type = static_cast<jint>( wsurf->getType() );
  1462     }
  1465     }
  1463     GFX_CATCH
  1466     GFX_CATCH
  1464     return type;
  1467     return type;
  1467 void JNICALL Java_org_eclipse_swt_internal_qt_graphics_OS_windowsurface_1dispose
  1470 void JNICALL Java_org_eclipse_swt_internal_qt_graphics_OS_windowsurface_1dispose
  1468   (JNIEnv* aJniEnv , jclass, jint aHandle)
  1471   (JNIEnv* aJniEnv , jclass, jint aHandle)
  1469 {
  1472 {
  1470     GFX_TRY
  1473     GFX_TRY
  1471     {
  1474     {
       
  1475         SWT_LOG_JNI_CALL();
  1472         HANDLE_TO_POINTER(WindowSurface*, wsurf, aHandle);
  1476         HANDLE_TO_POINTER(WindowSurface*, wsurf, aHandle);
  1473         wsurf->dispose();       
  1477         wsurf->dispose();
  1474     }
  1478     }
  1475     GFX_CATCH
  1479     GFX_CATCH
  1476 }
  1480 }
  1477 
  1481 
  1478 void JNICALL Java_org_eclipse_swt_internal_qt_graphics_OS_windowsurface_1refresh
  1482 void JNICALL Java_org_eclipse_swt_internal_qt_graphics_OS_windowsurface_1refresh
  1479   (JNIEnv* aJniEnv, jclass, jint aHandle)
  1483   (JNIEnv* aJniEnv, jclass, jint aHandle)
  1480 {
  1484 {
  1481     GFX_TRY
  1485     GFX_TRY
  1482     {
  1486     {
       
  1487         SWT_LOG_JNI_CALL();
  1483         HANDLE_TO_POINTER(WindowSurface*, wsurf, aHandle);
  1488         HANDLE_TO_POINTER(WindowSurface*, wsurf, aHandle);
  1484         wsurf->refresh();       
  1489         wsurf->refresh();
  1485     }
  1490     }
  1486     GFX_CATCH 
  1491     GFX_CATCH
  1487 }
  1492 }
  1488 
  1493 
  1489 
  1494 void JNICALL Java_org_eclipse_swt_internal_qt_graphics_OS_windowsurface_1handleSymbianWindowVisibilityChange
  1490 
  1495   (JNIEnv* aJniEnv, jclass, jint aHandle, jboolean aVisible)
  1491 
  1496 {
       
  1497     GFX_TRY
       
  1498     {
       
  1499         SWT_LOG_JNI_CALL();
       
  1500         HANDLE_TO_POINTER(WindowSurface*, wsurf, aHandle);
       
  1501         wsurf->handleSymbianWindowVisibilityChange(aVisible);
       
  1502     }
       
  1503     GFX_CATCH
       
  1504 }