@@ -136,7 +136,6 @@ public class Allocation extends BaseObj {
136136 * consumer. This usage will cause the allocation to be created
137137 * read only.
138138 *
139- * @hide
140139 */
141140 public static final int USAGE_IO_INPUT = 0x0020 ;
142141
@@ -145,7 +144,6 @@ public class Allocation extends BaseObj {
145144 * SurfaceTexture producer. The dimensions and format of the
146145 * SurfaceTexture will be forced to those of the allocation.
147146 *
148- * @hide
149147 */
150148 public static final int USAGE_IO_OUTPUT = 0x0040 ;
151149
@@ -193,8 +191,8 @@ private int getIDSafe() {
193191 /**
194192 * Get the element of the type of the Allocation.
195193 *
196- * @hide
197- * @return Element
194+ * @return Element that describes the structure of data in the
195+ * allocation
198196 *
199197 */
200198 public Element getElement () {
@@ -204,8 +202,8 @@ public Element getElement() {
204202 /**
205203 * Get the usage flags of the Allocation.
206204 *
207- * @hide
208- * @return usage
205+ * @return usage flags associated with the allocation. e.g.
206+ * script, texture, etc.
209207 *
210208 */
211209 public int getUsage () {
@@ -215,12 +213,11 @@ public int getUsage() {
215213 /**
216214 * Get the size of the Allocation in bytes.
217215 *
218- * @hide
219- * @return sizeInBytes
216+ * @return size of the Allocation in bytes.
220217 *
221218 */
222- public int getSizeBytes () {
223- return mType .getCount () * mType .getElement ().getSizeBytes ();
219+ public int getBytesSize () {
220+ return mType .getCount () * mType .getElement ().getBytesSize ();
224221 }
225222
226223 private void updateCacheInfo (Type t ) {
@@ -362,8 +359,6 @@ public void syncAll(int srcLocation) {
362359 * Send a buffer to the output stream. The contents of the
363360 * Allocation will be undefined after this operation.
364361 *
365- * @hide
366- *
367362 */
368363 public void ioSend () {
369364 if ((mUsage & USAGE_IO_OUTPUT ) == 0 ) {
@@ -385,8 +380,6 @@ public void ioSendOutput() {
385380 /**
386381 * Receive the latest input into the Allocation.
387382 *
388- * @hide
389- *
390383 */
391384 public void ioReceive () {
392385 if ((mUsage & USAGE_IO_INPUT ) == 0 ) {
@@ -424,37 +417,37 @@ private void validateBitmapFormat(Bitmap b) {
424417 throw new RSIllegalArgumentException ("Allocation kind is " +
425418 mType .getElement ().mKind + ", type " +
426419 mType .getElement ().mType +
427- " of " + mType .getElement ().getSizeBytes () +
420+ " of " + mType .getElement ().getBytesSize () +
428421 " bytes, passed bitmap was " + bc );
429422 }
430423 break ;
431424 case ARGB_8888 :
432425 if ((mType .getElement ().mKind != Element .DataKind .PIXEL_RGBA ) ||
433- (mType .getElement ().getSizeBytes () != 4 )) {
426+ (mType .getElement ().getBytesSize () != 4 )) {
434427 throw new RSIllegalArgumentException ("Allocation kind is " +
435428 mType .getElement ().mKind + ", type " +
436429 mType .getElement ().mType +
437- " of " + mType .getElement ().getSizeBytes () +
430+ " of " + mType .getElement ().getBytesSize () +
438431 " bytes, passed bitmap was " + bc );
439432 }
440433 break ;
441434 case RGB_565 :
442435 if ((mType .getElement ().mKind != Element .DataKind .PIXEL_RGB ) ||
443- (mType .getElement ().getSizeBytes () != 2 )) {
436+ (mType .getElement ().getBytesSize () != 2 )) {
444437 throw new RSIllegalArgumentException ("Allocation kind is " +
445438 mType .getElement ().mKind + ", type " +
446439 mType .getElement ().mType +
447- " of " + mType .getElement ().getSizeBytes () +
440+ " of " + mType .getElement ().getBytesSize () +
448441 " bytes, passed bitmap was " + bc );
449442 }
450443 break ;
451444 case ARGB_4444 :
452445 if ((mType .getElement ().mKind != Element .DataKind .PIXEL_RGBA ) ||
453- (mType .getElement ().getSizeBytes () != 2 )) {
446+ (mType .getElement ().getBytesSize () != 2 )) {
454447 throw new RSIllegalArgumentException ("Allocation kind is " +
455448 mType .getElement ().mKind + ", type " +
456449 mType .getElement ().mType +
457- " of " + mType .getElement ().getSizeBytes () +
450+ " of " + mType .getElement ().getBytesSize () +
458451 " bytes, passed bitmap was " + bc );
459452 }
460453 break ;
@@ -583,7 +576,7 @@ public void copyFrom(Bitmap b) {
583576 */
584577 public void setFromFieldPacker (int xoff , FieldPacker fp ) {
585578 mRS .validate ();
586- int eSize = mType .mElement .getSizeBytes ();
579+ int eSize = mType .mElement .getBytesSize ();
587580 final byte [] data = fp .getData ();
588581
589582 int count = data .length / eSize ;
@@ -612,7 +605,7 @@ public void setFromFieldPacker(int xoff, int component_number, FieldPacker fp) {
612605 }
613606
614607 final byte [] data = fp .getData ();
615- int eSize = mType .mElement .mElements [component_number ].getSizeBytes ();
608+ int eSize = mType .mElement .mElements [component_number ].getBytesSize ();
616609 eSize *= mType .mElement .mArraySizes [component_number ];
617610
618611 if (data .length != eSize ) {
@@ -665,7 +658,7 @@ public void generateMipmaps() {
665658 * @param d the source data array
666659 */
667660 public void copy1DRangeFromUnchecked (int off , int count , int [] d ) {
668- int dataSize = mType .mElement .getSizeBytes () * count ;
661+ int dataSize = mType .mElement .getBytesSize () * count ;
669662 data1DChecks (off , count , d .length * 4 , dataSize );
670663 mRS .nAllocationData1D (getIDSafe (), off , mSelectedLOD , count , d , dataSize );
671664 }
@@ -679,7 +672,7 @@ public void copy1DRangeFromUnchecked(int off, int count, int[] d) {
679672 * @param d the source data array
680673 */
681674 public void copy1DRangeFromUnchecked (int off , int count , short [] d ) {
682- int dataSize = mType .mElement .getSizeBytes () * count ;
675+ int dataSize = mType .mElement .getBytesSize () * count ;
683676 data1DChecks (off , count , d .length * 2 , dataSize );
684677 mRS .nAllocationData1D (getIDSafe (), off , mSelectedLOD , count , d , dataSize );
685678 }
@@ -693,7 +686,7 @@ public void copy1DRangeFromUnchecked(int off, int count, short[] d) {
693686 * @param d the source data array
694687 */
695688 public void copy1DRangeFromUnchecked (int off , int count , byte [] d ) {
696- int dataSize = mType .mElement .getSizeBytes () * count ;
689+ int dataSize = mType .mElement .getBytesSize () * count ;
697690 data1DChecks (off , count , d .length , dataSize );
698691 mRS .nAllocationData1D (getIDSafe (), off , mSelectedLOD , count , d , dataSize );
699692 }
@@ -707,7 +700,7 @@ public void copy1DRangeFromUnchecked(int off, int count, byte[] d) {
707700 * @param d the source data array
708701 */
709702 public void copy1DRangeFromUnchecked (int off , int count , float [] d ) {
710- int dataSize = mType .mElement .getSizeBytes () * count ;
703+ int dataSize = mType .mElement .getBytesSize () * count ;
711704 data1DChecks (off , count , d .length * 4 , dataSize );
712705 mRS .nAllocationData1D (getIDSafe (), off , mSelectedLOD , count , d , dataSize );
713706 }
@@ -1029,30 +1022,6 @@ static public Allocation createTyped(RenderScript rs, Type type, MipmapControl m
10291022 return new Allocation (id , rs , type , usage );
10301023 }
10311024
1032- /**
1033- * @hide
1034- * This API is hidden and only intended to be used for
1035- * transitional purposes.
1036- *
1037- * @param type renderscript type describing data layout
1038- * @param mips specifies desired mipmap behaviour for the
1039- * allocation
1040- * @param usage bit field specifying how the allocation is
1041- * utilized
1042- */
1043- static public Allocation createTyped (RenderScript rs , Type type , MipmapControl mips ,
1044- int usage , int pointer ) {
1045- rs .validate ();
1046- if (type .getID (rs ) == 0 ) {
1047- throw new RSInvalidStateException ("Bad Type" );
1048- }
1049- int id = rs .nAllocationCreateTyped (type .getID (rs ), mips .mID , usage , pointer );
1050- if (id == 0 ) {
1051- throw new RSRuntimeException ("Allocation creation failed." );
1052- }
1053- return new Allocation (id , rs , type , usage );
1054- }
1055-
10561025 /**
10571026 * Creates a renderscript allocation with the size specified by
10581027 * the type and no mipmaps generated by default
@@ -1194,16 +1163,21 @@ public SurfaceTexture getSurfaceTexture() {
11941163 }
11951164
11961165 /**
1166+ * For allocations used with io operations, returns the handle
1167+ * onto a raw buffer that is being managed by the screen
1168+ * compositor.
11971169 *
1198- * @hide
1170+ * @return Surface object associated with allocation
11991171 *
12001172 */
12011173 public Surface getSurface () {
12021174 return new Surface (getSurfaceTexture ());
12031175 }
12041176
12051177 /**
1206- * @hide
1178+ * Associate a surface for io output with this allocation
1179+ *
1180+ * @param sur Surface to associate with allocation
12071181 */
12081182 public void setSurface (Surface sur ) {
12091183 mRS .validate ();
0 commit comments