526 527 return (jint)oglsdo->textureID; 528 } 529 530 /** 531 * Initializes nativeWidth/Height fields of the surfaceData object with 532 * passed arguments. 533 */ 534 void 535 OGLSD_SetNativeDimensions(JNIEnv *env, OGLSDOps *oglsdo, 536 jint width, jint height) 537 { 538 jobject sdObject; 539 540 sdObject = (*env)->NewLocalRef(env, oglsdo->sdOps.sdObject); 541 if (sdObject == NULL) { 542 return; 543 } 544 545 JNU_SetFieldByName(env, NULL, sdObject, "nativeWidth", "I", width); 546 JNU_SetFieldByName(env, NULL, sdObject, "nativeHeight", "I", height); 547 548 (*env)->DeleteLocalRef(env, sdObject); 549 } 550 551 /** 552 * Deletes native OpenGL resources associated with this surface. 553 */ 554 void 555 OGLSD_Delete(JNIEnv *env, OGLSDOps *oglsdo) 556 { 557 J2dTraceLn1(J2D_TRACE_INFO, "OGLSD_Delete: type=%d", 558 oglsdo->drawableType); 559 560 if (oglsdo->drawableType == OGLSD_TEXTURE) { 561 if (oglsdo->textureID != 0) { 562 j2d_glDeleteTextures(1, &oglsdo->textureID); 563 oglsdo->textureID = 0; 564 } 565 } else if (oglsdo->drawableType == OGLSD_FBOBJECT) { 566 if (oglsdo->textureID != 0) { | 526 527 return (jint)oglsdo->textureID; 528 } 529 530 /** 531 * Initializes nativeWidth/Height fields of the surfaceData object with 532 * passed arguments. 533 */ 534 void 535 OGLSD_SetNativeDimensions(JNIEnv *env, OGLSDOps *oglsdo, 536 jint width, jint height) 537 { 538 jobject sdObject; 539 540 sdObject = (*env)->NewLocalRef(env, oglsdo->sdOps.sdObject); 541 if (sdObject == NULL) { 542 return; 543 } 544 545 JNU_SetFieldByName(env, NULL, sdObject, "nativeWidth", "I", width); 546 if (!((*env)->ExceptionOccurred(env))) { 547 JNU_SetFieldByName(env, NULL, sdObject, "nativeHeight", "I", height); 548 } 549 550 (*env)->DeleteLocalRef(env, sdObject); 551 } 552 553 /** 554 * Deletes native OpenGL resources associated with this surface. 555 */ 556 void 557 OGLSD_Delete(JNIEnv *env, OGLSDOps *oglsdo) 558 { 559 J2dTraceLn1(J2D_TRACE_INFO, "OGLSD_Delete: type=%d", 560 oglsdo->drawableType); 561 562 if (oglsdo->drawableType == OGLSD_TEXTURE) { 563 if (oglsdo->textureID != 0) { 564 j2d_glDeleteTextures(1, &oglsdo->textureID); 565 oglsdo->textureID = 0; 566 } 567 } else if (oglsdo->drawableType == OGLSD_FBOBJECT) { 568 if (oglsdo->textureID != 0) { |