@@ -184,9 +184,9 @@ public enum MipmapControl {
184184
185185 private int getIDSafe () {
186186 if (mAdaptedAllocation != null ) {
187- return mAdaptedAllocation .getID ();
187+ return mAdaptedAllocation .getID (mRS );
188188 }
189- return getID ();
189+ return getID (mRS );
190190 }
191191
192192
@@ -321,7 +321,7 @@ private void validateIsObject() {
321321 @ Override
322322 void updateFromNative () {
323323 super .updateFromNative ();
324- int typeID = mRS .nAllocationGetType (getID ());
324+ int typeID = mRS .nAllocationGetType (getID (mRS ));
325325 if (typeID != 0 ) {
326326 mType = new Type (typeID , mRS );
327327 mType .updateFromNative ();
@@ -371,7 +371,7 @@ public void ioSend() {
371371 "Can only send buffer if IO_OUTPUT usage specified." );
372372 }
373373 mRS .validate ();
374- mRS .nAllocationIoSend (getID ());
374+ mRS .nAllocationIoSend (getID (mRS ));
375375 }
376376
377377 /**
@@ -394,7 +394,7 @@ public void ioReceive() {
394394 "Can only receive if IO_INPUT usage specified." );
395395 }
396396 mRS .validate ();
397- mRS .nAllocationIoReceive (getID ());
397+ mRS .nAllocationIoReceive (getID (mRS ));
398398 }
399399
400400 /**
@@ -411,7 +411,7 @@ public void copyFrom(BaseObj[] d) {
411411 }
412412 int i [] = new int [d .length ];
413413 for (int ct =0 ; ct < d .length ; ct ++) {
414- i [ct ] = d [ct ].getID ();
414+ i [ct ] = d [ct ].getID (mRS );
415415 }
416416 copy1DRangeFromUnchecked (0 , mCurrentCount , i );
417417 }
@@ -571,7 +571,7 @@ public void copyFrom(Bitmap b) {
571571 mRS .validate ();
572572 validateBitmapSize (b );
573573 validateBitmapFormat (b );
574- mRS .nAllocationCopyFromBitmap (getID (), b );
574+ mRS .nAllocationCopyFromBitmap (getID (mRS ), b );
575575 }
576576
577577 /**
@@ -652,7 +652,7 @@ private void data1DChecks(int off, int count, int len, int dataSize) {
652652 * followup sync will be required.
653653 */
654654 public void generateMipmaps () {
655- mRS .nAllocationGenerateMipmaps (getID ());
655+ mRS .nAllocationGenerateMipmaps (getID (mRS ));
656656 }
657657
658658 /**
@@ -780,7 +780,7 @@ public void copy1DRangeFrom(int off, int count, float[] d) {
780780 public void copy1DRangeFrom (int off , int count , Allocation data , int dataOff ) {
781781 mRS .nAllocationData2D (getIDSafe (), off , 0 ,
782782 mSelectedLOD , mSelectedFace .mID ,
783- count , 1 , data .getID (), dataOff , 0 ,
783+ count , 1 , data .getID (mRS ), dataOff , 0 ,
784784 data .mSelectedLOD , data .mSelectedFace .mID );
785785 }
786786
@@ -857,7 +857,7 @@ public void copy2DRangeFrom(int xoff, int yoff, int w, int h,
857857 validate2DRange (xoff , yoff , w , h );
858858 mRS .nAllocationData2D (getIDSafe (), xoff , yoff ,
859859 mSelectedLOD , mSelectedFace .mID ,
860- w , h , data .getID (), dataXoff , dataYoff ,
860+ w , h , data .getID (mRS ), dataXoff , dataYoff ,
861861 data .mSelectedLOD , data .mSelectedFace .mID );
862862 }
863863
@@ -888,7 +888,7 @@ public void copyTo(Bitmap b) {
888888 mRS .validate ();
889889 validateBitmapFormat (b );
890890 validateBitmapSize (b );
891- mRS .nAllocationCopyToBitmap (getID (), b );
891+ mRS .nAllocationCopyToBitmap (getID (mRS ), b );
892892 }
893893
894894 /**
@@ -901,7 +901,7 @@ public void copyTo(Bitmap b) {
901901 public void copyTo (byte [] d ) {
902902 validateIsInt8 ();
903903 mRS .validate ();
904- mRS .nAllocationRead (getID (), d );
904+ mRS .nAllocationRead (getID (mRS ), d );
905905 }
906906
907907 /**
@@ -914,7 +914,7 @@ public void copyTo(byte[] d) {
914914 public void copyTo (short [] d ) {
915915 validateIsInt16 ();
916916 mRS .validate ();
917- mRS .nAllocationRead (getID (), d );
917+ mRS .nAllocationRead (getID (mRS ), d );
918918 }
919919
920920 /**
@@ -927,7 +927,7 @@ public void copyTo(short[] d) {
927927 public void copyTo (int [] d ) {
928928 validateIsInt32 ();
929929 mRS .validate ();
930- mRS .nAllocationRead (getID (), d );
930+ mRS .nAllocationRead (getID (mRS ), d );
931931 }
932932
933933 /**
@@ -940,7 +940,7 @@ public void copyTo(int[] d) {
940940 public void copyTo (float [] d ) {
941941 validateIsFloat32 ();
942942 mRS .validate ();
943- mRS .nAllocationRead (getID (), d );
943+ mRS .nAllocationRead (getID (mRS ), d );
944944 }
945945
946946 /**
@@ -959,10 +959,10 @@ public synchronized void resize(int dimX) {
959959 if ((mType .getY () > 0 )|| (mType .getZ () > 0 ) || mType .hasFaces () || mType .hasMipmaps ()) {
960960 throw new RSInvalidStateException ("Resize only support for 1D allocations at this time." );
961961 }
962- mRS .nAllocationResize1D (getID (), dimX );
962+ mRS .nAllocationResize1D (getID (mRS ), dimX );
963963 mRS .finish (); // Necessary because resize is fifoed and update is async.
964964
965- int typeID = mRS .nAllocationGetType (getID ());
965+ int typeID = mRS .nAllocationGetType (getID (mRS ));
966966 mType = new Type (typeID , mRS );
967967 mType .updateFromNative ();
968968 updateCacheInfo (mType );
@@ -991,10 +991,10 @@ public void resize(int dimX, int dimY) {
991991 throw new RSInvalidStateException (
992992 "Resize only support for 2D allocations at this time." );
993993 }
994- mRS .nAllocationResize2D (getID (), dimX , dimY );
994+ mRS .nAllocationResize2D (getID (mRS ), dimX , dimY );
995995 mRS .finish (); // Necessary because resize is fifoed and update is async.
996996
997- int typeID = mRS .nAllocationGetType (getID ());
997+ int typeID = mRS .nAllocationGetType (getID (mRS ));
998998 mType = new Type (typeID , mRS );
999999 mType .updateFromNative ();
10001000 updateCacheInfo (mType );
@@ -1019,10 +1019,10 @@ public void resize(int dimX, int dimY) {
10191019 */
10201020 static public Allocation createTyped (RenderScript rs , Type type , MipmapControl mips , int usage ) {
10211021 rs .validate ();
1022- if (type .getID () == 0 ) {
1022+ if (type .getID (rs ) == 0 ) {
10231023 throw new RSInvalidStateException ("Bad Type" );
10241024 }
1025- int id = rs .nAllocationCreateTyped (type .getID (), mips .mID , usage , 0 );
1025+ int id = rs .nAllocationCreateTyped (type .getID (rs ), mips .mID , usage , 0 );
10261026 if (id == 0 ) {
10271027 throw new RSRuntimeException ("Allocation creation failed." );
10281028 }
@@ -1043,10 +1043,10 @@ static public Allocation createTyped(RenderScript rs, Type type, MipmapControl m
10431043 static public Allocation createTyped (RenderScript rs , Type type , MipmapControl mips ,
10441044 int usage , int pointer ) {
10451045 rs .validate ();
1046- if (type .getID () == 0 ) {
1046+ if (type .getID (rs ) == 0 ) {
10471047 throw new RSInvalidStateException ("Bad Type" );
10481048 }
1049- int id = rs .nAllocationCreateTyped (type .getID (), mips .mID , usage , pointer );
1049+ int id = rs .nAllocationCreateTyped (type .getID (rs ), mips .mID , usage , pointer );
10501050 if (id == 0 ) {
10511051 throw new RSRuntimeException ("Allocation creation failed." );
10521052 }
@@ -1101,7 +1101,7 @@ static public Allocation createSized(RenderScript rs, Element e,
11011101 b .setX (count );
11021102 Type t = b .create ();
11031103
1104- int id = rs .nAllocationCreateTyped (t .getID (), MipmapControl .MIPMAP_NONE .mID , usage , 0 );
1104+ int id = rs .nAllocationCreateTyped (t .getID (rs ), MipmapControl .MIPMAP_NONE .mID , usage , 0 );
11051105 if (id == 0 ) {
11061106 throw new RSRuntimeException ("Allocation creation failed." );
11071107 }
@@ -1168,7 +1168,7 @@ static public Allocation createFromBitmap(RenderScript rs, Bitmap b,
11681168 rs .validate ();
11691169 Type t = typeFromBitmap (rs , b , mips );
11701170
1171- int id = rs .nAllocationCreateFromBitmap (t .getID (), mips .mID , b , usage );
1171+ int id = rs .nAllocationCreateFromBitmap (t .getID (rs ), mips .mID , b , usage );
11721172 if (id == 0 ) {
11731173 throw new RSRuntimeException ("Load failed." );
11741174 }
@@ -1186,9 +1186,9 @@ public SurfaceTexture getSurfaceTexture() {
11861186 throw new RSInvalidStateException ("Allocation is not a surface texture." );
11871187 }
11881188
1189- int id = mRS .nAllocationGetSurfaceTextureID (getID ());
1189+ int id = mRS .nAllocationGetSurfaceTextureID (getID (mRS ));
11901190 SurfaceTexture st = new SurfaceTexture (id );
1191- mRS .nAllocationGetSurfaceTextureID2 (getID (), st );
1191+ mRS .nAllocationGetSurfaceTextureID2 (getID (mRS ), st );
11921192
11931193 return st ;
11941194 }
@@ -1211,7 +1211,7 @@ public void setSurface(Surface sur) {
12111211 throw new RSInvalidStateException ("Allocation is not USAGE_IO_OUTPUT." );
12121212 }
12131213
1214- mRS .nAllocationSetSurface (getID (), sur );
1214+ mRS .nAllocationSetSurface (getID (mRS ), sur );
12151215 }
12161216
12171217 /**
@@ -1224,7 +1224,7 @@ public void setSurfaceTexture(SurfaceTexture st) {
12241224 }
12251225
12261226 Surface s = new Surface (st );
1227- mRS .nAllocationSetSurface (getID (), s );
1227+ mRS .nAllocationSetSurface (getID (mRS ), s );
12281228 }
12291229
12301230 /**
@@ -1283,7 +1283,7 @@ static public Allocation createCubemapFromBitmap(RenderScript rs, Bitmap b,
12831283 tb .setMipmaps (mips == MipmapControl .MIPMAP_FULL );
12841284 Type t = tb .create ();
12851285
1286- int id = rs .nAllocationCubeCreateFromBitmap (t .getID (), mips .mID , b , usage );
1286+ int id = rs .nAllocationCubeCreateFromBitmap (t .getID (rs ), mips .mID , b , usage );
12871287 if (id == 0 ) {
12881288 throw new RSRuntimeException ("Load failed for bitmap " + b + " element " + e );
12891289 }
0 commit comments