| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C)2011 D. R. Commander. All Rights Reserved. | 2 * Copyright (C)2011 D. R. Commander. All Rights Reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are met: | 5 * modification, are permitted provided that the following conditions are met: |
| 6 * | 6 * |
| 7 * - Redistributions of source code must retain the above copyright notice, | 7 * - Redistributions of source code must retain the above copyright notice, |
| 8 * this list of conditions and the following disclaimer. | 8 * this list of conditions and the following disclaimer. |
| 9 * - Redistributions in binary form must reproduce the above copyright notice, | 9 * - Redistributions in binary form must reproduce the above copyright notice, |
| 10 * this list of conditions and the following disclaimer in the documentation | 10 * this list of conditions and the following disclaimer in the documentation |
| (...skipping 617 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 628 } | 628 } |
| 629 } | 629 } |
| 630 | 630 |
| 631 bailif0(jpegBuf=(*env)->GetPrimitiveArrayCritical(env, jsrcBuf, 0)); | 631 bailif0(jpegBuf=(*env)->GetPrimitiveArrayCritical(env, jsrcBuf, 0)); |
| 632 for(i=0; i<n; i++) | 632 for(i=0; i<n; i++) |
| 633 { | 633 { |
| 634 int w=jpegWidth, h=jpegHeight; | 634 int w=jpegWidth, h=jpegHeight; |
| 635 if(t[i].r.w!=0) w=t[i].r.w; | 635 if(t[i].r.w!=0) w=t[i].r.w; |
| 636 if(t[i].r.h!=0) h=t[i].r.h; | 636 if(t[i].r.h!=0) h=t[i].r.h; |
| 637 bailif0(jdstBufs[i]=(*env)->GetObjectArrayElement(env, dstobjs,
i)); | 637 bailif0(jdstBufs[i]=(*env)->GetObjectArrayElement(env, dstobjs,
i)); |
| 638 » » if((*env)->GetArrayLength(env, jdstBufs[i])<tjBufSize(w, h, jpeg
Subsamp)) | 638 » » if((unsigned long)(*env)->GetArrayLength(env, jdstBufs[i]) |
| 639 » » » <tjBufSize(w, h, jpegSubsamp)) |
| 639 _throw("Destination buffer is not large enough"); | 640 _throw("Destination buffer is not large enough"); |
| 640 bailif0(dstBufs[i]=(*env)->GetPrimitiveArrayCritical(env, jdstBu
fs[i], 0)); | 641 bailif0(dstBufs[i]=(*env)->GetPrimitiveArrayCritical(env, jdstBu
fs[i], 0)); |
| 641 } | 642 } |
| 642 | 643 |
| 643 if(tjTransform(handle, jpegBuf, jpegSize, n, dstBufs, dstSizes, t, | 644 if(tjTransform(handle, jpegBuf, jpegSize, n, dstBufs, dstSizes, t, |
| 644 flags|TJFLAG_NOREALLOC)==-1) | 645 flags|TJFLAG_NOREALLOC)==-1) |
| 645 { | 646 { |
| 646 (*env)->ReleasePrimitiveArrayCritical(env, jsrcBuf, jpegBuf, 0); | 647 (*env)->ReleasePrimitiveArrayCritical(env, jsrcBuf, jpegBuf, 0); |
| 647 jpegBuf=NULL; | 648 jpegBuf=NULL; |
| 648 for(i=0; i<n; i++) | 649 for(i=0; i<n; i++) |
| (...skipping 24 matching lines...) Expand all Loading... |
| 673 if(dstSizesi) (*env)->ReleaseIntArrayElements(env, jdstSizes, dstSizesi,
0); | 674 if(dstSizesi) (*env)->ReleaseIntArrayElements(env, jdstSizes, dstSizesi,
0); |
| 674 if(t) free(t); | 675 if(t) free(t); |
| 675 return jdstSizes; | 676 return jdstSizes; |
| 676 } | 677 } |
| 677 | 678 |
| 678 JNIEXPORT void JNICALL Java_org_libjpegturbo_turbojpeg_TJDecompressor_destroy | 679 JNIEXPORT void JNICALL Java_org_libjpegturbo_turbojpeg_TJDecompressor_destroy |
| 679 (JNIEnv *env, jobject obj) | 680 (JNIEnv *env, jobject obj) |
| 680 { | 681 { |
| 681 Java_org_libjpegturbo_turbojpeg_TJCompressor_destroy(env, obj); | 682 Java_org_libjpegturbo_turbojpeg_TJCompressor_destroy(env, obj); |
| 682 } | 683 } |
| OLD | NEW |