Exemple #1
0
 public Float32Array copy(FloatBuffer buffer) {
   if (GWT.isProdMode()) {
     return ((Float32Array) ((HasArrayBufferView) buffer).getTypedArray())
         .subarray(buffer.position(), buffer.remaining());
   } else {
     ensureCapacity(buffer);
     for (int i = buffer.position(), j = 0; i < buffer.limit(); i++, j++) {
       floatBuffer.set(j, buffer.get(i));
     }
     return floatBuffer.subarray(0, buffer.remaining());
   }
 }
Exemple #2
0
 public static Float32Array Float32ArrayfromFloatArray(float[] floatArray) {
   Float32Array a = Float32ArrayNative.create(floatArray.length);
   a.set(floatArray);
   return a;
 }
Exemple #3
0
 private void ensureCapacity(FloatBuffer buffer) {
   if (buffer.remaining() > floatBuffer.length()) {
     floatBuffer = TypedArrays.createFloat32Array(buffer.remaining());
   }
 }