MCPcopy Create free account
hub / github.com/AcademySoftwareFoundation/OpenColorIO / GetJFloatBuffer

Function GetJFloatBuffer

src/bindings/java/JNIUtil.cpp:19–36  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

17}
18
19float* GetJFloatBuffer(JNIEnv * env, jobject buffer, int32_t len) {
20 jmethodID mid = env->GetMethodID(env->GetObjectClass(buffer), "isDirect", "()Z");
21 if (mid == 0) throw Exception("Could not find isDirect() method");
22 if(!env->CallBooleanMethod(buffer, mid)) {
23 std::ostringstream err;
24 err << "the FloatBuffer object is not 'direct' it needs to be created ";
25 err << "from a ByteBuffer.allocateDirect(..).asFloatBuffer() call.";
26 throw Exception(err.str().c_str());
27 }
28 if(env->GetDirectBufferCapacity(buffer) != len) {
29 std::ostringstream err;
30 err << "the FloatBuffer object is not allocated correctly it needs to ";
31 err << "of size " << len << " but is ";
32 err << env->GetDirectBufferCapacity(buffer) << ".";
33 throw Exception(err.str().c_str());
34 }
35 return (float*)env->GetDirectBufferAddress(buffer);
36}
37
38const char* GetOCIOTClass(ConstTransformRcPtr tran) {
39 if(ConstAllocationTransformRcPtr at = DynamicPtrCast<const AllocationTransform>(tran))

Calls

no outgoing calls

Tested by

no test coverage detected