diff options
author | Nikita Nemkin | 2019-03-16 16:35:41 +0000 |
---|---|---|
committer | Lars Vogel | 2019-04-12 10:01:40 +0000 |
commit | 89d6547ac4be96fb55fcfc0b3291fd425ec2b298 (patch) | |
tree | 491e86426e09770293cb2fe83e88c29119a3a390 | |
parent | 2dd565eed15989d73fd99f85ec687502d2ea96cd (diff) | |
download | eclipse.platform.swt-89d6547ac4be96fb55fcfc0b3291fd425ec2b298.tar.gz eclipse.platform.swt-89d6547ac4be96fb55fcfc0b3291fd425ec2b298.tar.xz eclipse.platform.swt-89d6547ac4be96fb55fcfc0b3291fd425ec2b298.zip |
Bug 545854 - [Win32] Drop custom JNI code for GDI+ interop
Custom code for point and color conversion is unnecessary, because
Color/Point/PointF are binary compatible with primitive arrays.
GDI+ Color is a thin wrapper around DWORD, use plain int for interop.
Change-Id: If586f3772c4409e4f7583e497552ca6b54d71138
Signed-off-by: Nikita Nemkin <nikita@nemkin.ru>
8 files changed, 302 insertions, 452 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/gdip.cpp b/bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/gdip.cpp index 672b83d051..b31aa2b56d 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/gdip.cpp +++ b/bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/gdip.cpp @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2016 IBM Corporation and others. + * Copyright (c) 2000, 2019 IBM Corporation and others. * * This program and the accompanying materials * are made available under the terms of the Eclipse Public License 2.0 @@ -48,15 +48,15 @@ JNIEXPORT jintLong JNICALL Gdip_NATIVE(BitmapData_1new) #endif #ifndef NO_Bitmap_1GetHBITMAP -extern "C" JNIEXPORT jint JNICALL Gdip_NATIVE(Bitmap_1GetHBITMAP)(JNIEnv *env, jclass that, jintLong arg0, jintLong arg1, jintLongArray arg2); +extern "C" JNIEXPORT jint JNICALL Gdip_NATIVE(Bitmap_1GetHBITMAP)(JNIEnv *env, jclass that, jintLong arg0, jint arg1, jintLongArray arg2); JNIEXPORT jint JNICALL Gdip_NATIVE(Bitmap_1GetHBITMAP) - (JNIEnv *env, jclass that, jintLong arg0, jintLong arg1, jintLongArray arg2) + (JNIEnv *env, jclass that, jintLong arg0, jint arg1, jintLongArray arg2) { jintLong *lparg2=NULL; jint rc = 0; Gdip_NATIVE_ENTER(env, that, Bitmap_1GetHBITMAP_FUNC); if (arg2) if ((lparg2 = env->GetIntLongArrayElements(arg2, NULL)) == NULL) goto fail; - rc = (jint)((Bitmap*)arg0)->GetHBITMAP(*(Color*)arg1, (HBITMAP*)lparg2); + rc = (jint)((Bitmap*)arg0)->GetHBITMAP((Color)arg1, (HBITMAP*)lparg2); fail: if (arg2 && lparg2) env->ReleaseIntLongArrayElements(arg2, lparg2, 0); Gdip_NATIVE_EXIT(env, that, Bitmap_1GetHBITMAP_FUNC); @@ -249,30 +249,6 @@ JNIEXPORT jint JNICALL Gdip_NATIVE(ColorPalette_1sizeof) } #endif -#ifndef NO_Color_1delete -extern "C" JNIEXPORT void JNICALL Gdip_NATIVE(Color_1delete)(JNIEnv *env, jclass that, jintLong arg0); -JNIEXPORT void JNICALL Gdip_NATIVE(Color_1delete) - (JNIEnv *env, jclass that, jintLong arg0) -{ - Gdip_NATIVE_ENTER(env, that, Color_1delete_FUNC); - delete (Color *)arg0; - Gdip_NATIVE_EXIT(env, that, Color_1delete_FUNC); -} -#endif - -#ifndef NO_Color_1new -extern "C" JNIEXPORT jintLong JNICALL Gdip_NATIVE(Color_1new)(JNIEnv *env, jclass that, jint arg0); -JNIEXPORT jintLong JNICALL Gdip_NATIVE(Color_1new) - (JNIEnv *env, jclass that, jint arg0) -{ - jintLong rc = 0; - Gdip_NATIVE_ENTER(env, that, Color_1new_FUNC); - rc = (jintLong)new Color((ARGB)arg0); - Gdip_NATIVE_EXIT(env, that, Color_1new_FUNC); - return rc; -} -#endif - #ifndef NO_FontFamily_1GetFamilyName extern "C" JNIEXPORT jint JNICALL Gdip_NATIVE(FontFamily_1GetFamilyName)(JNIEnv *env, jclass that, jintLong arg0, jcharArray arg1, jchar arg2); JNIEXPORT jint JNICALL Gdip_NATIVE(FontFamily_1GetFamilyName) @@ -717,6 +693,23 @@ fail: } #endif +#ifndef NO_GraphicsPath_1GetPathPoints +extern "C" JNIEXPORT jint JNICALL Gdip_NATIVE(GraphicsPath_1GetPathPoints)(JNIEnv *env, jclass that, jintLong arg0, jfloatArray arg1, jint arg2); +JNIEXPORT jint JNICALL Gdip_NATIVE(GraphicsPath_1GetPathPoints) + (JNIEnv *env, jclass that, jintLong arg0, jfloatArray arg1, jint arg2) +{ + jfloat *lparg1=NULL; + jint rc = 0; + Gdip_NATIVE_ENTER(env, that, GraphicsPath_1GetPathPoints_FUNC); + if (arg1) if ((lparg1 = env->GetFloatArrayElements(arg1, NULL)) == NULL) goto fail; + rc = (jint)((GraphicsPath *)arg0)->GetPathPoints((PointF *)lparg1, arg2); +fail: + if (arg1 && lparg1) env->ReleaseFloatArrayElements(arg1, lparg1, 0); + Gdip_NATIVE_EXIT(env, that, GraphicsPath_1GetPathPoints_FUNC); + return rc; +} +#endif + #ifndef NO_GraphicsPath_1GetPathTypes extern "C" JNIEXPORT jint JNICALL Gdip_NATIVE(GraphicsPath_1GetPathTypes)(JNIEnv *env, jclass that, jintLong arg0, jbyteArray arg1, jint arg2); JNIEXPORT jint JNICALL Gdip_NATIVE(GraphicsPath_1GetPathTypes) @@ -836,6 +829,26 @@ JNIEXPORT jintLong JNICALL Gdip_NATIVE(GraphicsPath_1new__I) } #endif +#ifndef NO_GraphicsPath_1new___3I_3BII +extern "C" JNIEXPORT jintLong JNICALL Gdip_NATIVE(GraphicsPath_1new___3I_3BII)(JNIEnv *env, jclass that, jintArray arg0, jbyteArray arg1, jint arg2, jint arg3); +JNIEXPORT jintLong JNICALL Gdip_NATIVE(GraphicsPath_1new___3I_3BII) + (JNIEnv *env, jclass that, jintArray arg0, jbyteArray arg1, jint arg2, jint arg3) +{ + jint *lparg0=NULL; + jbyte *lparg1=NULL; + jintLong rc = 0; + Gdip_NATIVE_ENTER(env, that, GraphicsPath_1new___3I_3BII_FUNC); + if (arg0) if ((lparg0 = env->GetIntArrayElements(arg0, NULL)) == NULL) goto fail; + if (arg1) if ((lparg1 = env->GetByteArrayElements(arg1, NULL)) == NULL) goto fail; + rc = (jintLong)new GraphicsPath((const Point *)lparg0, (const BYTE *)lparg1, arg2, (FillMode)arg3); +fail: + if (arg1 && lparg1) env->ReleaseByteArrayElements(arg1, lparg1, JNI_ABORT); + if (arg0 && lparg0) env->ReleaseIntArrayElements(arg0, lparg0, JNI_ABORT); + Gdip_NATIVE_EXIT(env, that, GraphicsPath_1new___3I_3BII_FUNC); + return rc; +} +#endif + #ifndef NO_Graphics_1DrawArc extern "C" JNIEXPORT jint JNICALL Gdip_NATIVE(Graphics_1DrawArc)(JNIEnv *env, jclass that, jintLong arg0, jintLong arg1, jint arg2, jint arg3, jint arg4, jint arg5, jfloat arg6, jfloat arg7); JNIEXPORT jint JNICALL Gdip_NATIVE(Graphics_1DrawArc) @@ -878,6 +891,35 @@ fail: } #endif +#if (!defined(NO_Graphics_1DrawDriverString__IIIII_3FII) && !defined(JNI64)) || (!defined(NO_Graphics_1DrawDriverString__JJIJJ_3FIJ) && defined(JNI64)) +#ifndef JNI64 +extern "C" JNIEXPORT jint JNICALL Gdip_NATIVE(Graphics_1DrawDriverString__IIIII_3FII)(JNIEnv *env, jclass that, jintLong arg0, jintLong arg1, jint arg2, jintLong arg3, jintLong arg4, jfloatArray arg5, jint arg6, jintLong arg7); +JNIEXPORT jint JNICALL Gdip_NATIVE(Graphics_1DrawDriverString__IIIII_3FII)(JNIEnv *env, jclass that, jintLong arg0, jintLong arg1, jint arg2, jintLong arg3, jintLong arg4, jfloatArray arg5, jint arg6, jintLong arg7) +#else +extern "C" JNIEXPORT jint JNICALL Gdip_NATIVE(Graphics_1DrawDriverString__JJIJJ_3FIJ)(JNIEnv *env, jclass that, jintLong arg0, jintLong arg1, jint arg2, jintLong arg3, jintLong arg4, jfloatArray arg5, jint arg6, jintLong arg7); +JNIEXPORT jint JNICALL Gdip_NATIVE(Graphics_1DrawDriverString__JJIJJ_3FIJ)(JNIEnv *env, jclass that, jintLong arg0, jintLong arg1, jint arg2, jintLong arg3, jintLong arg4, jfloatArray arg5, jint arg6, jintLong arg7) +#endif +{ + jfloat *lparg5=NULL; + jint rc = 0; +#ifndef JNI64 + Gdip_NATIVE_ENTER(env, that, Graphics_1DrawDriverString__IIIII_3FII_FUNC); +#else + Gdip_NATIVE_ENTER(env, that, Graphics_1DrawDriverString__JJIJJ_3FIJ_FUNC); +#endif + if (arg5) if ((lparg5 = env->GetFloatArrayElements(arg5, NULL)) == NULL) goto fail; + rc = (jint)((Graphics *)arg0)->DrawDriverString((const UINT16 *)arg1, arg2, (const Font *)arg3, (const Brush *)arg4, (const PointF *)lparg5, arg6, (const Matrix *)arg7); +fail: + if (arg5 && lparg5) env->ReleaseFloatArrayElements(arg5, lparg5, JNI_ABORT); +#ifndef JNI64 + Gdip_NATIVE_EXIT(env, that, Graphics_1DrawDriverString__IIIII_3FII_FUNC); +#else + Gdip_NATIVE_EXIT(env, that, Graphics_1DrawDriverString__JJIJJ_3FIJ_FUNC); +#endif + return rc; +} +#endif + #ifndef NO_Graphics_1DrawEllipse extern "C" JNIEXPORT jint JNICALL Gdip_NATIVE(Graphics_1DrawEllipse)(JNIEnv *env, jclass that, jintLong arg0, jintLong arg1, jint arg2, jint arg3, jint arg4, jint arg5); JNIEXPORT jint JNICALL Gdip_NATIVE(Graphics_1DrawEllipse) @@ -958,6 +1000,23 @@ JNIEXPORT jint JNICALL Gdip_NATIVE(Graphics_1DrawLine) } #endif +#ifndef NO_Graphics_1DrawLines +extern "C" JNIEXPORT jint JNICALL Gdip_NATIVE(Graphics_1DrawLines)(JNIEnv *env, jclass that, jintLong arg0, jintLong arg1, jintArray arg2, jint arg3); +JNIEXPORT jint JNICALL Gdip_NATIVE(Graphics_1DrawLines) + (JNIEnv *env, jclass that, jintLong arg0, jintLong arg1, jintArray arg2, jint arg3) +{ + jint *lparg2=NULL; + jint rc = 0; + Gdip_NATIVE_ENTER(env, that, Graphics_1DrawLines_FUNC); + if (arg2) if ((lparg2 = env->GetIntArrayElements(arg2, NULL)) == NULL) goto fail; + rc = (jint)((Graphics *)arg0)->DrawLines((Pen *)arg1, (const Point *)lparg2, (INT)arg3); +fail: + if (arg2 && lparg2) env->ReleaseIntArrayElements(arg2, lparg2, JNI_ABORT); + Gdip_NATIVE_EXIT(env, that, Graphics_1DrawLines_FUNC); + return rc; +} +#endif + #ifndef NO_Graphics_1DrawPath extern "C" JNIEXPORT jint JNICALL Gdip_NATIVE(Graphics_1DrawPath)(JNIEnv *env, jclass that, jintLong arg0, jintLong arg1, jintLong arg2); JNIEXPORT jint JNICALL Gdip_NATIVE(Graphics_1DrawPath) @@ -971,6 +1030,23 @@ JNIEXPORT jint JNICALL Gdip_NATIVE(Graphics_1DrawPath) } #endif +#ifndef NO_Graphics_1DrawPolygon +extern "C" JNIEXPORT jint JNICALL Gdip_NATIVE(Graphics_1DrawPolygon)(JNIEnv *env, jclass that, jintLong arg0, jintLong arg1, jintArray arg2, jint arg3); +JNIEXPORT jint JNICALL Gdip_NATIVE(Graphics_1DrawPolygon) + (JNIEnv *env, jclass that, jintLong arg0, jintLong arg1, jintArray arg2, jint arg3) +{ + jint *lparg2=NULL; + jint rc = 0; + Gdip_NATIVE_ENTER(env, that, Graphics_1DrawPolygon_FUNC); + if (arg2) if ((lparg2 = env->GetIntArrayElements(arg2, NULL)) == NULL) goto fail; + rc = (jint)((Graphics *)arg0)->DrawPolygon((Pen *)arg1, (Point *)lparg2, (INT)arg3); +fail: + if (arg2 && lparg2) env->ReleaseIntArrayElements(arg2, lparg2, 0); + Gdip_NATIVE_EXIT(env, that, Graphics_1DrawPolygon_FUNC); + return rc; +} +#endif + #ifndef NO_Graphics_1DrawRectangle extern "C" JNIEXPORT jint JNICALL Gdip_NATIVE(Graphics_1DrawRectangle)(JNIEnv *env, jclass that, jintLong arg0, jintLong arg1, jint arg2, jint arg3, jint arg4, jint arg5); JNIEXPORT jint JNICALL Gdip_NATIVE(Graphics_1DrawRectangle) @@ -1087,6 +1163,23 @@ JNIEXPORT jint JNICALL Gdip_NATIVE(Graphics_1FillPie) } #endif +#ifndef NO_Graphics_1FillPolygon +extern "C" JNIEXPORT jint JNICALL Gdip_NATIVE(Graphics_1FillPolygon)(JNIEnv *env, jclass that, jintLong arg0, jintLong arg1, jintArray arg2, jint arg3, jint arg4); +JNIEXPORT jint JNICALL Gdip_NATIVE(Graphics_1FillPolygon) + (JNIEnv *env, jclass that, jintLong arg0, jintLong arg1, jintArray arg2, jint arg3, jint arg4) +{ + jint *lparg2=NULL; + jint rc = 0; + Gdip_NATIVE_ENTER(env, that, Graphics_1FillPolygon_FUNC); + if (arg2) if ((lparg2 = env->GetIntArrayElements(arg2, NULL)) == NULL) goto fail; + rc = (jint)((Graphics *)arg0)->FillPolygon((Brush *)arg1, (const Point *)lparg2, (INT)arg3, (FillMode)arg4); +fail: + if (arg2 && lparg2) env->ReleaseIntArrayElements(arg2, lparg2, JNI_ABORT); + Gdip_NATIVE_EXIT(env, that, Graphics_1FillPolygon_FUNC); + return rc; +} +#endif + #ifndef NO_Graphics_1FillRectangle extern "C" JNIEXPORT jint JNICALL Gdip_NATIVE(Graphics_1FillRectangle)(JNIEnv *env, jclass that, jintLong arg0, jintLong arg1, jint arg2, jint arg3, jint arg4, jint arg5); JNIEXPORT jint JNICALL Gdip_NATIVE(Graphics_1FillRectangle) @@ -1264,6 +1357,26 @@ fail: } #endif +#ifndef NO_Graphics_1MeasureDriverString +extern "C" JNIEXPORT jint JNICALL Gdip_NATIVE(Graphics_1MeasureDriverString)(JNIEnv *env, jclass that, jintLong arg0, jintLong arg1, jint arg2, jintLong arg3, jfloatArray arg4, jint arg5, jintLong arg6, jobject arg7); +JNIEXPORT jint JNICALL Gdip_NATIVE(Graphics_1MeasureDriverString) + (JNIEnv *env, jclass that, jintLong arg0, jintLong arg1, jint arg2, jintLong arg3, jfloatArray arg4, jint arg5, jintLong arg6, jobject arg7) +{ + jfloat *lparg4=NULL; + RectF _arg7, *lparg7=NULL; + jint rc = 0; + Gdip_NATIVE_ENTER(env, that, Graphics_1MeasureDriverString_FUNC); + if (arg4) if ((lparg4 = env->GetFloatArrayElements(arg4, NULL)) == NULL) goto fail; + if (arg7) if ((lparg7 = getRectFFields(env, arg7, &_arg7)) == NULL) goto fail; + rc = (jint)((Graphics *)arg0)->MeasureDriverString((const UINT16 *)arg1, arg2, (Font *)arg3, (const PointF *)lparg4, arg5, (const Matrix *)arg6, lparg7); +fail: + if (arg7 && lparg7) setRectFFields(env, arg7, lparg7); + if (arg4 && lparg4) env->ReleaseFloatArrayElements(arg4, lparg4, JNI_ABORT); + Gdip_NATIVE_EXIT(env, that, Graphics_1MeasureDriverString_FUNC); + return rc; +} +#endif + #if (!defined(NO_Graphics_1MeasureString__I_3CIILorg_eclipse_swt_internal_gdip_PointF_2ILorg_eclipse_swt_internal_gdip_RectF_2) && !defined(JNI64)) || (!defined(NO_Graphics_1MeasureString__J_3CIJLorg_eclipse_swt_internal_gdip_PointF_2JLorg_eclipse_swt_internal_gdip_RectF_2) && defined(JNI64)) #ifndef JNI64 extern "C" JNIEXPORT jint JNICALL Gdip_NATIVE(Graphics_1MeasureString__I_3CIILorg_eclipse_swt_internal_gdip_PointF_2ILorg_eclipse_swt_internal_gdip_RectF_2)(JNIEnv *env, jclass that, jintLong arg0, jcharArray arg1, jint arg2, jintLong arg3, jobject arg4, jintLong arg5, jobject arg6); @@ -1641,13 +1754,13 @@ JNIEXPORT void JNICALL Gdip_NATIVE(HatchBrush_1delete) #endif #ifndef NO_HatchBrush_1new -extern "C" JNIEXPORT jintLong JNICALL Gdip_NATIVE(HatchBrush_1new)(JNIEnv *env, jclass that, jint arg0, jintLong arg1, jintLong arg2); +extern "C" JNIEXPORT jintLong JNICALL Gdip_NATIVE(HatchBrush_1new)(JNIEnv *env, jclass that, jint arg0, jint arg1, jint arg2); JNIEXPORT jintLong JNICALL Gdip_NATIVE(HatchBrush_1new) - (JNIEnv *env, jclass that, jint arg0, jintLong arg1, jintLong arg2) + (JNIEnv *env, jclass that, jint arg0, jint arg1, jint arg2) { jintLong rc = 0; Gdip_NATIVE_ENTER(env, that, HatchBrush_1new_FUNC); - rc = (jintLong)new HatchBrush((HatchStyle)arg0, *(Color *)arg1, *(Color *)arg2); + rc = (jintLong)new HatchBrush((HatchStyle)arg0, (Color)arg1, (Color)arg2); Gdip_NATIVE_EXIT(env, that, HatchBrush_1new_FUNC); return rc; } @@ -1811,6 +1924,26 @@ JNIEXPORT jint JNICALL Gdip_NATIVE(LinearGradientBrush_1ScaleTransform) } #endif +#ifndef NO_LinearGradientBrush_1SetInterpolationColors +extern "C" JNIEXPORT jint JNICALL Gdip_NATIVE(LinearGradientBrush_1SetInterpolationColors)(JNIEnv *env, jclass that, jintLong arg0, jintArray arg1, jfloatArray arg2, jint arg3); +JNIEXPORT jint JNICALL Gdip_NATIVE(LinearGradientBrush_1SetInterpolationColors) + (JNIEnv *env, jclass that, jintLong arg0, jintArray arg1, jfloatArray arg2, jint arg3) +{ + jint *lparg1=NULL; + jfloat *lparg2=NULL; + jint rc = 0; + Gdip_NATIVE_ENTER(env, that, LinearGradientBrush_1SetInterpolationColors_FUNC); + if (arg1) if ((lparg1 = env->GetIntArrayElements(arg1, NULL)) == NULL) goto fail; + if (arg2) if ((lparg2 = env->GetFloatArrayElements(arg2, NULL)) == NULL) goto fail; + rc = (jint)((LinearGradientBrush *)arg0)->SetInterpolationColors((const Color *)lparg1, (const REAL *)lparg2, arg3); +fail: + if (arg2 && lparg2) env->ReleaseFloatArrayElements(arg2, lparg2, JNI_ABORT); + if (arg1 && lparg1) env->ReleaseIntArrayElements(arg1, lparg1, JNI_ABORT); + Gdip_NATIVE_EXIT(env, that, LinearGradientBrush_1SetInterpolationColors_FUNC); + return rc; +} +#endif + #ifndef NO_LinearGradientBrush_1SetWrapMode extern "C" JNIEXPORT jint JNICALL Gdip_NATIVE(LinearGradientBrush_1SetWrapMode)(JNIEnv *env, jclass that, jintLong arg0, jint arg1); JNIEXPORT jint JNICALL Gdip_NATIVE(LinearGradientBrush_1SetWrapMode) @@ -1849,9 +1982,9 @@ JNIEXPORT void JNICALL Gdip_NATIVE(LinearGradientBrush_1delete) #endif #ifndef NO_LinearGradientBrush_1new -extern "C" JNIEXPORT jintLong JNICALL Gdip_NATIVE(LinearGradientBrush_1new)(JNIEnv *env, jclass that, jobject arg0, jobject arg1, jintLong arg2, jintLong arg3); +extern "C" JNIEXPORT jintLong JNICALL Gdip_NATIVE(LinearGradientBrush_1new)(JNIEnv *env, jclass that, jobject arg0, jobject arg1, jint arg2, jint arg3); JNIEXPORT jintLong JNICALL Gdip_NATIVE(LinearGradientBrush_1new) - (JNIEnv *env, jclass that, jobject arg0, jobject arg1, jintLong arg2, jintLong arg3) + (JNIEnv *env, jclass that, jobject arg0, jobject arg1, jint arg2, jint arg3) { PointF _arg0, *lparg0=NULL; PointF _arg1, *lparg1=NULL; @@ -1859,7 +1992,7 @@ JNIEXPORT jintLong JNICALL Gdip_NATIVE(LinearGradientBrush_1new) Gdip_NATIVE_ENTER(env, that, LinearGradientBrush_1new_FUNC); if (arg0) if ((lparg0 = getPointFFields(env, arg0, &_arg0)) == NULL) goto fail; if (arg1) if ((lparg1 = getPointFFields(env, arg1, &_arg1)) == NULL) goto fail; - rc = (jintLong)new LinearGradientBrush(*lparg0, *lparg1, *(Color *)arg2, *(Color *)arg3); + rc = (jintLong)new LinearGradientBrush(*lparg0, *lparg1, (Color)arg2, (Color)arg3); fail: if (arg1 && lparg1) setPointFFields(env, arg1, lparg1); if (arg0 && lparg0) setPointFFields(env, arg0, lparg0); @@ -2005,6 +2138,35 @@ fail: } #endif +#if (!defined(NO_Matrix_1TransformPoints__I_3FI) && !defined(JNI64)) || (!defined(NO_Matrix_1TransformPoints__J_3FI) && defined(JNI64)) +#ifndef JNI64 +extern "C" JNIEXPORT jint JNICALL Gdip_NATIVE(Matrix_1TransformPoints__I_3FI)(JNIEnv *env, jclass that, jintLong arg0, jfloatArray arg1, jint arg2); +JNIEXPORT jint JNICALL Gdip_NATIVE(Matrix_1TransformPoints__I_3FI)(JNIEnv *env, jclass that, jintLong arg0, jfloatArray arg1, jint arg2) +#else +extern "C" JNIEXPORT jint JNICALL Gdip_NATIVE(Matrix_1TransformPoints__J_3FI)(JNIEnv *env, jclass that, jintLong arg0, jfloatArray arg1, jint arg2); +JNIEXPORT jint JNICALL Gdip_NATIVE(Matrix_1TransformPoints__J_3FI)(JNIEnv *env, jclass that, jintLong arg0, jfloatArray arg1, jint arg2) +#endif +{ + jfloat *lparg1=NULL; + jint rc = 0; +#ifndef JNI64 + Gdip_NATIVE_ENTER(env, that, Matrix_1TransformPoints__I_3FI_FUNC); +#else + Gdip_NATIVE_ENTER(env, that, Matrix_1TransformPoints__J_3FI_FUNC); +#endif + if (arg1) if ((lparg1 = env->GetFloatArrayElements(arg1, NULL)) == NULL) goto fail; + rc = (jint)((Matrix *)arg0)->TransformPoints((PointF *)lparg1, arg2); +fail: + if (arg1 && lparg1) env->ReleaseFloatArrayElements(arg1, lparg1, 0); +#ifndef JNI64 + Gdip_NATIVE_EXIT(env, that, Matrix_1TransformPoints__I_3FI_FUNC); +#else + Gdip_NATIVE_EXIT(env, that, Matrix_1TransformPoints__J_3FI_FUNC); +#endif + return rc; +} +#endif + #ifndef NO_Matrix_1TransformVectors extern "C" JNIEXPORT jint JNICALL Gdip_NATIVE(Matrix_1TransformVectors)(JNIEnv *env, jclass that, jintLong arg0, jobject arg1, jint arg2); JNIEXPORT jint JNICALL Gdip_NATIVE(Matrix_1TransformVectors) @@ -2110,13 +2272,13 @@ fail: #endif #ifndef NO_PathGradientBrush_1SetCenterColor -extern "C" JNIEXPORT jint JNICALL Gdip_NATIVE(PathGradientBrush_1SetCenterColor)(JNIEnv *env, jclass that, jintLong arg0, jintLong arg1); +extern "C" JNIEXPORT jint JNICALL Gdip_NATIVE(PathGradientBrush_1SetCenterColor)(JNIEnv *env, jclass that, jintLong arg0, jint arg1); JNIEXPORT jint JNICALL Gdip_NATIVE(PathGradientBrush_1SetCenterColor) - (JNIEnv *env, jclass that, jintLong arg0, jintLong arg1) + (JNIEnv *env, jclass that, jintLong arg0, jint arg1) { jint rc = 0; Gdip_NATIVE_ENTER(env, that, PathGradientBrush_1SetCenterColor_FUNC); - rc = (jint)((PathGradientBrush *)arg0)->SetCenterColor(*(Color *)arg1); + rc = (jint)((PathGradientBrush *)arg0)->SetCenterColor((Color)arg1); Gdip_NATIVE_EXIT(env, that, PathGradientBrush_1SetCenterColor_FUNC); return rc; } @@ -2152,6 +2314,46 @@ JNIEXPORT jint JNICALL Gdip_NATIVE(PathGradientBrush_1SetGraphicsPath) } #endif +#ifndef NO_PathGradientBrush_1SetInterpolationColors +extern "C" JNIEXPORT jint JNICALL Gdip_NATIVE(PathGradientBrush_1SetInterpolationColors)(JNIEnv *env, jclass that, jintLong arg0, jintArray arg1, jfloatArray arg2, jint arg3); +JNIEXPORT jint JNICALL Gdip_NATIVE(PathGradientBrush_1SetInterpolationColors) + (JNIEnv *env, jclass that, jintLong arg0, jintArray arg1, jfloatArray arg2, jint arg3) +{ + jint *lparg1=NULL; + jfloat *lparg2=NULL; + jint rc = 0; + Gdip_NATIVE_ENTER(env, that, PathGradientBrush_1SetInterpolationColors_FUNC); + if (arg1) if ((lparg1 = env->GetIntArrayElements(arg1, NULL)) == NULL) goto fail; + if (arg2) if ((lparg2 = env->GetFloatArrayElements(arg2, NULL)) == NULL) goto fail; + rc = (jint)((PathGradientBrush *)arg0)->SetInterpolationColors((const Color *)lparg1, (const REAL *)lparg2, arg3); +fail: + if (arg2 && lparg2) env->ReleaseFloatArrayElements(arg2, lparg2, JNI_ABORT); + if (arg1 && lparg1) env->ReleaseIntArrayElements(arg1, lparg1, JNI_ABORT); + Gdip_NATIVE_EXIT(env, that, PathGradientBrush_1SetInterpolationColors_FUNC); + return rc; +} +#endif + +#ifndef NO_PathGradientBrush_1SetSurroundColors +extern "C" JNIEXPORT jint JNICALL Gdip_NATIVE(PathGradientBrush_1SetSurroundColors)(JNIEnv *env, jclass that, jintLong arg0, jintArray arg1, jintArray arg2); +JNIEXPORT jint JNICALL Gdip_NATIVE(PathGradientBrush_1SetSurroundColors) + (JNIEnv *env, jclass that, jintLong arg0, jintArray arg1, jintArray arg2) +{ + jint *lparg1=NULL; + jint *lparg2=NULL; + jint rc = 0; + Gdip_NATIVE_ENTER(env, that, PathGradientBrush_1SetSurroundColors_FUNC); + if (arg1) if ((lparg1 = env->GetIntArrayElements(arg1, NULL)) == NULL) goto fail; + if (arg2) if ((lparg2 = env->GetIntArrayElements(arg2, NULL)) == NULL) goto fail; + rc = (jint)((PathGradientBrush *)arg0)->SetSurroundColors((const Color *)lparg1, (INT *)lparg2); +fail: + if (arg2 && lparg2) env->ReleaseIntArrayElements(arg2, lparg2, 0); + if (arg1 && lparg1) env->ReleaseIntArrayElements(arg1, lparg1, JNI_ABORT); + Gdip_NATIVE_EXIT(env, that, PathGradientBrush_1SetSurroundColors_FUNC); + return rc; +} +#endif + #ifndef NO_PathGradientBrush_1SetWrapMode extern "C" JNIEXPORT jint JNICALL Gdip_NATIVE(PathGradientBrush_1SetWrapMode)(JNIEnv *env, jclass that, jintLong arg0, jint arg1); JNIEXPORT jint JNICALL Gdip_NATIVE(PathGradientBrush_1SetWrapMode) @@ -2499,13 +2701,13 @@ JNIEXPORT void JNICALL Gdip_NATIVE(SolidBrush_1delete) #endif #ifndef NO_SolidBrush_1new -extern "C" JNIEXPORT jintLong JNICALL Gdip_NATIVE(SolidBrush_1new)(JNIEnv *env, jclass that, jintLong arg0); +extern "C" JNIEXPORT jintLong JNICALL Gdip_NATIVE(SolidBrush_1new)(JNIEnv *env, jclass that, jint arg0); JNIEXPORT jintLong JNICALL Gdip_NATIVE(SolidBrush_1new) - (JNIEnv *env, jclass that, jintLong arg0) + (JNIEnv *env, jclass that, jint arg0) { jintLong rc = 0; Gdip_NATIVE_ENTER(env, that, SolidBrush_1new_FUNC); - rc = (jintLong)new SolidBrush(*(Color *)arg0); + rc = (jintLong)new SolidBrush((Color)arg0); Gdip_NATIVE_EXIT(env, that, SolidBrush_1new_FUNC); return rc; } diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/gdip_custom.cpp b/bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/gdip_custom.cpp index 502eb8630e..730ba7ebc5 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/gdip_custom.cpp +++ b/bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/gdip_custom.cpp @@ -16,340 +16,4 @@ #include "gdip_structs.h" #include "gdip_stats.h" -extern "C" { - #define Gdip_NATIVE(func) Java_org_eclipse_swt_internal_gdip_Gdip_##func - -#ifndef NO_Graphics_1DrawLines -JNIEXPORT jint JNICALL Gdip_NATIVE(Graphics_1DrawLines) - (JNIEnv *env, jclass that, jintLong arg0, jintLong arg1, jintArray arg2, jint arg3) -{ - Point *points=NULL; - jint *lparg2=NULL; - jint rc = 0; - Gdip_NATIVE_ENTER(env, that, Graphics_1DrawLines_FUNC); - if (arg2) if ((lparg2 = env->GetIntArrayElements(arg2, NULL)) == NULL) goto fail; - if (lparg2) { - points = new Point[arg3]; - for (int i=0, j=0; i<arg3; i++, j+=2) { - Point *point = new Point(lparg2[j], lparg2[j + 1]); - points[i] = *point; - delete point; - } - } - rc = (jint)((Graphics *)arg0)->DrawLines((Pen *)arg1, points, (INT)arg3); -fail: - if (lparg2 && points) delete[] points; - if (arg2 && lparg2) env->ReleaseIntArrayElements(arg2, lparg2, JNI_ABORT); - Gdip_NATIVE_EXIT(env, that, Graphics_1DrawLines_FUNC); - return rc; -} -#endif - -#ifndef NO_Graphics_1DrawPolygon -JNIEXPORT jint JNICALL Gdip_NATIVE(Graphics_1DrawPolygon) - (JNIEnv *env, jclass that, jintLong arg0, jintLong arg1, jintArray arg2, jint arg3) -{ - Point *points=NULL; - jint *lparg2=NULL; - jint rc = 0; - Gdip_NATIVE_ENTER(env, that, Graphics_1DrawPolygon_FUNC); - if (arg2) if ((lparg2 = env->GetIntArrayElements(arg2, NULL)) == NULL) goto fail; - if (lparg2) { - points = new Point[arg3]; - for (int i=0, j=0; i<arg3; i++, j+=2) { - Point *point = new Point(lparg2[j], lparg2[j + 1]); - points[i] = *point; - delete point; - } - } - rc = (jint)((Graphics *)arg0)->DrawPolygon((Pen *)arg1, points, (INT)arg3); -fail: - if (lparg2 && points) delete[] points; - if (arg2 && lparg2) env->ReleaseIntArrayElements(arg2, lparg2, JNI_ABORT); - Gdip_NATIVE_EXIT(env, that, Graphics_1DrawPolygon_FUNC); - return rc; -} -#endif - -#ifndef NO_Graphics_1FillPolygon -JNIEXPORT jint JNICALL Gdip_NATIVE(Graphics_1FillPolygon) - (JNIEnv *env, jclass that, jintLong arg0, jintLong arg1, jintArray arg2, jint arg3, jint arg4) -{ - Point *points=NULL; - jint *lparg2=NULL; - jint rc = 0; - Gdip_NATIVE_ENTER(env, that, Graphics_1FillPolygon_FUNC); - if (arg2) if ((lparg2 = env->GetIntArrayElements(arg2, NULL)) == NULL) goto fail; - if (lparg2) { - points = new Point[arg3]; - for (int i=0, j=0; i<arg3; i++, j+=2) { - Point *point = new Point(lparg2[j], lparg2[j + 1]); - points[i] = *point; - delete point; - } - } - rc = (jint)((Graphics *)arg0)->FillPolygon((Brush *)arg1, points, (INT)arg3, (FillMode)arg4); -fail: - if (lparg2 && points) delete[] points; - if (arg2 && lparg2) env->ReleaseIntArrayElements(arg2, lparg2, JNI_ABORT); - Gdip_NATIVE_EXIT(env, that, Graphics_1FillPolygon_FUNC); - return rc; -} -#endif - -#ifndef NO_GraphicsPath_1GetPathPoints -JNIEXPORT jint JNICALL Gdip_NATIVE(GraphicsPath_1GetPathPoints) - (JNIEnv *env, jclass that, jintLong arg0, jfloatArray arg1, jint arg2) -{ - PointF *points=NULL; - jfloat *lparg1=NULL; - jint rc = 0; - Gdip_NATIVE_ENTER(env, that, GraphicsPath_1GetPathPoints_FUNC); - if (arg1) if ((lparg1 = env->GetFloatArrayElements(arg1, NULL)) == NULL) goto fail; - if (lparg1) { - points = new PointF[arg2]; - } - rc = (jint)((GraphicsPath *)arg0)->GetPathPoints(points, arg2); -fail: - if (lparg1 && points) { - for (int i=0, j=0; i<arg2; i++, j+=2) { - lparg1[j] = points[i].X; - lparg1[j + 1] = points[i].Y; - } - delete[] points; - } - if (arg1 && lparg1) env->ReleaseFloatArrayElements(arg1, lparg1, 0); - Gdip_NATIVE_EXIT(env, that, GraphicsPath_1GetPathPoints_FUNC); - return rc; -} -#endif - - -#if (!defined(NO_Matrix_1TransformPoints__I_3FI) && !defined(JNI64)) || (!defined(NO_Matrix_1TransformPoints__J_3FI) && defined(JNI64)) -#ifdef JNI64 -JNIEXPORT jint JNICALL Gdip_NATIVE(Matrix_1TransformPoints__J_3FI) -#else -JNIEXPORT jint JNICALL Gdip_NATIVE(Matrix_1TransformPoints__I_3FI) -#endif - (JNIEnv *env, jclass that, jintLong arg0, jfloatArray arg1, jint arg2) -{ - PointF *points=NULL; - jfloat *lparg1=NULL; - jint rc = 0; -#ifdef JNI64 - Gdip_NATIVE_ENTER(env, that, Matrix_1TransformPoints__J_3FI_FUNC); -#else - Gdip_NATIVE_ENTER(env, that, Matrix_1TransformPoints__I_3FI_FUNC); -#endif - if (arg1) if ((lparg1 = env->GetFloatArrayElements(arg1, NULL)) == NULL) goto fail; - if (lparg1) { - points = new PointF[arg2]; - for (int i=0, j=0; i<arg2; i++, j+=2) { - PointF *point = new PointF(lparg1[j], lparg1[j + 1]); - points[i] = *point; - delete point; - } - } - rc = (jint)((Matrix *)arg0)->TransformPoints(points, arg2); -fail: - if (lparg1 && points) { - for (int i=0, j=0; i<arg2; i++, j+=2) { - lparg1[j] = points[i].X; - lparg1[j + 1] = points[i].Y; - } - delete[] points; - } - if (arg1 && lparg1) env->ReleaseFloatArrayElements(arg1, lparg1, 0); - Gdip_NATIVE_EXIT(env, that, Matrix_1TransformPoints__I_3FI_FUNC); - return rc; -} -#endif - -#ifndef NO_LinearGradientBrush_1SetInterpolationColors -JNIEXPORT jint JNICALL Gdip_NATIVE(LinearGradientBrush_1SetInterpolationColors) - (JNIEnv *env, jclass that, jintLong arg0, jintLongArray arg1, jfloatArray arg2, jint arg3) -{ - Color *colors=NULL; - jintLong *lparg1=NULL; - jfloat *lparg2=NULL; - jint rc = 0; - Gdip_NATIVE_ENTER(env, that, LinearGradientBrush_1SetInterpolationColors_FUNC); - if (arg1) if ((lparg1 = env->GetIntLongArrayElements(arg1, NULL)) == NULL) goto fail; - if (arg2) if ((lparg2 = env->GetFloatArrayElements(arg2, NULL)) == NULL) goto fail; - if (lparg1) { - colors = new Color[arg3]; - for (int i=0; i<arg3; i++) { - colors[i] = *(Color *)lparg1[i]; - } - } - rc = (jint)((LinearGradientBrush *)arg0)->SetInterpolationColors(colors, (const REAL *)lparg2, arg3); -fail: - if (lparg1 && colors) { - delete[] colors; - } - if (arg2 && lparg2) env->ReleaseFloatArrayElements(arg2, lparg2, 0); - if (arg1 && lparg1) env->ReleaseIntLongArrayElements(arg1, lparg1, 0); - Gdip_NATIVE_EXIT(env, that, LinearGradientBrush_1SetInterpolationColors_FUNC); - return rc; -} -#endif - -#ifndef NO_PathGradientBrush_1SetInterpolationColors -JNIEXPORT jint JNICALL Gdip_NATIVE(PathGradientBrush_1SetInterpolationColors) - (JNIEnv *env, jclass that, jintLong arg0, jintLongArray arg1, jfloatArray arg2, jint arg3) -{ - Color *colors=NULL; - jintLong *lparg1=NULL; - jfloat *lparg2=NULL; - jint rc = 0; - Gdip_NATIVE_ENTER(env, that, PathGradientBrush_1SetInterpolationColors_FUNC); - if (arg1) if ((lparg1 = env->GetIntLongArrayElements(arg1, NULL)) == NULL) goto fail; - if (arg2) if ((lparg2 = env->GetFloatArrayElements(arg2, NULL)) == NULL) goto fail; - if (lparg1) { - colors = new Color[arg3]; - for (int i=0; i<arg3; i++) { - colors[i] = *(Color *)lparg1[i]; - } - } - rc = (jint)((PathGradientBrush *)arg0)->SetInterpolationColors(colors, (const REAL *)lparg2, arg3); -fail: - if (lparg1 && colors) { - delete[] colors; - } - if (arg2 && lparg2) env->ReleaseFloatArrayElements(arg2, lparg2, 0); - if (arg1 && lparg1) env->ReleaseIntLongArrayElements(arg1, lparg1, 0); - Gdip_NATIVE_EXIT(env, that, PathGradientBrush_1SetInterpolationColors_FUNC); - return rc; -} -#endif - -#ifndef NO_PathGradientBrush_1SetSurroundColors -JNIEXPORT jint JNICALL Gdip_NATIVE(PathGradientBrush_1SetSurroundColors) - (JNIEnv *env, jclass that, jintLong arg0, jintLongArray arg1, jintArray arg2) -{ - Color *colors=NULL; - jintLong *lparg1=NULL; - jint *lparg2=NULL; - jint rc = 0; - Gdip_NATIVE_ENTER(env, that, PathGradientBrush_1SetSurroundColors_FUNC); - if (arg1) if ((lparg1 = env->GetIntLongArrayElements(arg1, NULL)) == NULL) goto fail; - if (arg2) if ((lparg2 = env->GetIntArrayElements(arg2, NULL)) == NULL) goto fail; - if (lparg1 && lparg2) { - colors = new Color[lparg2[0]]; - for (int i=0; i<lparg2[0]; i++) { - colors[i] = *(Color *)lparg1[i]; - } - } - rc = (jint)((PathGradientBrush *)arg0)->SetSurroundColors((Color *)colors, (INT *)lparg2); -fail: - if (lparg1 && lparg2 && colors) { - delete[] colors; - } - if (arg2 && lparg2) env->ReleaseIntArrayElements(arg2, lparg2, 0); - if (arg1 && lparg1) env->ReleaseIntLongArrayElements(arg1, lparg1, 0); - Gdip_NATIVE_EXIT(env, that, PathGradientBrush_1SetSurroundColors_FUNC); - return rc; -} -#endif - -#ifndef NO_GraphicsPath_1new___3I_3BII -JNIEXPORT jintLong JNICALL Gdip_NATIVE(GraphicsPath_1new___3I_3BII) - (JNIEnv *env, jclass that, jintArray arg0, jbyteArray arg1, jint arg2, jint arg3) -{ - Point *points=NULL; - jint *lparg0=NULL; - jbyte *lparg1=NULL; - jintLong rc = 0; - Gdip_NATIVE_ENTER(env, that, GraphicsPath_1new___3I_3BII_FUNC); - if (arg0) if ((lparg0 = env->GetIntArrayElements(arg0, NULL)) == NULL) goto fail; - if (lparg0) { - points = new Point[arg2]; - for (int i=0, j=0; i<arg2; i++, j+=2) { - Point *point = new Point(lparg0[j], lparg0[j + 1]); - points[i] = *point; - delete point; - } - } - if (arg1) if ((lparg1 = env->GetByteArrayElements(arg1, NULL)) == NULL) goto fail; - rc = (jintLong)new GraphicsPath(points, (BYTE *)lparg1, arg2, (FillMode)arg3); -fail: - if (arg1 && lparg1) env->ReleaseByteArrayElements(arg1, lparg1, 0); - if (lparg0 && points) delete[] points; - if (arg0 && lparg0) env->ReleaseIntArrayElements(arg0, lparg0, 0); - Gdip_NATIVE_EXIT(env, that, GraphicsPath_1new___3I_3BII_FUNC); - return rc; -} -#endif - -#if (!defined(NO_Graphics_1DrawDriverString__IIIII_3FII) && !defined(JNI64)) || (!defined(Graphics_1DrawDriverString__JJIJJ_3FIJ) && defined(JNI64)) -#ifdef JNI64 -extern "C" JNIEXPORT jint JNICALL Gdip_NATIVE(Graphics_1DrawDriverString__JJIJJ_3FIJ)(JNIEnv *env, jclass that, jintLong arg0, jintLong arg1, jint arg2, jintLong arg3, jintLong arg4, jfloatArray arg5, jint arg6, jintLong arg7); -JNIEXPORT jint JNICALL Gdip_NATIVE(Graphics_1DrawDriverString__JJIJJ_3FIJ)(JNIEnv *env, jclass that, jintLong arg0, jintLong arg1, jint arg2, jintLong arg3, jintLong arg4, jfloatArray arg5, jint arg6, jintLong arg7) -#else -extern "C" JNIEXPORT jint JNICALL Gdip_NATIVE(Graphics_1DrawDriverString__IIIII_3FII)(JNIEnv *env, jclass that, jintLong arg0, jintLong arg1, jint arg2, jintLong arg3, jintLong arg4, jfloatArray arg5, jint arg6, jintLong arg7); -JNIEXPORT jint JNICALL Gdip_NATIVE(Graphics_1DrawDriverString__IIIII_3FII)(JNIEnv *env, jclass that, jintLong arg0, jintLong arg1, jint arg2, jintLong arg3, jintLong arg4, jfloatArray arg5, jint arg6, jintLong arg7) -#endif - -{ - PointF *points=NULL; - jfloat *lparg5=NULL; - jint rc = 0; -#ifdef JNI64 - Gdip_NATIVE_ENTER(env, that, Graphics_1DrawDriverString__JJIJJ_3FIJ_FUNC); -#else - Gdip_NATIVE_ENTER(env, that, Graphics_1DrawDriverString__IIIII_3FII_FUNC); -#endif - if (arg5) if ((lparg5 = env->GetFloatArrayElements(arg5, NULL)) == NULL) goto fail; - if (lparg5) { - points = new PointF[arg2]; - for (int i=0, j=0; i<arg2; i++, j+=2) { - PointF *point = new PointF(lparg5[j], lparg5[j + 1]); - points[i] = *point; - delete point; - } - } - rc = (jint)((Graphics *)arg0)->DrawDriverString((const UINT16 *)arg1, arg2, (const Font *)arg3, (const Brush *)arg4, points, arg6, (const Matrix *)arg7); -fail: - if (arg5 && lparg5) env->ReleaseFloatArrayElements(arg5, lparg5, 0); - if (lparg5 && points) delete[] points; -#ifdef JNI64 - Gdip_NATIVE_EXIT(env, that, Graphics_1DrawDriverString__JJIJJ_3FIJ_FUNC); -#else - Gdip_NATIVE_EXIT(env, that, Graphics_1DrawDriverString__IIIII_3FII_FUNC); -#endif - return rc; -} -#endif - -#ifndef NO_Graphics_1MeasureDriverString -extern "C" JNIEXPORT jint JNICALL Gdip_NATIVE(Graphics_1MeasureDriverString)(JNIEnv *env, jclass that, jintLong arg0, jintLong arg1, jint arg2, jintLong arg3, jfloatArray arg4, jint arg5, jintLong arg6, jobject arg7); -JNIEXPORT jint JNICALL Gdip_NATIVE(Graphics_1MeasureDriverString) - (JNIEnv *env, jclass that, jintLong arg0, jintLong arg1, jint arg2, jintLong arg3, jfloatArray arg4, jint arg5, jintLong arg6, jobject arg7) -{ - PointF *points=NULL; - jfloat *lparg4=NULL; - RectF _arg7, *lparg7=NULL; - jint rc = 0; - Gdip_NATIVE_ENTER(env, that, Graphics_1MeasureDriverString_FUNC); - if (arg4) if ((lparg4 = env->GetFloatArrayElements(arg4, NULL)) == NULL) goto fail; - if (lparg4) { - points = new PointF[arg2]; - for (int i=0, j=0; i<arg2; i++, j+=2) { - PointF *point = new PointF(lparg4[j], lparg4[j + 1]); - points[i] = *point; - delete point; - } - } - if (arg7) if ((lparg7 = getRectFFields(env, arg7, &_arg7)) == NULL) goto fail; - rc = (jint)((Graphics *)arg0)->MeasureDriverString((const UINT16 *)arg1, arg2, (const Font *)arg3, points, arg5, (const Matrix *)arg6, lparg7); -fail: - if (arg7 && lparg7) setRectFFields(env, arg7, lparg7); - if (arg4 && lparg4) env->ReleaseFloatArrayElements(arg4, lparg4, 0); - if (lparg4 && points) delete[] points; - Gdip_NATIVE_EXIT(env, that, Graphics_1MeasureDriverString_FUNC); - return rc; -} -#endif - -} diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/gdip_stats.cpp b/bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/gdip_stats.cpp index 5e4fc075d8..de67fb8e79 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/gdip_stats.cpp +++ b/bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/gdip_stats.cpp @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2016 IBM Corporation and others. + * Copyright (c) 2000, 2019 IBM Corporation and others. * * This program and the accompanying materials * are made available under the terms of the Eclipse Public License 2.0 @@ -47,8 +47,6 @@ char * Gdip_nativeFunctionNames[] = { "Brush_1Clone", "Brush_1GetType", "ColorPalette_1sizeof", - "Color_1delete", - "Color_1new", "FontFamily_1GetFamilyName", "FontFamily_1IsAvailable", "FontFamily_1delete", diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/gdip_stats.h b/bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/gdip_stats.h index 9e2feea85e..53f5ad67aa 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/gdip_stats.h +++ b/bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/gdip_stats.h @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2016 IBM Corporation and others. + * Copyright (c) 2000, 2019 IBM Corporation and others. * * This program and the accompanying materials * are made available under the terms of the Eclipse Public License 2.0 @@ -57,8 +57,6 @@ typedef enum { Brush_1Clone_FUNC, Brush_1GetType_FUNC, ColorPalette_1sizeof_FUNC, - Color_1delete_FUNC, - Color_1new_FUNC, FontFamily_1GetFamilyName_FUNC, FontFamily_1IsAvailable_FUNC, FontFamily_1delete_FUNC, diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/gdip/Gdip.java b/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/gdip/Gdip.java index 25e6d3bcef..61c790c9ea 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/gdip/Gdip.java +++ b/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/gdip/Gdip.java @@ -181,10 +181,10 @@ public static final native void Bitmap_delete(long /*int*/ bitmap); /** * @method flags=cpp * @param bitmap cast=(Bitmap*) - * @param colorBackground cast=(Color*),flags=struct + * @param colorBackground cast=(Color) * @param hbmReturn cast=(HBITMAP*) */ -public static final native int Bitmap_GetHBITMAP(long /*int*/ bitmap, long /*int*/ colorBackground, long /*int*/[] hbmReturn); +public static final native int Bitmap_GetHBITMAP(long /*int*/ bitmap, int colorBackground, long /*int*/[] hbmReturn); /** * @method flags=cpp * @param bitmap cast=(Bitmap*) @@ -219,13 +219,6 @@ public static final native long /*int*/ Brush_Clone(long /*int*/ brush); * @param brush cast=(Brush *) */ public static final native int Brush_GetType(long /*int*/ brush); -/** - * @method flags=new - * @param argb cast=(ARGB) - */ -public static final native long /*int*/ Color_new(int argb); -/** @method flags=delete */ -public static final native void Color_delete(long /*int*/ color); /** @method flags=new */ public static final native long /*int*/ PrivateFontCollection_new(); /** @method flags=delete */ @@ -335,12 +328,12 @@ public static final native int Graphics_DrawArc(long /*int*/ graphics, long /*in */ public static final native int Graphics_DrawDriverString(long /*int*/ graphics, long /*int*/ text, int length, long /*int*/ font, long /*int*/ brush, PointF /*long*/ positions, int flags, long /*int*/ matrix); /** - * @method flags=no_gen cpp + * @method flags=cpp * @param graphics cast=(Graphics *) * @param text cast=(const UINT16 *) * @param font cast=(const Font *) * @param brush cast=(const Brush *) - * @param positions cast=(const PointF *) + * @param positions cast=(const PointF *),flags=no_out * @param matrix cast=(const Matrix *) */ public static final native int Graphics_DrawDriverString(long /*int*/ graphics, long /*int*/ text, int length, long /*int*/ font, long /*int*/ brush, float[] positions, int flags, long /*int*/ matrix); @@ -380,9 +373,10 @@ public static final native int Graphics_DrawImage(long /*int*/ graphics, long /* */ public static final native int Graphics_DrawLine(long /*int*/ graphics, long /*int*/ pen, int x1, int y1, int x2, int y2); /** - * @method flags=no_gen cpp + * @method flags=cpp * @param graphics cast=(Graphics *) * @param pen cast=(Pen *) + * @param points cast=(const Point *),flags=no_out * @param count cast=(INT) */ public static final native int Graphics_DrawLines(long /*int*/ graphics, long /*int*/ pen, int[] points, int count); @@ -394,9 +388,10 @@ public static final native int Graphics_DrawLines(long /*int*/ graphics, long /* */ public static final native int Graphics_DrawPath(long /*int*/ graphics, long /*int*/ pen, long /*int*/ path); /** - * @method flags=no_gen cpp + * @method flags=cpp * @param graphics cast=(Graphics *) * @param pen cast=(Pen *) + * @param points cast=(Point *) * @param count cast=(INT) */ public static final native int Graphics_DrawPolygon(long /*int*/ graphics, long /*int*/ pen, int[] points, int count); @@ -463,10 +458,10 @@ public static final native void Graphics_Flush(long /*int*/ graphics, int intent */ public static final native int Graphics_FillPie(long /*int*/ graphics, long /*int*/ brush, int x, int y, int width, int height, float startAngle, float sweepAngle); /** - * @method flags=no_gen cpp + * @method flags=cpp * @param graphics cast=(Graphics *) * @param brush cast=(Brush *) - * @param points cast=(Point *) + * @param points cast=(const Point *),flags=no_out * @param count cast=(INT) * @param fillMode cast=(FillMode) */ @@ -534,7 +529,14 @@ public static final native int Graphics_GetTransform(long /*int*/ graphics, long * @param graphics cast=(Graphics *) */ public static final native int Graphics_GetVisibleClipBounds(long /*int*/ graphics, Rect rect); -/** @method flags=no_gen */ +/** + * @method flags=cpp + * @param graphics cast=(Graphics *) + * @param text cast=(const UINT16 *) + * @param font cast=(Font *) + * @param positions cast=(const PointF *),flags=no_out + * @param matrix cast=(const Matrix *) + */ public static final native int Graphics_MeasureDriverString(long /*int*/ graphics, long /*int*/ text, int length, long /*int*/ font, float[] positions, int flags, long /*int*/ matrix, RectF boundingBox); /** * @method flags=cpp @@ -659,8 +661,10 @@ public static final native int Graphics_TranslateTransform(long /*int*/ graphics */ public static final native long /*int*/ GraphicsPath_new(int fillMode); /** - * @method flags=no_gen new - * @param points cast=(FillMode) + * @method flags=new + * @param points cast=(const Point *),flags=no_out + * @param types cast=(const BYTE *),flags=no_out + * @param fillMode cast=(FillMode) */ public static final native long /*int*/ GraphicsPath_new(int[] points, byte[] types, int count, int fillMode); /** @method flags=delete */ @@ -753,7 +757,7 @@ public static final native int GraphicsPath_GetBounds(long /*int*/ path, RectF b */ public static final native int GraphicsPath_GetLastPoint(long /*int*/ path, PointF lastPoint); /** - * @method flags=no_gen cpp + * @method flags=cpp * @param path cast=(GraphicsPath *) * @param points cast=(PointF *) */ @@ -802,10 +806,10 @@ public static final native int GraphicsPath_Transform(long /*int*/ path, long /* /** * @method flags=new * @param hatchStyle cast=(HatchStyle) - * @param foreColor cast=(Color *),flags=struct - * @param backColor cast=(Color *),flags=struct + * @param foreColor cast=(Color) + * @param backColor cast=(Color) */ -public static final native long /*int*/ HatchBrush_new(int hatchStyle, long /*int*/ foreColor, long /*int*/ backColor); +public static final native long /*int*/ HatchBrush_new(int hatchStyle, int foreColor, int backColor); /** * @method flags=cpp * @param image cast=(Image*) @@ -861,19 +865,19 @@ public static final native void HatchBrush_delete(long /*int*/ brush); * @method flags=new * @param point1 flags=struct * @param point2 flags=struct - * @param color1 cast=(Color *),flags=struct - * @param color2 cast=(Color *),flags=struct + * @param color1 cast=(Color) + * @param color2 cast=(Color) */ -public static final native long /*int*/ LinearGradientBrush_new(PointF point1, PointF point2, long /*int*/ color1, long /*int*/ color2); +public static final native long /*int*/ LinearGradientBrush_new(PointF point1, PointF point2, int color1, int color2); /** @method flags=delete */ public static final native void LinearGradientBrush_delete(long /*int*/ brush); /** - * @method flags=no_gen cpp + * @method flags=cpp * @param brush cast=(LinearGradientBrush *) - * @param presetColors cast=(const Color *) - * @param blendPositions cast=(const REAL *) + * @param presetColors cast=(const Color *),flags=no_out + * @param blendPositions cast=(const REAL *),flags=no_out */ -public static final native int LinearGradientBrush_SetInterpolationColors(long /*int*/ brush, long /*int*/[] presetColors, float[] blendPositions, int count); +public static final native int LinearGradientBrush_SetInterpolationColors(long /*int*/ brush, int [] presetColors, float[] blendPositions, int count); /** * @method flags=cpp * @param brush cast=(LinearGradientBrush *) @@ -960,7 +964,11 @@ public static final native int Matrix_Shear(long /*int*/ matrix, float shearX, f * @param matrix cast=(Matrix *) */ public static final native int Matrix_TransformPoints(long /*int*/ matrix, PointF pts, int count); -/** @method flags=no_gen */ +/** + * @method flags=cpp + * @param matrix cast=(Matrix *) + * @param pts cast=(PointF *) + */ public static final native int Matrix_TransformPoints(long /*int*/ matrix, float[] pts, int count); /** * @method flags=cpp @@ -1006,9 +1014,9 @@ public static final native void PathGradientBrush_delete(long /*int*/ brush); /** * @method flags=cpp * @param brush cast=(PathGradientBrush *) - * @param color cast=(Color *),flags=struct + * @param color cast=(Color) */ -public static final native int PathGradientBrush_SetCenterColor(long /*int*/ brush, long /*int*/ color); +public static final native int PathGradientBrush_SetCenterColor(long /*int*/ brush, int color); /** * @method flags=cpp * @param brush cast=(PathGradientBrush *) @@ -1016,19 +1024,19 @@ public static final native int PathGradientBrush_SetCenterColor(long /*int*/ bru */ public static final native int PathGradientBrush_SetCenterPoint(long /*int*/ brush, PointF pt); /** - * @method flags=no_gen + * @method flags=cpp * @param brush cast=(PathGradientBrush *) - * @param presetColors cast=(const Color *) - * @param blendPositions cast=(const REAL *) + * @param presetColors cast=(const Color *),flags=no_out + * @param blendPositions cast=(const REAL *),flags=no_out */ -public static final native int PathGradientBrush_SetInterpolationColors(long /*int*/ brush, long /*int*/[] presetColors, float[] blendPositions, int count); +public static final native int PathGradientBrush_SetInterpolationColors(long /*int*/ brush, int [] presetColors, float[] blendPositions, int count); /** - * @method flags=no_gen + * @method flags=cpp * @param brush cast=(PathGradientBrush *) - * @param colors cast=(Color *) + * @param colors cast=(const Color *),flags=no_out * @param count cast=(INT *) */ -public static final native int PathGradientBrush_SetSurroundColors(long /*int*/ brush, long /*int*/[] colors, int[] count); +public static final native int PathGradientBrush_SetSurroundColors(long /*int*/ brush, int [] colors, int[] count); /** * @method flags=cpp * @param brush cast=(PathGradientBrush *) @@ -1135,9 +1143,9 @@ public static final native long /*int*/ Region_GetHRGN(long /*int*/ region, long public static final native boolean Region_IsInfinite(long /*int*/ region, long /*int*/ graphics); /** * @method flags=new - * @param color cast=(Color *),flags=struct + * @param color cast=(Color) */ -public static final native long /*int*/ SolidBrush_new(long /*int*/ color); +public static final native long /*int*/ SolidBrush_new(int color); /** @method flags=delete */ public static final native void SolidBrush_delete(long /*int*/ brush); /** @method flags=delete */ diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/GC.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/GC.java index 7e30eb9623..9671da2438 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/GC.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/GC.java @@ -209,12 +209,9 @@ void checkGC(int mask) { } } else { int foreground = data.foreground; - int rgb = ((foreground >> 16) & 0xFF) | (foreground & 0xFF00) | ((foreground & 0xFF) << 16); - long /*int*/ color = Gdip.Color_new(data.alpha << 24 | rgb); - if (color == 0) SWT.error(SWT.ERROR_NO_HANDLES); + int color = (data.alpha << 24) | ((foreground >> 16) & 0xFF) | (foreground & 0xFF00) | ((foreground & 0xFF) << 16); brush = Gdip.SolidBrush_new(color); if (brush == 0) SWT.error(SWT.ERROR_NO_HANDLES); - Gdip.Color_delete(color); data.gdipFgBrush = brush; } if (pen != 0) { @@ -298,12 +295,9 @@ void checkGC(int mask) { } } else { int background = data.background; - int rgb = ((background >> 16) & 0xFF) | (background & 0xFF00) | ((background & 0xFF) << 16); - long /*int*/ color = Gdip.Color_new(data.alpha << 24 | rgb); - if (color == 0) SWT.error(SWT.ERROR_NO_HANDLES); + int color = (data.alpha << 24) | ((background >> 16) & 0xFF) | (background & 0xFF00) | ((background & 0xFF) << 16); long /*int*/ brush = Gdip.SolidBrush_new(color); if (brush == 0) SWT.error(SWT.ERROR_NO_HANDLES); - Gdip.Color_delete(color); data.gdipBrush = data.gdipBgBrush = brush; } } @@ -2762,17 +2756,11 @@ void fillGradientRectangleInPixels(int x, int y, int width, int height, boolean p2.X = p1.X + width; p2.Y = p1.Y; } - int rgb = ((fromRGB.red & 0xFF) << 16) | ((fromRGB.green & 0xFF) << 8) | (fromRGB.blue & 0xFF); - long /*int*/ fromGpColor = Gdip.Color_new(data.alpha << 24 | rgb); - if (fromGpColor == 0) SWT.error(SWT.ERROR_NO_HANDLES); - rgb = ((toRGB.red & 0xFF) << 16) | ((toRGB.green & 0xFF) << 8) | (toRGB.blue & 0xFF); - long /*int*/ toGpColor = Gdip.Color_new(data.alpha << 24 | rgb); - if (toGpColor == 0) SWT.error(SWT.ERROR_NO_HANDLES); + int fromGpColor = (data.alpha << 24) | ((fromRGB.red & 0xFF) << 16) | ((fromRGB.green & 0xFF) << 8) | (fromRGB.blue & 0xFF); + int toGpColor = (data.alpha << 24) | ((toRGB.red & 0xFF) << 16) | ((toRGB.green & 0xFF) << 8) | (toRGB.blue & 0xFF); long /*int*/ brush = Gdip.LinearGradientBrush_new(p1, p2, fromGpColor, toGpColor); Gdip.Graphics_FillRectangle(data.gdipGraphics, brush, x, y, width, height); Gdip.LinearGradientBrush_delete(brush); - Gdip.Color_delete(fromGpColor); - Gdip.Color_delete(toGpColor); return; } /* diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/Pattern.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/Pattern.java index 3710041684..3918f5c4ec 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/Pattern.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/Pattern.java @@ -190,15 +190,13 @@ public Pattern(Device device, float x1, float y1, float x2, float y2, Color colo if (color2.isDisposed()) SWT.error(SWT.ERROR_INVALID_ARGUMENT); this.device.checkGDIP(); int colorRef1 = color1.handle; - int rgb = ((colorRef1 >> 16) & 0xFF) | (colorRef1 & 0xFF00) | ((colorRef1 & 0xFF) << 16); - long /*int*/ foreColor = Gdip.Color_new((alpha1 & 0xFF) << 24 | rgb); + int foreColor = ((alpha1 & 0xFF) << 24) | ((colorRef1 >> 16) & 0xFF) | (colorRef1 & 0xFF00) | ((colorRef1 & 0xFF) << 16); if (x1 == x2 && y1 == y2) { handle = Gdip.SolidBrush_new(foreColor); if (handle == 0) SWT.error(SWT.ERROR_NO_HANDLES); } else { int colorRef2 = color2.handle; - rgb = ((colorRef2 >> 16) & 0xFF) | (colorRef2 & 0xFF00) | ((colorRef2 & 0xFF) << 16); - long /*int*/ backColor = Gdip.Color_new((alpha2 & 0xFF) << 24 | rgb); + int backColor = ((alpha2 & 0xFF) << 24) | ((colorRef2 >> 16) & 0xFF) | (colorRef2 & 0xFF00) | ((colorRef2 & 0xFF) << 16); PointF p1 = new PointF(); p1.X = x1; p1.Y = y1; @@ -212,13 +210,10 @@ public Pattern(Device device, float x1, float y1, float x2, float y2, Color colo int r = (int)(((colorRef1 & 0xFF) >> 0) * 0.5f + ((colorRef2 & 0xFF) >> 0) * 0.5f); int g = (int)(((colorRef1 & 0xFF00) >> 8) * 0.5f + ((colorRef2 & 0xFF00) >> 8) * 0.5f); int b = (int)(((colorRef1 & 0xFF0000) >> 16) * 0.5f + ((colorRef2 & 0xFF0000) >> 16) * 0.5f); - long /*int*/ midColor = Gdip.Color_new(a << 24 | r << 16 | g << 8 | b); - Gdip.LinearGradientBrush_SetInterpolationColors(handle, new long /*int*/ []{foreColor, midColor, backColor}, new float[]{0, 0.5f, 1}, 3); - Gdip.Color_delete(midColor); + int midColor = a << 24 | r << 16 | g << 8 | b; + Gdip.LinearGradientBrush_SetInterpolationColors(handle, new int [] {foreColor, midColor, backColor}, new float[]{0, 0.5f, 1}, 3); } - Gdip.Color_delete(backColor); } - Gdip.Color_delete(foreColor); init(); } diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/TextLayout.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/TextLayout.java index 63de7fc163..663d970214 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/TextLayout.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/TextLayout.java @@ -548,10 +548,7 @@ int[] computePolyline(int left, int top, int right, int bottom) { long /*int*/ createGdipBrush(int pixel, int alpha) { int argb = ((alpha & 0xFF) << 24) | ((pixel >> 16) & 0xFF) | (pixel & 0xFF00) | ((pixel & 0xFF) << 16); - long /*int*/ gdiColor = Gdip.Color_new(argb); - long /*int*/ brush = Gdip.SolidBrush_new(gdiColor); - Gdip.Color_delete(gdiColor); - return brush; + return Gdip.SolidBrush_new(argb); } long /*int*/ createGdipBrush(Color color, int alpha) { |