Lines Matching refs:env
31 static jint OutputStream_setup(JNIEnv* env, jobject thiz, jobject out, in OutputStream_setup() argument
34 jclass thisClass = env->GetObjectClass(thiz); in OutputStream_setup()
35 if (env->ExceptionCheck() || thisClass == NULL) { in OutputStream_setup()
39 jfieldID fidNumber = env->GetFieldID(thisClass, "JNIPointer", "J"); in OutputStream_setup()
40 if (NULL == fidNumber || env->ExceptionCheck()) { in OutputStream_setup()
69 int32_t errorFlag = w_ptr->setup(env, out, w, h, fmt, q); in OutputStream_setup()
70 if (env->ExceptionCheck() || errorFlag != J_SUCCESS) { in OutputStream_setup()
76 env->SetLongField(thiz, fidNumber, reinterpret_cast<jlong>(w_ptr)); in OutputStream_setup()
77 if (env->ExceptionCheck()) { in OutputStream_setup()
84 static jint InputStream_setup(JNIEnv* env, jobject thiz, jobject dimens, in InputStream_setup() argument
87 jclass thisClass = env->GetObjectClass(thiz); in InputStream_setup()
88 if (env->ExceptionCheck() || thisClass == NULL) { in InputStream_setup()
95 jclass pointClass = env->GetObjectClass(dimens); in InputStream_setup()
96 if (env->ExceptionCheck() || pointClass == NULL) { in InputStream_setup()
99 setMethod = env->GetMethodID(pointClass, "set", "(II)V"); in InputStream_setup()
100 if (env->ExceptionCheck() || setMethod == NULL) { in InputStream_setup()
105 jfieldID fidNumber = env->GetFieldID(thisClass, "JNIPointer", "J"); in InputStream_setup()
106 if (NULL == fidNumber || env->ExceptionCheck()) { in InputStream_setup()
124 int32_t errorFlag = r_ptr->setup(env, in, &w, &h, fmt); in InputStream_setup()
125 if (env->ExceptionCheck() || errorFlag != J_SUCCESS) { in InputStream_setup()
132 env->CallVoidMethod(dimens, setMethod, static_cast<jint>(w), in InputStream_setup()
134 if (env->ExceptionCheck()) { in InputStream_setup()
140 env->SetLongField(thiz, fidNumber, reinterpret_cast<jlong>(r_ptr)); in InputStream_setup()
141 if (env->ExceptionCheck()) { in InputStream_setup()
148 static JpegWriter* getWPtr(JNIEnv* env, jobject thiz, jfieldID* fid) { in getWPtr() argument
149 jclass thisClass = env->GetObjectClass(thiz); in getWPtr()
150 if (env->ExceptionCheck() || thisClass == NULL) { in getWPtr()
153 jfieldID fidNumber = env->GetFieldID(thisClass, "JNIPointer", "J"); in getWPtr()
154 if (NULL == fidNumber || env->ExceptionCheck()) { in getWPtr()
157 jlong ptr = env->GetLongField(thiz, fidNumber); in getWPtr()
158 if (env->ExceptionCheck()) { in getWPtr()
169 static JpegReader* getRPtr(JNIEnv* env, jobject thiz, jfieldID* fid) { in getRPtr() argument
170 jclass thisClass = env->GetObjectClass(thiz); in getRPtr()
171 if (env->ExceptionCheck() || thisClass == NULL) { in getRPtr()
174 jfieldID fidNumber = env->GetFieldID(thisClass, "JNIPointer", "J"); in getRPtr()
175 if (NULL == fidNumber || env->ExceptionCheck()) { in getRPtr()
178 jlong ptr = env->GetLongField(thiz, fidNumber); in getRPtr()
179 if (env->ExceptionCheck()) { in getRPtr()
190 static void OutputStream_cleanup(JNIEnv* env, jobject thiz) { in OutputStream_cleanup() argument
192 JpegWriter* w_ptr = getWPtr(env, thiz, &fidNumber); in OutputStream_cleanup()
197 w_ptr->updateEnv(env); in OutputStream_cleanup()
202 env->SetLongField(thiz, fidNumber, reinterpret_cast<jlong>(w_ptr)); in OutputStream_cleanup()
205 static void InputStream_cleanup(JNIEnv* env, jobject thiz) { in InputStream_cleanup() argument
207 JpegReader* r_ptr = getRPtr(env, thiz, &fidNumber); in InputStream_cleanup()
212 r_ptr->updateEnv(env); in InputStream_cleanup()
217 env->SetLongField(thiz, fidNumber, reinterpret_cast<jlong>(r_ptr)); in InputStream_cleanup()
220 static jint OutputStream_writeInputBytes(JNIEnv* env, jobject thiz, in OutputStream_writeInputBytes() argument
222 JpegWriter* w_ptr = getWPtr(env, thiz, NULL); in OutputStream_writeInputBytes()
227 jbyte* in_buf = (jbyte*) env->GetByteArrayElements(inBuffer, 0); in OutputStream_writeInputBytes()
228 if (env->ExceptionCheck() || in_buf == NULL) { in OutputStream_writeInputBytes()
239 w_ptr->updateEnv(env); in OutputStream_writeInputBytes()
242 env->ReleaseByteArrayElements(inBuffer, in_buf, JNI_ABORT); in OutputStream_writeInputBytes()
246 static jint InputStream_readDecodedBytes(JNIEnv* env, jobject thiz, in InputStream_readDecodedBytes() argument
248 JpegReader* r_ptr = getRPtr(env, thiz, NULL); in InputStream_readDecodedBytes()
253 jbyte* in_buf = (jbyte*) env->GetByteArrayElements(inBuffer, 0); in InputStream_readDecodedBytes()
254 if (env->ExceptionCheck() || in_buf == NULL) { in InputStream_readDecodedBytes()
263 r_ptr->updateEnv(env); in InputStream_readDecodedBytes()
269 env->ReleaseByteArrayElements(inBuffer, in_buf, JNI_ABORT); in InputStream_readDecodedBytes()
271 env->ReleaseByteArrayElements(inBuffer, in_buf, JNI_COMMIT); in InputStream_readDecodedBytes()
276 static jint InputStream_skipDecodedBytes(JNIEnv* env, jobject thiz, in InputStream_skipDecodedBytes() argument
281 JpegReader* r_ptr = getRPtr(env, thiz, NULL); in InputStream_skipDecodedBytes()
287 r_ptr->updateEnv(env); in InputStream_skipDecodedBytes()
311 static int registerNativeMethods(JNIEnv* env, const char* className, in registerNativeMethods() argument
314 clazz = env->FindClass(className); in registerNativeMethods()
319 if (env->RegisterNatives(clazz, gMethods, numMethods) < 0) { in registerNativeMethods()
327 JNIEnv* env; in JNI_OnLoad() local
328 if (vm->GetEnv(reinterpret_cast<void**>(&env), JNI_VERSION_1_6) != JNI_OK) { in JNI_OnLoad()
332 if (!registerNativeMethods(env, outClassPathName, writeMethods, in JNI_OnLoad()
337 if (!registerNativeMethods(env, inClassPathName, readMethods, in JNI_OnLoad()
343 jclass outCls = env->FindClass("java/io/OutputStream"); in JNI_OnLoad()
348 jmethodID cachedWriteFun = env->GetMethodID(outCls, "write", "([BII)V"); in JNI_OnLoad()
356 jclass inCls = env->FindClass("java/io/InputStream"); in JNI_OnLoad()
361 jmethodID cachedReadFun = env->GetMethodID(inCls, "read", "([BII)I"); in JNI_OnLoad()
366 jmethodID cachedSkipFun = env->GetMethodID(inCls, "skip", "(J)J"); in JNI_OnLoad()