📄 m3gadaptation.c
字号:
/*******************************************************************************
* Modification Notice:
* --------------------------
* This software is modified by MediaTek Inc. and the information contained
* herein is confidential. The software may not be copied and the information
* contained herein may not be used or disclosed except with the written
* permission of MediaTek Inc. (C) 2001
*
*******************************************************************************/
/*****************************************************************************
*
* Filename:
* ---------
* m3gadaptation.c
*
* Project:
* --------
* Maui_Software
*
* Description:
* ------------
*
*
* Author:
* -------
* -------
*
*============================================================================
* HISTORY
* Below this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
*------------------------------------------------------------------------------
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
*------------------------------------------------------------------------------
* Upper this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
*============================================================================
****************************************************************************/
/*************************************************************************
* Include Header Files
*************************************************************************/
#include "m3g.h"
/*************************************************************************
* Global Definition
*************************************************************************/
#define MAX_REMOVED_OBJECTS_NUM (2048)
#ifdef SUPPORT_JSR_184
static int removed_count = 0;
static st_m3g_object3d* removed_objects[MAX_REMOVED_OBJECTS_NUM];
/*************************************************************************
* Function Definition
*************************************************************************/
KNIEXPORT KNI_RETURNTYPE_INT
Java_javax_microedition_m3g_ObjectPool_getHandleTypeImpl()
{
st_m3g_object3d* handle = (st_m3g_object3d*)KNI_GetParameterAsInt(1);
KNI_ReturnInt((jint)handle->object_type);
}
KNIEXPORT KNI_RETURNTYPE_VOID
Java_javax_microedition_m3g_ObjectPool_addReferenceHandleImpl()
{
st_m3g_object3d* handle = (st_m3g_object3d*)KNI_GetParameterAsInt(1);
int object_type = KNI_GetParameterAsInt(2);
if (handle == NULL || handle == (st_m3g_object3d*)&m3g_graphics3d) {
KNI_ReturnVoid();
}
if(object_type == 1)((st_m3g_transform*)handle)->reference_count++;
else if(object_type == 2) ((st_m3g_rayintersection*)handle)->reference_count++;
else INC_REF(handle);
KNI_ReturnVoid();
}
void
_m3g_ObjectPool_removeAssociation(st_m3g_object3d* remove)
{
if (remove == NULL) return;
/* if over capability */
if (removed_count+1 > MAX_REMOVED_OBJECTS_NUM)
return;
removed_objects[removed_count++] = remove;
}
KNIEXPORT KNI_RETURNTYPE_INT
Java_javax_microedition_m3g_ObjectPool_getRemoveObjectsImpl()
{
// kal_trace(TRACE_GROUP_6, FUNC_J2ME_M3G_GETREMOVEOBJECTS);
KNI_StartHandles(1);
KNI_DeclareHandle(object_handle);
KNI_GetParameterAsObject(1, object_handle);
if(*object_handle) {
#if FAST_KNI && defined(CLDCHI)
jint_array* array = (jint_array*)*object_handle;
ASSERT(array->length==removed_count);
memcpy(array->elements, removed_objects, removed_count*sizeof(int));
memset(removed_objects, 0, removed_count*sizeof(int));
removed_count = 0;
#else
ASSERT(0);
#endif /* FAST_KNI */
}
KNI_EndHandles();
KNI_ReturnInt(removed_count);
}
KNIEXPORT KNI_RETURNTYPE_INT
Java_javax_microedition_m3g_ObjectPool_getUserParameterCountImpl()
{
st_m3g_object3d* handle = (st_m3g_object3d*)KNI_GetParameterAsInt(1);
KNI_ReturnInt((jint)handle->userparameter_count);
}
KNIEXPORT KNI_RETURNTYPE_INT
Java_javax_microedition_m3g_ObjectPool_getUserParameterImpl()
{
st_m3g_object3d* handle = (st_m3g_object3d*)KNI_GetParameterAsInt(1);
jint index = KNI_GetParameterAsInt(2);
jint result;
KNI_StartHandles(1);
KNI_DeclareHandle(param_handle);
KNI_GetParameterAsObject(3, param_handle);
if(*param_handle) {
#if FAST_KNI && defined(CLDCHI)
jbyte_array* param = (jbyte_array*)*param_handle;
memcpy(param->elements, handle->user_parameter[index].parameter_values, handle->user_parameter[index].parameter_size);
result = handle->user_parameter[index].parameter_id;
#else
ASSERT(0);
#endif /* FAST_KNI */
} else {
result = handle->user_parameter[index].parameter_size;
}
KNI_EndHandles();
KNI_ReturnInt(result);
}
KNIEXPORT KNI_RETURNTYPE_BOOLEAN
Java_javax_microedition_m3g_ObjectPool_setMMILock()
{
jboolean lock = KNI_GetParameterAsBoolean(1);
KNI_ReturnBoolean(jvm_set_mmi_Lock(lock));
}
#endif /* #ifdef SUPPORT_JSR_184 */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -