333 } 334 335 if (cData != NULL) { 336 return cData; 337 } 338 339 cData = (ColorData*)calloc(1, sizeof(ColorData)); 340 341 if (cData != NULL) { 342 jboolean allGray 343 = (*env)->GetBooleanField(env, bisdo->icm, allGrayID); 344 int *pRgb = (int *) 345 ((*env)->GetPrimitiveArrayCritical(env, bisdo->lutarray, NULL)); 346 347 if (pRgb == NULL) { 348 free(cData); 349 return (ColorData*)NULL; 350 } 351 352 cData->img_clr_tbl = initCubemap(pRgb, bisdo->lutsize, 32); 353 cData->representsPrimaries = calculatePrimaryColorsApproximation(pRgb, cData->img_clr_tbl, 32); 354 if (allGray == JNI_TRUE) { 355 initInverseGrayLut(pRgb, bisdo->lutsize, cData); 356 } 357 (*env)->ReleasePrimitiveArrayCritical(env, bisdo->lutarray, pRgb, 358 JNI_ABORT); 359 360 initDitherTables(cData); 361 362 if (JNU_IsNull(env, colorData)) { 363 jlong pData = ptr_to_jlong(cData); 364 colorData = (*env)->NewObjectA(env, clsICMCD, initICMCDmID, (jvalue *)&pData); 365 366 if ((*env)->ExceptionCheck(env)) 367 { 368 free(cData); 369 return (ColorData*)NULL; 370 } 371 372 (*env)->SetObjectField(env, bisdo->icm, colorDataID, colorData); | 333 } 334 335 if (cData != NULL) { 336 return cData; 337 } 338 339 cData = (ColorData*)calloc(1, sizeof(ColorData)); 340 341 if (cData != NULL) { 342 jboolean allGray 343 = (*env)->GetBooleanField(env, bisdo->icm, allGrayID); 344 int *pRgb = (int *) 345 ((*env)->GetPrimitiveArrayCritical(env, bisdo->lutarray, NULL)); 346 347 if (pRgb == NULL) { 348 free(cData); 349 return (ColorData*)NULL; 350 } 351 352 cData->img_clr_tbl = initCubemap(pRgb, bisdo->lutsize, 32); 353 if (cData->img_clr_tbl == NULL) { 354 free(cData); 355 return (ColorData*)NULL; 356 } 357 cData->representsPrimaries = calculatePrimaryColorsApproximation(pRgb, cData->img_clr_tbl, 32); 358 if (allGray == JNI_TRUE) { 359 initInverseGrayLut(pRgb, bisdo->lutsize, cData); 360 } 361 (*env)->ReleasePrimitiveArrayCritical(env, bisdo->lutarray, pRgb, 362 JNI_ABORT); 363 364 initDitherTables(cData); 365 366 if (JNU_IsNull(env, colorData)) { 367 jlong pData = ptr_to_jlong(cData); 368 colorData = (*env)->NewObjectA(env, clsICMCD, initICMCDmID, (jvalue *)&pData); 369 370 if ((*env)->ExceptionCheck(env)) 371 { 372 free(cData); 373 return (ColorData*)NULL; 374 } 375 376 (*env)->SetObjectField(env, bisdo->icm, colorDataID, colorData); |