summaryrefslogtreecommitdiffstats
path: root/graphics/java/android
diff options
context:
space:
mode:
Diffstat (limited to 'graphics/java/android')
-rw-r--r--graphics/java/android/graphics/AvoidXfermode.java4
-rw-r--r--graphics/java/android/graphics/Bitmap.java64
-rw-r--r--graphics/java/android/graphics/BitmapFactory.java4
-rw-r--r--graphics/java/android/graphics/BitmapRegionDecoder.java16
-rw-r--r--graphics/java/android/graphics/BitmapShader.java6
-rw-r--r--graphics/java/android/graphics/BlurMaskFilter.java2
-rw-r--r--graphics/java/android/graphics/Camera.java10
-rw-r--r--graphics/java/android/graphics/Canvas.java196
-rw-r--r--graphics/java/android/graphics/ColorFilter.java6
-rw-r--r--graphics/java/android/graphics/ColorMatrixColorFilter.java4
-rw-r--r--graphics/java/android/graphics/ComposePathEffect.java3
-rw-r--r--graphics/java/android/graphics/ComposeShader.java14
-rw-r--r--graphics/java/android/graphics/CornerPathEffect.java2
-rw-r--r--graphics/java/android/graphics/DashPathEffect.java2
-rw-r--r--graphics/java/android/graphics/DiscretePathEffect.java2
-rw-r--r--graphics/java/android/graphics/DrawFilter.java4
-rw-r--r--graphics/java/android/graphics/EmbossMaskFilter.java2
-rw-r--r--graphics/java/android/graphics/Interpolator.java14
-rw-r--r--graphics/java/android/graphics/LargeBitmap.java14
-rw-r--r--graphics/java/android/graphics/LayerRasterizer.java4
-rw-r--r--graphics/java/android/graphics/LightingColorFilter.java4
-rw-r--r--graphics/java/android/graphics/LinearGradient.java8
-rw-r--r--graphics/java/android/graphics/MaskFilter.java4
-rw-r--r--graphics/java/android/graphics/Matrix.java95
-rw-r--r--graphics/java/android/graphics/Movie.java10
-rw-r--r--graphics/java/android/graphics/NinePatch.java18
-rw-r--r--graphics/java/android/graphics/Paint.java102
-rw-r--r--graphics/java/android/graphics/PaintFlagsDrawFilter.java2
-rw-r--r--graphics/java/android/graphics/Path.java86
-rw-r--r--graphics/java/android/graphics/PathDashPathEffect.java2
-rw-r--r--graphics/java/android/graphics/PathEffect.java4
-rw-r--r--graphics/java/android/graphics/PathMeasure.java20
-rw-r--r--graphics/java/android/graphics/Picture.java24
-rw-r--r--graphics/java/android/graphics/PixelXorXfermode.java2
-rw-r--r--graphics/java/android/graphics/PorterDuffColorFilter.java4
-rw-r--r--graphics/java/android/graphics/PorterDuffXfermode.java2
-rw-r--r--graphics/java/android/graphics/RadialGradient.java8
-rw-r--r--graphics/java/android/graphics/Rasterizer.java4
-rw-r--r--graphics/java/android/graphics/Region.java46
-rw-r--r--graphics/java/android/graphics/RegionIterator.java10
-rw-r--r--graphics/java/android/graphics/Shader.java10
-rw-r--r--graphics/java/android/graphics/SumPathEffect.java2
-rw-r--r--graphics/java/android/graphics/SurfaceTexture.java6
-rw-r--r--graphics/java/android/graphics/SweepGradient.java8
-rw-r--r--graphics/java/android/graphics/TableMaskFilter.java8
-rw-r--r--graphics/java/android/graphics/Typeface.java30
-rw-r--r--graphics/java/android/graphics/Xfermode.java4
-rw-r--r--graphics/java/android/graphics/drawable/LayerDrawable.java1
-rw-r--r--graphics/java/android/renderscript/Byte2.java356
-rw-r--r--graphics/java/android/renderscript/Byte3.java388
-rw-r--r--graphics/java/android/renderscript/Byte4.java420
-rw-r--r--graphics/java/android/renderscript/Double2.java372
-rw-r--r--graphics/java/android/renderscript/Double3.java406
-rw-r--r--graphics/java/android/renderscript/Double4.java442
-rw-r--r--graphics/java/android/renderscript/Float2.java372
-rw-r--r--graphics/java/android/renderscript/Float3.java406
-rw-r--r--graphics/java/android/renderscript/Float4.java441
-rw-r--r--graphics/java/android/renderscript/Int2.java426
-rw-r--r--graphics/java/android/renderscript/Int3.java465
-rw-r--r--graphics/java/android/renderscript/Int4.java505
-rw-r--r--graphics/java/android/renderscript/Long2.java425
-rw-r--r--graphics/java/android/renderscript/Long3.java464
-rw-r--r--graphics/java/android/renderscript/Long4.java504
-rw-r--r--graphics/java/android/renderscript/ScriptIntrinsicResize.java112
-rw-r--r--graphics/java/android/renderscript/Short2.java428
-rw-r--r--graphics/java/android/renderscript/Short3.java465
-rw-r--r--graphics/java/android/renderscript/Short4.java505
67 files changed, 8114 insertions, 685 deletions
diff --git a/graphics/java/android/graphics/AvoidXfermode.java b/graphics/java/android/graphics/AvoidXfermode.java
index 5a59e36..206c959 100644
--- a/graphics/java/android/graphics/AvoidXfermode.java
+++ b/graphics/java/android/graphics/AvoidXfermode.java
@@ -56,6 +56,6 @@ public class AvoidXfermode extends Xfermode {
native_instance = nativeCreate(opColor, tolerance, mode.nativeInt);
}
- private static native int nativeCreate(int opColor, int tolerance,
- int nativeMode);
+ private static native long nativeCreate(int opColor, int tolerance,
+ int nativeMode);
}
diff --git a/graphics/java/android/graphics/Bitmap.java b/graphics/java/android/graphics/Bitmap.java
index 3db12c5..9b71d64 100644
--- a/graphics/java/android/graphics/Bitmap.java
+++ b/graphics/java/android/graphics/Bitmap.java
@@ -41,7 +41,7 @@ public final class Bitmap implements Parcelable {
*
* @hide
*/
- public final int mNativeBitmap;
+ public final long mNativeBitmap;
/**
* Backing buffer for the Bitmap.
@@ -104,7 +104,7 @@ public final class Bitmap implements Parcelable {
* int (pointer).
*/
@SuppressWarnings({"UnusedDeclaration"}) // called from JNI
- Bitmap(int nativeBitmap, byte[] buffer, int width, int height, int density,
+ Bitmap(long nativeBitmap, byte[] buffer, int width, int height, int density,
boolean isMutable, boolean isPremultiplied,
byte[] ninePatchChunk, int[] layoutBounds) {
if (nativeBitmap == 0) {
@@ -1042,7 +1042,7 @@ public final class Bitmap implements Parcelable {
* <p>This method will not affect the behavior of a bitmap without an alpha
* channel, or if {@link #hasAlpha()} returns false.</p>
*
- * <p>Calling createBitmap() or createScaledBitmap() with a source
+ * <p>Calling {@link #createBitmap} or {@link #createScaledBitmap} with a source
* Bitmap whose colors are not pre-multiplied may result in a RuntimeException,
* since those functions require drawing the source, which is not supported for
* un-pre-multiplied Bitmaps.</p>
@@ -1524,7 +1524,7 @@ public final class Bitmap implements Parcelable {
*/
public Bitmap extractAlpha(Paint paint, int[] offsetXY) {
checkRecycled("Can't extractAlpha on a recycled bitmap");
- int nativePaint = paint != null ? paint.mNativePaint : 0;
+ long nativePaint = paint != null ? paint.mNativePaint : 0;
Bitmap bm = nativeExtractAlpha(mNativeBitmap, nativePaint, offsetXY);
if (bm == null) {
throw new RuntimeException("Failed to extractAlpha on Bitmap");
@@ -1558,9 +1558,9 @@ public final class Bitmap implements Parcelable {
}
private static class BitmapFinalizer {
- private final int mNativeBitmap;
+ private final long mNativeBitmap;
- BitmapFinalizer(int nativeBitmap) {
+ BitmapFinalizer(long nativeBitmap) {
mNativeBitmap = nativeBitmap;
}
@@ -1581,56 +1581,56 @@ public final class Bitmap implements Parcelable {
private static native Bitmap nativeCreate(int[] colors, int offset,
int stride, int width, int height,
int nativeConfig, boolean mutable);
- private static native Bitmap nativeCopy(int srcBitmap, int nativeConfig,
+ private static native Bitmap nativeCopy(long nativeSrcBitmap, int nativeConfig,
boolean isMutable);
- private static native void nativeDestructor(int nativeBitmap);
- private static native boolean nativeRecycle(int nativeBitmap);
- private static native void nativeReconfigure(int nativeBitmap, int width, int height,
+ private static native void nativeDestructor(long nativeBitmap);
+ private static native boolean nativeRecycle(long nativeBitmap);
+ private static native void nativeReconfigure(long nativeBitmap, int width, int height,
int config, int allocSize);
- private static native boolean nativeCompress(int nativeBitmap, int format,
+ private static native boolean nativeCompress(long nativeBitmap, int format,
int quality, OutputStream stream,
byte[] tempStorage);
- private static native void nativeErase(int nativeBitmap, int color);
- private static native int nativeRowBytes(int nativeBitmap);
- private static native int nativeConfig(int nativeBitmap);
+ private static native void nativeErase(long nativeBitmap, int color);
+ private static native int nativeRowBytes(long nativeBitmap);
+ private static native int nativeConfig(long nativeBitmap);
- private static native int nativeGetPixel(int nativeBitmap, int x, int y,
+ private static native int nativeGetPixel(long nativeBitmap, int x, int y,
boolean isPremultiplied);
- private static native void nativeGetPixels(int nativeBitmap, int[] pixels,
+ private static native void nativeGetPixels(long nativeBitmap, int[] pixels,
int offset, int stride, int x, int y,
int width, int height, boolean isPremultiplied);
- private static native void nativeSetPixel(int nativeBitmap, int x, int y,
+ private static native void nativeSetPixel(long nativeBitmap, int x, int y,
int color, boolean isPremultiplied);
- private static native void nativeSetPixels(int nativeBitmap, int[] colors,
+ private static native void nativeSetPixels(long nativeBitmap, int[] colors,
int offset, int stride, int x, int y,
int width, int height, boolean isPremultiplied);
- private static native void nativeCopyPixelsToBuffer(int nativeBitmap,
+ private static native void nativeCopyPixelsToBuffer(long nativeBitmap,
Buffer dst);
- private static native void nativeCopyPixelsFromBuffer(int nb, Buffer src);
- private static native int nativeGenerationId(int nativeBitmap);
+ private static native void nativeCopyPixelsFromBuffer(long nativeBitmap, Buffer src);
+ private static native int nativeGenerationId(long nativeBitmap);
private static native Bitmap nativeCreateFromParcel(Parcel p);
// returns true on success
- private static native boolean nativeWriteToParcel(int nativeBitmap,
+ private static native boolean nativeWriteToParcel(long nativeBitmap,
boolean isMutable,
int density,
Parcel p);
// returns a new bitmap built from the native bitmap's alpha, and the paint
- private static native Bitmap nativeExtractAlpha(int nativeBitmap,
- int nativePaint,
+ private static native Bitmap nativeExtractAlpha(long nativeBitmap,
+ long nativePaint,
int[] offsetXY);
- private static native void nativePrepareToDraw(int nativeBitmap);
- private static native boolean nativeHasAlpha(int nativeBitmap);
- private static native void nativeSetAlphaAndPremultiplied(int nBitmap, boolean hasAlpha,
+ private static native void nativePrepareToDraw(long nativeBitmap);
+ private static native boolean nativeHasAlpha(long nativeBitmap);
+ private static native void nativeSetAlphaAndPremultiplied(long nBitmap, boolean hasAlpha,
boolean isPremul);
- private static native boolean nativeHasMipMap(int nativeBitmap);
- private static native void nativeSetHasMipMap(int nBitmap, boolean hasMipMap);
- private static native boolean nativeSameAs(int nb0, int nb1);
-
- /* package */ final int ni() {
+ private static native boolean nativeHasMipMap(long nativeBitmap);
+ private static native void nativeSetHasMipMap(long nativeBitmap, boolean hasMipMap);
+ private static native boolean nativeSameAs(long nativeBitmap0, long nativeBitmap1);
+
+ /* package */ final long ni() {
return mNativeBitmap;
}
}
diff --git a/graphics/java/android/graphics/BitmapFactory.java b/graphics/java/android/graphics/BitmapFactory.java
index 4575364..67e8f23 100644
--- a/graphics/java/android/graphics/BitmapFactory.java
+++ b/graphics/java/android/graphics/BitmapFactory.java
@@ -590,7 +590,7 @@ public class BitmapFactory {
Trace.traceBegin(Trace.TRACE_TAG_GRAPHICS, "decodeBitmap");
try {
if (is instanceof AssetManager.AssetInputStream) {
- final int asset = ((AssetManager.AssetInputStream) is).getAssetInt();
+ final long asset = ((AssetManager.AssetInputStream) is).getNativeAsset();
bm = nativeDecodeAsset(asset, outPadding, opts);
} else {
bm = decodeStreamInternal(is, outPadding, opts);
@@ -693,7 +693,7 @@ public class BitmapFactory {
Rect padding, Options opts);
private static native Bitmap nativeDecodeFileDescriptor(FileDescriptor fd,
Rect padding, Options opts);
- private static native Bitmap nativeDecodeAsset(int asset, Rect padding, Options opts);
+ private static native Bitmap nativeDecodeAsset(long nativeAsset, Rect padding, Options opts);
private static native Bitmap nativeDecodeByteArray(byte[] data, int offset,
int length, Options opts);
private static native boolean nativeIsSeekable(FileDescriptor fd);
diff --git a/graphics/java/android/graphics/BitmapRegionDecoder.java b/graphics/java/android/graphics/BitmapRegionDecoder.java
index 3a99977..e689b08 100644
--- a/graphics/java/android/graphics/BitmapRegionDecoder.java
+++ b/graphics/java/android/graphics/BitmapRegionDecoder.java
@@ -33,7 +33,7 @@ import java.io.InputStream;
*
*/
public final class BitmapRegionDecoder {
- private int mNativeBitmapRegionDecoder;
+ private long mNativeBitmapRegionDecoder;
private boolean mRecycled;
// ensures that the native decoder object exists and that only one decode can
// occur at a time.
@@ -114,7 +114,7 @@ public final class BitmapRegionDecoder {
boolean isShareable) throws IOException {
if (is instanceof AssetManager.AssetInputStream) {
return nativeNewInstance(
- ((AssetManager.AssetInputStream) is).getAssetInt(),
+ ((AssetManager.AssetInputStream) is).getNativeAsset(),
isShareable);
} else {
// pass some temp storage down to the native code. 1024 is made up,
@@ -165,7 +165,7 @@ public final class BitmapRegionDecoder {
This can be called from JNI code.
*/
- private BitmapRegionDecoder(int decoder) {
+ private BitmapRegionDecoder(long decoder) {
mNativeBitmapRegionDecoder = decoder;
mRecycled = false;
}
@@ -254,12 +254,12 @@ public final class BitmapRegionDecoder {
}
}
- private static native Bitmap nativeDecodeRegion(int lbm,
+ private static native Bitmap nativeDecodeRegion(long lbm,
int start_x, int start_y, int width, int height,
BitmapFactory.Options options);
- private static native int nativeGetWidth(int lbm);
- private static native int nativeGetHeight(int lbm);
- private static native void nativeClean(int lbm);
+ private static native int nativeGetWidth(long lbm);
+ private static native int nativeGetHeight(long lbm);
+ private static native void nativeClean(long lbm);
private static native BitmapRegionDecoder nativeNewInstance(
byte[] data, int offset, int length, boolean isShareable);
@@ -268,5 +268,5 @@ public final class BitmapRegionDecoder {
private static native BitmapRegionDecoder nativeNewInstance(
InputStream is, byte[] storage, boolean isShareable);
private static native BitmapRegionDecoder nativeNewInstance(
- int asset, boolean isShareable);
+ long asset, boolean isShareable);
}
diff --git a/graphics/java/android/graphics/BitmapShader.java b/graphics/java/android/graphics/BitmapShader.java
index a4f75b9..b7673d8 100644
--- a/graphics/java/android/graphics/BitmapShader.java
+++ b/graphics/java/android/graphics/BitmapShader.java
@@ -42,7 +42,7 @@ public class BitmapShader extends Shader {
mBitmap = bitmap;
mTileX = tileX;
mTileY = tileY;
- final int b = bitmap.ni();
+ final long b = bitmap.ni();
native_instance = nativeCreate(b, tileX.nativeInt, tileY.nativeInt);
native_shader = nativePostCreate(native_instance, b, tileX.nativeInt, tileY.nativeInt);
}
@@ -57,8 +57,8 @@ public class BitmapShader extends Shader {
return copy;
}
- private static native int nativeCreate(int native_bitmap, int shaderTileModeX,
+ private static native long nativeCreate(long native_bitmap, int shaderTileModeX,
int shaderTileModeY);
- private static native int nativePostCreate(int native_shader, int native_bitmap,
+ private static native long nativePostCreate(long native_shader, long native_bitmap,
int shaderTileModeX, int shaderTileModeY);
}
diff --git a/graphics/java/android/graphics/BlurMaskFilter.java b/graphics/java/android/graphics/BlurMaskFilter.java
index 5eafe76..939af52 100644
--- a/graphics/java/android/graphics/BlurMaskFilter.java
+++ b/graphics/java/android/graphics/BlurMaskFilter.java
@@ -47,5 +47,5 @@ public class BlurMaskFilter extends MaskFilter {
native_instance = nativeConstructor(radius, style.native_int);
}
- private static native int nativeConstructor(float radius, int style);
+ private static native long nativeConstructor(float radius, int style);
}
diff --git a/graphics/java/android/graphics/Camera.java b/graphics/java/android/graphics/Camera.java
index 9e07bd4..c263a84 100644
--- a/graphics/java/android/graphics/Camera.java
+++ b/graphics/java/android/graphics/Camera.java
@@ -159,7 +159,7 @@ public class Camera {
}
public native float dotWithNormal(float dx, float dy, float dz);
-
+
protected void finalize() throws Throwable {
try {
nativeDestructor();
@@ -170,8 +170,8 @@ public class Camera {
private native void nativeConstructor();
private native void nativeDestructor();
- private native void nativeGetMatrix(int native_matrix);
- private native void nativeApplyToCanvas(int native_canvas);
-
- int native_instance;
+ private native void nativeGetMatrix(long native_matrix);
+ private native void nativeApplyToCanvas(long native_canvas);
+
+ long native_instance;
}
diff --git a/graphics/java/android/graphics/Canvas.java b/graphics/java/android/graphics/Canvas.java
index d46238f..f86840e 100644
--- a/graphics/java/android/graphics/Canvas.java
+++ b/graphics/java/android/graphics/Canvas.java
@@ -40,7 +40,7 @@ public class Canvas {
// assigned in constructors or setBitmap, freed in finalizer
/** @hide */
- public int mNativeCanvas;
+ public long mNativeCanvas;
// may be null
private Bitmap mBitmap;
@@ -84,9 +84,9 @@ public class Canvas {
private final CanvasFinalizer mFinalizer;
private static final class CanvasFinalizer {
- private int mNativeCanvas;
+ private long mNativeCanvas;
- public CanvasFinalizer(int nativeCanvas) {
+ public CanvasFinalizer(long nativeCanvas) {
mNativeCanvas = nativeCanvas;
}
@@ -144,7 +144,7 @@ public class Canvas {
}
/** @hide */
- public Canvas(int nativeCanvas) {
+ public Canvas(long nativeCanvas) {
if (nativeCanvas == 0) {
throw new IllegalStateException();
}
@@ -157,8 +157,8 @@ public class Canvas {
* Replace existing canvas while ensuring that the swap has occurred before
* the previous native canvas is unreferenced.
*/
- private void safeCanvasSwap(int nativeCanvas, boolean copyState) {
- final int oldCanvas = mNativeCanvas;
+ private void safeCanvasSwap(long nativeCanvas, boolean copyState) {
+ final long oldCanvas = mNativeCanvas;
mNativeCanvas = nativeCanvas;
mFinalizer.mNativeCanvas = nativeCanvas;
if (copyState) {
@@ -174,7 +174,7 @@ public class Canvas {
*
* @hide
*/
- public int getNativeCanvas() {
+ public long getNativeCanvas() {
return mNativeCanvas;
}
@@ -712,7 +712,7 @@ public class Canvas {
}
public void setDrawFilter(DrawFilter filter) {
- int nativeFilter = 0;
+ long nativeFilter = 0;
if (filter != null) {
nativeFilter = filter.mNativeInt;
}
@@ -1387,7 +1387,7 @@ public class Canvas {
vertOffset, texs, texOffset, colors, colorOffset,
indices, indexOffset, indexCount, paint.mNativePaint);
}
-
+
/**
* Draw the text, with origin at (x,y), using the specified paint. The
* origin is interpreted based on the Align setting in the paint.
@@ -1713,137 +1713,155 @@ public class Canvas {
*/
public static native void freeTextLayoutCaches();
- private static native int initRaster(int nativeBitmapOrZero);
- private static native void copyNativeCanvasState(int srcCanvas, int dstCanvas);
- private static native int native_saveLayer(int nativeCanvas, RectF bounds,
- int paint, int layerFlags);
- private static native int native_saveLayer(int nativeCanvas, float l,
+ private static native long initRaster(long nativeBitmapOrZero);
+ private static native void copyNativeCanvasState(long nativeSrcCanvas,
+ long nativeDstCanvas);
+ private static native int native_saveLayer(long nativeCanvas,
+ RectF bounds,
+ long nativePaint,
+ int layerFlags);
+ private static native int native_saveLayer(long nativeCanvas, float l,
float t, float r, float b,
- int paint, int layerFlags);
- private static native int native_saveLayerAlpha(int nativeCanvas,
+ long nativePaint,
+ int layerFlags);
+ private static native int native_saveLayerAlpha(long nativeCanvas,
RectF bounds, int alpha,
int layerFlags);
- private static native int native_saveLayerAlpha(int nativeCanvas, float l,
+ private static native int native_saveLayerAlpha(long nativeCanvas, float l,
float t, float r, float b,
int alpha, int layerFlags);
- private static native void native_concat(int nCanvas, int nMatrix);
- private static native void native_setMatrix(int nCanvas, int nMatrix);
- private static native boolean native_clipRect(int nCanvas,
+ private static native void native_concat(long nativeCanvas,
+ long nativeMatrix);
+ private static native void native_setMatrix(long nativeCanvas,
+ long nativeMatrix);
+ private static native boolean native_clipRect(long nativeCanvas,
float left, float top,
float right, float bottom,
int regionOp);
- private static native boolean native_clipPath(int nativeCanvas,
- int nativePath,
+ private static native boolean native_clipPath(long nativeCanvas,
+ long nativePath,
int regionOp);
- private static native boolean native_clipRegion(int nativeCanvas,
- int nativeRegion,
+ private static native boolean native_clipRegion(long nativeCanvas,
+ long nativeRegion,
int regionOp);
- private static native void nativeSetDrawFilter(int nativeCanvas,
- int nativeFilter);
- private static native boolean native_getClipBounds(int nativeCanvas,
+ private static native void nativeSetDrawFilter(long nativeCanvas,
+ long nativeFilter);
+ private static native boolean native_getClipBounds(long nativeCanvas,
Rect bounds);
- private static native void native_getCTM(int canvas, int matrix);
- private static native boolean native_quickReject(int nativeCanvas,
+ private static native void native_getCTM(long nativeCanvas,
+ long nativeMatrix);
+ private static native boolean native_quickReject(long nativeCanvas,
RectF rect);
- private static native boolean native_quickReject(int nativeCanvas,
- int path);
- private static native boolean native_quickReject(int nativeCanvas,
+ private static native boolean native_quickReject(long nativeCanvas,
+ long nativePath);
+ private static native boolean native_quickReject(long nativeCanvas,
float left, float top,
float right, float bottom);
- private static native void native_drawRGB(int nativeCanvas, int r, int g,
+ private static native void native_drawRGB(long nativeCanvas, int r, int g,
int b);
- private static native void native_drawARGB(int nativeCanvas, int a, int r,
+ private static native void native_drawARGB(long nativeCanvas, int a, int r,
int g, int b);
- private static native void native_drawColor(int nativeCanvas, int color);
- private static native void native_drawColor(int nativeCanvas, int color,
+ private static native void native_drawColor(long nativeCanvas, int color);
+ private static native void native_drawColor(long nativeCanvas, int color,
int mode);
- private static native void native_drawPaint(int nativeCanvas, int paint);
- private static native void native_drawLine(int nativeCanvas, float startX,
+ private static native void native_drawPaint(long nativeCanvas,
+ long nativePaint);
+ private static native void native_drawLine(long nativeCanvas, float startX,
float startY, float stopX,
- float stopY, int paint);
- private static native void native_drawRect(int nativeCanvas, RectF rect,
- int paint);
- private static native void native_drawRect(int nativeCanvas, float left,
+ float stopY, long nativePaint);
+ private static native void native_drawRect(long nativeCanvas, RectF rect,
+ long nativePaint);
+ private static native void native_drawRect(long nativeCanvas, float left,
float top, float right,
- float bottom, int paint);
- private static native void native_drawOval(int nativeCanvas, RectF oval,
- int paint);
- private static native void native_drawCircle(int nativeCanvas, float cx,
+ float bottom,
+ long nativePaint);
+ private static native void native_drawOval(long nativeCanvas, RectF oval,
+ long nativePaint);
+ private static native void native_drawCircle(long nativeCanvas, float cx,
float cy, float radius,
- int paint);
- private static native void native_drawArc(int nativeCanvas, RectF oval,
+ long nativePaint);
+ private static native void native_drawArc(long nativeCanvas, RectF oval,
float startAngle, float sweep,
- boolean useCenter, int paint);
- private static native void native_drawRoundRect(int nativeCanvas,
+ boolean useCenter,
+ long nativePaint);
+ private static native void native_drawRoundRect(long nativeCanvas,
RectF rect, float rx,
- float ry, int paint);
- private static native void native_drawPath(int nativeCanvas, int path,
- int paint);
- private native void native_drawBitmap(int nativeCanvas, int bitmap,
+ float ry, long nativePaint);
+ private static native void native_drawPath(long nativeCanvas,
+ long nativePath,
+ long nativePaint);
+ private native void native_drawBitmap(long nativeCanvas, long nativeBitmap,
float left, float top,
- int nativePaintOrZero,
+ long nativePaintOrZero,
int canvasDensity,
int screenDensity,
int bitmapDensity);
- private native void native_drawBitmap(int nativeCanvas, int bitmap,
+ private native void native_drawBitmap(long nativeCanvas, long nativeBitmap,
Rect src, RectF dst,
- int nativePaintOrZero,
+ long nativePaintOrZero,
int screenDensity,
int bitmapDensity);
- private static native void native_drawBitmap(int nativeCanvas, int bitmap,
+ private static native void native_drawBitmap(long nativeCanvas,
+ long nativeBitmap,
Rect src, Rect dst,
- int nativePaintOrZero,
+ long nativePaintOrZero,
int screenDensity,
int bitmapDensity);
- private static native void native_drawBitmap(int nativeCanvas, int[] colors,
+ private static native void native_drawBitmap(long nativeCanvas, int[] colors,
int offset, int stride, float x,
float y, int width, int height,
boolean hasAlpha,
- int nativePaintOrZero);
- private static native void nativeDrawBitmapMatrix(int nCanvas, int nBitmap,
- int nMatrix, int nPaint);
- private static native void nativeDrawBitmapMesh(int nCanvas, int nBitmap,
+ long nativePaintOrZero);
+ private static native void nativeDrawBitmapMatrix(long nativeCanvas,
+ long nativeBitmap,
+ long nativeMatrix,
+ long nativePaint);
+ private static native void nativeDrawBitmapMesh(long nativeCanvas,
+ long nativeBitmap,
int meshWidth, int meshHeight,
float[] verts, int vertOffset,
- int[] colors, int colorOffset, int nPaint);
- private static native void nativeDrawVertices(int nCanvas, int mode, int n,
+ int[] colors, int colorOffset,
+ long nativePaint);
+ private static native void nativeDrawVertices(long nativeCanvas, int mode, int n,
float[] verts, int vertOffset, float[] texs, int texOffset,
int[] colors, int colorOffset, short[] indices,
- int indexOffset, int indexCount, int nPaint);
-
- private static native void native_drawText(int nativeCanvas, char[] text,
+ int indexOffset, int indexCount, long nativePaint);
+
+ private static native void native_drawText(long nativeCanvas, char[] text,
int index, int count, float x,
- float y, int flags, int paint);
- private static native void native_drawText(int nativeCanvas, String text,
+ float y, int flags,
+ long nativePaint);
+ private static native void native_drawText(long nativeCanvas, String text,
int start, int end, float x,
- float y, int flags, int paint);
+ float y, int flags,
+ long nativePaint);
- private static native void native_drawTextRun(int nativeCanvas, String text,
+ private static native void native_drawTextRun(long nativeCanvas, String text,
int start, int end, int contextStart, int contextEnd,
- float x, float y, int flags, int paint);
+ float x, float y, int flags, long nativePaint);
- private static native void native_drawTextRun(int nativeCanvas, char[] text,
+ private static native void native_drawTextRun(long nativeCanvas, char[] text,
int start, int count, int contextStart, int contextCount,
- float x, float y, int flags, int paint);
+ float x, float y, int flags, long nativePaint);
- private static native void native_drawPosText(int nativeCanvas,
+ private static native void native_drawPosText(long nativeCanvas,
char[] text, int index,
int count, float[] pos,
- int paint);
- private static native void native_drawPosText(int nativeCanvas,
+ long nativePaint);
+ private static native void native_drawPosText(long nativeCanvas,
String text, float[] pos,
- int paint);
- private static native void native_drawTextOnPath(int nativeCanvas,
+ long nativePaint);
+ private static native void native_drawTextOnPath(long nativeCanvas,
char[] text, int index,
- int count, int path,
+ int count, long nativePath,
float hOffset,
float vOffset, int bidiFlags,
- int paint);
- private static native void native_drawTextOnPath(int nativeCanvas,
- String text, int path,
- float hOffset,
- float vOffset,
- int flags, int paint);
- private static native void finalizer(int nativeCanvas);
+ long nativePaint);
+ private static native void native_drawTextOnPath(long nativeCanvas,
+ String text, long nativePath,
+ float hOffset,
+ float vOffset,
+ int flags, long nativePaint);
+ private static native void finalizer(long nativeCanvas);
}
diff --git a/graphics/java/android/graphics/ColorFilter.java b/graphics/java/android/graphics/ColorFilter.java
index e5cf830..8e432da 100644
--- a/graphics/java/android/graphics/ColorFilter.java
+++ b/graphics/java/android/graphics/ColorFilter.java
@@ -23,12 +23,12 @@ package android.graphics;
public class ColorFilter {
- int native_instance;
+ long native_instance;
/**
* @hide
*/
- public int nativeColorFilter;
+ public long nativeColorFilter;
protected void finalize() throws Throwable {
try {
@@ -38,5 +38,5 @@ public class ColorFilter {
}
}
- private static native void finalizer(int native_instance, int nativeColorFilter);
+ private static native void finalizer(long native_instance, long nativeColorFilter);
}
diff --git a/graphics/java/android/graphics/ColorMatrixColorFilter.java b/graphics/java/android/graphics/ColorMatrixColorFilter.java
index 4f32342..21b7721 100644
--- a/graphics/java/android/graphics/ColorMatrixColorFilter.java
+++ b/graphics/java/android/graphics/ColorMatrixColorFilter.java
@@ -45,6 +45,6 @@ public class ColorMatrixColorFilter extends ColorFilter {
nativeColorFilter = nColorMatrixFilter(native_instance, array);
}
- private static native int nativeColorMatrixFilter(float[] array);
- private static native int nColorMatrixFilter(int nativeFilter, float[] array);
+ private static native long nativeColorMatrixFilter(float[] array);
+ private static native long nColorMatrixFilter(long nativeFilter, float[] array);
}
diff --git a/graphics/java/android/graphics/ComposePathEffect.java b/graphics/java/android/graphics/ComposePathEffect.java
index beac78e..3fc9eb5 100644
--- a/graphics/java/android/graphics/ComposePathEffect.java
+++ b/graphics/java/android/graphics/ComposePathEffect.java
@@ -27,6 +27,7 @@ public class ComposePathEffect extends PathEffect {
innerpe.native_instance);
}
- private static native int nativeCreate(int outerpe, int innerpe);
+ private static native long nativeCreate(long nativeOuterpe,
+ long nativeInnerpe);
}
diff --git a/graphics/java/android/graphics/ComposeShader.java b/graphics/java/android/graphics/ComposeShader.java
index de0d3d6..5109ffd 100644
--- a/graphics/java/android/graphics/ComposeShader.java
+++ b/graphics/java/android/graphics/ComposeShader.java
@@ -104,12 +104,12 @@ public class ComposeShader extends Shader {
return copy;
}
- private static native int nativeCreate1(int native_shaderA, int native_shaderB,
- int native_mode);
- private static native int nativeCreate2(int native_shaderA, int native_shaderB,
+ private static native long nativeCreate1(long native_shaderA, long native_shaderB,
+ long native_mode);
+ private static native long nativeCreate2(long native_shaderA, long native_shaderB,
int porterDuffMode);
- private static native int nativePostCreate1(int native_shader, int native_skiaShaderA,
- int native_skiaShaderB, int native_mode);
- private static native int nativePostCreate2(int native_shader, int native_skiaShaderA,
- int native_skiaShaderB, int porterDuffMode);
+ private static native long nativePostCreate1(long native_shader, long native_skiaShaderA,
+ long native_skiaShaderB, long native_mode);
+ private static native long nativePostCreate2(long native_shader, long native_skiaShaderA,
+ long native_skiaShaderB, int porterDuffMode);
}
diff --git a/graphics/java/android/graphics/CornerPathEffect.java b/graphics/java/android/graphics/CornerPathEffect.java
index 400c886..8f4d7d9 100644
--- a/graphics/java/android/graphics/CornerPathEffect.java
+++ b/graphics/java/android/graphics/CornerPathEffect.java
@@ -28,6 +28,6 @@ public class CornerPathEffect extends PathEffect {
native_instance = nativeCreate(radius);
}
- private static native int nativeCreate(float radius);
+ private static native long nativeCreate(float radius);
}
diff --git a/graphics/java/android/graphics/DashPathEffect.java b/graphics/java/android/graphics/DashPathEffect.java
index 2bdecce..ef3ebe8 100644
--- a/graphics/java/android/graphics/DashPathEffect.java
+++ b/graphics/java/android/graphics/DashPathEffect.java
@@ -38,6 +38,6 @@ public class DashPathEffect extends PathEffect {
native_instance = nativeCreate(intervals, phase);
}
- private static native int nativeCreate(float intervals[], float phase);
+ private static native long nativeCreate(float intervals[], float phase);
}
diff --git a/graphics/java/android/graphics/DiscretePathEffect.java b/graphics/java/android/graphics/DiscretePathEffect.java
index de8b2f0..3b3c9c9 100644
--- a/graphics/java/android/graphics/DiscretePathEffect.java
+++ b/graphics/java/android/graphics/DiscretePathEffect.java
@@ -26,6 +26,6 @@ public class DiscretePathEffect extends PathEffect {
native_instance = nativeCreate(segmentLength, deviation);
}
- private static native int nativeCreate(float length, float deviation);
+ private static native long nativeCreate(float length, float deviation);
}
diff --git a/graphics/java/android/graphics/DrawFilter.java b/graphics/java/android/graphics/DrawFilter.java
index 1f64539..ed38f37 100644
--- a/graphics/java/android/graphics/DrawFilter.java
+++ b/graphics/java/android/graphics/DrawFilter.java
@@ -25,7 +25,7 @@ package android.graphics;
public class DrawFilter {
// this is set by subclasses, but don't make it public
- /* package */ int mNativeInt; // pointer to native object
+ /* package */ long mNativeInt; // pointer to native object
protected void finalize() throws Throwable {
try {
@@ -35,6 +35,6 @@ public class DrawFilter {
}
}
- private static native void nativeDestructor(int nativeDrawFilter);
+ private static native void nativeDestructor(long nativeDrawFilter);
}
diff --git a/graphics/java/android/graphics/EmbossMaskFilter.java b/graphics/java/android/graphics/EmbossMaskFilter.java
index 5dd8611..a9e180f 100644
--- a/graphics/java/android/graphics/EmbossMaskFilter.java
+++ b/graphics/java/android/graphics/EmbossMaskFilter.java
@@ -33,6 +33,6 @@ public class EmbossMaskFilter extends MaskFilter {
native_instance = nativeConstructor(direction, ambient, specular, blurRadius);
}
- private static native int nativeConstructor(float[] direction, float ambient, float specular, float blurRadius);
+ private static native long nativeConstructor(float[] direction, float ambient, float specular, float blurRadius);
}
diff --git a/graphics/java/android/graphics/Interpolator.java b/graphics/java/android/graphics/Interpolator.java
index 75851a6..f695a9e 100644
--- a/graphics/java/android/graphics/Interpolator.java
+++ b/graphics/java/android/graphics/Interpolator.java
@@ -151,13 +151,13 @@ public class Interpolator {
private int mValueCount;
private int mFrameCount;
- private final int native_instance;
+ private final long native_instance;
- private static native int nativeConstructor(int valueCount, int frameCount);
- private static native void nativeDestructor(int native_instance);
- private static native void nativeReset(int native_instance, int valueCount, int frameCount);
- private static native void nativeSetKeyFrame(int native_instance, int index, int msec, float[] values, float[] blend);
- private static native void nativeSetRepeatMirror(int native_instance, float repeatCount, boolean mirror);
- private static native int nativeTimeToValues(int native_instance, int msec, float[] values);
+ private static native long nativeConstructor(int valueCount, int frameCount);
+ private static native void nativeDestructor(long native_instance);
+ private static native void nativeReset(long native_instance, int valueCount, int frameCount);
+ private static native void nativeSetKeyFrame(long native_instance, int index, int msec, float[] values, float[] blend);
+ private static native void nativeSetRepeatMirror(long native_instance, float repeatCount, boolean mirror);
+ private static native int nativeTimeToValues(long native_instance, int msec, float[] values);
}
diff --git a/graphics/java/android/graphics/LargeBitmap.java b/graphics/java/android/graphics/LargeBitmap.java
index 6656b17..238b32a 100644
--- a/graphics/java/android/graphics/LargeBitmap.java
+++ b/graphics/java/android/graphics/LargeBitmap.java
@@ -37,7 +37,7 @@ import java.nio.ShortBuffer;
* @hide
*/
public final class LargeBitmap {
- private int mNativeLargeBitmap;
+ private long mNativeLargeBitmap;
private boolean mRecycled;
/* Private constructor that must received an already allocated native
@@ -45,8 +45,8 @@ public final class LargeBitmap {
This can be called from JNI code.
*/
- private LargeBitmap(int lbm) {
- mNativeLargeBitmap = lbm;
+ private LargeBitmap(long nativeLbm) {
+ mNativeLargeBitmap = nativeLbm;
mRecycled = false;
}
@@ -119,10 +119,10 @@ public final class LargeBitmap {
recycle();
}
- private static native Bitmap nativeDecodeRegion(int lbm,
+ private static native Bitmap nativeDecodeRegion(long nativeLbm,
int start_x, int start_y, int width, int height,
BitmapFactory.Options options);
- private static native int nativeGetWidth(int lbm);
- private static native int nativeGetHeight(int lbm);
- private static native void nativeClean(int lbm);
+ private static native int nativeGetWidth(long nativeLbm);
+ private static native int nativeGetHeight(long nativeLbm);
+ private static native void nativeClean(long nativeLbm);
}
diff --git a/graphics/java/android/graphics/LayerRasterizer.java b/graphics/java/android/graphics/LayerRasterizer.java
index 9bd55a5..dc307c6 100644
--- a/graphics/java/android/graphics/LayerRasterizer.java
+++ b/graphics/java/android/graphics/LayerRasterizer.java
@@ -34,7 +34,7 @@ public class LayerRasterizer extends Rasterizer {
nativeAddLayer(native_instance, paint.mNativePaint, 0, 0);
}
- private static native int nativeConstructor();
- private static native void nativeAddLayer(int native_layer, int native_paint, float dx, float dy);
+ private static native long nativeConstructor();
+ private static native void nativeAddLayer(long native_layer, long native_paint, float dx, float dy);
}
diff --git a/graphics/java/android/graphics/LightingColorFilter.java b/graphics/java/android/graphics/LightingColorFilter.java
index c621de6..fbd2694 100644
--- a/graphics/java/android/graphics/LightingColorFilter.java
+++ b/graphics/java/android/graphics/LightingColorFilter.java
@@ -33,6 +33,6 @@ public class LightingColorFilter extends ColorFilter {
nativeColorFilter = nCreateLightingFilter(native_instance, mul, add);
}
- private static native int native_CreateLightingFilter(int mul, int add);
- private static native int nCreateLightingFilter(int nativeFilter, int mul, int add);
+ private static native long native_CreateLightingFilter(int mul, int add);
+ private static native long nCreateLightingFilter(long nativeFilter, int mul, int add);
}
diff --git a/graphics/java/android/graphics/LinearGradient.java b/graphics/java/android/graphics/LinearGradient.java
index 4c88de3..9ad3e49 100644
--- a/graphics/java/android/graphics/LinearGradient.java
+++ b/graphics/java/android/graphics/LinearGradient.java
@@ -116,12 +116,12 @@ public class LinearGradient extends Shader {
return copy;
}
- private native int nativeCreate1(float x0, float y0, float x1, float y1,
+ private native long nativeCreate1(float x0, float y0, float x1, float y1,
int colors[], float positions[], int tileMode);
- private native int nativeCreate2(float x0, float y0, float x1, float y1,
+ private native long nativeCreate2(float x0, float y0, float x1, float y1,
int color0, int color1, int tileMode);
- private native int nativePostCreate1(int native_shader, float x0, float y0, float x1, float y1,
+ private native long nativePostCreate1(long native_shader, float x0, float y0, float x1, float y1,
int colors[], float positions[], int tileMode);
- private native int nativePostCreate2(int native_shader, float x0, float y0, float x1, float y1,
+ private native long nativePostCreate2(long native_shader, float x0, float y0, float x1, float y1,
int color0, int color1, int tileMode);
}
diff --git a/graphics/java/android/graphics/MaskFilter.java b/graphics/java/android/graphics/MaskFilter.java
index 4ebb619..27a7dda 100644
--- a/graphics/java/android/graphics/MaskFilter.java
+++ b/graphics/java/android/graphics/MaskFilter.java
@@ -27,6 +27,6 @@ public class MaskFilter {
nativeDestructor(native_instance);
}
- private static native void nativeDestructor(int native_filter);
- int native_instance;
+ private static native void nativeDestructor(long native_filter);
+ long native_instance;
}
diff --git a/graphics/java/android/graphics/Matrix.java b/graphics/java/android/graphics/Matrix.java
index 32e0c01..c8bcf26 100644
--- a/graphics/java/android/graphics/Matrix.java
+++ b/graphics/java/android/graphics/Matrix.java
@@ -219,7 +219,7 @@ public class Matrix {
/**
* @hide
*/
- public int native_instance;
+ public long native_instance;
/**
* Create an identity matrix
@@ -800,83 +800,86 @@ public class Matrix {
}
}
- /*package*/ final int ni() {
+ /*package*/ final long ni() {
return native_instance;
}
- private static native int native_create(int native_src_or_zero);
- private static native boolean native_isIdentity(int native_object);
- private static native boolean native_rectStaysRect(int native_object);
- private static native void native_reset(int native_object);
- private static native void native_set(int native_object, int other);
- private static native void native_setTranslate(int native_object,
+ private static native long native_create(long native_src_or_zero);
+ private static native boolean native_isIdentity(long native_object);
+ private static native boolean native_rectStaysRect(long native_object);
+ private static native void native_reset(long native_object);
+ private static native void native_set(long native_object,
+ long native_other);
+ private static native void native_setTranslate(long native_object,
float dx, float dy);
- private static native void native_setScale(int native_object,
+ private static native void native_setScale(long native_object,
float sx, float sy, float px, float py);
- private static native void native_setScale(int native_object,
+ private static native void native_setScale(long native_object,
float sx, float sy);
- private static native void native_setRotate(int native_object,
+ private static native void native_setRotate(long native_object,
float degrees, float px, float py);
- private static native void native_setRotate(int native_object,
+ private static native void native_setRotate(long native_object,
float degrees);
- private static native void native_setSinCos(int native_object,
+ private static native void native_setSinCos(long native_object,
float sinValue, float cosValue, float px, float py);
- private static native void native_setSinCos(int native_object,
+ private static native void native_setSinCos(long native_object,
float sinValue, float cosValue);
- private static native void native_setSkew(int native_object,
+ private static native void native_setSkew(long native_object,
float kx, float ky, float px, float py);
- private static native void native_setSkew(int native_object,
+ private static native void native_setSkew(long native_object,
float kx, float ky);
- private static native boolean native_setConcat(int native_object,
- int a, int b);
- private static native boolean native_preTranslate(int native_object,
+ private static native boolean native_setConcat(long native_object,
+ long native_a,
+ long native_b);
+ private static native boolean native_preTranslate(long native_object,
float dx, float dy);
- private static native boolean native_preScale(int native_object,
+ private static native boolean native_preScale(long native_object,
float sx, float sy, float px, float py);
- private static native boolean native_preScale(int native_object,
+ private static native boolean native_preScale(long native_object,
float sx, float sy);
- private static native boolean native_preRotate(int native_object,
+ private static native boolean native_preRotate(long native_object,
float degrees, float px, float py);
- private static native boolean native_preRotate(int native_object,
+ private static native boolean native_preRotate(long native_object,
float degrees);
- private static native boolean native_preSkew(int native_object,
+ private static native boolean native_preSkew(long native_object,
float kx, float ky, float px, float py);
- private static native boolean native_preSkew(int native_object,
+ private static native boolean native_preSkew(long native_object,
float kx, float ky);
- private static native boolean native_preConcat(int native_object,
- int other_matrix);
- private static native boolean native_postTranslate(int native_object,
+ private static native boolean native_preConcat(long native_object,
+ long native_other_matrix);
+ private static native boolean native_postTranslate(long native_object,
float dx, float dy);
- private static native boolean native_postScale(int native_object,
+ private static native boolean native_postScale(long native_object,
float sx, float sy, float px, float py);
- private static native boolean native_postScale(int native_object,
+ private static native boolean native_postScale(long native_object,
float sx, float sy);
- private static native boolean native_postRotate(int native_object,
+ private static native boolean native_postRotate(long native_object,
float degrees, float px, float py);
- private static native boolean native_postRotate(int native_object,
+ private static native boolean native_postRotate(long native_object,
float degrees);
- private static native boolean native_postSkew(int native_object,
+ private static native boolean native_postSkew(long native_object,
float kx, float ky, float px, float py);
- private static native boolean native_postSkew(int native_object,
+ private static native boolean native_postSkew(long native_object,
float kx, float ky);
- private static native boolean native_postConcat(int native_object,
- int other_matrix);
- private static native boolean native_setRectToRect(int native_object,
+ private static native boolean native_postConcat(long native_object,
+ long native_other_matrix);
+ private static native boolean native_setRectToRect(long native_object,
RectF src, RectF dst, int stf);
- private static native boolean native_setPolyToPoly(int native_object,
+ private static native boolean native_setPolyToPoly(long native_object,
float[] src, int srcIndex, float[] dst, int dstIndex, int pointCount);
- private static native boolean native_invert(int native_object, int inverse);
- private static native void native_mapPoints(int native_object,
+ private static native boolean native_invert(long native_object,
+ long native_inverse);
+ private static native void native_mapPoints(long native_object,
float[] dst, int dstIndex, float[] src, int srcIndex,
int ptCount, boolean isPts);
- private static native boolean native_mapRect(int native_object,
+ private static native boolean native_mapRect(long native_object,
RectF dst, RectF src);
- private static native float native_mapRadius(int native_object,
+ private static native float native_mapRadius(long native_object,
float radius);
- private static native void native_getValues(int native_object,
+ private static native void native_getValues(long native_object,
float[] values);
- private static native void native_setValues(int native_object,
+ private static native void native_setValues(long native_object,
float[] values);
- private static native boolean native_equals(int native_a, int native_b);
- private static native void finalizer(int native_instance);
+ private static native boolean native_equals(long native_a, long native_b);
+ private static native void finalizer(long native_instance);
}
diff --git a/graphics/java/android/graphics/Movie.java b/graphics/java/android/graphics/Movie.java
index 9419faf..b0a4553 100644
--- a/graphics/java/android/graphics/Movie.java
+++ b/graphics/java/android/graphics/Movie.java
@@ -21,9 +21,9 @@ import java.io.InputStream;
import java.io.FileInputStream;
public class Movie {
- private final int mNativeMovie;
+ private final long mNativeMovie;
- private Movie(int nativeMovie) {
+ private Movie(long nativeMovie) {
if (nativeMovie == 0) {
throw new RuntimeException("native movie creation failed");
}
@@ -48,19 +48,19 @@ public class Movie {
return null;
}
if (is instanceof AssetManager.AssetInputStream) {
- final int asset = ((AssetManager.AssetInputStream) is).getAssetInt();
+ final long asset = ((AssetManager.AssetInputStream) is).getNativeAsset();
return nativeDecodeAsset(asset);
}
return nativeDecodeStream(is);
}
- private static native Movie nativeDecodeAsset(int asset);
+ private static native Movie nativeDecodeAsset(long asset);
private static native Movie nativeDecodeStream(InputStream is);
public static native Movie decodeByteArray(byte[] data, int offset,
int length);
- private static native void nativeDestructor(int nativeMovie);
+ private static native void nativeDestructor(long nativeMovie);
public static Movie decodeFile(String pathName) {
InputStream is;
diff --git a/graphics/java/android/graphics/NinePatch.java b/graphics/java/android/graphics/NinePatch.java
index 528d9de..69089b1 100644
--- a/graphics/java/android/graphics/NinePatch.java
+++ b/graphics/java/android/graphics/NinePatch.java
@@ -39,7 +39,7 @@ public class NinePatch {
*
* @hide
*/
- public final int mNativeChunk;
+ public final long mNativeChunk;
private Paint mPaint;
private String mSrcName;
@@ -217,7 +217,7 @@ public class NinePatch {
* that are transparent.
*/
public final Region getTransparentRegion(Rect bounds) {
- int r = nativeGetTransparentRegion(mBitmap.ni(), mNativeChunk, bounds);
+ long r = nativeGetTransparentRegion(mBitmap.ni(), mNativeChunk, bounds);
return r != 0 ? new Region(r) : null;
}
@@ -236,11 +236,11 @@ public class NinePatch {
* If validation is successful, this method returns a native Res_png_9patch*
* object used by the renderers.
*/
- private static native int validateNinePatchChunk(int bitmap, byte[] chunk);
- private static native void nativeFinalize(int chunk);
- private static native void nativeDraw(int canvas_instance, RectF loc, int bitmap_instance,
- int c, int paint_instance_or_null, int destDensity, int srcDensity);
- private static native void nativeDraw(int canvas_instance, Rect loc, int bitmap_instance,
- int c, int paint_instance_or_null, int destDensity, int srcDensity);
- private static native int nativeGetTransparentRegion(int bitmap, int chunk, Rect location);
+ private static native long validateNinePatchChunk(long bitmap, byte[] chunk);
+ private static native void nativeFinalize(long chunk);
+ private static native void nativeDraw(long canvas_instance, RectF loc, long bitmap_instance,
+ long c, long paint_instance_or_null, int destDensity, int srcDensity);
+ private static native void nativeDraw(long canvas_instance, Rect loc, long bitmap_instance,
+ long c, long paint_instance_or_null, int destDensity, int srcDensity);
+ private static native long nativeGetTransparentRegion(long bitmap, long chunk, Rect location);
}
diff --git a/graphics/java/android/graphics/Paint.java b/graphics/java/android/graphics/Paint.java
index 5fc2588..33832a7 100644
--- a/graphics/java/android/graphics/Paint.java
+++ b/graphics/java/android/graphics/Paint.java
@@ -32,7 +32,7 @@ public class Paint {
/**
* @hide
*/
- public int mNativePaint;
+ public long mNativePaint;
private ColorFilter mColorFilter;
private MaskFilter mMaskFilter;
@@ -943,7 +943,7 @@ public class Paint {
* @return shader
*/
public Shader setShader(Shader shader) {
- int shaderNative = 0;
+ long shaderNative = 0;
if (shader != null)
shaderNative = shader.native_instance;
native_setShader(mNativePaint, shaderNative);
@@ -967,7 +967,7 @@ public class Paint {
* @return filter
*/
public ColorFilter setColorFilter(ColorFilter filter) {
- int filterNative = 0;
+ long filterNative = 0;
if (filter != null)
filterNative = filter.native_instance;
native_setColorFilter(mNativePaint, filterNative);
@@ -994,7 +994,7 @@ public class Paint {
* @return xfermode
*/
public Xfermode setXfermode(Xfermode xfermode) {
- int xfermodeNative = 0;
+ long xfermodeNative = 0;
if (xfermode != null)
xfermodeNative = xfermode.native_instance;
native_setXfermode(mNativePaint, xfermodeNative);
@@ -1021,7 +1021,7 @@ public class Paint {
* @return effect
*/
public PathEffect setPathEffect(PathEffect effect) {
- int effectNative = 0;
+ long effectNative = 0;
if (effect != null) {
effectNative = effect.native_instance;
}
@@ -1050,7 +1050,7 @@ public class Paint {
* @return maskfilter
*/
public MaskFilter setMaskFilter(MaskFilter maskfilter) {
- int maskfilterNative = 0;
+ long maskfilterNative = 0;
if (maskfilter != null) {
maskfilterNative = maskfilter.native_instance;
}
@@ -1081,7 +1081,7 @@ public class Paint {
* @return typeface
*/
public Typeface setTypeface(Typeface typeface) {
- int typefaceNative = 0;
+ long typefaceNative = 0;
if (typeface != null) {
typefaceNative = typeface.native_instance;
}
@@ -1112,7 +1112,7 @@ public class Paint {
* @return rasterizer
*/
public Rasterizer setRasterizer(Rasterizer rasterizer) {
- int rasterizerNative = 0;
+ long rasterizerNative = 0;
if (rasterizer != null) {
rasterizerNative = rasterizer.native_instance;
}
@@ -2207,68 +2207,68 @@ public class Paint {
}
}
- private static native int native_init();
- private static native int native_initWithPaint(int paint);
- private static native void native_reset(int native_object);
- private static native void native_set(int native_dst, int native_src);
- private static native int native_getStyle(int native_object);
- private static native void native_setStyle(int native_object, int style);
- private static native int native_getStrokeCap(int native_object);
- private static native void native_setStrokeCap(int native_object, int cap);
- private static native int native_getStrokeJoin(int native_object);
- private static native void native_setStrokeJoin(int native_object,
+ private static native long native_init();
+ private static native long native_initWithPaint(long paint);
+ private static native void native_reset(long native_object);
+ private static native void native_set(long native_dst, long native_src);
+ private static native int native_getStyle(long native_object);
+ private static native void native_setStyle(long native_object, int style);
+ private static native int native_getStrokeCap(long native_object);
+ private static native void native_setStrokeCap(long native_object, int cap);
+ private static native int native_getStrokeJoin(long native_object);
+ private static native void native_setStrokeJoin(long native_object,
int join);
- private static native boolean native_getFillPath(int native_object,
- int src, int dst);
- private static native int native_setShader(int native_object, int shader);
- private static native int native_setColorFilter(int native_object,
- int filter);
- private static native int native_setXfermode(int native_object,
- int xfermode);
- private static native int native_setPathEffect(int native_object,
- int effect);
- private static native int native_setMaskFilter(int native_object,
- int maskfilter);
- private static native int native_setTypeface(int native_object,
- int typeface);
- private static native int native_setRasterizer(int native_object,
- int rasterizer);
-
- private static native int native_getTextAlign(int native_object);
- private static native void native_setTextAlign(int native_object,
+ private static native boolean native_getFillPath(long native_object,
+ long src, long dst);
+ private static native long native_setShader(long native_object, long shader);
+ private static native long native_setColorFilter(long native_object,
+ long filter);
+ private static native long native_setXfermode(long native_object,
+ long xfermode);
+ private static native long native_setPathEffect(long native_object,
+ long effect);
+ private static native long native_setMaskFilter(long native_object,
+ long maskfilter);
+ private static native long native_setTypeface(long native_object,
+ long typeface);
+ private static native long native_setRasterizer(long native_object,
+ long rasterizer);
+
+ private static native int native_getTextAlign(long native_object);
+ private static native void native_setTextAlign(long native_object,
int align);
- private static native void native_setTextLocale(int native_object,
+ private static native void native_setTextLocale(long native_object,
String locale);
- private static native int native_getTextWidths(int native_object,
+ private static native int native_getTextWidths(long native_object,
char[] text, int index, int count, int bidiFlags, float[] widths);
- private static native int native_getTextWidths(int native_object,
+ private static native int native_getTextWidths(long native_object,
String text, int start, int end, int bidiFlags, float[] widths);
- private static native int native_getTextGlyphs(int native_object,
+ private static native int native_getTextGlyphs(long native_object,
String text, int start, int end, int contextStart, int contextEnd,
int flags, char[] glyphs);
- private static native float native_getTextRunAdvances(int native_object,
+ private static native float native_getTextRunAdvances(long native_object,
char[] text, int index, int count, int contextIndex, int contextCount,
int flags, float[] advances, int advancesIndex);
- private static native float native_getTextRunAdvances(int native_object,
+ private static native float native_getTextRunAdvances(long native_object,
String text, int start, int end, int contextStart, int contextEnd,
int flags, float[] advances, int advancesIndex);
- private native int native_getTextRunCursor(int native_object, char[] text,
+ private native int native_getTextRunCursor(long native_object, char[] text,
int contextStart, int contextLength, int flags, int offset, int cursorOpt);
- private native int native_getTextRunCursor(int native_object, String text,
+ private native int native_getTextRunCursor(long native_object, String text,
int contextStart, int contextEnd, int flags, int offset, int cursorOpt);
- private static native void native_getTextPath(int native_object, int bidiFlags,
- char[] text, int index, int count, float x, float y, int path);
- private static native void native_getTextPath(int native_object, int bidiFlags,
- String text, int start, int end, float x, float y, int path);
- private static native void nativeGetStringBounds(int nativePaint,
+ private static native void native_getTextPath(long native_object, int bidiFlags,
+ char[] text, int index, int count, float x, float y, long path);
+ private static native void native_getTextPath(long native_object, int bidiFlags,
+ String text, int start, int end, float x, float y, long path);
+ private static native void nativeGetStringBounds(long nativePaint,
String text, int start, int end, int bidiFlags, Rect bounds);
- private static native void nativeGetCharArrayBounds(int nativePaint,
+ private static native void nativeGetCharArrayBounds(long nativePaint,
char[] text, int index, int count, int bidiFlags, Rect bounds);
- private static native void finalizer(int nativePaint);
+ private static native void finalizer(long nativePaint);
}
diff --git a/graphics/java/android/graphics/PaintFlagsDrawFilter.java b/graphics/java/android/graphics/PaintFlagsDrawFilter.java
index c833a12..65a6218 100644
--- a/graphics/java/android/graphics/PaintFlagsDrawFilter.java
+++ b/graphics/java/android/graphics/PaintFlagsDrawFilter.java
@@ -38,6 +38,6 @@ public class PaintFlagsDrawFilter extends DrawFilter {
mNativeInt = nativeConstructor(clearBits, setBits);
}
- private static native int nativeConstructor(int clearBits, int setBits);
+ private static native long nativeConstructor(int clearBits, int setBits);
}
diff --git a/graphics/java/android/graphics/Path.java b/graphics/java/android/graphics/Path.java
index 5b04a91..b5a1f64 100644
--- a/graphics/java/android/graphics/Path.java
+++ b/graphics/java/android/graphics/Path.java
@@ -29,7 +29,7 @@ public class Path {
/**
* @hide
*/
- public final int mNativePath;
+ public final long mNativePath;
/**
* @hide
@@ -56,7 +56,7 @@ public class Path {
* @param src The path to copy from when initializing the new path
*/
public Path(Path src) {
- int valNative = 0;
+ long valNative = 0;
if (src != null) {
valNative = src.mNativePath;
isSimplePath = src.isSimplePath;
@@ -634,7 +634,7 @@ public class Path {
* the original path is modified.
*/
public void offset(float dx, float dy, Path dst) {
- int dstNative = 0;
+ long dstNative = 0;
if (dst != null) {
dstNative = dst.mNativePath;
dst.isSimplePath = false;
@@ -673,7 +673,7 @@ public class Path {
* then the the original path is modified
*/
public void transform(Matrix matrix, Path dst) {
- int dstNative = 0;
+ long dstNative = 0;
if (dst != null) {
dst.isSimplePath = false;
dstNative = dst.mNativePath;
@@ -699,54 +699,54 @@ public class Path {
}
}
- final int ni() {
+ final long ni() {
return mNativePath;
}
- private static native int init1();
- private static native int init2(int nPath);
- private static native void native_reset(int nPath);
- private static native void native_rewind(int nPath);
- private static native void native_set(int native_dst, int native_src);
- private static native int native_getFillType(int nPath);
- private static native void native_setFillType(int nPath, int ft);
- private static native boolean native_isEmpty(int nPath);
- private static native boolean native_isRect(int nPath, RectF rect);
- private static native void native_computeBounds(int nPath, RectF bounds);
- private static native void native_incReserve(int nPath, int extraPtCount);
- private static native void native_moveTo(int nPath, float x, float y);
- private static native void native_rMoveTo(int nPath, float dx, float dy);
- private static native void native_lineTo(int nPath, float x, float y);
- private static native void native_rLineTo(int nPath, float dx, float dy);
- private static native void native_quadTo(int nPath, float x1, float y1,
+ private static native long init1();
+ private static native long init2(long nPath);
+ private static native void native_reset(long nPath);
+ private static native void native_rewind(long nPath);
+ private static native void native_set(long native_dst, long native_src);
+ private static native int native_getFillType(long nPath);
+ private static native void native_setFillType(long nPath, int ft);
+ private static native boolean native_isEmpty(long nPath);
+ private static native boolean native_isRect(long nPath, RectF rect);
+ private static native void native_computeBounds(long nPath, RectF bounds);
+ private static native void native_incReserve(long nPath, int extraPtCount);
+ private static native void native_moveTo(long nPath, float x, float y);
+ private static native void native_rMoveTo(long nPath, float dx, float dy);
+ private static native void native_lineTo(long nPath, float x, float y);
+ private static native void native_rLineTo(long nPath, float dx, float dy);
+ private static native void native_quadTo(long nPath, float x1, float y1,
float x2, float y2);
- private static native void native_rQuadTo(int nPath, float dx1, float dy1,
+ private static native void native_rQuadTo(long nPath, float dx1, float dy1,
float dx2, float dy2);
- private static native void native_cubicTo(int nPath, float x1, float y1,
+ private static native void native_cubicTo(long nPath, float x1, float y1,
float x2, float y2, float x3, float y3);
- private static native void native_rCubicTo(int nPath, float x1, float y1,
+ private static native void native_rCubicTo(long nPath, float x1, float y1,
float x2, float y2, float x3, float y3);
- private static native void native_arcTo(int nPath, RectF oval,
+ private static native void native_arcTo(long nPath, RectF oval,
float startAngle, float sweepAngle, boolean forceMoveTo);
- private static native void native_close(int nPath);
- private static native void native_addRect(int nPath, RectF rect, int dir);
- private static native void native_addRect(int nPath, float left, float top,
+ private static native void native_close(long nPath);
+ private static native void native_addRect(long nPath, RectF rect, int dir);
+ private static native void native_addRect(long nPath, float left, float top,
float right, float bottom, int dir);
- private static native void native_addOval(int nPath, RectF oval, int dir);
- private static native void native_addCircle(int nPath, float x, float y, float radius, int dir);
- private static native void native_addArc(int nPath, RectF oval,
+ private static native void native_addOval(long nPath, RectF oval, int dir);
+ private static native void native_addCircle(long nPath, float x, float y, float radius, int dir);
+ private static native void native_addArc(long nPath, RectF oval,
float startAngle, float sweepAngle);
- private static native void native_addRoundRect(int nPath, RectF rect,
+ private static native void native_addRoundRect(long nPath, RectF rect,
float rx, float ry, int dir);
- private static native void native_addRoundRect(int nPath, RectF r, float[] radii, int dir);
- private static native void native_addPath(int nPath, int src, float dx, float dy);
- private static native void native_addPath(int nPath, int src);
- private static native void native_addPath(int nPath, int src, int matrix);
- private static native void native_offset(int nPath, float dx, float dy, int dst_path);
- private static native void native_offset(int nPath, float dx, float dy);
- private static native void native_setLastPoint(int nPath, float dx, float dy);
- private static native void native_transform(int nPath, int matrix, int dst_path);
- private static native void native_transform(int nPath, int matrix);
- private static native boolean native_op(int path1, int path2, int op, int result);
- private static native void finalizer(int nPath);
+ private static native void native_addRoundRect(long nPath, RectF r, float[] radii, int dir);
+ private static native void native_addPath(long nPath, long src, float dx, float dy);
+ private static native void native_addPath(long nPath, long src);
+ private static native void native_addPath(long nPath, long src, long matrix);
+ private static native void native_offset(long nPath, float dx, float dy, long dst_path);
+ private static native void native_offset(long nPath, float dx, float dy);
+ private static native void native_setLastPoint(long nPath, float dx, float dy);
+ private static native void native_transform(long nPath, long matrix, long dst_path);
+ private static native void native_transform(long nPath, long matrix);
+ private static native boolean native_op(long path1, long path2, int op, long result);
+ private static native void finalizer(long nPath);
}
diff --git a/graphics/java/android/graphics/PathDashPathEffect.java b/graphics/java/android/graphics/PathDashPathEffect.java
index e8ad5fd..4f43f68 100644
--- a/graphics/java/android/graphics/PathDashPathEffect.java
+++ b/graphics/java/android/graphics/PathDashPathEffect.java
@@ -45,7 +45,7 @@ public class PathDashPathEffect extends PathEffect {
style.native_style);
}
- private static native int nativeCreate(int native_path, float advance,
+ private static native long nativeCreate(long native_path, float advance,
float phase, int native_style);
}
diff --git a/graphics/java/android/graphics/PathEffect.java b/graphics/java/android/graphics/PathEffect.java
index 9b2cd66..617dfca 100644
--- a/graphics/java/android/graphics/PathEffect.java
+++ b/graphics/java/android/graphics/PathEffect.java
@@ -27,6 +27,6 @@ public class PathEffect {
nativeDestructor(native_instance);
}
- private static native void nativeDestructor(int native_patheffect);
- int native_instance;
+ private static native void nativeDestructor(long native_patheffect);
+ long native_instance;
}
diff --git a/graphics/java/android/graphics/PathMeasure.java b/graphics/java/android/graphics/PathMeasure.java
index 7062824..e56716f 100644
--- a/graphics/java/android/graphics/PathMeasure.java
+++ b/graphics/java/android/graphics/PathMeasure.java
@@ -138,16 +138,16 @@ public class PathMeasure {
native_destroy(native_instance);
}
- private static native int native_create(int native_path, boolean forceClosed);
- private static native void native_setPath(int native_instance, int native_path, boolean forceClosed);
- private static native float native_getLength(int native_instance);
- private static native boolean native_getPosTan(int native_instance, float distance, float pos[], float tan[]);
- private static native boolean native_getMatrix(int native_instance, float distance, int native_matrix, int flags);
- private static native boolean native_getSegment(int native_instance, float startD, float stopD, int native_path, boolean startWithMoveTo);
- private static native boolean native_isClosed(int native_instance);
- private static native boolean native_nextContour(int native_instance);
- private static native void native_destroy(int native_instance);
+ private static native long native_create(long native_path, boolean forceClosed);
+ private static native void native_setPath(long native_instance, long native_path, boolean forceClosed);
+ private static native float native_getLength(long native_instance);
+ private static native boolean native_getPosTan(long native_instance, float distance, float pos[], float tan[]);
+ private static native boolean native_getMatrix(long native_instance, float distance, long native_matrix, int flags);
+ private static native boolean native_getSegment(long native_instance, float startD, float stopD, long native_path, boolean startWithMoveTo);
+ private static native boolean native_isClosed(long native_instance);
+ private static native boolean native_nextContour(long native_instance);
+ private static native void native_destroy(long native_instance);
- /* package */private final int native_instance;
+ /* package */private final long native_instance;
}
diff --git a/graphics/java/android/graphics/Picture.java b/graphics/java/android/graphics/Picture.java
index 71e02f6..25188e0 100644
--- a/graphics/java/android/graphics/Picture.java
+++ b/graphics/java/android/graphics/Picture.java
@@ -29,7 +29,7 @@ import java.io.OutputStream;
*/
public class Picture {
private Canvas mRecordingCanvas;
- private final int mNativePicture;
+ private final long mNativePicture;
/**
* @hide
@@ -63,7 +63,7 @@ public class Picture {
* into it.
*/
public Canvas beginRecording(int width, int height) {
- int ni = nativeBeginRecording(mNativePicture, width, height);
+ long ni = nativeBeginRecording(mNativePicture, width, height);
mRecordingCanvas = new RecordingCanvas(this, ni);
return mRecordingCanvas;
}
@@ -164,11 +164,11 @@ public class Picture {
}
}
- final int ni() {
+ final long ni() {
return mNativePicture;
}
- private Picture(int nativePicture, boolean fromStream) {
+ private Picture(long nativePicture, boolean fromStream) {
if (nativePicture == 0) {
throw new RuntimeException();
}
@@ -177,21 +177,21 @@ public class Picture {
}
// return empty picture if src is 0, or a copy of the native src
- private static native int nativeConstructor(int nativeSrcOr0);
- private static native int nativeCreateFromStream(InputStream stream,
+ private static native long nativeConstructor(long nativeSrcOr0);
+ private static native long nativeCreateFromStream(InputStream stream,
byte[] storage);
- private static native int nativeBeginRecording(int nativeCanvas,
+ private static native long nativeBeginRecording(long nativeCanvas,
int w, int h);
- private static native void nativeEndRecording(int nativeCanvas);
- private static native void nativeDraw(int nativeCanvas, int nativePicture);
- private static native boolean nativeWriteToStream(int nativePicture,
+ private static native void nativeEndRecording(long nativeCanvas);
+ private static native void nativeDraw(long nativeCanvas, long nativePicture);
+ private static native boolean nativeWriteToStream(long nativePicture,
OutputStream stream, byte[] storage);
- private static native void nativeDestructor(int nativePicture);
+ private static native void nativeDestructor(long nativePicture);
private static class RecordingCanvas extends Canvas {
private final Picture mPicture;
- public RecordingCanvas(Picture pict, int nativeCanvas) {
+ public RecordingCanvas(Picture pict, long nativeCanvas) {
super(nativeCanvas);
mPicture = pict;
}
diff --git a/graphics/java/android/graphics/PixelXorXfermode.java b/graphics/java/android/graphics/PixelXorXfermode.java
index 6075ec3..0080e65 100644
--- a/graphics/java/android/graphics/PixelXorXfermode.java
+++ b/graphics/java/android/graphics/PixelXorXfermode.java
@@ -29,5 +29,5 @@ public class PixelXorXfermode extends Xfermode {
native_instance = nativeCreate(opColor);
}
- private static native int nativeCreate(int opColor);
+ private static native long nativeCreate(int opColor);
}
diff --git a/graphics/java/android/graphics/PorterDuffColorFilter.java b/graphics/java/android/graphics/PorterDuffColorFilter.java
index ecc7c24..894284f 100644
--- a/graphics/java/android/graphics/PorterDuffColorFilter.java
+++ b/graphics/java/android/graphics/PorterDuffColorFilter.java
@@ -29,7 +29,7 @@ public class PorterDuffColorFilter extends ColorFilter {
nativeColorFilter = nCreatePorterDuffFilter(native_instance, srcColor, mode.nativeInt);
}
- private static native int native_CreatePorterDuffFilter(int srcColor, int porterDuffMode);
- private static native int nCreatePorterDuffFilter(int nativeFilter, int srcColor,
+ private static native long native_CreatePorterDuffFilter(int srcColor, int porterDuffMode);
+ private static native long nCreatePorterDuffFilter(long nativeFilter, int srcColor,
int porterDuffMode);
}
diff --git a/graphics/java/android/graphics/PorterDuffXfermode.java b/graphics/java/android/graphics/PorterDuffXfermode.java
index 6ba064c..d9d7689 100644
--- a/graphics/java/android/graphics/PorterDuffXfermode.java
+++ b/graphics/java/android/graphics/PorterDuffXfermode.java
@@ -32,5 +32,5 @@ public class PorterDuffXfermode extends Xfermode {
native_instance = nativeCreateXfermode(mode.nativeInt);
}
- private static native int nativeCreateXfermode(int mode);
+ private static native long nativeCreateXfermode(int mode);
}
diff --git a/graphics/java/android/graphics/RadialGradient.java b/graphics/java/android/graphics/RadialGradient.java
index f011e5c..f10e5d6 100644
--- a/graphics/java/android/graphics/RadialGradient.java
+++ b/graphics/java/android/graphics/RadialGradient.java
@@ -117,14 +117,14 @@ public class RadialGradient extends Shader {
return copy;
}
- private static native int nativeCreate1(float x, float y, float radius,
+ private static native long nativeCreate1(float x, float y, float radius,
int colors[], float positions[], int tileMode);
- private static native int nativeCreate2(float x, float y, float radius,
+ private static native long nativeCreate2(float x, float y, float radius,
int color0, int color1, int tileMode);
- private static native int nativePostCreate1(int native_shader, float x, float y, float radius,
+ private static native long nativePostCreate1(long native_shader, float x, float y, float radius,
int colors[], float positions[], int tileMode);
- private static native int nativePostCreate2(int native_shader, float x, float y, float radius,
+ private static native long nativePostCreate2(long native_shader, float x, float y, float radius,
int color0, int color1, int tileMode);
}
diff --git a/graphics/java/android/graphics/Rasterizer.java b/graphics/java/android/graphics/Rasterizer.java
index feb5f0c..817814c 100644
--- a/graphics/java/android/graphics/Rasterizer.java
+++ b/graphics/java/android/graphics/Rasterizer.java
@@ -27,7 +27,7 @@ public class Rasterizer {
finalizer(native_instance);
}
- private static native void finalizer(int native_instance);
+ private static native void finalizer(long native_instance);
- int native_instance;
+ long native_instance;
}
diff --git a/graphics/java/android/graphics/Region.java b/graphics/java/android/graphics/Region.java
index 72d0c43..727723d 100644
--- a/graphics/java/android/graphics/Region.java
+++ b/graphics/java/android/graphics/Region.java
@@ -30,7 +30,7 @@ public class Region implements Parcelable {
/**
* @hide
*/
- public final int mNativeRegion;
+ public final long mNativeRegion;
// the native values for these must match up with the enum in SkRegion.h
public enum Op {
@@ -342,7 +342,7 @@ public class Region implements Parcelable {
* @return a new region created from the data in the parcel
*/
public Region createFromParcel(Parcel p) {
- int ni = nativeCreateFromParcel(p);
+ long ni = nativeCreateFromParcel(p);
if (ni == 0) {
throw new RuntimeException();
}
@@ -385,7 +385,7 @@ public class Region implements Parcelable {
}
}
- Region(int ni) {
+ Region(long ni) {
if (ni == 0) {
throw new RuntimeException();
}
@@ -394,38 +394,38 @@ public class Region implements Parcelable {
/* add dummy parameter so constructor can be called from jni without
triggering 'not cloneable' exception */
- private Region(int ni, int dummy) {
+ private Region(long ni, int dummy) {
this(ni);
}
- final int ni() {
+ final long ni() {
return mNativeRegion;
}
- private static native boolean nativeEquals(int native_r1, int native_r2);
+ private static native boolean nativeEquals(long native_r1, long native_r2);
- private static native int nativeConstructor();
- private static native void nativeDestructor(int native_region);
+ private static native long nativeConstructor();
+ private static native void nativeDestructor(long native_region);
- private static native void nativeSetRegion(int native_dst, int native_src);
- private static native boolean nativeSetRect(int native_dst, int left,
+ private static native void nativeSetRegion(long native_dst, long native_src);
+ private static native boolean nativeSetRect(long native_dst, int left,
int top, int right, int bottom);
- private static native boolean nativeSetPath(int native_dst, int native_path,
- int native_clip);
- private static native boolean nativeGetBounds(int native_region, Rect rect);
- private static native boolean nativeGetBoundaryPath(int native_region,
- int native_path);
+ private static native boolean nativeSetPath(long native_dst, long native_path,
+ long native_clip);
+ private static native boolean nativeGetBounds(long native_region, Rect rect);
+ private static native boolean nativeGetBoundaryPath(long native_region,
+ long native_path);
- private static native boolean nativeOp(int native_dst, int left, int top,
+ private static native boolean nativeOp(long native_dst, int left, int top,
int right, int bottom, int op);
- private static native boolean nativeOp(int native_dst, Rect rect,
- int native_region, int op);
- private static native boolean nativeOp(int native_dst, int native_region1,
- int native_region2, int op);
+ private static native boolean nativeOp(long native_dst, Rect rect,
+ long native_region, int op);
+ private static native boolean nativeOp(long native_dst, long native_region1,
+ long native_region2, int op);
- private static native int nativeCreateFromParcel(Parcel p);
- private static native boolean nativeWriteToParcel(int native_region,
+ private static native long nativeCreateFromParcel(Parcel p);
+ private static native boolean nativeWriteToParcel(long native_region,
Parcel p);
- private static native String nativeToString(int native_region);
+ private static native String nativeToString(long native_region);
}
diff --git a/graphics/java/android/graphics/RegionIterator.java b/graphics/java/android/graphics/RegionIterator.java
index 817f853..8401adb 100644
--- a/graphics/java/android/graphics/RegionIterator.java
+++ b/graphics/java/android/graphics/RegionIterator.java
@@ -45,10 +45,10 @@ public class RegionIterator {
nativeDestructor(mNativeIter);
}
- private static native int nativeConstructor(int native_region);
- private static native void nativeDestructor(int native_iter);
- private static native boolean nativeNext(int native_iter, Rect r);
-
- private final int mNativeIter;
+ private static native long nativeConstructor(long native_region);
+ private static native void nativeDestructor(long native_iter);
+ private static native boolean nativeNext(long native_iter, Rect r);
+
+ private final long mNativeIter;
}
diff --git a/graphics/java/android/graphics/Shader.java b/graphics/java/android/graphics/Shader.java
index afc68d8..94b4c4a 100644
--- a/graphics/java/android/graphics/Shader.java
+++ b/graphics/java/android/graphics/Shader.java
@@ -28,11 +28,11 @@ public class Shader {
*
* @hide
*/
- public int native_instance;
+ public long native_instance;
/**
* @hide
*/
- public int native_shader;
+ public long native_shader;
private Matrix mLocalMatrix;
@@ -112,7 +112,7 @@ public class Shader {
}
}
- private static native void nativeDestructor(int native_shader, int native_skiaShader);
- private static native void nativeSetLocalMatrix(int native_shader,
- int native_skiaShader, int matrix_instance);
+ private static native void nativeDestructor(long native_shader, long native_skiaShader);
+ private static native void nativeSetLocalMatrix(long native_shader,
+ long native_skiaShader, long matrix_instance);
}
diff --git a/graphics/java/android/graphics/SumPathEffect.java b/graphics/java/android/graphics/SumPathEffect.java
index cc7c778..8fedc31 100644
--- a/graphics/java/android/graphics/SumPathEffect.java
+++ b/graphics/java/android/graphics/SumPathEffect.java
@@ -27,6 +27,6 @@ public class SumPathEffect extends PathEffect {
second.native_instance);
}
- private static native int nativeCreate(int first, int second);
+ private static native long nativeCreate(long first, long second);
}
diff --git a/graphics/java/android/graphics/SurfaceTexture.java b/graphics/java/android/graphics/SurfaceTexture.java
index b910a24..1f8e223 100644
--- a/graphics/java/android/graphics/SurfaceTexture.java
+++ b/graphics/java/android/graphics/SurfaceTexture.java
@@ -69,9 +69,9 @@ public class SurfaceTexture {
/**
* These fields are used by native code, do not access or modify.
*/
- private int mSurfaceTexture;
- private int mBufferQueue;
- private int mFrameAvailableListener;
+ private long mSurfaceTexture;
+ private long mBufferQueue;
+ private long mFrameAvailableListener;
/**
* Callback interface for being notified that a new stream frame is available.
diff --git a/graphics/java/android/graphics/SweepGradient.java b/graphics/java/android/graphics/SweepGradient.java
index e9cda39..21239f7 100644
--- a/graphics/java/android/graphics/SweepGradient.java
+++ b/graphics/java/android/graphics/SweepGradient.java
@@ -106,12 +106,12 @@ public class SweepGradient extends Shader {
return copy;
}
- private static native int nativeCreate1(float x, float y, int colors[], float positions[]);
- private static native int nativeCreate2(float x, float y, int color0, int color1);
+ private static native long nativeCreate1(float x, float y, int colors[], float positions[]);
+ private static native long nativeCreate2(float x, float y, int color0, int color1);
- private static native int nativePostCreate1(int native_shader, float cx, float cy,
+ private static native long nativePostCreate1(long native_shader, float cx, float cy,
int[] colors, float[] positions);
- private static native int nativePostCreate2(int native_shader, float cx, float cy,
+ private static native long nativePostCreate2(long native_shader, float cx, float cy,
int color0, int color1);
}
diff --git a/graphics/java/android/graphics/TableMaskFilter.java b/graphics/java/android/graphics/TableMaskFilter.java
index a8a7ff0..d0c1438 100644
--- a/graphics/java/android/graphics/TableMaskFilter.java
+++ b/graphics/java/android/graphics/TableMaskFilter.java
@@ -28,7 +28,7 @@ public class TableMaskFilter extends MaskFilter {
native_instance = nativeNewTable(table);
}
- private TableMaskFilter(int ni) {
+ private TableMaskFilter(long ni) {
native_instance = ni;
}
@@ -40,7 +40,7 @@ public class TableMaskFilter extends MaskFilter {
return new TableMaskFilter(nativeNewGamma(gamma));
}
- private static native int nativeNewTable(byte[] table);
- private static native int nativeNewClip(int min, int max);
- private static native int nativeNewGamma(float gamma);
+ private static native long nativeNewTable(byte[] table);
+ private static native long nativeNewClip(int min, int max);
+ private static native long nativeNewGamma(float gamma);
}
diff --git a/graphics/java/android/graphics/Typeface.java b/graphics/java/android/graphics/Typeface.java
index c68c9f7..936ea4f 100644
--- a/graphics/java/android/graphics/Typeface.java
+++ b/graphics/java/android/graphics/Typeface.java
@@ -18,6 +18,7 @@ package android.graphics;
import android.content.res.AssetManager;
import android.util.SparseArray;
+import android.util.LongSparseArray;
import java.io.File;
@@ -45,10 +46,10 @@ public class Typeface {
public static final Typeface MONOSPACE;
static Typeface[] sDefaults;
- private static final SparseArray<SparseArray<Typeface>> sTypefaceCache =
- new SparseArray<SparseArray<Typeface>>(3);
+ private static final LongSparseArray<SparseArray<Typeface>> sTypefaceCache =
+ new LongSparseArray<SparseArray<Typeface>>(3);
- int native_instance;
+ long native_instance;
// Style
public static final int NORMAL = 0;
@@ -100,7 +101,7 @@ public class Typeface {
* @return The best matching typeface.
*/
public static Typeface create(Typeface family, int style) {
- int ni = 0;
+ long ni = 0;
if (family != null) {
// Return early if we're asked for the same face/style
if (family.mStyle == style) {
@@ -170,7 +171,7 @@ public class Typeface {
}
// don't allow clients to call this directly
- private Typeface(int ni) {
+ private Typeface(long ni) {
if (ni == 0) {
throw new RuntimeException("native typeface cannot be made");
}
@@ -214,15 +215,20 @@ public class Typeface {
@Override
public int hashCode() {
- int result = native_instance;
+ /*
+ * Modified method for hashCode with long native_instance derived from
+ * http://developer.android.com/reference/java/lang/Object.html
+ */
+ int result = 17;
+ result = 31 * result + (int) (native_instance ^ (native_instance >>> 32));
result = 31 * result + mStyle;
return result;
}
- private static native int nativeCreate(String familyName, int style);
- private static native int nativeCreateFromTypeface(int native_instance, int style);
- private static native void nativeUnref(int native_instance);
- private static native int nativeGetStyle(int native_instance);
- private static native int nativeCreateFromAsset(AssetManager mgr, String path);
- private static native int nativeCreateFromFile(String path);
+ private static native long nativeCreate(String familyName, int style);
+ private static native long nativeCreateFromTypeface(long native_instance, int style);
+ private static native void nativeUnref(long native_instance);
+ private static native int nativeGetStyle(long native_instance);
+ private static native long nativeCreateFromAsset(AssetManager mgr, String path);
+ private static native long nativeCreateFromFile(String path);
}
diff --git a/graphics/java/android/graphics/Xfermode.java b/graphics/java/android/graphics/Xfermode.java
index 2467bdc..883350d 100644
--- a/graphics/java/android/graphics/Xfermode.java
+++ b/graphics/java/android/graphics/Xfermode.java
@@ -38,7 +38,7 @@ public class Xfermode {
}
}
- private static native void finalizer(int native_instance);
+ private static native void finalizer(long native_instance);
- int native_instance;
+ long native_instance;
}
diff --git a/graphics/java/android/graphics/drawable/LayerDrawable.java b/graphics/java/android/graphics/drawable/LayerDrawable.java
index 81cc11b..2ea9b8e 100644
--- a/graphics/java/android/graphics/drawable/LayerDrawable.java
+++ b/graphics/java/android/graphics/drawable/LayerDrawable.java
@@ -295,6 +295,7 @@ public class LayerDrawable extends Drawable implements Drawable.Callback {
drawable.setCallback(this);
}
layers[i].mDrawable = drawable;
+ mLayerState.mHaveStateful = false;
return true;
}
}
diff --git a/graphics/java/android/renderscript/Byte2.java b/graphics/java/android/renderscript/Byte2.java
index cf34f3a..f796de3 100644
--- a/graphics/java/android/renderscript/Byte2.java
+++ b/graphics/java/android/renderscript/Byte2.java
@@ -25,6 +25,9 @@ import android.util.Log;
*
**/
public class Byte2 {
+ public byte x;
+ public byte y;
+
public Byte2() {
}
@@ -33,8 +36,357 @@ public class Byte2 {
y = initY;
}
- public byte x;
- public byte y;
+ /** @hide */
+ public Byte2(Byte2 source) {
+ this.x = source.x;
+ this.y = source.y;
+ }
+
+ /** @hide
+ * Vector add
+ *
+ * @param a
+ */
+ public void add(Byte2 a) {
+ this.x += a.x;
+ this.y += a.y;
+ }
+
+ /** @hide
+ * Vector add
+ *
+ * @param a
+ * @param b
+ * @return
+ */
+ public static Byte2 add(Byte2 a, Byte2 b) {
+ Byte2 result = new Byte2();
+ result.x = (byte)(a.x + b.x);
+ result.y = (byte)(a.y + b.y);
+
+ return result;
+ }
+
+ /** @hide
+ * Vector add
+ *
+ * @param value
+ */
+ public void add(byte value) {
+ x += value;
+ y += value;
+ }
+
+ /** @hide
+ * Vector add
+ *
+ * @param a
+ * @param b
+ * @return
+ */
+ public static Byte2 add(Byte2 a, byte b) {
+ Byte2 result = new Byte2();
+ result.x = (byte)(a.x + b);
+ result.y = (byte)(a.y + b);
+
+ return result;
+ }
+
+ /** @hide
+ * Vector subtraction
+ *
+ * @param a
+ */
+ public void sub(Byte2 a) {
+ this.x -= a.x;
+ this.y -= a.y;
+ }
+
+ /** @hide
+ * Vector subtraction
+ *
+ * @param a
+ * @param b
+ * @return
+ */
+ public static Byte2 sub(Byte2 a, Byte2 b) {
+ Byte2 result = new Byte2();
+ result.x = (byte)(a.x - b.x);
+ result.y = (byte)(a.y - b.y);
+
+ return result;
+ }
+
+ /** @hide
+ * Vector subtraction
+ *
+ * @param value
+ */
+ public void sub(byte value) {
+ x -= value;
+ y -= value;
+ }
+
+ /** @hide
+ * Vector subtraction
+ *
+ * @param a
+ * @param b
+ * @return
+ */
+ public static Byte2 sub(Byte2 a, byte b) {
+ Byte2 result = new Byte2();
+ result.x = (byte)(a.x - b);
+ result.y = (byte)(a.y - b);
+
+ return result;
+ }
+
+ /** @hide
+ * Vector multiplication
+ *
+ * @param a
+ */
+ public void mul(Byte2 a) {
+ this.x *= a.x;
+ this.y *= a.y;
+ }
+
+ /** @hide
+ * Vector multiplication
+ *
+ * @param a
+ * @param b
+ * @return
+ */
+ public static Byte2 mul(Byte2 a, Byte2 b) {
+ Byte2 result = new Byte2();
+ result.x = (byte)(a.x * b.x);
+ result.y = (byte)(a.y * b.y);
+
+ return result;
+ }
+
+ /** @hide
+ * Vector multiplication
+ *
+ * @param value
+ */
+ public void mul(byte value) {
+ x *= value;
+ y *= value;
+ }
+
+ /** @hide
+ * Vector multiplication
+ *
+ * @param a
+ * @param b
+ * @return
+ */
+ public static Byte2 mul(Byte2 a, byte b) {
+ Byte2 result = new Byte2();
+ result.x = (byte)(a.x * b);
+ result.y = (byte)(a.y * b);
+
+ return result;
+ }
+
+ /** @hide
+ * Vector division
+ *
+ * @param a
+ */
+ public void div(Byte2 a) {
+ this.x /= a.x;
+ this.y /= a.y;
+ }
+
+ /** @hide
+ * Vector division
+ *
+ * @param a
+ * @param b
+ * @return
+ */
+ public static Byte2 div(Byte2 a, Byte2 b) {
+ Byte2 result = new Byte2();
+ result.x = (byte)(a.x / b.x);
+ result.y = (byte)(a.y / b.y);
+
+ return result;
+ }
+
+ /** @hide
+ * Vector division
+ *
+ * @param value
+ */
+ public void div(byte value) {
+ x /= value;
+ y /= value;
+ }
+
+ /** @hide
+ * Vector division
+ *
+ * @param a
+ * @param b
+ * @return
+ */
+ public static Byte2 div(Byte2 a, byte b) {
+ Byte2 result = new Byte2();
+ result.x = (byte)(a.x / b);
+ result.y = (byte)(a.y / b);
+
+ return result;
+ }
+
+ /** @hide
+ * get vector length
+ *
+ * @return
+ */
+ public byte length() {
+ return 2;
+ }
+
+ /** @hide
+ * set vector negate
+ */
+ public void negate() {
+ this.x = (byte)(-x);
+ this.y = (byte)(-y);
+ }
+
+ /** @hide
+ * Vector dot Product
+ *
+ * @param a
+ * @return
+ */
+ public byte dotProduct(Byte2 a) {
+ return (byte)((x * a.x) + (y * a.y));
+ }
+
+ /** @hide
+ * Vector dot Product
+ *
+ * @param a
+ * @param b
+ * @return
+ */
+ public static byte dotProduct(Byte2 a, Byte2 b) {
+ return (byte)((b.x * a.x) + (b.y * a.y));
+ }
+
+ /** @hide
+ * Vector add Multiple
+ *
+ * @param a
+ * @param factor
+ */
+ public void addMultiple(Byte2 a, byte factor) {
+ x += a.x * factor;
+ y += a.y * factor;
+ }
+
+ /** @hide
+ * set vector value by Byte2
+ *
+ * @param a
+ */
+ public void set(Byte2 a) {
+ this.x = a.x;
+ this.y = a.y;
+ }
+
+ /** @hide
+ * set the vector field value by Char
+ *
+ * @param a
+ * @param b
+ */
+ public void setValues(byte a, byte b) {
+ this.x = a;
+ this.y = b;
+ }
+
+ /** @hide
+ * return the element sum of vector
+ *
+ * @return
+ */
+ public byte elementSum() {
+ return (byte)(x + y);
+ }
+
+ /** @hide
+ * get the vector field value by index
+ *
+ * @param i
+ * @return
+ */
+ public byte get(int i) {
+ switch (i) {
+ case 0:
+ return x;
+ case 1:
+ return y;
+ default:
+ throw new IndexOutOfBoundsException("Index: i");
+ }
+ }
+
+ /** @hide
+ * set the vector field value by index
+ *
+ * @param i
+ * @param value
+ */
+ public void setAt(int i, byte value) {
+ switch (i) {
+ case 0:
+ x = value;
+ return;
+ case 1:
+ y = value;
+ return;
+ default:
+ throw new IndexOutOfBoundsException("Index: i");
+ }
+ }
+
+ /** @hide
+ * add the vector field value by index
+ *
+ * @param i
+ * @param value
+ */
+ public void addAt(int i, byte value) {
+ switch (i) {
+ case 0:
+ x += value;
+ return;
+ case 1:
+ y += value;
+ return;
+ default:
+ throw new IndexOutOfBoundsException("Index: i");
+ }
+ }
+
+ /** @hide
+ * copy the vector to Char array
+ *
+ * @param data
+ * @param offset
+ */
+ public void copyTo(byte[] data, int offset) {
+ data[offset] = x;
+ data[offset + 1] = y;
+ }
+
}
diff --git a/graphics/java/android/renderscript/Byte3.java b/graphics/java/android/renderscript/Byte3.java
index 266e94d..f2a95ac 100644
--- a/graphics/java/android/renderscript/Byte3.java
+++ b/graphics/java/android/renderscript/Byte3.java
@@ -25,6 +25,10 @@ import android.util.Log;
*
**/
public class Byte3 {
+ public byte x;
+ public byte y;
+ public byte z;
+
public Byte3() {
}
@@ -34,9 +38,387 @@ public class Byte3 {
z = initZ;
}
- public byte x;
- public byte y;
- public byte z;
+ /** @hide */
+ public Byte3(Byte3 source) {
+ this.x = source.x;
+ this.y = source.y;
+ this.z = source.z;
+ }
+
+ /** @hide
+ * Vector add
+ *
+ * @param a
+ */
+ public void add(Byte3 a) {
+ this.x += a.x;
+ this.y += a.y;
+ this.z += a.z;
+ }
+
+ /** @hide
+ * Vector add
+ *
+ * @param a
+ * @param b
+ * @return
+ */
+ public static Byte3 add(Byte3 a, Byte3 b) {
+ Byte3 result = new Byte3();
+ result.x = (byte)(a.x + b.x);
+ result.y = (byte)(a.y + b.y);
+ result.z = (byte)(a.z + b.z);
+
+ return result;
+ }
+
+ /** @hide
+ * Vector add
+ *
+ * @param value
+ */
+ public void add(byte value) {
+ x += value;
+ y += value;
+ z += value;
+ }
+
+ /** @hide
+ * Vector add
+ *
+ * @param a
+ * @param b
+ * @return
+ */
+ public static Byte3 add(Byte3 a, byte b) {
+ Byte3 result = new Byte3();
+ result.x = (byte)(a.x + b);
+ result.y = (byte)(a.y + b);
+ result.z = (byte)(a.z + b);
+
+ return result;
+ }
+
+ /** @hide
+ * Vector subtraction
+ *
+ * @param a
+ */
+ public void sub(Byte3 a) {
+ this.x -= a.x;
+ this.y -= a.y;
+ this.z -= a.z;
+ }
+
+ /** @hide
+ * Vector subtraction
+ *
+ * @param a
+ * @param b
+ * @return
+ */
+ public static Byte3 sub(Byte3 a, Byte3 b) {
+ Byte3 result = new Byte3();
+ result.x = (byte)(a.x - b.x);
+ result.y = (byte)(a.y - b.y);
+ result.z = (byte)(a.z - b.z);
+
+ return result;
+ }
+
+ /** @hide
+ * Vector subtraction
+ *
+ * @param value
+ */
+ public void sub(byte value) {
+ x -= value;
+ y -= value;
+ z -= value;
+ }
+
+ /** @hide
+ * Vector subtraction
+ *
+ * @param a
+ * @param b
+ * @return
+ */
+ public static Byte3 sub(Byte3 a, byte b) {
+ Byte3 result = new Byte3();
+ result.x = (byte)(a.x - b);
+ result.y = (byte)(a.y - b);
+ result.z = (byte)(a.z - b);
+
+ return result;
+ }
+
+ /** @hide
+ * Vector multiplication
+ *
+ * @param a
+ */
+ public void mul(Byte3 a) {
+ this.x *= a.x;
+ this.y *= a.y;
+ this.z *= a.z;
+ }
+
+ /** @hide
+ * Vector multiplication
+ *
+ * @param a
+ * @param b
+ * @return
+ */
+ public static Byte3 mul(Byte3 a, Byte3 b) {
+ Byte3 result = new Byte3();
+ result.x = (byte)(a.x * b.x);
+ result.y = (byte)(a.y * b.y);
+ result.z = (byte)(a.z * b.z);
+
+ return result;
+ }
+
+ /** @hide
+ * Vector multiplication
+ *
+ * @param value
+ */
+ public void mul(byte value) {
+ x *= value;
+ y *= value;
+ z *= value;
+ }
+
+ /** @hide
+ * Vector multiplication
+ *
+ * @param a
+ * @param b
+ * @return
+ */
+ public static Byte3 mul(Byte3 a, byte b) {
+ Byte3 result = new Byte3();
+ result.x = (byte)(a.x * b);
+ result.y = (byte)(a.y * b);
+ result.z = (byte)(a.z * b);
+
+ return result;
+ }
+
+ /** @hide
+ * Vector division
+ *
+ * @param a
+ */
+ public void div(Byte3 a) {
+ this.x /= a.x;
+ this.y /= a.y;
+ this.z /= a.z;
+ }
+
+ /** @hide
+ * Vector division
+ *
+ * @param a
+ * @param b
+ * @return
+ */
+ public static Byte3 div(Byte3 a, Byte3 b) {
+ Byte3 result = new Byte3();
+ result.x = (byte)(a.x / b.x);
+ result.y = (byte)(a.y / b.y);
+ result.z = (byte)(a.z / b.z);
+
+ return result;
+ }
+
+ /** @hide
+ * Vector division
+ *
+ * @param value
+ */
+ public void div(byte value) {
+ x /= value;
+ y /= value;
+ z /= value;
+ }
+
+ /** @hide
+ * Vector division
+ *
+ * @param a
+ * @param b
+ * @return
+ */
+ public static Byte3 div(Byte3 a, byte b) {
+ Byte3 result = new Byte3();
+ result.x = (byte)(a.x / b);
+ result.y = (byte)(a.y / b);
+ result.z = (byte)(a.z / b);
+
+ return result;
+ }
+
+ /** @hide
+ * get vector length
+ *
+ * @return
+ */
+ public byte length() {
+ return 3;
+ }
+
+ /** @hide
+ * set vector negate
+ */
+ public void negate() {
+ this.x = (byte)(-x);
+ this.y = (byte)(-y);
+ this.z = (byte)(-z);
+ }
+
+ /** @hide
+ * Vector dot Product
+ *
+ * @param a
+ * @return
+ */
+ public byte dotProduct(Byte3 a) {
+ return (byte)((byte)((byte)(x * a.x) + (byte)(y * a.y)) + (byte)(z * a.z));
+ }
+
+ /** @hide
+ * Vector dot Product
+ *
+ * @param a
+ * @param b
+ * @return
+ */
+ public static byte dotProduct(Byte3 a, Byte3 b) {
+ return (byte)((byte)((byte)(b.x * a.x) + (byte)(b.y * a.y)) + (byte)(b.z * a.z));
+ }
+
+ /** @hide
+ * Vector add Multiple
+ *
+ * @param a
+ * @param factor
+ */
+ public void addMultiple(Byte3 a, byte factor) {
+ x += a.x * factor;
+ y += a.y * factor;
+ z += a.z * factor;
+ }
+
+ /** @hide
+ * set vector value by Byte3
+ *
+ * @param a
+ */
+ public void set(Byte3 a) {
+ this.x = a.x;
+ this.y = a.y;
+ this.z = a.z;
+ }
+
+ /** @hide
+ * set the vector field value by Char
+ *
+ * @param a
+ * @param b
+ * @param c
+ */
+ public void setValues(byte a, byte b, byte c) {
+ this.x = a;
+ this.y = b;
+ this.z = c;
+ }
+
+ /** @hide
+ * return the element sum of vector
+ *
+ * @return
+ */
+ public byte elementSum() {
+ return (byte)(x + y + z);
+ }
+
+ /** @hide
+ * get the vector field value by index
+ *
+ * @param i
+ * @return
+ */
+ public byte get(int i) {
+ switch (i) {
+ case 0:
+ return x;
+ case 1:
+ return y;
+ case 2:
+ return z;
+ default:
+ throw new IndexOutOfBoundsException("Index: i");
+ }
+ }
+
+ /** @hide
+ * set the vector field value by index
+ *
+ * @param i
+ * @param value
+ */
+ public void setAt(int i, byte value) {
+ switch (i) {
+ case 0:
+ x = value;
+ return;
+ case 1:
+ y = value;
+ return;
+ case 2:
+ z = value;
+ return;
+ default:
+ throw new IndexOutOfBoundsException("Index: i");
+ }
+ }
+
+ /** @hide
+ * add the vector field value by index
+ *
+ * @param i
+ * @param value
+ */
+ public void addAt(int i, byte value) {
+ switch (i) {
+ case 0:
+ x += value;
+ return;
+ case 1:
+ y += value;
+ return;
+ case 2:
+ z += value;
+ return;
+ default:
+ throw new IndexOutOfBoundsException("Index: i");
+ }
+ }
+
+ /** @hide
+ * copy the vector to Char array
+ *
+ * @param data
+ * @param offset
+ */
+ public void copyTo(byte[] data, int offset) {
+ data[offset] = x;
+ data[offset + 1] = y;
+ data[offset + 2] = z;
+ }
}
diff --git a/graphics/java/android/renderscript/Byte4.java b/graphics/java/android/renderscript/Byte4.java
index 68c8f52..b8a8a6b 100644
--- a/graphics/java/android/renderscript/Byte4.java
+++ b/graphics/java/android/renderscript/Byte4.java
@@ -25,6 +25,11 @@ import android.util.Log;
*
**/
public class Byte4 {
+ public byte x;
+ public byte y;
+ public byte z;
+ public byte w;
+
public Byte4() {
}
@@ -34,11 +39,418 @@ public class Byte4 {
z = initZ;
w = initW;
}
+ /** @hide */
+ public Byte4(Byte4 source) {
+ this.x = source.x;
+ this.y = source.y;
+ this.z = source.z;
+ this.w = source.w;
+ }
- public byte x;
- public byte y;
- public byte z;
- public byte w;
+ /** @hide
+ * Vector add
+ *
+ * @param a
+ */
+ public void add(Byte4 a) {
+ this.x += a.x;
+ this.y += a.y;
+ this.z += a.z;
+ this.w += a.w;
+ }
+
+ /** @hide
+ * Vector add
+ *
+ * @param a
+ * @param b
+ * @return
+ */
+ public static Byte4 add(Byte4 a, Byte4 b) {
+ Byte4 result = new Byte4();
+ result.x = (byte)(a.x + b.x);
+ result.y = (byte)(a.y + b.y);
+ result.z = (byte)(a.z + b.z);
+ result.w = (byte)(a.w + b.w);
+
+ return result;
+ }
+
+ /** @hide
+ * Vector add
+ *
+ * @param value
+ */
+ public void add(byte value) {
+ x += value;
+ y += value;
+ z += value;
+ w += value;
+ }
+
+ /** @hide
+ * Vector add
+ *
+ * @param a
+ * @param b
+ * @return
+ */
+ public static Byte4 add(Byte4 a, byte b) {
+ Byte4 result = new Byte4();
+ result.x = (byte)(a.x + b);
+ result.y = (byte)(a.y + b);
+ result.z = (byte)(a.z + b);
+ result.w = (byte)(a.w + b);
+
+ return result;
+ }
+
+ /** @hide
+ * Vector subtraction
+ *
+ * @param a
+ */
+ public void sub(Byte4 a) {
+ this.x -= a.x;
+ this.y -= a.y;
+ this.z -= a.z;
+ this.w -= a.w;
+ }
+
+ /** @hide
+ * Vector subtraction
+ *
+ * @param a
+ * @param b
+ * @return
+ */
+ public static Byte4 sub(Byte4 a, Byte4 b) {
+ Byte4 result = new Byte4();
+ result.x = (byte)(a.x - b.x);
+ result.y = (byte)(a.y - b.y);
+ result.z = (byte)(a.z - b.z);
+ result.w = (byte)(a.w - b.w);
+
+ return result;
+ }
+
+ /** @hide
+ * Vector subtraction
+ *
+ * @param value
+ */
+ public void sub(byte value) {
+ x -= value;
+ y -= value;
+ z -= value;
+ w -= value;
+ }
+
+ /** @hide
+ * Vector subtraction
+ *
+ * @param a
+ * @param b
+ * @return
+ */
+ public static Byte4 sub(Byte4 a, byte b) {
+ Byte4 result = new Byte4();
+ result.x = (byte)(a.x - b);
+ result.y = (byte)(a.y - b);
+ result.z = (byte)(a.z - b);
+ result.w = (byte)(a.w - b);
+
+ return result;
+ }
+
+ /** @hide
+ * Vector multiplication
+ *
+ * @param a
+ */
+ public void mul(Byte4 a) {
+ this.x *= a.x;
+ this.y *= a.y;
+ this.z *= a.z;
+ this.w *= a.w;
+ }
+
+ /** @hide
+ * Vector multiplication
+ *
+ * @param a
+ * @param b
+ * @return
+ */
+ public static Byte4 mul(Byte4 a, Byte4 b) {
+ Byte4 result = new Byte4();
+ result.x = (byte)(a.x * b.x);
+ result.y = (byte)(a.y * b.y);
+ result.z = (byte)(a.z * b.z);
+ result.w = (byte)(a.w * b.w);
+
+ return result;
+ }
+
+ /** @hide
+ * Vector multiplication
+ *
+ * @param value
+ */
+ public void mul(byte value) {
+ x *= value;
+ y *= value;
+ z *= value;
+ w *= value;
+ }
+
+ /** @hide
+ * Vector multiplication
+ *
+ * @param a
+ * @param b
+ * @return
+ */
+ public static Byte4 mul(Byte4 a, byte b) {
+ Byte4 result = new Byte4();
+ result.x = (byte)(a.x * b);
+ result.y = (byte)(a.y * b);
+ result.z = (byte)(a.z * b);
+ result.w = (byte)(a.w * b);
+
+ return result;
+ }
+
+ /** @hide
+ * Vector division
+ *
+ * @param a
+ */
+ public void div(Byte4 a) {
+ this.x /= a.x;
+ this.y /= a.y;
+ this.z /= a.z;
+ this.w /= a.w;
+ }
+
+ /** @hide
+ * Vector division
+ *
+ * @param a
+ * @param b
+ * @return
+ */
+ public static Byte4 div(Byte4 a, Byte4 b) {
+ Byte4 result = new Byte4();
+ result.x = (byte)(a.x / b.x);
+ result.y = (byte)(a.y / b.y);
+ result.z = (byte)(a.z / b.z);
+ result.w = (byte)(a.w / b.w);
+
+ return result;
+ }
+
+ /** @hide
+ * Vector division
+ *
+ * @param value
+ */
+ public void div(byte value) {
+ x /= value;
+ y /= value;
+ z /= value;
+ w /= value;
+ }
+
+ /** @hide
+ * Vector division
+ *
+ * @param a
+ * @param b
+ * @return
+ */
+ public static Byte4 div(Byte4 a, byte b) {
+ Byte4 result = new Byte4();
+ result.x = (byte)(a.x / b);
+ result.y = (byte)(a.y / b);
+ result.z = (byte)(a.z / b);
+ result.w = (byte)(a.w / b);
+
+ return result;
+ }
+
+ /** @hide
+ * get vector length
+ *
+ * @return
+ */
+ public byte length() {
+ return 4;
+ }
+
+ /** @hide
+ * set vector negate
+ */
+ public void negate() {
+ this.x = (byte)(-x);
+ this.y = (byte)(-y);
+ this.z = (byte)(-z);
+ this.w = (byte)(-w);
+ }
+
+ /** @hide
+ * Vector dot Product
+ *
+ * @param a
+ * @return
+ */
+ public byte dotProduct(Byte4 a) {
+ return (byte)((x * a.x) + (y * a.y) + (z * a.z) + (w * a.w));
+ }
+
+ /** @hide
+ * Vector dot Product
+ *
+ * @param a
+ * @param b
+ * @return
+ */
+ public static byte dotProduct(Byte4 a, Byte4 b) {
+ return (byte)((b.x * a.x) + (b.y * a.y) + (b.z * a.z) + (b.w * a.w));
+ }
+
+ /** @hide
+ * Vector add Multiple
+ *
+ * @param a
+ * @param factor
+ */
+ public void addMultiple(Byte4 a, byte factor) {
+ x += a.x * factor;
+ y += a.y * factor;
+ z += a.z * factor;
+ w += a.w * factor;
+ }
+
+ /** @hide
+ * set vector value by Byte4
+ *
+ * @param a
+ */
+ public void set(Byte4 a) {
+ this.x = a.x;
+ this.y = a.y;
+ this.z = a.z;
+ this.w = a.w;
+ }
+
+ /** @hide
+ * set the vector field values
+ *
+ * @param a
+ * @param b
+ * @param c
+ * @param d
+ */
+ public void setValues(byte a, byte b, byte c, byte d) {
+ this.x = a;
+ this.y = b;
+ this.z = c;
+ this.w = d;
+ }
+
+ /** @hide
+ * return the element sum of vector
+ *
+ * @return
+ */
+ public byte elementSum() {
+ return (byte)(x + y + z + w);
+ }
+
+ /** @hide
+ * get the vector field value by index
+ *
+ * @param i
+ * @return
+ */
+ public byte get(int i) {
+ switch (i) {
+ case 0:
+ return x;
+ case 1:
+ return y;
+ case 2:
+ return z;
+ case 3:
+ return w;
+ default:
+ throw new IndexOutOfBoundsException("Index: i");
+ }
+ }
+
+ /** @hide
+ * set the vector field value by index
+ *
+ * @param i
+ * @param value
+ */
+ public void setAt(int i, byte value) {
+ switch (i) {
+ case 0:
+ x = value;
+ return;
+ case 1:
+ y = value;
+ return;
+ case 2:
+ z = value;
+ return;
+ case 3:
+ w = value;
+ return;
+ default:
+ throw new IndexOutOfBoundsException("Index: i");
+ }
+ }
+
+ /** @hide
+ * add the vector field value by index
+ *
+ * @param i
+ * @param value
+ */
+ public void addAt(int i, byte value) {
+ switch (i) {
+ case 0:
+ x += value;
+ return;
+ case 1:
+ y += value;
+ return;
+ case 2:
+ z += value;
+ return;
+ case 3:
+ w += value;
+ return;
+ default:
+ throw new IndexOutOfBoundsException("Index: i");
+ }
+ }
+
+ /** @hide
+ * copy the vector to Char array
+ *
+ * @param data
+ * @param offset
+ */
+ public void copyTo(byte[] data, int offset) {
+ data[offset] = x;
+ data[offset + 1] = y;
+ data[offset + 2] = z;
+ data[offset + 3] = w;
+ }
}
diff --git a/graphics/java/android/renderscript/Double2.java b/graphics/java/android/renderscript/Double2.java
index 29fd515..4c7319d 100644
--- a/graphics/java/android/renderscript/Double2.java
+++ b/graphics/java/android/renderscript/Double2.java
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2011 The Android Open Source Project
+ * Copyright (C) 2013 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -16,28 +16,370 @@
package android.renderscript;
-import java.lang.Math;
-import android.util.Log;
-
-
/**
- * Class for exposing the native RenderScript double2 type back
- * to the Android system.
- *
- **/
+ * Vector version of the basic double type.
+ * Provides two double fields packed.
+ */
public class Double2 {
+ public double x;
+ public double y;
+
public Double2() {
}
- public Double2(double initX, double initY) {
- x = initX;
- y = initY;
+ /** @hide */
+ public Double2(Double2 data) {
+ this.x = data.x;
+ this.y = data.y;
}
- public double x;
- public double y;
-}
+ public Double2(double x, double y) {
+ this.x = x;
+ this.y = y;
+ }
+
+ /** @hide
+ * Vector add
+ *
+ * @param a
+ * @param b
+ * @return
+ */
+ public static Double2 add(Double2 a, Double2 b) {
+ Double2 res = new Double2();
+ res.x = a.x + b.x;
+ res.y = a.y + b.y;
+
+ return res;
+ }
+
+ /** @hide
+ * Vector add
+ *
+ * @param value
+ */
+ public void add(Double2 value) {
+ x += value.x;
+ y += value.y;
+ }
+
+ /** @hide
+ * Vector add
+ *
+ * @param value
+ */
+ public void add(double value) {
+ x += value;
+ y += value;
+ }
+
+ /** @hide
+ * Vector add
+ *
+ * @param a
+ * @param b
+ * @return
+ */
+ public static Double2 add(Double2 a, double b) {
+ Double2 res = new Double2();
+ res.x = a.x + b;
+ res.y = a.y + b;
+
+ return res;
+ }
+
+ /** @hide
+ * Vector subtraction
+ *
+ * @param value
+ */
+ public void sub(Double2 value) {
+ x -= value.x;
+ y -= value.y;
+ }
+
+ /** @hide
+ * Vector subtraction
+ *
+ * @param a
+ * @param b
+ * @return
+ */
+ public static Double2 sub(Double2 a, Double2 b) {
+ Double2 res = new Double2();
+ res.x = a.x - b.x;
+ res.y = a.y - b.y;
+
+ return res;
+ }
+
+ /** @hide
+ * Vector subtraction
+ *
+ * @param value
+ */
+ public void sub(double value) {
+ x -= value;
+ y -= value;
+ }
+
+ /** @hide
+ * Vector subtraction
+ *
+ * @param a
+ * @param b
+ * @return
+ */
+ public static Double2 sub(Double2 a, double b) {
+ Double2 res = new Double2();
+ res.x = a.x - b;
+ res.y = a.y - b;
+
+ return res;
+ }
+
+ /** @hide
+ * Vector multiplication
+ *
+ * @param value
+ */
+ public void mul(Double2 value) {
+ x *= value.x;
+ y *= value.y;
+ }
+
+ /** @hide
+ * Vector multiplication
+ *
+ * @param a
+ * @param b
+ * @return
+ */
+ public static Double2 mul(Double2 a, Double2 b) {
+ Double2 res = new Double2();
+ res.x = a.x * b.x;
+ res.y = a.y * b.y;
+
+ return res;
+ }
+ /** @hide
+ * Vector multiplication
+ *
+ * @param value
+ */
+ public void mul(double value) {
+ x *= value;
+ y *= value;
+ }
+
+ /** @hide
+ * Vector multiplication
+ *
+ * @param a
+ * @param b
+ * @return
+ */
+ public static Double2 mul(Double2 a, double b) {
+ Double2 res = new Double2();
+ res.x = a.x * b;
+ res.y = a.y * b;
+
+ return res;
+ }
+
+ /** @hide
+ * Vector division
+ *
+ * @param value
+ */
+ public void div(Double2 value) {
+ x /= value.x;
+ y /= value.y;
+ }
+
+ /** @hide
+ * Vector division
+ *
+ * @param a
+ * @param b
+ * @return
+ */
+ public static Double2 div(Double2 a, Double2 b) {
+ Double2 res = new Double2();
+ res.x = a.x / b.x;
+ res.y = a.y / b.y;
+
+ return res;
+ }
+
+ /** @hide
+ * Vector division
+ *
+ * @param value
+ */
+ public void div(double value) {
+ x /= value;
+ y /= value;
+ }
+
+ /** @hide
+ * Vector division
+ *
+ * @param a
+ * @param b
+ * @return
+ */
+ public static Double2 div(Double2 a, double b) {
+ Double2 res = new Double2();
+ res.x = a.x / b;
+ res.y = a.y / b;
+
+ return res;
+ }
+
+ /** @hide
+ * Vector dot Product
+ *
+ * @param a
+ * @return
+ */
+ public double dotProduct(Double2 a) {
+ return (x * a.x) + (y * a.y);
+ }
+
+ /** @hide
+ * Vector dot Product
+ *
+ * @param a
+ * @param b
+ * @return
+ */
+ public static Double dotProduct(Double2 a, Double2 b) {
+ return (b.x * a.x) + (b.y * a.y);
+ }
+ /** @hide
+ * Vector add Multiple
+ *
+ * @param a
+ * @param factor
+ */
+ public void addMultiple(Double2 a, double factor) {
+ x += a.x * factor;
+ y += a.y * factor;
+ }
+
+ /** @hide
+ * Set vector value by double2
+ *
+ * @param a
+ */
+ public void set(Double2 a) {
+ this.x = a.x;
+ this.y = a.y;
+ }
+
+ /** @hide
+ * Set vector negate
+ */
+ public void negate() {
+ x = -x;
+ y = -y;
+ }
+
+ /** @hide
+ * Get vector length
+ *
+ * @return
+ */
+ public int length() {
+ return 2;
+ }
+
+ /** @hide
+ * Return the element sum of vector
+ *
+ * @return
+ */
+ public double elementSum() {
+ return x + y;
+ }
+ /** @hide
+ * Get the vector field value by index
+ *
+ * @param i
+ * @return
+ */
+ public double get(int i) {
+ switch (i) {
+ case 0:
+ return x;
+ case 1:
+ return y;
+ default:
+ throw new IndexOutOfBoundsException("Index: i");
+ }
+ }
+
+ /** @hide
+ * Set the vector field value by index
+ *
+ * @param i
+ * @param value
+ */
+ public void setAt(int i, double value) {
+ switch (i) {
+ case 0:
+ x = value;
+ return;
+ case 1:
+ y = value;
+ return;
+ default:
+ throw new IndexOutOfBoundsException("Index: i");
+ }
+ }
+
+ /** @hide
+ * Add the vector field value by index
+ *
+ * @param i
+ * @param value
+ */
+ public void addAt(int i, double value) {
+ switch (i) {
+ case 0:
+ x += value;
+ return;
+ case 1:
+ y += value;
+ return;
+ default:
+ throw new IndexOutOfBoundsException("Index: i");
+ }
+ }
+ /** @hide
+ * Set the vector field value
+ *
+ * @param x
+ * @param y
+ */
+ public void setValues(double x, double y) {
+ this.x = x;
+ this.y = y;
+ }
+
+ /** @hide
+ * Copy the vector to double array
+ *
+ * @param data
+ * @param offset
+ */
+ public void copyTo(double[] data, int offset) {
+ data[offset] = x;
+ data[offset + 1] = y;
+ }
+}
diff --git a/graphics/java/android/renderscript/Double3.java b/graphics/java/android/renderscript/Double3.java
index 818952e..b819716 100644
--- a/graphics/java/android/renderscript/Double3.java
+++ b/graphics/java/android/renderscript/Double3.java
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2011 The Android Open Source Project
+ * Copyright (C) 2013 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -16,30 +16,402 @@
package android.renderscript;
-import java.lang.Math;
-import android.util.Log;
-
-
/**
- * Class for exposing the native RenderScript double3 type back
- * to the Android system.
- *
- **/
+ * Vector version of the basic double type.
+ * Provides three double fields packed.
+ */
public class Double3 {
+ public double x;
+ public double y;
+ public double z;
+
public Double3() {
}
+ /** @hide */
+ public Double3(Double3 data) {
+ this.x = data.x;
+ this.y = data.y;
+ this.z = data.z;
+ }
- public Double3(double initX, double initY, double initZ) {
- x = initX;
- y = initY;
- z = initZ;
+ public Double3(double x, double y, double z) {
+ this.x = x;
+ this.y = y;
+ this.z = z;
}
- public double x;
- public double y;
- public double z;
-}
+ /** @hide
+ * Vector add
+ *
+ * @param a
+ * @param b
+ * @return
+ */
+ public static Double3 add(Double3 a, Double3 b) {
+ Double3 res = new Double3();
+ res.x = a.x + b.x;
+ res.y = a.y + b.y;
+ res.z = a.z + b.z;
+
+ return res;
+ }
+
+ /** @hide
+ * Vector add
+ *
+ * @param value
+ */
+ public void add(Double3 value) {
+ x += value.x;
+ y += value.y;
+ z += value.z;
+ }
+
+ /** @hide
+ * Vector add
+ *
+ * @param value
+ */
+ public void add(double value) {
+ x += value;
+ y += value;
+ z += value;
+ }
+ /** @hide
+ * Vector add
+ *
+ * @param a
+ * @param b
+ * @return
+ */
+ public static Double3 add(Double3 a, double b) {
+ Double3 res = new Double3();
+ res.x = a.x + b;
+ res.y = a.y + b;
+ res.z = a.z + b;
+ return res;
+ }
+
+ /** @hide
+ * Vector subtraction
+ *
+ * @param value
+ */
+ public void sub(Double3 value) {
+ x -= value.x;
+ y -= value.y;
+ z -= value.z;
+ }
+
+ /** @hide
+ * Vector subtraction
+ *
+ * @param a
+ * @param b
+ * @return
+ */
+ public static Double3 sub(Double3 a, Double3 b) {
+ Double3 res = new Double3();
+ res.x = a.x - b.x;
+ res.y = a.y - b.y;
+ res.z = a.z - b.z;
+
+ return res;
+ }
+
+ /** @hide
+ * Vector subtraction
+ *
+ * @param value
+ */
+ public void sub(double value) {
+ x -= value;
+ y -= value;
+ z -= value;
+ }
+
+ /** @hide
+ * Vector subtraction
+ *
+ * @param a
+ * @param b
+ * @return
+ */
+ public static Double3 sub(Double3 a, double b) {
+ Double3 res = new Double3();
+ res.x = a.x - b;
+ res.y = a.y - b;
+ res.z = a.z - b;
+
+ return res;
+ }
+
+ /** @hide
+ * Vector multiplication
+ *
+ * @param value
+ */
+ public void mul(Double3 value) {
+ x *= value.x;
+ y *= value.y;
+ z *= value.z;
+ }
+
+ /** @hide
+ * Vector multiplication
+ *
+ * @param a
+ * @param b
+ * @return
+ */
+ public static Double3 mul(Double3 a, Double3 b) {
+ Double3 res = new Double3();
+ res.x = a.x * b.x;
+ res.y = a.y * b.y;
+ res.z = a.z * b.z;
+
+ return res;
+ }
+
+ /** @hide
+ * Vector multiplication
+ *
+ * @param value
+ */
+ public void mul(double value) {
+ x *= value;
+ y *= value;
+ z *= value;
+ }
+ /** @hide
+ * Vector multiplication
+ *
+ * @param a
+ * @param b
+ * @return
+ */
+ public static Double3 mul(Double3 a, double b) {
+ Double3 res = new Double3();
+ res.x = a.x * b;
+ res.y = a.y * b;
+ res.z = a.z * b;
+ return res;
+ }
+
+ /** @hide
+ * Vector division
+ *
+ * @param value
+ */
+ public void div(Double3 value) {
+ x /= value.x;
+ y /= value.y;
+ z /= value.z;
+ }
+
+ /** @hide
+ * Vector division
+ *
+ * @param a
+ * @param b
+ * @return
+ */
+ public static Double3 div(Double3 a, Double3 b) {
+ Double3 res = new Double3();
+ res.x = a.x / b.x;
+ res.y = a.y / b.y;
+ res.z = a.z / b.z;
+
+ return res;
+ }
+
+ /** @hide
+ * Vector division
+ *
+ * @param value
+ */
+ public void div(double value) {
+ x /= value;
+ y /= value;
+ z /= value;
+ }
+
+ /** @hide
+ * Vector division
+ *
+ * @param a
+ * @param b
+ * @return
+ */
+ public static Double3 div(Double3 a, double b) {
+ Double3 res = new Double3();
+ res.x = a.x / b;
+ res.y = a.y / b;
+ res.z = a.z / b;
+
+ return res;
+ }
+
+ /** @hide
+ * Vector dot Product
+ *
+ * @param a
+ * @return
+ */
+ public double dotProduct(Double3 a) {
+ return (x * a.x) + (y * a.y) + (z * a.z);
+ }
+
+ /** @hide
+ * Vector dot Product
+ *
+ * @param a
+ * @param b
+ * @return
+ */
+ public static double dotProduct(Double3 a, Double3 b) {
+ return (b.x * a.x) + (b.y * a.y) + (b.z * a.z);
+ }
+
+ /** @hide
+ * Vector add Multiple
+ *
+ * @param a
+ * @param factor
+ */
+ public void addMultiple(Double3 a, double factor) {
+ x += a.x * factor;
+ y += a.y * factor;
+ z += a.z * factor;
+ }
+
+ /** @hide
+ * Set vector value by double3
+ *
+ * @param a
+ */
+ public void set(Double3 a) {
+ this.x = a.x;
+ this.y = a.y;
+ this.z = a.z;
+ }
+
+ /** @hide
+ * Set vector negate
+ */
+ public void negate() {
+ x = -x;
+ y = -y;
+ z = -z;
+ }
+
+ /** @hide
+ * Get vector length
+ *
+ * @return
+ */
+ public int length() {
+ return 3;
+ }
+
+ /** @hide
+ * Return the element sum of vector
+ *
+ * @return
+ */
+ public double elementSum() {
+ return x + y + z;
+ }
+
+ /** @hide
+ * Get the vector field value by index
+ *
+ * @param i
+ * @return
+ */
+ public double get(int i) {
+ switch (i) {
+ case 0:
+ return x;
+ case 1:
+ return y;
+ case 2:
+ return z;
+ default:
+ throw new IndexOutOfBoundsException("Index: i");
+ }
+ }
+
+ /** @hide
+ * Set the vector field value by index
+ *
+ * @param i
+ * @param value
+ */
+ public void setAt(int i, double value) {
+ switch (i) {
+ case 0:
+ x = value;
+ return;
+ case 1:
+ y = value;
+ return;
+ case 2:
+ z = value;
+ return;
+ default:
+ throw new IndexOutOfBoundsException("Index: i");
+ }
+ }
+
+ /** @hide
+ * Add the vector field value by index
+ *
+ * @param i
+ * @param value
+ */
+ public void addAt(int i, double value) {
+ switch (i) {
+ case 0:
+ x += value;
+ return;
+ case 1:
+ y += value;
+ return;
+ case 2:
+ z += value;
+ return;
+ default:
+ throw new IndexOutOfBoundsException("Index: i");
+ }
+ }
+
+ /** @hide
+ * Set the vector field value
+ *
+ * @param x
+ * @param y
+ * @param z
+ */
+ public void setValues(double x, double y, double z) {
+ this.x = x;
+ this.y = y;
+ this.z = z;
+ }
+
+ /** @hide
+ * Copy the vector to double array
+ *
+ * @param data
+ * @param offset
+ */
+ public void copyTo(double[] data, int offset) {
+ data[offset] = x;
+ data[offset + 1] = y;
+ data[offset + 2] = z;
+ }
+}
diff --git a/graphics/java/android/renderscript/Double4.java b/graphics/java/android/renderscript/Double4.java
index 7775ab7..e4829f7 100644
--- a/graphics/java/android/renderscript/Double4.java
+++ b/graphics/java/android/renderscript/Double4.java
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2011 The Android Open Source Project
+ * Copyright (C) 2013 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -16,31 +16,435 @@
package android.renderscript;
-import java.lang.Math;
-import android.util.Log;
-
-
/**
- * Class for exposing the native RenderScript double4 type back
- * to the Android system.
- *
- **/
+ * Vector version of the basic double type.
+ * Provides four double fields packed.
+ */
public class Double4 {
+ public double x;
+ public double y;
+ public double z;
+ public double w;
+
public Double4() {
}
+ /** @hide */
+ public Double4(Double4 data) {
+ this.x = data.x;
+ this.y = data.y;
+ this.z = data.z;
+ this.w = data.w;
+ }
- public Double4(double initX, double initY, double initZ, double initW) {
- x = initX;
- y = initY;
- z = initZ;
- w = initW;
+ public Double4(double x, double y, double z, double w) {
+ this.x = x;
+ this.y = y;
+ this.z = z;
+ this.w = w;
}
- public double x;
- public double y;
- public double z;
- public double w;
-}
+ /** @hide
+ * Vector add
+ *
+ * @param a
+ * @param b
+ * @return
+ */
+ public static Double4 add(Double4 a, Double4 b) {
+ Double4 res = new Double4();
+ res.x = a.x + b.x;
+ res.y = a.y + b.y;
+ res.z = a.z + b.z;
+ res.w = a.w + b.w;
+
+ return res;
+ }
+
+ /** @hide
+ * Vector add
+ *
+ * @param value
+ */
+ public void add(Double4 value) {
+ x += value.x;
+ y += value.y;
+ z += value.z;
+ w += value.w;
+ }
+
+ /** @hide
+ * Vector add
+ *
+ * @param value
+ */
+ public void add(double value) {
+ x += value;
+ y += value;
+ z += value;
+ w += value;
+ }
+
+ /** @hide
+ * Vector add
+ *
+ * @param a
+ * @param b
+ * @return
+ */
+ public static Double4 add(Double4 a, double b) {
+ Double4 res = new Double4();
+ res.x = a.x + b;
+ res.y = a.y + b;
+ res.z = a.z + b;
+ res.w = a.w + b;
+
+ return res;
+ }
+
+ /** @hide
+ * Vector subtraction
+ *
+ * @param value
+ */
+ public void sub(Double4 value) {
+ x -= value.x;
+ y -= value.y;
+ z -= value.z;
+ w -= value.w;
+ }
+
+ /** @hide
+ * Vector subtraction
+ *
+ * @param value
+ */
+ public void sub(double value) {
+ x -= value;
+ y -= value;
+ z -= value;
+ w -= value;
+ }
+
+ /** @hide
+ * Vector subtraction
+ *
+ * @param a
+ * @param b
+ * @return
+ */
+ public static Double4 sub(Double4 a, double b) {
+ Double4 res = new Double4();
+ res.x = a.x - b;
+ res.y = a.y - b;
+ res.z = a.z - b;
+ res.w = a.w - b;
+
+ return res;
+ }
+
+ /** @hide
+ * Vector subtraction
+ *
+ * @param a
+ * @param b
+ * @return
+ */
+ public static Double4 sub(Double4 a, Double4 b) {
+ Double4 res = new Double4();
+ res.x = a.x - b.x;
+ res.y = a.y - b.y;
+ res.z = a.z - b.z;
+ res.w = a.w - b.w;
+
+ return res;
+ }
+
+ /** @hide
+ * Vector multiplication
+ *
+ * @param value
+ */
+ public void mul(Double4 value) {
+ x *= value.x;
+ y *= value.y;
+ z *= value.z;
+ w *= value.w;
+ }
+
+ /** @hide
+ * Vector multiplication
+ *
+ * @param value
+ */
+ public void mul(double value) {
+ x *= value;
+ y *= value;
+ z *= value;
+ w *= value;
+ }
+ /** @hide
+ * Vector multiplication
+ *
+ * @param a
+ * @param b
+ * @return
+ */
+ public static Double4 mul(Double4 a, Double4 b) {
+ Double4 res = new Double4();
+ res.x = a.x * b.x;
+ res.y = a.y * b.y;
+ res.z = a.z * b.z;
+ res.w = a.w * b.w;
+ return res;
+ }
+
+ /** @hide
+ * Vector multiplication
+ *
+ * @param a
+ * @param b
+ * @return
+ */
+ public static Double4 mul(Double4 a, double b) {
+ Double4 res = new Double4();
+ res.x = a.x * b;
+ res.y = a.y * b;
+ res.z = a.z * b;
+ res.w = a.w * b;
+
+ return res;
+ }
+
+ /** @hide
+ * Vector division
+ *
+ * @param value
+ */
+ public void div(Double4 value) {
+ x /= value.x;
+ y /= value.y;
+ z /= value.z;
+ w /= value.w;
+ }
+
+ /** @hide
+ * Vector division
+ *
+ * @param value
+ */
+ public void div(double value) {
+ x /= value;
+ y /= value;
+ z /= value;
+ w /= value;
+ }
+
+ /** @hide
+ * Vector division
+ *
+ * @param a
+ * @param b
+ * @return
+ */
+ public static Double4 div(Double4 a, double b) {
+ Double4 res = new Double4();
+ res.x = a.x / b;
+ res.y = a.y / b;
+ res.z = a.z / b;
+ res.w = a.w / b;
+
+ return res;
+ }
+
+ /** @hide
+ * Vector division
+ *
+ * @param a
+ * @param b
+ * @return
+ */
+ public static Double4 div(Double4 a, Double4 b) {
+ Double4 res = new Double4();
+ res.x = a.x / b.x;
+ res.y = a.y / b.y;
+ res.z = a.z / b.z;
+ res.w = a.w / b.w;
+
+ return res;
+ }
+
+ /** @hide
+ * Vector dot Product
+ *
+ * @param a
+ * @return
+ */
+ public double dotProduct(Double4 a) {
+ return (x * a.x) + (y * a.y) + (z * a.z) + (w * a.w);
+ }
+
+ /** @hide
+ * Vector dot Product
+ *
+ * @param a
+ * @param b
+ * @return
+ */
+ public static double dotProduct(Double4 a, Double4 b) {
+ return (b.x * a.x) + (b.y * a.y) + (b.z * a.z) + (b.w * a.w);
+ }
+
+ /** @hide
+ * Vector add Multiple
+ *
+ * @param a
+ * @param factor
+ */
+ public void addMultiple(Double4 a, double factor) {
+ x += a.x * factor;
+ y += a.y * factor;
+ z += a.z * factor;
+ w += a.w * factor;
+ }
+
+ /** @hide
+ * Set vector value by double4
+ *
+ * @param a
+ */
+ public void set(Double4 a) {
+ this.x = a.x;
+ this.y = a.y;
+ this.z = a.z;
+ this.w = a.w;
+ }
+
+ /** @hide
+ * Set vector negate
+ */
+ public void negate() {
+ x = -x;
+ y = -y;
+ z = -z;
+ w = -w;
+ }
+ /** @hide
+ * Get vector length
+ *
+ * @return
+ */
+ public int length() {
+ return 4;
+ }
+
+ /** @hide
+ * Return the element sum of vector
+ *
+ * @return
+ */
+ public double elementSum() {
+ return x + y + z + w;
+ }
+
+ /** @hide
+ * Get the vector field value by index
+ *
+ * @param i
+ * @return
+ */
+ public double get(int i) {
+ switch (i) {
+ case 0:
+ return x;
+ case 1:
+ return y;
+ case 2:
+ return z;
+ case 3:
+ return w;
+ default:
+ throw new IndexOutOfBoundsException("Index: i");
+ }
+ }
+
+ /** @hide
+ * Set the vector field value by index
+ *
+ * @param i
+ * @param value
+ */
+ public void setAt(int i, double value) {
+ switch (i) {
+ case 0:
+ x = value;
+ return;
+ case 1:
+ y = value;
+ return;
+ case 2:
+ z = value;
+ return;
+ case 3:
+ w = value;
+ return;
+ default:
+ throw new IndexOutOfBoundsException("Index: i");
+ }
+ }
+
+ /** @hide
+ * Add the vector field value by index
+ *
+ * @param i
+ * @param value
+ */
+ public void addAt(int i, double value) {
+ switch (i) {
+ case 0:
+ x += value;
+ return;
+ case 1:
+ y += value;
+ return;
+ case 2:
+ z += value;
+ return;
+ case 3:
+ w += value;
+ return;
+ default:
+ throw new IndexOutOfBoundsException("Index: i");
+ }
+ }
+
+ /** @hide
+ * Set the vector field value
+ *
+ * @param x
+ * @param y
+ * @param z
+ * @param w
+ */
+ public void setValues(double x, double y, double z, double w) {
+ this.x = x;
+ this.y = y;
+ this.z = z;
+ this.w = w;
+ }
+
+ /** @hide
+ * Copy the vector to double array
+ *
+ * @param data
+ * @param offset
+ */
+ public void copyTo(double[] data, int offset) {
+ data[offset] = x;
+ data[offset + 1] = y;
+ data[offset + 2] = z;
+ data[offset + 3] = w;
+ }
+}
diff --git a/graphics/java/android/renderscript/Float2.java b/graphics/java/android/renderscript/Float2.java
index 0f730fe..26193d2 100644
--- a/graphics/java/android/renderscript/Float2.java
+++ b/graphics/java/android/renderscript/Float2.java
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2009 The Android Open Source Project
+ * Copyright (C) 2013 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -16,27 +16,369 @@
package android.renderscript;
-import java.lang.Math;
-import android.util.Log;
-
-
/**
- * Class for exposing the native RenderScript float2 type back to the Android system.
- *
- **/
-public class Float2 {
+ * Vector version of the basic float type.
+ * Provides two float fields packed.
+ */
+public class Float2 {
+ public float x;
+ public float y;
+
public Float2() {
}
+ /** @hide */
+ public Float2(Float2 data) {
+ this.x = data.x;
+ this.y = data.y;
+ }
- public Float2(float initX, float initY) {
- x = initX;
- y = initY;
+ public Float2(float x, float y) {
+ this.x = x;
+ this.y = y;
}
- public float x;
- public float y;
-}
+ /** @hide
+ * Vector add
+ *
+ * @param a
+ * @param b
+ * @return
+ */
+ public static Float2 add(Float2 a, Float2 b) {
+ Float2 res = new Float2();
+ res.x = a.x + b.x;
+ res.y = a.y + b.y;
+
+ return res;
+ }
+
+ /** @hide
+ * Vector add
+ *
+ * @param value
+ */
+ public void add(Float2 value) {
+ x += value.x;
+ y += value.y;
+ }
+
+ /** @hide
+ * Vector add
+ *
+ * @param value
+ */
+ public void add(float value) {
+ x += value;
+ y += value;
+ }
+
+ /** @hide
+ * Vector add
+ *
+ * @param a
+ * @param b
+ * @return
+ */
+ public static Float2 add(Float2 a, float b) {
+ Float2 res = new Float2();
+ res.x = a.x + b;
+ res.y = a.y + b;
+ return res;
+ }
+
+ /** @hide
+ * Vector subtraction
+ *
+ * @param value
+ */
+ public void sub(Float2 value) {
+ x -= value.x;
+ y -= value.y;
+ }
+
+ /** @hide
+ * Vector subtraction
+ *
+ * @param a
+ * @param b
+ * @return
+ */
+ public static Float2 sub(Float2 a, Float2 b) {
+ Float2 res = new Float2();
+ res.x = a.x - b.x;
+ res.y = a.y - b.y;
+
+ return res;
+ }
+
+ /** @hide
+ * Vector subtraction
+ *
+ * @param value
+ */
+ public void sub(float value) {
+ x -= value;
+ y -= value;
+ }
+
+ /** @hide
+ * Vector subtraction
+ *
+ * @param a
+ * @param b
+ * @return
+ */
+ public static Float2 sub(Float2 a, float b) {
+ Float2 res = new Float2();
+ res.x = a.x - b;
+ res.y = a.y - b;
+ return res;
+ }
+
+ /** @hide
+ * Vector multiplication
+ *
+ * @param value
+ */
+ public void mul(Float2 value) {
+ x *= value.x;
+ y *= value.y;
+ }
+ /** @hide
+ * Vector multiplication
+ *
+ * @param a
+ * @param b
+ * @return
+ */
+ public static Float2 mul(Float2 a, Float2 b) {
+ Float2 res = new Float2();
+ res.x = a.x * b.x;
+ res.y = a.y * b.y;
+
+ return res;
+ }
+ /** @hide
+ * Vector multiplication
+ *
+ * @param value
+ */
+ public void mul(float value) {
+ x *= value;
+ y *= value;
+ }
+
+ /** @hide
+ * Vector multiplication
+ *
+ * @param a
+ * @param b
+ * @return
+ */
+ public static Float2 mul(Float2 a, float b) {
+ Float2 res = new Float2();
+ res.x = a.x * b;
+ res.y = a.y * b;
+
+ return res;
+ }
+
+ /** @hide
+ * Vector division
+ *
+ * @param value
+ */
+ public void div(Float2 value) {
+ x /= value.x;
+ y /= value.y;
+ }
+
+ /** @hide
+ * Vector division
+ *
+ * @param a
+ * @param b
+ * @return
+ */
+ public static Float2 div(Float2 a, Float2 b) {
+ Float2 res = new Float2();
+ res.x = a.x / b.x;
+ res.y = a.y / b.y;
+
+ return res;
+ }
+
+ /** @hide
+ * Vector division
+ *
+ * @param value
+ */
+ public void div(float value) {
+ x /= value;
+ y /= value;
+ }
+
+ /** @hide
+ * Vector division
+ *
+ * @param a
+ * @param b
+ * @return
+ */
+ public static Float2 div(Float2 a, float b) {
+ Float2 res = new Float2();
+ res.x = a.x / b;
+ res.y = a.y / b;
+
+ return res;
+ }
+
+ /** @hide
+ * Vector dot Product
+ *
+ * @param a
+ * @return
+ */
+ public float dotProduct(Float2 a) {
+ return (x * a.x) + (y * a.y);
+ }
+
+ /** @hide
+ * Vector dot Product
+ *
+ * @param a
+ * @param b
+ * @return
+ */
+ public static float dotProduct(Float2 a, Float2 b) {
+ return (b.x * a.x) + (b.y * a.y);
+ }
+
+ /** @hide
+ * Vector add Multiple
+ *
+ * @param a
+ * @param factor
+ */
+ public void addMultiple(Float2 a, float factor) {
+ x += a.x * factor;
+ y += a.y * factor;
+ }
+
+ /** @hide
+ * set vector value by float2
+ *
+ * @param a
+ */
+ public void set(Float2 a) {
+ this.x = a.x;
+ this.y = a.y;
+ }
+
+ /** @hide
+ * set vector negate
+ */
+ public void negate() {
+ x = -x;
+ y = -y;
+ }
+
+ /** @hide
+ * get vector length
+ *
+ * @return
+ */
+ public int length() {
+ return 2;
+ }
+
+ /** @hide
+ * return the element sum of vector
+ *
+ * @return
+ */
+ public float elementSum() {
+ return x + y;
+ }
+
+ /** @hide
+ * get the vector field value by index
+ *
+ * @param i
+ * @return
+ */
+ public float get(int i) {
+ switch (i) {
+ case 0:
+ return x;
+ case 1:
+ return y;
+ default:
+ throw new IndexOutOfBoundsException("Index: i");
+ }
+ }
+
+ /** @hide
+ * set the vector field value by index
+ *
+ * @param i
+ * @param value
+ */
+ public void setAt(int i, float value) {
+ switch (i) {
+ case 0:
+ x = value;
+ return;
+ case 1:
+ y = value;
+ return;
+ default:
+ throw new IndexOutOfBoundsException("Index: i");
+ }
+ }
+
+ /** @hide
+ * add the vector field value by index
+ *
+ * @param i
+ * @param value
+ */
+ public void addAt(int i, float value) {
+ switch (i) {
+ case 0:
+ x += value;
+ return;
+ case 1:
+ y += value;
+ return;
+ default:
+ throw new IndexOutOfBoundsException("Index: i");
+ }
+ }
+
+ /** @hide
+ * set the vector field value
+ *
+ * @param x
+ * @param y
+ */
+ public void setValues(float x, float y) {
+ this.x = x;
+ this.y = y;
+ }
+
+ /** @hide
+ * copy the vector to float array
+ *
+ * @param data
+ * @param offset
+ */
+ public void copyTo(float[] data, int offset) {
+ data[offset] = x;
+ data[offset + 1] = y;
+ }
+}
diff --git a/graphics/java/android/renderscript/Float3.java b/graphics/java/android/renderscript/Float3.java
index 749865f..555bdf6 100644
--- a/graphics/java/android/renderscript/Float3.java
+++ b/graphics/java/android/renderscript/Float3.java
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2009 The Android Open Source Project
+ * Copyright (C) 2013 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -16,28 +16,402 @@
package android.renderscript;
-import java.lang.Math;
-import android.util.Log;
-
-
/**
- * Class for exposing the native RenderScript float2 type back to the Android system.
- *
- **/
+ * Vector version of the basic float type.
+ * Provides three float fields packed.
+ */
public class Float3 {
+ public float x;
+ public float y;
+ public float z;
+
public Float3() {
}
- public Float3(float initX, float initY, float initZ) {
- x = initX;
- y = initY;
- z = initZ;
+ /** @hide */
+ public Float3(Float3 data) {
+ this.x = data.x;
+ this.y = data.y;
+ this.z = data.z;
}
- public float x;
- public float y;
- public float z;
-}
+ public Float3(float x, float y, float z) {
+ this.x = x;
+ this.y = y;
+ this.z = z;
+ }
+
+ /** @hide
+ * Vector add
+ *
+ * @param a
+ * @param b
+ * @return
+ */
+ public static Float3 add(Float3 a, Float3 b) {
+ Float3 res = new Float3();
+ res.x = a.x + b.x;
+ res.y = a.y + b.y;
+ res.z = a.z + b.z;
+
+ return res;
+ }
+
+ /** @hide
+ * Vector add
+ *
+ * @param value
+ */
+ public void add(Float3 value) {
+ x += value.x;
+ y += value.y;
+ z += value.z;
+ }
+
+ /** @hide
+ * Vector add
+ *
+ * @param value
+ */
+ public void add(float value) {
+ x += value;
+ y += value;
+ z += value;
+ }
+
+ /** @hide
+ * Vector add
+ *
+ * @param a
+ * @param b
+ * @return
+ */
+ public static Float3 add(Float3 a, float b) {
+ Float3 res = new Float3();
+ res.x = a.x + b;
+ res.y = a.y + b;
+ res.z = a.z + b;
+
+ return res;
+ }
+
+ /** @hide
+ * Vector subtraction
+ *
+ * @param value
+ */
+ public void sub(Float3 value) {
+ x -= value.x;
+ y -= value.y;
+ z -= value.z;
+ }
+
+ /** @hide
+ * Vector subtraction
+ *
+ * @param a
+ * @param b
+ * @return
+ */
+ public static Float3 sub(Float3 a, Float3 b) {
+ Float3 res = new Float3();
+ res.x = a.x - b.x;
+ res.y = a.y - b.y;
+ res.z = a.z - b.z;
+
+ return res;
+ }
+
+ /** @hide
+ * Vector subtraction
+ *
+ * @param value
+ */
+ public void sub(float value) {
+ x -= value;
+ y -= value;
+ z -= value;
+ }
+
+ /** @hide
+ * Vector subtraction
+ *
+ * @param a
+ * @param b
+ * @return
+ */
+ public static Float3 sub(Float3 a, float b) {
+ Float3 res = new Float3();
+ res.x = a.x - b;
+ res.y = a.y - b;
+ res.z = a.z - b;
+
+ return res;
+ }
+
+ /** @hide
+ * Vector multiplication
+ *
+ * @param value
+ */
+ public void mul(Float3 value) {
+ x *= value.x;
+ y *= value.y;
+ z *= value.z;
+ }
+
+ /** @hide
+ * Vector multiplication
+ *
+ * @param a
+ * @param b
+ * @return
+ */
+ public static Float3 mul(Float3 a, Float3 b) {
+ Float3 res = new Float3();
+ res.x = a.x * b.x;
+ res.y = a.y * b.y;
+ res.z = a.z * b.z;
+
+ return res;
+ }
+
+ /** @hide
+ * Vector multiplication
+ *
+ * @param value
+ */
+ public void mul(float value) {
+ x *= value;
+ y *= value;
+ z *= value;
+ }
+
+ /** @hide
+ * Vector multiplication
+ *
+ * @param a
+ * @param b
+ * @return
+ */
+ public static Float3 mul(Float3 a, float b) {
+ Float3 res = new Float3();
+ res.x = a.x * b;
+ res.y = a.y * b;
+ res.z = a.z * b;
+
+ return res;
+ }
+ /** @hide
+ * Vector division
+ *
+ * @param value
+ */
+ public void div(Float3 value) {
+ x /= value.x;
+ y /= value.y;
+ z /= value.z;
+ }
+ /** @hide
+ * Vector division
+ *
+ * @param a
+ * @param b
+ * @return
+ */
+ public static Float3 div(Float3 a, Float3 b) {
+ Float3 res = new Float3();
+ res.x = a.x / b.x;
+ res.y = a.y / b.y;
+ res.z = a.z / b.z;
+ return res;
+ }
+
+ /** @hide
+ * Vector division
+ *
+ * @param value
+ */
+ public void div(float value) {
+ x /= value;
+ y /= value;
+ z /= value;
+ }
+
+ /** @hide
+ * Vector division
+ *
+ * @param a
+ * @param b
+ * @return
+ */
+ public static Float3 div(Float3 a, float b) {
+ Float3 res = new Float3();
+ res.x = a.x / b;
+ res.y = a.y / b;
+ res.z = a.z / b;
+
+ return res;
+ }
+
+ /** @hide
+ * Vector dot Product
+ *
+ * @param a
+ * @return
+ */
+ public Float dotProduct(Float3 a) {
+ return new Float((x * a.x) + (y * a.y) + (z * a.z));
+ }
+
+ /** @hide
+ * Vector dot Product
+ *
+ * @param a
+ * @param b
+ * @return
+ */
+ public static Float dotProduct(Float3 a, Float3 b) {
+ return new Float((b.x * a.x) + (b.y * a.y) + (b.z * a.z));
+ }
+
+ /** @hide
+ * Vector add Multiple
+ *
+ * @param a
+ * @param factor
+ */
+ public void addMultiple(Float3 a, float factor) {
+ x += a.x * factor;
+ y += a.y * factor;
+ z += a.z * factor;
+ }
+ /** @hide
+ * set vector value by float3
+ *
+ * @param a
+ */
+ public void set(Float3 a) {
+ this.x = a.x;
+ this.y = a.y;
+ this.z = a.z;
+ }
+
+ /** @hide
+ * set vector negate
+ */
+ public void negate() {
+ x = -x;
+ y = -y;
+ z = -z;
+ }
+
+ /** @hide
+ * get vector length
+ *
+ * @return
+ */
+ public int length() {
+ return 3;
+ }
+
+ /** @hide
+ * return the element sum of vector
+ *
+ * @return
+ */
+ public Float elementSum() {
+ return new Float(x + y + z);
+ }
+
+ /** @hide
+ * get the vector field value by index
+ *
+ * @param i
+ * @return
+ */
+ public float get(int i) {
+ switch (i) {
+ case 0:
+ return x;
+ case 1:
+ return y;
+ case 2:
+ return z;
+ default:
+ throw new IndexOutOfBoundsException("Index: i");
+ }
+ }
+
+ /** @hide
+ * set the vector field value by index
+ *
+ * @param i
+ * @param value
+ */
+ public void setAt(int i, float value) {
+ switch (i) {
+ case 0:
+ x = value;
+ return;
+ case 1:
+ y = value;
+ return;
+ case 2:
+ z = value;
+ return;
+ default:
+ throw new IndexOutOfBoundsException("Index: i");
+ }
+ }
+
+ /** @hide
+ * add the vector field value by index
+ *
+ * @param i
+ * @param value
+ */
+ public void addAt(int i, float value) {
+ switch (i) {
+ case 0:
+ x += value;
+ return;
+ case 1:
+ y += value;
+ return;
+ case 2:
+ z += value;
+ return;
+ default:
+ throw new IndexOutOfBoundsException("Index: i");
+ }
+ }
+
+ /** @hide
+ * set the vector field value
+ *
+ * @param x
+ * @param y
+ * @param z
+ */
+ public void setValues(float x, float y, float z) {
+ this.x = x;
+ this.y = y;
+ this.z = z;
+ }
+
+ /** @hide
+ * copy the vector to float array
+ *
+ * @param data
+ * @param offset
+ */
+ public void copyTo(float[] data, int offset) {
+ data[offset] = x;
+ data[offset + 1] = y;
+ data[offset + 2] = z;
+ }
+}
diff --git a/graphics/java/android/renderscript/Float4.java b/graphics/java/android/renderscript/Float4.java
index 7ddf6aa..6541b2e 100644
--- a/graphics/java/android/renderscript/Float4.java
+++ b/graphics/java/android/renderscript/Float4.java
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2009 The Android Open Source Project
+ * Copyright (C) 2013 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -16,30 +16,435 @@
package android.renderscript;
-import java.lang.Math;
-import android.util.Log;
-
-
/**
- * Class for exposing the native RenderScript float2 type back to the Android system.
- *
- **/
+ * Vector version of the basic float type.
+ * Provides four float fields packed.
+ */
public class Float4 {
+ public float x;
+ public float y;
+ public float z;
+ public float w;
+
public Float4() {
}
+ /** @hide */
+ public Float4(Float4 data) {
+ this.x = data.x;
+ this.y = data.y;
+ this.z = data.z;
+ this.w = data.w;
+ }
- public Float4(float initX, float initY, float initZ, float initW) {
- x = initX;
- y = initY;
- z = initZ;
- w = initW;
+ public Float4(float x, float y, float z, float w) {
+ this.x = x;
+ this.y = y;
+ this.z = z;
+ this.w = w;
}
- public float x;
- public float y;
- public float z;
- public float w;
-}
+ /** @hide
+ * Vector add
+ *
+ * @param a
+ * @param b
+ * @return
+ */
+ public static Float4 add(Float4 a, Float4 b) {
+ Float4 res = new Float4();
+ res.x = a.x + b.x;
+ res.y = a.y + b.y;
+ res.z = a.z + b.z;
+ res.w = a.w + b.w;
+
+ return res;
+ }
+
+ /** @hide
+ * Vector add
+ *
+ * @param value
+ */
+ public void add(Float4 value) {
+ x += value.x;
+ y += value.y;
+ z += value.z;
+ w += value.w;
+ }
+
+ /** @hide
+ * Vector add
+ *
+ * @param value
+ */
+ public void add(float value) {
+ x += value;
+ y += value;
+ z += value;
+ w += value;
+ }
+
+ /** @hide
+ * Vector add
+ *
+ * @param a
+ * @param b
+ * @return
+ */
+ public static Float4 add(Float4 a, float b) {
+ Float4 res = new Float4();
+ res.x = a.x + b;
+ res.y = a.y + b;
+ res.z = a.z + b;
+ res.w = a.w + b;
+
+ return res;
+ }
+
+ /** @hide
+ * Vector subtraction
+ *
+ * @param value
+ */
+ public void sub(Float4 value) {
+ x -= value.x;
+ y -= value.y;
+ z -= value.z;
+ w -= value.w;
+ }
+
+ /** @hide
+ * Vector subtraction
+ *
+ * @param value
+ */
+ public void sub(float value) {
+ x -= value;
+ y -= value;
+ z -= value;
+ w -= value;
+ }
+
+ /** @hide
+ * Vector subtraction
+ *
+ * @param a
+ * @param b
+ * @return
+ */
+ public static Float4 sub(Float4 a, float b) {
+ Float4 res = new Float4();
+ res.x = a.x - b;
+ res.y = a.y - b;
+ res.z = a.z - b;
+ res.w = a.w - b;
+
+ return res;
+ }
+
+ /** @hide
+ * Vector subtraction
+ *
+ * @param a
+ * @param b
+ * @return
+ */
+ public static Float4 sub(Float4 a, Float4 b) {
+ Float4 res = new Float4();
+ res.x = a.x - b.x;
+ res.y = a.y - b.y;
+ res.z = a.z - b.z;
+ res.w = a.w - b.w;
+
+ return res;
+ }
+
+ /** @hide
+ * Vector multiplication
+ *
+ * @param value
+ */
+ public void mul(Float4 value) {
+ x *= value.x;
+ y *= value.y;
+ z *= value.z;
+ w *= value.w;
+ }
+
+ /** @hide
+ * Vector multiplication
+ *
+ * @param value
+ */
+ public void mul(float value) {
+ x *= value;
+ y *= value;
+ z *= value;
+ w *= value;
+ }
+ /** @hide
+ * Vector multiplication
+ *
+ * @param a
+ * @param b
+ * @return
+ */
+ public static Float4 mul(Float4 a, Float4 b) {
+ Float4 res = new Float4();
+ res.x = a.x * b.x;
+ res.y = a.y * b.y;
+ res.z = a.z * b.z;
+ res.w = a.w * b.w;
+ return res;
+ }
+
+ /** @hide
+ * Vector multiplication
+ *
+ * @param a
+ * @param b
+ * @return
+ */
+ public static Float4 mul(Float4 a, float b) {
+ Float4 res = new Float4();
+ res.x = a.x * b;
+ res.y = a.y * b;
+ res.z = a.z * b;
+ res.w = a.w * b;
+
+ return res;
+ }
+
+ /** @hide
+ * Vector division
+ *
+ * @param value
+ */
+ public void div(Float4 value) {
+ x /= value.x;
+ y /= value.y;
+ z /= value.z;
+ w /= value.w;
+ }
+
+ /** @hide
+ * Vector division
+ *
+ * @param value
+ */
+ public void div(float value) {
+ x /= value;
+ y /= value;
+ z /= value;
+ w /= value;
+ }
+
+ /** @hide
+ * Vector division
+ *
+ * @param a
+ * @param b
+ * @return
+ */
+ public static Float4 div(Float4 a, float b) {
+ Float4 res = new Float4();
+ res.x = a.x / b;
+ res.y = a.y / b;
+ res.z = a.z / b;
+ res.w = a.w / b;
+
+ return res;
+ }
+
+ /** @hide
+ * Vector division
+ *
+ * @param a
+ * @param b
+ * @return
+ */
+ public static Float4 div(Float4 a, Float4 b) {
+ Float4 res = new Float4();
+ res.x = a.x / b.x;
+ res.y = a.y / b.y;
+ res.z = a.z / b.z;
+ res.w = a.w / b.w;
+
+ return res;
+ }
+
+ /** @hide
+ * Vector dot Product
+ *
+ * @param a
+ * @return
+ */
+ public float dotProduct(Float4 a) {
+ return (x * a.x) + (y * a.y) + (z * a.z) + (w * a.w);
+ }
+
+ /** @hide
+ * Vector dot Product
+ *
+ * @param a
+ * @param b
+ * @return
+ */
+ public static float dotProduct(Float4 a, Float4 b) {
+ return (b.x * a.x) + (b.y * a.y) + (b.z * a.z) + (b.w * a.w);
+ }
+
+ /** @hide
+ * Vector add Multiple
+ *
+ * @param a
+ * @param factor
+ */
+ public void addMultiple(Float4 a, float factor) {
+ x += a.x * factor;
+ y += a.y * factor;
+ z += a.z * factor;
+ w += a.w * factor;
+ }
+
+ /** @hide
+ * set vector value by float4
+ *
+ * @param a
+ */
+ public void set(Float4 a) {
+ this.x = a.x;
+ this.y = a.y;
+ this.z = a.z;
+ this.w = a.w;
+ }
+
+ /** @hide
+ * set vector negate
+ */
+ public void negate() {
+ x = -x;
+ y = -y;
+ z = -z;
+ w = -w;
+ }
+ /** @hide
+ * get vector length
+ *
+ * @return
+ */
+ public int length() {
+ return 4;
+ }
+
+ /** @hide
+ * return the element sum of vector
+ *
+ * @return
+ */
+ public float elementSum() {
+ return x + y + z + w;
+ }
+
+ /** @hide
+ * get the vector field value by index
+ *
+ * @param i
+ * @return
+ */
+ public float get(int i) {
+ switch (i) {
+ case 0:
+ return x;
+ case 1:
+ return y;
+ case 2:
+ return z;
+ case 3:
+ return w;
+ default:
+ throw new IndexOutOfBoundsException("Index: i");
+ }
+ }
+
+ /** @hide
+ * set the vector field value by index
+ *
+ * @param i
+ * @param value
+ */
+ public void setAt(int i, float value) {
+ switch (i) {
+ case 0:
+ x = value;
+ return;
+ case 1:
+ y = value;
+ return;
+ case 2:
+ z = value;
+ return;
+ case 3:
+ w = value;
+ return;
+ default:
+ throw new IndexOutOfBoundsException("Index: i");
+ }
+ }
+
+ /** @hide
+ * add the vector field value by index
+ *
+ * @param i
+ * @param value
+ */
+ public void addAt(int i, float value) {
+ switch (i) {
+ case 0:
+ x += value;
+ return;
+ case 1:
+ y += value;
+ return;
+ case 2:
+ z += value;
+ return;
+ case 3:
+ w += value;
+ return;
+ default:
+ throw new IndexOutOfBoundsException("Index: i");
+ }
+ }
+
+ /** @hide
+ * set the vector field value
+ *
+ * @param x
+ * @param y
+ * @param z
+ * @param w
+ */
+ public void setValues(float x, float y, float z, float w) {
+ this.x = x;
+ this.y = y;
+ this.z = z;
+ this.w = w;
+ }
+
+ /** @hide
+ * copy the vector to float array
+ *
+ * @param data
+ * @param offset
+ */
+ public void copyTo(float[] data, int offset) {
+ data[offset] = x;
+ data[offset + 1] = y;
+ data[offset + 2] = z;
+ data[offset + 3] = w;
+ }
+}
diff --git a/graphics/java/android/renderscript/Int2.java b/graphics/java/android/renderscript/Int2.java
index 71b5dd5..120957b 100644
--- a/graphics/java/android/renderscript/Int2.java
+++ b/graphics/java/android/renderscript/Int2.java
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2009 The Android Open Source Project
+ * Copyright (C) 2013 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -16,27 +16,425 @@
package android.renderscript;
-import java.lang.Math;
-import android.util.Log;
-
-
/**
- * Class for exposing the native RenderScript int2 type back to the Android system.
- *
- **/
+ * Vector version of the basic int type.
+ * Provides two int fields packed.
+ */
public class Int2 {
+ public int x;
+ public int y;
+
public Int2() {
}
- public Int2(int initX, int initY) {
- x = initX;
- y = initY;
+ /** @hide */
+ public Int2(int i) {
+ this.x = this.y = i;
}
- public int x;
- public int y;
-}
+ public Int2(int x, int y) {
+ this.x = x;
+ this.y = y;
+ }
+
+ /** @hide */
+ public Int2(Int2 source) {
+ this.x = source.x;
+ this.y = source.y;
+ }
+
+ /** @hide
+ * Vector add
+ *
+ * @param a
+ */
+ public void add(Int2 a) {
+ this.x += a.x;
+ this.y += a.y;
+ }
+
+ /** @hide
+ * Vector add
+ *
+ * @param a
+ * @param b
+ * @return
+ */
+ public static Int2 add(Int2 a, Int2 b) {
+ Int2 result = new Int2();
+ result.x = a.x + b.x;
+ result.y = a.y + b.y;
+
+ return result;
+ }
+
+ /** @hide
+ * Vector add
+ *
+ * @param value
+ */
+ public void add(int value) {
+ x += value;
+ y += value;
+ }
+
+ /** @hide
+ * Vector add
+ *
+ * @param a
+ * @param b
+ * @return
+ */
+ public static Int2 add(Int2 a, int b) {
+ Int2 result = new Int2();
+ result.x = a.x + b;
+ result.y = a.y + b;
+
+ return result;
+ }
+
+ /** @hide
+ * Vector subtraction
+ *
+ * @param a
+ */
+ public void sub(Int2 a) {
+ this.x -= a.x;
+ this.y -= a.y;
+ }
+
+ /** @hide
+ * Vector subtraction
+ *
+ * @param a
+ * @param b
+ * @return
+ */
+ public static Int2 sub(Int2 a, Int2 b) {
+ Int2 result = new Int2();
+ result.x = a.x - b.x;
+ result.y = a.y - b.y;
+
+ return result;
+ }
+
+ /** @hide
+ * Vector subtraction
+ *
+ * @param value
+ */
+ public void sub(int value) {
+ x -= value;
+ y -= value;
+ }
+
+ /** @hide
+ * Vector subtraction
+ *
+ * @param a
+ * @param b
+ * @return
+ */
+ public static Int2 sub(Int2 a, int b) {
+ Int2 result = new Int2();
+ result.x = a.x - b;
+ result.y = a.y - b;
+
+ return result;
+ }
+
+ /** @hide
+ * Vector multiplication
+ *
+ * @param a
+ */
+ public void mul(Int2 a) {
+ this.x *= a.x;
+ this.y *= a.y;
+ }
+
+ /** @hide
+ * Vector multiplication
+ *
+ * @param a
+ * @param b
+ * @return
+ */
+ public static Int2 mul(Int2 a, Int2 b) {
+ Int2 result = new Int2();
+ result.x = a.x * b.x;
+ result.y = a.y * b.y;
+
+ return result;
+ }
+
+ /** @hide
+ * Vector multiplication
+ *
+ * @param value
+ */
+ public void mul(int value) {
+ x *= value;
+ y *= value;
+ }
+
+ /** @hide
+ * Vector multiplication
+ *
+ * @param a
+ * @param b
+ * @return
+ */
+ public static Int2 mul(Int2 a, int b) {
+ Int2 result = new Int2();
+ result.x = a.x * b;
+ result.y = a.y * b;
+
+ return result;
+ }
+
+ /** @hide
+ * Vector division
+ *
+ * @param a
+ */
+ public void div(Int2 a) {
+ this.x /= a.x;
+ this.y /= a.y;
+ }
+
+ /** @hide
+ * Vector division
+ *
+ * @param a
+ * @param b
+ * @return
+ */
+ public static Int2 div(Int2 a, Int2 b) {
+ Int2 result = new Int2();
+ result.x = a.x / b.x;
+ result.y = a.y / b.y;
+
+ return result;
+ }
+
+ /** @hide
+ * Vector division
+ *
+ * @param value
+ */
+ public void div(int value) {
+ x /= value;
+ y /= value;
+ }
+
+ /** @hide
+ * Vector division
+ *
+ * @param a
+ * @param b
+ * @return
+ */
+ public static Int2 div(Int2 a, int b) {
+ Int2 result = new Int2();
+ result.x = a.x / b;
+ result.y = a.y / b;
+
+ return result;
+ }
+
+ /** @hide
+ * Vector Modulo
+ *
+ * @param a
+ */
+ public void mod(Int2 a) {
+ this.x %= a.x;
+ this.y %= a.y;
+ }
+
+ /** @hide
+ * Vector Modulo
+ *
+ * @param a
+ * @param b
+ * @return
+ */
+ public static Int2 mod(Int2 a, Int2 b) {
+ Int2 result = new Int2();
+ result.x = a.x % b.x;
+ result.y = a.y % b.y;
+
+ return result;
+ }
+
+ /** @hide
+ * Vector Modulo
+ *
+ * @param value
+ */
+ public void mod(int value) {
+ x %= value;
+ y %= value;
+ }
+
+ /** @hide
+ * Vector Modulo
+ *
+ * @param a
+ * @param b
+ * @return
+ */
+ public static Int2 mod(Int2 a, int b) {
+ Int2 result = new Int2();
+ result.x = a.x % b;
+ result.y = a.y % b;
+
+ return result;
+ }
+ /** @hide
+ * get vector length
+ *
+ * @return
+ */
+ public int length() {
+ return 2;
+ }
+
+ /** @hide
+ * set vector negate
+ */
+ public void negate() {
+ this.x = -x;
+ this.y = -y;
+ }
+ /** @hide
+ * Vector dot Product
+ *
+ * @param a
+ * @return
+ */
+ public int dotProduct(Int2 a) {
+ return (int)((x * a.x) + (y * a.y));
+ }
+
+ /** @hide
+ * Vector dot Product
+ *
+ * @param a
+ * @param b
+ * @return
+ */
+ public static int dotProduct(Int2 a, Int2 b) {
+ return (int)((b.x * a.x) + (b.y * a.y));
+ }
+ /** @hide
+ * Vector add Multiple
+ *
+ * @param a
+ * @param factor
+ */
+ public void addMultiple(Int2 a, int factor) {
+ x += a.x * factor;
+ y += a.y * factor;
+ }
+
+ /** @hide
+ * set vector value by Int2
+ *
+ * @param a
+ */
+ public void set(Int2 a) {
+ this.x = a.x;
+ this.y = a.y;
+ }
+
+ /** @hide
+ * set the vector field value by Int
+ *
+ * @param a
+ * @param b
+ */
+ public void setValues(int a, int b) {
+ this.x = a;
+ this.y = b;
+ }
+ /** @hide
+ * return the element sum of vector
+ *
+ * @return
+ */
+ public int elementSum() {
+ return (int)(x + y);
+ }
+
+ /** @hide
+ * get the vector field value by index
+ *
+ * @param i
+ * @return
+ */
+ public int get(int i) {
+ switch (i) {
+ case 0:
+ return (int)(x);
+ case 1:
+ return (int)(y);
+ default:
+ throw new IndexOutOfBoundsException("Index: i");
+ }
+ }
+
+ /** @hide
+ * set the vector field value by index
+ *
+ * @param i
+ * @param value
+ */
+ public void setAt(int i, int value) {
+ switch (i) {
+ case 0:
+ x = value;
+ return;
+ case 1:
+ y = value;
+ return;
+ default:
+ throw new IndexOutOfBoundsException("Index: i");
+ }
+ }
+
+ /** @hide
+ * add the vector field value by index
+ *
+ * @param i
+ * @param value
+ */
+ public void addAt(int i, int value) {
+ switch (i) {
+ case 0:
+ x += value;
+ return;
+ case 1:
+ y += value;
+ return;
+ default:
+ throw new IndexOutOfBoundsException("Index: i");
+ }
+ }
+
+ /** @hide
+ * copy the vector to int array
+ *
+ * @param data
+ * @param offset
+ */
+ public void copyTo(int[] data, int offset) {
+ data[offset] = (int)(x);
+ data[offset + 1] = (int)(y);
+ }
+}
diff --git a/graphics/java/android/renderscript/Int3.java b/graphics/java/android/renderscript/Int3.java
index 719c908..c770395 100644
--- a/graphics/java/android/renderscript/Int3.java
+++ b/graphics/java/android/renderscript/Int3.java
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2009 The Android Open Source Project
+ * Copyright (C) 2013 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -16,29 +16,462 @@
package android.renderscript;
-import java.lang.Math;
-import android.util.Log;
-
-
/**
- * Class for exposing the native RenderScript int3 type back to the Android system.
- *
- **/
+ * Vector version of the basic int type.
+ * Provides three int fields packed.
+ */
public class Int3 {
+ public int x;
+ public int y;
+ public int z;
+
public Int3() {
}
+
+ /** @hide */
+ public Int3(int i) {
+ this.x = this.y = this.z = i;
+ }
- public Int3(int initX, int initY, int initZ) {
- x = initX;
- y = initY;
- z = initZ;
+ public Int3(int x, int y, int z) {
+ this.x = x;
+ this.y = y;
+ this.z = z;
}
- public int x;
- public int y;
- public int z;
-}
+ /** @hide */
+ public Int3(Int3 source) {
+ this.x = source.x;
+ this.y = source.y;
+ this.z = source.z;
+ }
+ /** @hide
+ * Vector add
+ *
+ * @param a
+ */
+ public void add(Int3 a) {
+ this.x += a.x;
+ this.y += a.y;
+ this.z += a.z;
+ }
+
+ /** @hide
+ * Vector add
+ *
+ * @param a
+ * @param b
+ * @return
+ */
+ public static Int3 add(Int3 a, Int3 b) {
+ Int3 result = new Int3();
+ result.x = a.x + b.x;
+ result.y = a.y + b.y;
+ result.z = a.z + b.z;
+ return result;
+ }
+
+ /** @hide
+ * Vector add
+ *
+ * @param value
+ */
+ public void add(int value) {
+ x += value;
+ y += value;
+ z += value;
+ }
+
+ /** @hide
+ * Vector add
+ *
+ * @param a
+ * @param b
+ * @return
+ */
+ public static Int3 add(Int3 a, int b) {
+ Int3 result = new Int3();
+ result.x = a.x + b;
+ result.y = a.y + b;
+ result.z = a.z + b;
+
+ return result;
+ }
+ /** @hide
+ * Vector subtraction
+ *
+ * @param a
+ */
+ public void sub(Int3 a) {
+ this.x -= a.x;
+ this.y -= a.y;
+ this.z -= a.z;
+ }
+
+ /** @hide
+ * Vector subtraction
+ *
+ * @param a
+ * @param b
+ * @return
+ */
+ public static Int3 sub(Int3 a, Int3 b) {
+ Int3 result = new Int3();
+ result.x = a.x - b.x;
+ result.y = a.y - b.y;
+ result.z = a.z - b.z;
+
+ return result;
+ }
+
+ /** @hide
+ * Vector subtraction
+ *
+ * @param value
+ */
+ public void sub(int value) {
+ x -= value;
+ y -= value;
+ z -= value;
+ }
+
+ /** @hide
+ * Vector subtraction
+ *
+ * @param a
+ * @param b
+ * @return
+ */
+ public static Int3 sub(Int3 a, int b) {
+ Int3 result = new Int3();
+ result.x = a.x - b;
+ result.y = a.y - b;
+ result.z = a.z - b;
+
+ return result;
+ }
+
+ /** @hide
+ * Vector multiplication
+ *
+ * @param a
+ */
+ public void mul(Int3 a) {
+ this.x *= a.x;
+ this.y *= a.y;
+ this.z *= a.z;
+ }
+
+ /** @hide
+ * Vector multiplication
+ *
+ * @param a
+ * @param b
+ * @return
+ */
+ public static Int3 mul(Int3 a, Int3 b) {
+ Int3 result = new Int3();
+ result.x = a.x * b.x;
+ result.y = a.y * b.y;
+ result.z = a.z * b.z;
+
+ return result;
+ }
+
+ /** @hide
+ * Vector multiplication
+ *
+ * @param value
+ */
+ public void mul(int value) {
+ x *= value;
+ y *= value;
+ z *= value;
+ }
+
+ /** @hide
+ * Vector multiplication
+ *
+ * @param a
+ * @param b
+ * @return
+ */
+ public static Int3 mul(Int3 a, int b) {
+ Int3 result = new Int3();
+ result.x = a.x * b;
+ result.y = a.y * b;
+ result.z = a.z * b;
+
+ return result;
+ }
+
+ /** @hide
+ * Vector division
+ *
+ * @param a
+ */
+ public void div(Int3 a) {
+ this.x /= a.x;
+ this.y /= a.y;
+ this.z /= a.z;
+ }
+ /** @hide
+ * Vector division
+ *
+ * @param a
+ * @param b
+ * @return
+ */
+ public static Int3 div(Int3 a, Int3 b) {
+ Int3 result = new Int3();
+ result.x = a.x / b.x;
+ result.y = a.y / b.y;
+ result.z = a.z / b.z;
+
+ return result;
+ }
+
+ /** @hide
+ * Vector division
+ *
+ * @param value
+ */
+ public void div(int value) {
+ x /= value;
+ y /= value;
+ z /= value;
+ }
+
+ /** @hide
+ * Vector division
+ *
+ * @param a
+ * @param b
+ * @return
+ */
+ public static Int3 div(Int3 a, int b) {
+ Int3 result = new Int3();
+ result.x = a.x / b;
+ result.y = a.y / b;
+ result.z = a.z / b;
+
+ return result;
+ }
+
+ /** @hide
+ * Vector Modulo
+ *
+ * @param a
+ */
+ public void mod(Int3 a) {
+ this.x %= a.x;
+ this.y %= a.y;
+ this.z %= a.z;
+ }
+
+ /** @hide
+ * Vector Modulo
+ *
+ * @param a
+ * @param b
+ * @return
+ */
+ public static Int3 mod(Int3 a, Int3 b) {
+ Int3 result = new Int3();
+ result.x = a.x % b.x;
+ result.y = a.y % b.y;
+ result.z = a.z % b.z;
+
+ return result;
+ }
+
+ /** @hide
+ * Vector Modulo
+ *
+ * @param value
+ */
+ public void mod(int value) {
+ x %= value;
+ y %= value;
+ z %= value;
+ }
+
+ /** @hide
+ * Vector Modulo
+ *
+ * @param a
+ * @param b
+ * @return
+ */
+ public static Int3 mod(Int3 a, int b) {
+ Int3 result = new Int3();
+ result.x = a.x % b;
+ result.y = a.y % b;
+ result.z = a.z % b;
+
+ return result;
+ }
+
+ /** @hide
+ * get vector length
+ *
+ * @return
+ */
+ public int length() {
+ return 3;
+ }
+
+ /** @hide
+ * set vector negate
+ */
+ public void negate() {
+ this.x = -x;
+ this.y = -y;
+ this.z = -z;
+ }
+
+ /** @hide
+ * Vector dot Product
+ *
+ * @param a
+ * @return
+ */
+ public int dotProduct(Int3 a) {
+ return (int)((x * a.x) + (y * a.y) + (z * a.z));
+ }
+
+ /** @hide
+ * Vector dot Product
+ *
+ * @param a
+ * @param b
+ * @return
+ */
+ public static int dotProduct(Int3 a, Int3 b) {
+ return (int)((b.x * a.x) + (b.y * a.y) + (b.z * a.z));
+ }
+
+ /** @hide
+ * Vector add Multiple
+ *
+ * @param a
+ * @param factor
+ */
+ public void addMultiple(Int3 a, int factor) {
+ x += a.x * factor;
+ y += a.y * factor;
+ z += a.z * factor;
+ }
+
+ /** @hide
+ * set vector value by Int3
+ *
+ * @param a
+ */
+ public void set(Int3 a) {
+ this.x = a.x;
+ this.y = a.y;
+ this.z = a.z;
+ }
+
+ /** @hide
+ * set the vector field value by Int
+ *
+ * @param a
+ * @param b
+ * @param c
+ */
+ public void setValues(int a, int b, int c) {
+ this.x = a;
+ this.y = b;
+ this.z = c;
+ }
+
+ /** @hide
+ * return the element sum of vector
+ *
+ * @return
+ */
+ public int elementSum() {
+ return (int)(x + y + z);
+ }
+
+ /** @hide
+ * get the vector field value by index
+ *
+ * @param i
+ * @return
+ */
+ public int get(int i) {
+ switch (i) {
+ case 0:
+ return (int)(x);
+ case 1:
+ return (int)(y);
+ case 2:
+ return (int)(z);
+ default:
+ throw new IndexOutOfBoundsException("Index: i");
+ }
+ }
+
+ /** @hide
+ * set the vector field value by index
+ *
+ * @param i
+ * @param value
+ */
+ public void setAt(int i, int value) {
+ switch (i) {
+ case 0:
+ x = value;
+ return;
+ case 1:
+ y = value;
+ return;
+ case 2:
+ z = value;
+ return;
+ default:
+ throw new IndexOutOfBoundsException("Index: i");
+ }
+ }
+
+ /** @hide
+ * add the vector field value by index
+ *
+ * @param i
+ * @param value
+ */
+ public void addAt(int i, int value) {
+ switch (i) {
+ case 0:
+ x += value;
+ return;
+ case 1:
+ y += value;
+ return;
+ case 2:
+ z += value;
+ return;
+ default:
+ throw new IndexOutOfBoundsException("Index: i");
+ }
+ }
+
+ /** @hide
+ * copy the vector to int array
+ *
+ * @param data
+ * @param offset
+ */
+ public void copyTo(int[] data, int offset) {
+ data[offset] = (int)(x);
+ data[offset + 1] = (int)(y);
+ data[offset + 2] = (int)(z);
+ }
+}
diff --git a/graphics/java/android/renderscript/Int4.java b/graphics/java/android/renderscript/Int4.java
index eefb349..1c0e2e2 100644
--- a/graphics/java/android/renderscript/Int4.java
+++ b/graphics/java/android/renderscript/Int4.java
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2009 The Android Open Source Project
+ * Copyright (C) 2013 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -16,30 +16,499 @@
package android.renderscript;
-import java.lang.Math;
-import android.util.Log;
-
-
/**
- * Class for exposing the native RenderScript int4 type back to the Android system.
- *
- **/
+ * Vector version of the basic int type.
+ * Provides four int fields packed.
+ */
public class Int4 {
+ public int x;
+ public int y;
+ public int z;
+ public int w;
+
public Int4() {
}
- public Int4(int initX, int initY, int initZ, int initW) {
- x = initX;
- y = initY;
- z = initZ;
- w = initW;
+ /** @hide */
+ public Int4(int i) {
+ this.x = this.y = this.z = this.w = i;
}
- public int x;
- public int y;
- public int z;
- public int w;
-}
+ public Int4(int x, int y, int z, int w) {
+ this.x = x;
+ this.y = y;
+ this.z = z;
+ this.w = w;
+ }
+ /** @hide */
+ public Int4(Int4 source) {
+ this.x = source.x;
+ this.y = source.y;
+ this.z = source.z;
+ this.w = source.w;
+ }
+
+ /** @hide
+ * Vector add
+ *
+ * @param a
+ */
+ public void add(Int4 a) {
+ this.x += a.x;
+ this.y += a.y;
+ this.z += a.z;
+ this.w += a.w;
+ }
+
+ /** @hide
+ * Vector add
+ *
+ * @param a
+ * @param b
+ * @return
+ */
+ public static Int4 add(Int4 a, Int4 b) {
+ Int4 result = new Int4();
+ result.x = a.x + b.x;
+ result.y = a.y + b.y;
+ result.z = a.z + b.z;
+ result.w = a.w + b.w;
+
+ return result;
+ }
+
+ /** @hide
+ * Vector add
+ *
+ * @param value
+ */
+ public void add(int value) {
+ x += value;
+ y += value;
+ z += value;
+ w += value;
+ }
+ /** @hide
+ * Vector add
+ *
+ * @param a
+ * @param b
+ * @return
+ */
+ public static Int4 add(Int4 a, int b) {
+ Int4 result = new Int4();
+ result.x = a.x + b;
+ result.y = a.y + b;
+ result.z = a.z + b;
+ result.w = a.w + b;
+
+ return result;
+ }
+
+ /** @hide
+ * Vector subtraction
+ *
+ * @param a
+ */
+ public void sub(Int4 a) {
+ this.x -= a.x;
+ this.y -= a.y;
+ this.z -= a.z;
+ this.w -= a.w;
+ }
+
+ /** @hide
+ * Vector subtraction
+ *
+ * @param a
+ * @param b
+ * @return
+ */
+ public static Int4 sub(Int4 a, Int4 b) {
+ Int4 result = new Int4();
+ result.x = a.x - b.x;
+ result.y = a.y - b.y;
+ result.z = a.z - b.z;
+ result.w = a.w - b.w;
+
+ return result;
+ }
+
+ /** @hide
+ * Vector subtraction
+ *
+ * @param value
+ */
+ public void sub(int value) {
+ x -= value;
+ y -= value;
+ z -= value;
+ w -= value;
+ }
+
+ /** @hide
+ * Vector subtraction
+ *
+ * @param a
+ * @param b
+ * @return
+ */
+ public static Int4 sub(Int4 a, int b) {
+ Int4 result = new Int4();
+ result.x = a.x - b;
+ result.y = a.y - b;
+ result.z = a.z - b;
+ result.w = a.w - b;
+
+ return result;
+ }
+
+ /** @hide
+ * Vector multiplication
+ *
+ * @param a
+ */
+ public void mul(Int4 a) {
+ this.x *= a.x;
+ this.y *= a.y;
+ this.z *= a.z;
+ this.w *= a.w;
+ }
+
+ /** @hide
+ * Vector multiplication
+ *
+ * @param a
+ * @param b
+ * @return
+ */
+ public static Int4 mul(Int4 a, Int4 b) {
+ Int4 result = new Int4();
+ result.x = a.x * b.x;
+ result.y = a.y * b.y;
+ result.z = a.z * b.z;
+ result.w = a.w * b.w;
+
+ return result;
+ }
+
+ /** @hide
+ * Vector multiplication
+ *
+ * @param value
+ */
+ public void mul(int value) {
+ x *= value;
+ y *= value;
+ z *= value;
+ w *= value;
+ }
+
+ /** @hide
+ * Vector multiplication
+ *
+ * @param a
+ * @param b
+ * @return
+ */
+ public static Int4 mul(Int4 a, int b) {
+ Int4 result = new Int4();
+ result.x = a.x * b;
+ result.y = a.y * b;
+ result.z = a.z * b;
+ result.w = a.w * b;
+
+ return result;
+ }
+ /** @hide
+ * Vector division
+ *
+ * @param a
+ */
+ public void div(Int4 a) {
+ this.x /= a.x;
+ this.y /= a.y;
+ this.z /= a.z;
+ this.w /= a.w;
+ }
+
+ /** @hide
+ * Vector division
+ *
+ * @param a
+ * @param b
+ * @return
+ */
+ public static Int4 div(Int4 a, Int4 b) {
+ Int4 result = new Int4();
+ result.x = a.x / b.x;
+ result.y = a.y / b.y;
+ result.z = a.z / b.z;
+ result.w = a.w / b.w;
+
+ return result;
+ }
+
+ /** @hide
+ * Vector division
+ *
+ * @param value
+ */
+ public void div(int value) {
+ x /= value;
+ y /= value;
+ z /= value;
+ w /= value;
+ }
+
+ /** @hide
+ * Vector division
+ *
+ * @param a
+ * @param b
+ * @return
+ */
+ public static Int4 div(Int4 a, int b) {
+ Int4 result = new Int4();
+ result.x = a.x / b;
+ result.y = a.y / b;
+ result.z = a.z / b;
+ result.w = a.w / b;
+
+ return result;
+ }
+
+ /** @hide
+ * Vector Modulo
+ *
+ * @param a
+ */
+ public void mod(Int4 a) {
+ this.x %= a.x;
+ this.y %= a.y;
+ this.z %= a.z;
+ this.w %= a.w;
+ }
+
+ /** @hide
+ * Vector Modulo
+ *
+ * @param a
+ * @param b
+ * @return
+ */
+ public static Int4 mod(Int4 a, Int4 b) {
+ Int4 result = new Int4();
+ result.x = a.x % b.x;
+ result.y = a.y % b.y;
+ result.z = a.z % b.z;
+ result.w = a.w % b.w;
+
+ return result;
+ }
+
+ /** @hide
+ * Vector Modulo
+ *
+ * @param value
+ */
+ public void mod(int value) {
+ x %= value;
+ y %= value;
+ z %= value;
+ w %= value;
+ }
+
+ /** @hide
+ * Vector Modulo
+ *
+ * @param a
+ * @param b
+ * @return
+ */
+ public static Int4 mod(Int4 a, int b) {
+ Int4 result = new Int4();
+ result.x = a.x % b;
+ result.y = a.y % b;
+ result.z = a.z % b;
+ result.w = a.w % b;
+
+ return result;
+ }
+
+ /** @hide
+ * get vector length
+ *
+ * @return
+ */
+ public int length() {
+ return 4;
+ }
+
+ /** @hide
+ * set vector negate
+ */
+ public void negate() {
+ this.x = -x;
+ this.y = -y;
+ this.z = -z;
+ this.w = -w;
+ }
+
+ /** @hide
+ * Vector dot Product
+ *
+ * @param a
+ * @return
+ */
+ public int dotProduct(Int4 a) {
+ return (int)((x * a.x) + (y * a.y) + (z * a.z) + (w * a.w));
+ }
+
+ /** @hide
+ * Vector dot Product
+ *
+ * @param a
+ * @param b
+ * @return
+ */
+ public static int dotProduct(Int4 a, Int4 b) {
+ return (int)((b.x * a.x) + (b.y * a.y) + (b.z * a.z) + (b.w * a.w));
+ }
+
+ /** @hide
+ * Vector add Multiple
+ *
+ * @param a
+ * @param factor
+ */
+ public void addMultiple(Int4 a, int factor) {
+ x += a.x * factor;
+ y += a.y * factor;
+ z += a.z * factor;
+ w += a.w * factor;
+ }
+
+ /** @hide
+ * set vector value by Int4
+ *
+ * @param a
+ */
+ public void set(Int4 a) {
+ this.x = a.x;
+ this.y = a.y;
+ this.z = a.z;
+ this.w = a.w;
+ }
+
+ /** @hide
+ * set the vector field value by Int
+ *
+ * @param a
+ * @param b
+ * @param c
+ * @param d
+ */
+ public void setValues(int a, int b, int c, int d) {
+ this.x = a;
+ this.y = b;
+ this.z = c;
+ this.w = d;
+ }
+
+ /** @hide
+ * return the element sum of vector
+ *
+ * @return
+ */
+ public int elementSum() {
+ return (int)(x + y + z + w);
+ }
+
+ /** @hide
+ * get the vector field value by index
+ *
+ * @param i
+ * @return
+ */
+ public int get(int i) {
+ switch (i) {
+ case 0:
+ return (int)(x);
+ case 1:
+ return (int)(y);
+ case 2:
+ return (int)(z);
+ case 3:
+ return (int)(w);
+ default:
+ throw new IndexOutOfBoundsException("Index: i");
+ }
+ }
+
+ /** @hide
+ * set the vector field value by index
+ *
+ * @param i
+ * @param value
+ */
+ public void setAt(int i, int value) {
+ switch (i) {
+ case 0:
+ x = value;
+ return;
+ case 1:
+ y = value;
+ return;
+ case 2:
+ z = value;
+ return;
+ case 3:
+ w = value;
+ return;
+ default:
+ throw new IndexOutOfBoundsException("Index: i");
+ }
+ }
+
+ /** @hide
+ * add the vector field value by index
+ *
+ * @param i
+ * @param value
+ */
+ public void addAt(int i, int value) {
+ switch (i) {
+ case 0:
+ x += value;
+ return;
+ case 1:
+ y += value;
+ return;
+ case 2:
+ z += value;
+ return;
+ case 3:
+ w += value;
+ return;
+ default:
+ throw new IndexOutOfBoundsException("Index: i");
+ }
+ }
+
+ /** @hide
+ * copy the vector to int array
+ *
+ * @param data
+ * @param offset
+ */
+ public void copyTo(int[] data, int offset) {
+ data[offset] = (int)(x);
+ data[offset + 1] = (int)(y);
+ data[offset + 2] = (int)(z);
+ data[offset + 3] = (int)(w);
+ }
+}
diff --git a/graphics/java/android/renderscript/Long2.java b/graphics/java/android/renderscript/Long2.java
index bd8382d..fabf204 100644
--- a/graphics/java/android/renderscript/Long2.java
+++ b/graphics/java/android/renderscript/Long2.java
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2009 The Android Open Source Project
+ * Copyright (C) 2013 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -16,26 +16,425 @@
package android.renderscript;
-import java.lang.Math;
-import android.util.Log;
-
-
/**
- * Class for exposing the native RenderScript long2 type back to the Android system.
- **/
+ * Vector version of the basic long type.
+ * Provides two long fields packed.
+ */
public class Long2 {
+ public long x;
+ public long y;
+
public Long2() {
}
- public Long2(long initX, long initY) {
- x = initX;
- y = initY;
+ /** @hide */
+ public Long2(long i) {
+ this.x = this.y = i;
}
- public long x;
- public long y;
-}
+ public Long2(long x, long y) {
+ this.x = x;
+ this.y = y;
+ }
+
+ /** @hide */
+ public Long2(Long2 source) {
+ this.x = source.x;
+ this.y = source.y;
+ }
+
+ /** @hide
+ * Vector add
+ *
+ * @param a
+ */
+ public void add(Long2 a) {
+ this.x += a.x;
+ this.y += a.y;
+ }
+
+ /** @hide
+ * Vector add
+ *
+ * @param a
+ * @param b
+ * @return
+ */
+ public static Long2 add(Long2 a, Long2 b) {
+ Long2 result = new Long2();
+ result.x = a.x + b.x;
+ result.y = a.y + b.y;
+
+ return result;
+ }
+
+ /** @hide
+ * Vector add
+ *
+ * @param value
+ */
+ public void add(long value) {
+ x += value;
+ y += value;
+ }
+
+ /** @hide
+ * Vector add
+ *
+ * @param a
+ * @param b
+ * @return
+ */
+ public static Long2 add(Long2 a, long b) {
+ Long2 result = new Long2();
+ result.x = a.x + b;
+ result.y = a.y + b;
+
+ return result;
+ }
+
+ /** @hide
+ * Vector subtraction
+ *
+ * @param a
+ */
+ public void sub(Long2 a) {
+ this.x -= a.x;
+ this.y -= a.y;
+ }
+ /** @hide
+ * Vector subtraction
+ *
+ * @param a
+ * @param b
+ * @return
+ */
+ public static Long2 sub(Long2 a, Long2 b) {
+ Long2 result = new Long2();
+ result.x = a.x - b.x;
+ result.y = a.y - b.y;
+ return result;
+ }
+
+ /** @hide
+ * Vector subtraction
+ *
+ * @param value
+ */
+ public void sub(long value) {
+ x -= value;
+ y -= value;
+ }
+
+ /** @hide
+ * Vector subtraction
+ *
+ * @param a
+ * @param b
+ * @return
+ */
+ public static Long2 sub(Long2 a, long b) {
+ Long2 result = new Long2();
+ result.x = a.x - b;
+ result.y = a.y - b;
+
+ return result;
+ }
+
+ /** @hide
+ * Vector multiplication
+ *
+ * @param a
+ */
+ public void mul(Long2 a) {
+ this.x *= a.x;
+ this.y *= a.y;
+ }
+
+ /** @hide
+ * Vector multiplication
+ *
+ * @param a
+ * @param b
+ * @return
+ */
+ public static Long2 mul(Long2 a, Long2 b) {
+ Long2 result = new Long2();
+ result.x = a.x * b.x;
+ result.y = a.y * b.y;
+
+ return result;
+ }
+
+ /** @hide
+ * Vector multiplication
+ *
+ * @param value
+ */
+ public void mul(long value) {
+ x *= value;
+ y *= value;
+ }
+
+ /** @hide
+ * Vector multiplication
+ *
+ * @param a
+ * @param b
+ * @return
+ */
+ public static Long2 mul(Long2 a, long b) {
+ Long2 result = new Long2();
+ result.x = a.x * b;
+ result.y = a.y * b;
+
+ return result;
+ }
+
+ /** @hide
+ * Vector division
+ *
+ * @param a
+ */
+ public void div(Long2 a) {
+ this.x /= a.x;
+ this.y /= a.y;
+ }
+ /** @hide
+ * Vector division
+ *
+ * @param a
+ * @param b
+ * @return
+ */
+ public static Long2 div(Long2 a, Long2 b) {
+ Long2 result = new Long2();
+ result.x = a.x / b.x;
+ result.y = a.y / b.y;
+ return result;
+ }
+
+ /** @hide
+ * Vector division
+ *
+ * @param value
+ */
+ public void div(long value) {
+ x /= value;
+ y /= value;
+ }
+
+ /** @hide
+ * Vector division
+ *
+ * @param a
+ * @param b
+ * @return
+ */
+ public static Long2 div(Long2 a, long b) {
+ Long2 result = new Long2();
+ result.x = a.x / b;
+ result.y = a.y / b;
+
+ return result;
+ }
+
+ /** @hide
+ * Vector Modulo
+ *
+ * @param a
+ */
+ public void mod(Long2 a) {
+ this.x %= a.x;
+ this.y %= a.y;
+ }
+
+ /** @hide
+ * Vector Modulo
+ *
+ * @param a
+ * @param b
+ * @return
+ */
+ public static Long2 mod(Long2 a, Long2 b) {
+ Long2 result = new Long2();
+ result.x = a.x % b.x;
+ result.y = a.y % b.y;
+
+ return result;
+ }
+
+ /** @hide
+ * Vector Modulo
+ *
+ * @param value
+ */
+ public void mod(long value) {
+ x %= value;
+ y %= value;
+ }
+
+ /** @hide
+ * Vector Modulo
+ *
+ * @param a
+ * @param b
+ * @return
+ */
+ public static Long2 mod(Long2 a, long b) {
+ Long2 result = new Long2();
+ result.x = a.x % b;
+ result.y = a.y % b;
+
+ return result;
+ }
+
+ /** @hide
+ * get vector length
+ *
+ * @return
+ */
+ public long length() {
+ return 2;
+ }
+
+ /** @hide
+ * set vector negate
+ */
+ public void negate() {
+ this.x = -x;
+ this.y = -y;
+ }
+
+ /** @hide
+ * Vector dot Product
+ *
+ * @param a
+ * @return
+ */
+ public long dotProduct(Long2 a) {
+ return (long)((x * a.x) + (y * a.y));
+ }
+
+ /** @hide
+ * Vector dot Product
+ *
+ * @param a
+ * @param b
+ * @return
+ */
+ public static long dotProduct(Long2 a, Long2 b) {
+ return (long)((b.x * a.x) + (b.y * a.y));
+ }
+
+ /** @hide
+ * Vector add Multiple
+ *
+ * @param a
+ * @param factor
+ */
+ public void addMultiple(Long2 a, long factor) {
+ x += a.x * factor;
+ y += a.y * factor;
+ }
+
+ /** @hide
+ * set vector value by Long2
+ *
+ * @param a
+ */
+ public void set(Long2 a) {
+ this.x = a.x;
+ this.y = a.y;
+ }
+
+ /** @hide
+ * set the vector field value by Long
+ *
+ * @param a
+ * @param b
+ */
+ public void setValues(long a, long b) {
+ this.x = a;
+ this.y = b;
+ }
+
+ /** @hide
+ * return the element sum of vector
+ *
+ * @return
+ */
+ public long elementSum() {
+ return (long)(x + y);
+ }
+
+ /** @hide
+ * get the vector field value by index
+ *
+ * @param i
+ * @return
+ */
+ public long get(int i) {
+ switch (i) {
+ case 0:
+ return (long)(x);
+ case 1:
+ return (long)(y);
+ default:
+ throw new IndexOutOfBoundsException("Index: i");
+ }
+ }
+
+ /** @hide
+ * set the vector field value by index
+ *
+ * @param i
+ * @param value
+ */
+ public void setAt(int i, long value) {
+ switch (i) {
+ case 0:
+ x = value;
+ return;
+ case 1:
+ y = value;
+ return;
+ default:
+ throw new IndexOutOfBoundsException("Index: i");
+ }
+ }
+
+ /** @hide
+ * add the vector field value by index
+ *
+ * @param i
+ * @param value
+ */
+ public void addAt(int i, long value) {
+ switch (i) {
+ case 0:
+ x += value;
+ return;
+ case 1:
+ y += value;
+ return;
+ default:
+ throw new IndexOutOfBoundsException("Index: i");
+ }
+ }
+
+ /** @hide
+ * copy the vector to long array
+ *
+ * @param data
+ * @param offset
+ */
+ public void copyTo(long[] data, int offset) {
+ data[offset] = (long)(x);
+ data[offset + 1] = (long)(y);
+ }
+}
diff --git a/graphics/java/android/renderscript/Long3.java b/graphics/java/android/renderscript/Long3.java
index 3e94942..88ff855 100644
--- a/graphics/java/android/renderscript/Long3.java
+++ b/graphics/java/android/renderscript/Long3.java
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2009 The Android Open Source Project
+ * Copyright (C) 2013 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -16,28 +16,462 @@
package android.renderscript;
-import java.lang.Math;
-import android.util.Log;
-
-
/**
- * Class for exposing the native RenderScript long3 type back to the Android system.
- **/
+ * Vector version of the basic long type.
+ * Provides three long fields packed.
+ */
public class Long3 {
+ public long x;
+ public long y;
+ public long z;
+
public Long3() {
}
+
+ /** @hide */
+ public Long3(long i) {
+ this.x = this.y = this.z = i;
+ }
- public Long3(long initX, long initY, long initZ) {
- x = initX;
- y = initY;
- z = initZ;
+ public Long3(long x, long y, long z) {
+ this.x = x;
+ this.y = y;
+ this.z = z;
}
- public long x;
- public long y;
- public long z;
-}
+ /** @hide */
+ public Long3(Long3 source) {
+ this.x = source.x;
+ this.y = source.y;
+ this.z = source.z;
+ }
+
+ /** @hide
+ * Vector add
+ *
+ * @param a
+ */
+ public void add(Long3 a) {
+ this.x += a.x;
+ this.y += a.y;
+ this.z += a.z;
+ }
+
+ /** @hide
+ * Vector add
+ *
+ * @param a
+ * @param b
+ * @return
+ */
+ public static Long3 add(Long3 a, Long3 b) {
+ Long3 result = new Long3();
+ result.x = a.x + b.x;
+ result.y = a.y + b.y;
+ result.z = a.z + b.z;
+
+ return result;
+ }
+
+ /** @hide
+ * Vector add
+ *
+ * @param value
+ */
+ public void add(long value) {
+ x += value;
+ y += value;
+ z += value;
+ }
+
+ /** @hide
+ * Vector add
+ *
+ * @param a
+ * @param b
+ * @return
+ */
+ public static Long3 add(Long3 a, long b) {
+ Long3 result = new Long3();
+ result.x = a.x + b;
+ result.y = a.y + b;
+ result.z = a.z + b;
+
+ return result;
+ }
+
+ /** @hide
+ * Vector subtraction
+ *
+ * @param a
+ */
+ public void sub(Long3 a) {
+ this.x -= a.x;
+ this.y -= a.y;
+ this.z -= a.z;
+ }
+
+ /** @hide
+ * Vector subtraction
+ *
+ * @param a
+ * @param b
+ * @return
+ */
+ public static Long3 sub(Long3 a, Long3 b) {
+ Long3 result = new Long3();
+ result.x = a.x - b.x;
+ result.y = a.y - b.y;
+ result.z = a.z - b.z;
+
+ return result;
+ }
+
+ /** @hide
+ * Vector subtraction
+ *
+ * @param value
+ */
+ public void sub(long value) {
+ x -= value;
+ y -= value;
+ z -= value;
+ }
+
+ /** @hide
+ * Vector subtraction
+ *
+ * @param a
+ * @param b
+ * @return
+ */
+ public static Long3 sub(Long3 a, long b) {
+ Long3 result = new Long3();
+ result.x = a.x - b;
+ result.y = a.y - b;
+ result.z = a.z - b;
+
+ return result;
+ }
+
+ /** @hide
+ * Vector multiplication
+ *
+ * @param a
+ */
+ public void mul(Long3 a) {
+ this.x *= a.x;
+ this.y *= a.y;
+ this.z *= a.z;
+ }
+
+ /** @hide
+ * Vector multiplication
+ *
+ * @param a
+ * @param b
+ * @return
+ */
+ public static Long3 mul(Long3 a, Long3 b) {
+ Long3 result = new Long3();
+ result.x = a.x * b.x;
+ result.y = a.y * b.y;
+ result.z = a.z * b.z;
+
+ return result;
+ }
+
+ /** @hide
+ * Vector multiplication
+ *
+ * @param value
+ */
+ public void mul(long value) {
+ x *= value;
+ y *= value;
+ z *= value;
+ }
+
+ /** @hide
+ * Vector multiplication
+ *
+ * @param a
+ * @param b
+ * @return
+ */
+ public static Long3 mul(Long3 a, long b) {
+ Long3 result = new Long3();
+ result.x = a.x * b;
+ result.y = a.y * b;
+ result.z = a.z * b;
+
+ return result;
+ }
+
+ /** @hide
+ * Vector division
+ *
+ * @param a
+ */
+ public void div(Long3 a) {
+ this.x /= a.x;
+ this.y /= a.y;
+ this.z /= a.z;
+ }
+
+ /** @hide
+ * Vector division
+ *
+ * @param a
+ * @param b
+ * @return
+ */
+ public static Long3 div(Long3 a, Long3 b) {
+ Long3 result = new Long3();
+ result.x = a.x / b.x;
+ result.y = a.y / b.y;
+ result.z = a.z / b.z;
+
+ return result;
+ }
+
+ /** @hide
+ * Vector division
+ *
+ * @param value
+ */
+ public void div(long value) {
+ x /= value;
+ y /= value;
+ z /= value;
+ }
+
+ /** @hide
+ * Vector division
+ *
+ * @param a
+ * @param b
+ * @return
+ */
+ public static Long3 div(Long3 a, long b) {
+ Long3 result = new Long3();
+ result.x = a.x / b;
+ result.y = a.y / b;
+ result.z = a.z / b;
+
+ return result;
+ }
+
+ /** @hide
+ * Vector Modulo
+ *
+ * @param a
+ */
+ public void mod(Long3 a) {
+ this.x %= a.x;
+ this.y %= a.y;
+ this.z %= a.z;
+ }
+
+ /** @hide
+ * Vector Modulo
+ *
+ * @param a
+ * @param b
+ * @return
+ */
+ public static Long3 mod(Long3 a, Long3 b) {
+ Long3 result = new Long3();
+ result.x = a.x % b.x;
+ result.y = a.y % b.y;
+ result.z = a.z % b.z;
+
+ return result;
+ }
+
+ /** @hide
+ * Vector Modulo
+ *
+ * @param value
+ */
+ public void mod(long value) {
+ x %= value;
+ y %= value;
+ z %= value;
+ }
+
+ /** @hide
+ * Vector Modulo
+ *
+ * @param a
+ * @param b
+ * @return
+ */
+ public static Long3 mod(Long3 a, long b) {
+ Long3 result = new Long3();
+ result.x = a.x % b;
+ result.y = a.y % b;
+ result.z = a.z % b;
+
+ return result;
+ }
+ /** @hide
+ * get vector length
+ *
+ * @return
+ */
+ public long length() {
+ return 3;
+ }
+
+ /** @hide
+ * set vector negate
+ */
+ public void negate() {
+ this.x = -x;
+ this.y = -y;
+ this.z = -z;
+ }
+ /** @hide
+ * Vector dot Product
+ *
+ * @param a
+ * @return
+ */
+ public long dotProduct(Long3 a) {
+ return (long)((x * a.x) + (y * a.y) + (z * a.z));
+ }
+
+ /** @hide
+ * Vector dot Product
+ *
+ * @param a
+ * @param b
+ * @return
+ */
+ public static long dotProduct(Long3 a, Long3 b) {
+ return (long)((b.x * a.x) + (b.y * a.y) + (b.z * a.z));
+ }
+ /** @hide
+ * Vector add Multiple
+ *
+ * @param a
+ * @param factor
+ */
+ public void addMultiple(Long3 a, long factor) {
+ x += a.x * factor;
+ y += a.y * factor;
+ z += a.z * factor;
+ }
+
+ /** @hide
+ * set vector value by Long3
+ *
+ * @param a
+ */
+ public void set(Long3 a) {
+ this.x = a.x;
+ this.y = a.y;
+ this.z = a.z;
+ }
+
+ /** @hide
+ * set the vector field value by Long
+ *
+ * @param a
+ * @param b
+ * @param c
+ */
+ public void setValues(long a, long b, long c) {
+ this.x = a;
+ this.y = b;
+ this.z = c;
+ }
+ /** @hide
+ * return the element sum of vector
+ *
+ * @return
+ */
+ public long elementSum() {
+ return (long)(x + y + z);
+ }
+
+ /** @hide
+ * get the vector field value by index
+ *
+ * @param i
+ * @return
+ */
+ public long get(int i) {
+ switch (i) {
+ case 0:
+ return (long)(x);
+ case 1:
+ return (long)(y);
+ case 2:
+ return (long)(z);
+ default:
+ throw new IndexOutOfBoundsException("Index: i");
+ }
+ }
+
+ /** @hide
+ * set the vector field value by index
+ *
+ * @param i
+ * @param value
+ */
+ public void setAt(int i, long value) {
+ switch (i) {
+ case 0:
+ x = value;
+ return;
+ case 1:
+ y = value;
+ return;
+ case 2:
+ z = value;
+ return;
+ default:
+ throw new IndexOutOfBoundsException("Index: i");
+ }
+ }
+
+ /** @hide
+ * add the vector field value by index
+ *
+ * @param i
+ * @param value
+ */
+ public void addAt(int i, long value) {
+ switch (i) {
+ case 0:
+ x += value;
+ return;
+ case 1:
+ y += value;
+ return;
+ case 2:
+ z += value;
+ return;
+ default:
+ throw new IndexOutOfBoundsException("Index: i");
+ }
+ }
+
+ /** @hide
+ * copy the vector to long array
+ *
+ * @param data
+ * @param offset
+ */
+ public void copyTo(long[] data, int offset) {
+ data[offset] = (long)(x);
+ data[offset + 1] = (long)(y);
+ data[offset + 2] = (long)(z);
+ }
+}
diff --git a/graphics/java/android/renderscript/Long4.java b/graphics/java/android/renderscript/Long4.java
index 00fb7e6..757b910 100644
--- a/graphics/java/android/renderscript/Long4.java
+++ b/graphics/java/android/renderscript/Long4.java
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2009 The Android Open Source Project
+ * Copyright (C) 2013 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -16,29 +16,499 @@
package android.renderscript;
-import java.lang.Math;
-import android.util.Log;
-
-
/**
- * Class for exposing the native RenderScript long4 type back to the Android system.
- **/
+ * Vector version of the basic long type.
+ * Provides four long fields packed.
+ */
public class Long4 {
+ public long x;
+ public long y;
+ public long z;
+ public long w;
+
public Long4() {
}
- public Long4(long initX, long initY, long initZ, long initW) {
- x = initX;
- y = initY;
- z = initZ;
- w = initW;
+ /** @hide */
+ public Long4(long i) {
+ this.x = this.y = this.z = this.w = i;
}
- public long x;
- public long y;
- public long z;
- public long w;
-}
+ public Long4(long x, long y, long z, long w) {
+ this.x = x;
+ this.y = y;
+ this.z = z;
+ this.w = w;
+ }
+
+ /** @hide */
+ public Long4(Long4 source) {
+ this.x = source.x;
+ this.y = source.y;
+ this.z = source.z;
+ this.w = source.w;
+ }
+
+ /** @hide
+ * Vector add
+ *
+ * @param a
+ */
+ public void add(Long4 a) {
+ this.x += a.x;
+ this.y += a.y;
+ this.z += a.z;
+ this.w += a.w;
+ }
+
+ /** @hide
+ * Vector add
+ *
+ * @param a
+ * @param b
+ * @return
+ */
+ public static Long4 add(Long4 a, Long4 b) {
+ Long4 result = new Long4();
+ result.x = a.x + b.x;
+ result.y = a.y + b.y;
+ result.z = a.z + b.z;
+ result.w = a.w + b.w;
+
+ return result;
+ }
+
+ /** @hide
+ * Vector add
+ *
+ * @param value
+ */
+ public void add(long value) {
+ x += value;
+ y += value;
+ z += value;
+ w += value;
+ }
+
+ /** @hide
+ * Vector add
+ *
+ * @param a
+ * @param b
+ * @return
+ */
+ public static Long4 add(Long4 a, long b) {
+ Long4 result = new Long4();
+ result.x = a.x + b;
+ result.y = a.y + b;
+ result.z = a.z + b;
+ result.w = a.w + b;
+
+ return result;
+ }
+
+ /** @hide
+ * Vector subtraction
+ *
+ * @param a
+ */
+ public void sub(Long4 a) {
+ this.x -= a.x;
+ this.y -= a.y;
+ this.z -= a.z;
+ this.w -= a.w;
+ }
+
+ /** @hide
+ * Vector subtraction
+ *
+ * @param a
+ * @param b
+ * @return
+ */
+ public static Long4 sub(Long4 a, Long4 b) {
+ Long4 result = new Long4();
+ result.x = a.x - b.x;
+ result.y = a.y - b.y;
+ result.z = a.z - b.z;
+ result.w = a.w - b.w;
+
+ return result;
+ }
+
+ /** @hide
+ * Vector subtraction
+ *
+ * @param value
+ */
+ public void sub(long value) {
+ x -= value;
+ y -= value;
+ z -= value;
+ w -= value;
+ }
+
+ /** @hide
+ * Vector subtraction
+ *
+ * @param a
+ * @param b
+ * @return
+ */
+ public static Long4 sub(Long4 a, long b) {
+ Long4 result = new Long4();
+ result.x = a.x - b;
+ result.y = a.y - b;
+ result.z = a.z - b;
+ result.w = a.w - b;
+
+ return result;
+ }
+
+ /** @hide
+ * Vector multiplication
+ *
+ * @param a
+ */
+ public void mul(Long4 a) {
+ this.x *= a.x;
+ this.y *= a.y;
+ this.z *= a.z;
+ this.w *= a.w;
+ }
+
+ /** @hide
+ * Vector multiplication
+ *
+ * @param a
+ * @param b
+ * @return
+ */
+ public static Long4 mul(Long4 a, Long4 b) {
+ Long4 result = new Long4();
+ result.x = a.x * b.x;
+ result.y = a.y * b.y;
+ result.z = a.z * b.z;
+ result.w = a.w * b.w;
+
+ return result;
+ }
+
+ /** @hide
+ * Vector multiplication
+ *
+ * @param value
+ */
+ public void mul(long value) {
+ x *= value;
+ y *= value;
+ z *= value;
+ w *= value;
+ }
+
+ /** @hide
+ * Vector multiplication
+ *
+ * @param a
+ * @param b
+ * @return
+ */
+ public static Long4 mul(Long4 a, long b) {
+ Long4 result = new Long4();
+ result.x = a.x * b;
+ result.y = a.y * b;
+ result.z = a.z * b;
+ result.w = a.w * b;
+ return result;
+ }
+
+ /** @hide
+ * Vector division
+ *
+ * @param a
+ */
+ public void div(Long4 a) {
+ this.x /= a.x;
+ this.y /= a.y;
+ this.z /= a.z;
+ this.w /= a.w;
+ }
+
+ /** @hide
+ * Vector division
+ *
+ * @param a
+ * @param b
+ * @return
+ */
+ public static Long4 div(Long4 a, Long4 b) {
+ Long4 result = new Long4();
+ result.x = a.x / b.x;
+ result.y = a.y / b.y;
+ result.z = a.z / b.z;
+ result.w = a.w / b.w;
+
+ return result;
+ }
+
+ /** @hide
+ * Vector division
+ *
+ * @param value
+ */
+ public void div(long value) {
+ x /= value;
+ y /= value;
+ z /= value;
+ w /= value;
+ }
+
+ /** @hide
+ * Vector division
+ *
+ * @param a
+ * @param b
+ * @return
+ */
+ public static Long4 div(Long4 a, long b) {
+ Long4 result = new Long4();
+ result.x = a.x / b;
+ result.y = a.y / b;
+ result.z = a.z / b;
+ result.w = a.w / b;
+
+ return result;
+ }
+
+ /** @hide
+ * Vector Modulo
+ *
+ * @param a
+ */
+ public void mod(Long4 a) {
+ this.x %= a.x;
+ this.y %= a.y;
+ this.z %= a.z;
+ this.w %= a.w;
+ }
+
+ /** @hide
+ * Vector Modulo
+ *
+ * @param a
+ * @param b
+ * @return
+ */
+ public static Long4 mod(Long4 a, Long4 b) {
+ Long4 result = new Long4();
+ result.x = a.x % b.x;
+ result.y = a.y % b.y;
+ result.z = a.z % b.z;
+ result.w = a.w % b.w;
+
+ return result;
+ }
+
+ /** @hide
+ * Vector Modulo
+ *
+ * @param value
+ */
+ public void mod(long value) {
+ x %= value;
+ y %= value;
+ z %= value;
+ w %= value;
+ }
+
+ /** @hide
+ * Vector Modulo
+ *
+ * @param a
+ * @param b
+ * @return
+ */
+ public static Long4 mod(Long4 a, long b) {
+ Long4 result = new Long4();
+ result.x = a.x % b;
+ result.y = a.y % b;
+ result.z = a.z % b;
+ result.w = a.w % b;
+
+ return result;
+ }
+
+ /** @hide
+ * get vector length
+ *
+ * @return
+ */
+ public long length() {
+ return 4;
+ }
+
+ /** @hide
+ * set vector negate
+ */
+ public void negate() {
+ this.x = -x;
+ this.y = -y;
+ this.z = -z;
+ this.w = -w;
+ }
+
+ /** @hide
+ * Vector dot Product
+ *
+ * @param a
+ * @return
+ */
+ public long dotProduct(Long4 a) {
+ return (long)((x * a.x) + (y * a.y) + (z * a.z) + (w * a.w));
+ }
+
+ /** @hide
+ * Vector dot Product
+ *
+ * @param a
+ * @param b
+ * @return
+ */
+ public static long dotProduct(Long4 a, Long4 b) {
+ return (long)((b.x * a.x) + (b.y * a.y) + (b.z * a.z) + (b.w * a.w));
+ }
+
+ /** @hide
+ * Vector add Multiple
+ *
+ * @param a
+ * @param factor
+ */
+ public void addMultiple(Long4 a, long factor) {
+ x += a.x * factor;
+ y += a.y * factor;
+ z += a.z * factor;
+ w += a.w * factor;
+ }
+
+ /** @hide
+ * set vector value by Long4
+ *
+ * @param a
+ */
+ public void set(Long4 a) {
+ this.x = a.x;
+ this.y = a.y;
+ this.z = a.z;
+ this.w = a.w;
+ }
+ /** @hide
+ * set the vector field value by Long
+ *
+ * @param a
+ * @param b
+ * @param c
+ * @param d
+ */
+ public void setValues(long a, long b, long c, long d) {
+ this.x = a;
+ this.y = b;
+ this.z = c;
+ this.w = d;
+ }
+
+ /** @hide
+ * return the element sum of vector
+ *
+ * @return
+ */
+ public long elementSum() {
+ return (long)(x + y + z + w);
+ }
+ /** @hide
+ * get the vector field value by index
+ *
+ * @param i
+ * @return
+ */
+ public long get(int i) {
+ switch (i) {
+ case 0:
+ return (long)(x);
+ case 1:
+ return (long)(y);
+ case 2:
+ return (long)(z);
+ case 3:
+ return (long)(w);
+ default:
+ throw new IndexOutOfBoundsException("Index: i");
+ }
+ }
+
+ /** @hide
+ * set the vector field value by index
+ *
+ * @param i
+ * @param value
+ */
+ public void setAt(int i, long value) {
+ switch (i) {
+ case 0:
+ x = value;
+ return;
+ case 1:
+ y = value;
+ return;
+ case 2:
+ z = value;
+ return;
+ case 3:
+ w = value;
+ return;
+ default:
+ throw new IndexOutOfBoundsException("Index: i");
+ }
+ }
+
+ /** @hide
+ * add the vector field value by index
+ *
+ * @param i
+ * @param value
+ */
+ public void addAt(int i, long value) {
+ switch (i) {
+ case 0:
+ x += value;
+ return;
+ case 1:
+ y += value;
+ return;
+ case 2:
+ z += value;
+ return;
+ case 3:
+ w += value;
+ return;
+ default:
+ throw new IndexOutOfBoundsException("Index: i");
+ }
+ }
+
+ /** @hide
+ * copy the vector to long array
+ *
+ * @param data
+ * @param offset
+ */
+ public void copyTo(Long[] data, int offset) {
+ data[offset] = (long)(x);
+ data[offset + 1] = (long)(y);
+ data[offset + 2] = (long)(z);
+ data[offset + 3] = (long)(w);
+ }
+}
diff --git a/graphics/java/android/renderscript/ScriptIntrinsicResize.java b/graphics/java/android/renderscript/ScriptIntrinsicResize.java
new file mode 100644
index 0000000..a42d3be
--- /dev/null
+++ b/graphics/java/android/renderscript/ScriptIntrinsicResize.java
@@ -0,0 +1,112 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.renderscript;
+
+/**
+ * Intrinsic for performing a resize of a 2D allocation.
+ */
+public final class ScriptIntrinsicResize extends ScriptIntrinsic {
+ private Allocation mInput;
+
+ private ScriptIntrinsicResize(int id, RenderScript rs) {
+ super(id, rs);
+ }
+
+ /**
+ * Supported elements types are {@link Element#U8}, {@link
+ * Element#U8_2}, {@link Element#U8_3}, {@link Element#U8_4}
+ *
+ * @param rs The RenderScript context
+ *
+ * @return ScriptIntrinsicResize
+ */
+ public static ScriptIntrinsicResize create(RenderScript rs) {
+ int id = rs.nScriptIntrinsicCreate(12, 0);
+ ScriptIntrinsicResize si = new ScriptIntrinsicResize(id, rs);
+ return si;
+
+ }
+
+ /**
+ * Set the input of the resize.
+ * Must match the element type supplied during create.
+ *
+ * @param ain The input allocation.
+ */
+ public void setInput(Allocation ain) {
+ Element e = ain.getElement();
+ if (!e.isCompatible(Element.U8(mRS)) &&
+ !e.isCompatible(Element.U8_2(mRS)) &&
+ !e.isCompatible(Element.U8_3(mRS)) &&
+ !e.isCompatible(Element.U8_4(mRS))) {
+ throw new RSIllegalArgumentException("Unsuported element type.");
+ }
+
+ mInput = ain;
+ setVar(0, ain);
+ }
+
+ /**
+ * Get a FieldID for the input field of this intrinsic.
+ *
+ * @return Script.FieldID The FieldID object.
+ */
+ public Script.FieldID getFieldID_Input() {
+ return createFieldID(0, null);
+ }
+
+
+ /**
+ * Resize copy the input allocation to the output specified. The
+ * Allocation is rescaled if necessary using bi-cubic
+ * interpolation.
+ *
+ * @param aout Output allocation. Element type must match
+ * current input. Must not be same as input.
+ */
+ public void forEach_bicubic(Allocation aout) {
+ if (aout == mInput) {
+ throw new RSIllegalArgumentException("Output cannot be same as Input.");
+ }
+ forEach_bicubic(aout, null);
+ }
+
+ /**
+ * Resize copy the input allocation to the output specified. The
+ * Allocation is rescaled if necessary using bi-cubic
+ * interpolation.
+ *
+ * @param aout Output allocation. Element type must match
+ * current input.
+ * @param opt LaunchOptions for clipping
+ */
+ public void forEach_bicubic(Allocation aout, Script.LaunchOptions opt) {
+ forEach(0, null, aout, null, opt);
+ }
+
+ /**
+ * Get a KernelID for this intrinsic kernel.
+ *
+ * @return Script.KernelID The KernelID object.
+ */
+ public Script.KernelID getKernelID_bicubic() {
+ return createKernelID(0, 2, null, null);
+ }
+
+
+}
+
diff --git a/graphics/java/android/renderscript/Short2.java b/graphics/java/android/renderscript/Short2.java
index 7c6027f..070d608 100644
--- a/graphics/java/android/renderscript/Short2.java
+++ b/graphics/java/android/renderscript/Short2.java
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2009 The Android Open Source Project
+ * Copyright (C) 2013 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -16,27 +16,425 @@
package android.renderscript;
-import java.lang.Math;
-import android.util.Log;
-
-
-/**
- * Class for exposing the native RenderScript Short2 type back to the Android system.
- *
- **/
+/**
+ * Vector version of the basic short type.
+ * Provides two short fields packed.
+ */
public class Short2 {
+ public short x;
+ public short y;
+
public Short2() {
}
- public Short2(short initX, short initY) {
- x = initX;
- y = initY;
+ /** @hide */
+ public Short2(short i) {
+ this.x = this.y = i;
}
- public short x;
- public short y;
-}
+ public Short2(short x, short y) {
+ this.x = x;
+ this.y = y;
+ }
+
+ /** @hide */
+ public Short2(Short2 source) {
+ this.x = source.x;
+ this.y = source.y;
+ }
+
+ /** @hide
+ * Vector add
+ *
+ * @param a
+ */
+ public void add(Short2 a) {
+ this.x += a.x;
+ this.y += a.y;
+ }
+
+ /** @hide
+ * Vector add
+ *
+ * @param a
+ * @param b
+ * @return
+ */
+ public static Short2 add(Short2 a, Short2 b) {
+ Short2 result = new Short2();
+ result.x = (short)(a.x + b.x);
+ result.y = (short)(a.y + b.y);
+
+ return result;
+ }
+
+ /** @hide
+ * Vector add
+ *
+ * @param value
+ */
+ public void add(short value) {
+ x += value;
+ y += value;
+ }
+
+ /** @hide
+ * Vector add
+ *
+ * @param a
+ * @param b
+ * @return
+ */
+ public static Short2 add(Short2 a, short b) {
+ Short2 result = new Short2();
+ result.x = (short)(a.x + b);
+ result.y = (short)(a.y + b);
+
+ return result;
+ }
+
+ /** @hide
+ * Vector subtraction
+ *
+ * @param a
+ */
+ public void sub(Short2 a) {
+ this.x -= a.x;
+ this.y -= a.y;
+ }
+
+ /** @hide
+ * Vector subtraction
+ *
+ * @param a
+ * @param b
+ * @return
+ */
+ public static Short2 sub(Short2 a, Short2 b) {
+ Short2 result = new Short2();
+ result.x = (short)(a.x - b.x);
+ result.y = (short)(a.y - b.y);
+
+ return result;
+ }
+
+ /** @hide
+ * Vector subtraction
+ *
+ * @param value
+ */
+ public void sub(short value) {
+ x -= value;
+ y -= value;
+ }
+
+ /** @hide
+ * Vector subtraction
+ *
+ * @param a
+ * @param b
+ * @return
+ */
+ public static Short2 sub(Short2 a, short b) {
+ Short2 result = new Short2();
+ result.x = (short)(a.x - b);
+ result.y = (short)(a.y - b);
+
+ return result;
+ }
+
+ /** @hide
+ * Vector multiplication
+ *
+ * @param a
+ */
+ public void mul(Short2 a) {
+ this.x *= a.x;
+ this.y *= a.y;
+ }
+
+ /** @hide
+ * Vector multiplication
+ *
+ * @param a
+ * @param b
+ * @return
+ */
+ public static Short2 mul(Short2 a, Short2 b) {
+ Short2 result = new Short2();
+ result.x = (short)(a.x * b.x);
+ result.y = (short)(a.y * b.y);
+
+ return result;
+ }
+
+ /** @hide
+ * Vector multiplication
+ *
+ * @param value
+ */
+ public void mul(short value) {
+ x *= value;
+ y *= value;
+ }
+
+ /** @hide
+ * Vector multiplication
+ *
+ * @param a
+ * @param b
+ * @return
+ */
+ public static Short2 mul(Short2 a, short b) {
+ Short2 result = new Short2();
+ result.x = (short)(a.x * b);
+ result.y = (short)(a.y * b);
+
+ return result;
+ }
+
+ /** @hide
+ * Vector division
+ *
+ * @param a
+ */
+ public void div(Short2 a) {
+ this.x /= a.x;
+ this.y /= a.y;
+ }
+
+ /** @hide
+ * Vector division
+ *
+ * @param a
+ * @param b
+ * @return
+ */
+ public static Short2 div(Short2 a, Short2 b) {
+ Short2 result = new Short2();
+ result.x = (short)(a.x / b.x);
+ result.y = (short)(a.y / b.y);
+
+ return result;
+ }
+
+ /** @hide
+ * Vector division
+ *
+ * @param value
+ */
+ public void div(short value) {
+ x /= value;
+ y /= value;
+ }
+
+ /** @hide
+ * Vector division
+ *
+ * @param a
+ * @param b
+ * @return
+ */
+ public static Short2 div(Short2 a, short b) {
+ Short2 result = new Short2();
+ result.x = (short)(a.x / b);
+ result.y = (short)(a.y / b);
+
+ return result;
+ }
+
+ /** @hide
+ * Vector Modulo
+ *
+ * @param a
+ */
+ public void mod(Short2 a) {
+ this.x %= a.x;
+ this.y %= a.y;
+ }
+
+ /** @hide
+ * Vector Modulo
+ *
+ * @param a
+ * @param b
+ * @return
+ */
+ public static Short2 mod(Short2 a, Short2 b) {
+ Short2 result = new Short2();
+ result.x = (short)(a.x % b.x);
+ result.y = (short)(a.y % b.y);
+
+ return result;
+ }
+
+ /** @hide
+ * Vector Modulo
+ *
+ * @param value
+ */
+ public void mod(short value) {
+ x %= value;
+ y %= value;
+ }
+
+ /** @hide
+ * Vector Modulo
+ *
+ * @param a
+ * @param b
+ * @return
+ */
+ public static Short2 mod(Short2 a, short b) {
+ Short2 result = new Short2();
+ result.x = (short)(a.x % b);
+ result.y = (short)(a.y % b);
+
+ return result;
+ }
+ /** @hide
+ * get vector length
+ *
+ * @return
+ */
+ public short length() {
+ return 2;
+ }
+
+ /** @hide
+ * set vector negate
+ */
+ public void negate() {
+ this.x = (short)(-x);
+ this.y = (short)(-y);
+ }
+ /** @hide
+ * Vector dot Product
+ *
+ * @param a
+ * @return
+ */
+ public short dotProduct(Short2 a) {
+ return (short)((x * a.x) + (y * a.y));
+ }
+
+ /** @hide
+ * Vector dot Product
+ *
+ * @param a
+ * @param b
+ * @return
+ */
+ public static short dotProduct(Short2 a, Short2 b) {
+ return (short)((b.x * a.x) + (b.y * a.y));
+ }
+ /** @hide
+ * Vector add Multiple
+ *
+ * @param a
+ * @param factor
+ */
+ public void addMultiple(Short2 a, short factor) {
+ x += a.x * factor;
+ y += a.y * factor;
+ }
+
+ /** @hide
+ * set vector value by Short2
+ *
+ * @param a
+ */
+ public void set(Short2 a) {
+ this.x = a.x;
+ this.y = a.y;
+ }
+
+ /** @hide
+ * set the vector field value by Short
+ *
+ * @param a
+ * @param b
+ */
+ public void setValues(short a, short b) {
+ this.x = a;
+ this.y = b;
+ }
+ /** @hide
+ * return the element sum of vector
+ *
+ * @return
+ */
+ public short elementSum() {
+ return (short)(x + y);
+ }
+
+ /** @hide
+ * get the vector field value by index
+ *
+ * @param i
+ * @return
+ */
+ public short get(int i) {
+ switch (i) {
+ case 0:
+ return (short)(x);
+ case 1:
+ return (short)(y);
+ default:
+ throw new IndexOutOfBoundsException("Index: i");
+ }
+ }
+
+ /** @hide
+ * set the vector field value by index
+ *
+ * @param i
+ * @param value
+ */
+ public void setAt(int i, short value) {
+ switch (i) {
+ case 0:
+ x = value;
+ return;
+ case 1:
+ y = value;
+ return;
+ default:
+ throw new IndexOutOfBoundsException("Index: i");
+ }
+ }
+
+ /** @hide
+ * add the vector field value by index
+ *
+ * @param i
+ * @param value
+ */
+ public void addAt(int i, short value) {
+ switch (i) {
+ case 0:
+ x += value;
+ return;
+ case 1:
+ y += value;
+ return;
+ default:
+ throw new IndexOutOfBoundsException("Index: i");
+ }
+ }
+
+ /** @hide
+ * copy the vector to short array
+ *
+ * @param data
+ * @param offset
+ */
+ public void copyTo(short[] data, int offset) {
+ data[offset] = (short)(x);
+ data[offset + 1] = (short)(y);
+ }
+}
diff --git a/graphics/java/android/renderscript/Short3.java b/graphics/java/android/renderscript/Short3.java
index 49de05e..661db0a 100644
--- a/graphics/java/android/renderscript/Short3.java
+++ b/graphics/java/android/renderscript/Short3.java
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2009 The Android Open Source Project
+ * Copyright (C) 2013 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -16,29 +16,462 @@
package android.renderscript;
-import java.lang.Math;
-import android.util.Log;
-
-
/**
- * Class for exposing the native RenderScript short3 type back to the Android system.
- *
- **/
+ * Vector version of the basic short type.
+ * Provides three short fields packed.
+ */
public class Short3 {
+ public short x;
+ public short y;
+ public short z;
+
public Short3() {
}
- public Short3(short initX, short initY, short initZ) {
- x = initX;
- y = initY;
- z = initZ;
+ /** @hide */
+ public Short3(short i) {
+ this.x = this.y = this.z = i;
}
- public short x;
- public short y;
- public short z;
-}
+ public Short3(short x, short y, short z) {
+ this.x = x;
+ this.y = y;
+ this.z = z;
+ }
+
+ /** @hide */
+ public Short3(Short3 source) {
+ this.x = source.x;
+ this.y = source.y;
+ this.z = source.z;
+ }
+
+ /** @hide
+ * Vector add
+ *
+ * @param a
+ */
+ public void add(Short3 a) {
+ this.x += a.x;
+ this.y += a.y;
+ this.z += a.z;
+ }
+
+ /** @hide
+ * Vector add
+ *
+ * @param a
+ * @param b
+ * @return
+ */
+ public static Short3 add(Short3 a, Short3 b) {
+ Short3 result = new Short3();
+ result.x = (short)(a.x + b.x);
+ result.y = (short)(a.y + b.y);
+ result.z = (short)(a.z + b.z);
+
+ return result;
+ }
+
+ /** @hide
+ * Vector add
+ *
+ * @param value
+ */
+ public void add(short value) {
+ x += value;
+ y += value;
+ z += value;
+ }
+
+ /** @hide
+ * Vector add
+ *
+ * @param a
+ * @param b
+ * @return
+ */
+ public static Short3 add(Short3 a, short b) {
+ Short3 result = new Short3();
+ result.x = (short)(a.x + b);
+ result.y = (short)(a.y + b);
+ result.z = (short)(a.z + b);
+
+ return result;
+ }
+
+ /** @hide
+ * Vector subtraction
+ *
+ * @param a
+ */
+ public void sub(Short3 a) {
+ this.x -= a.x;
+ this.y -= a.y;
+ this.z -= a.z;
+ }
+
+ /** @hide
+ * Vector subtraction
+ *
+ * @param a
+ * @param b
+ * @return
+ */
+ public static Short3 sub(Short3 a, Short3 b) {
+ Short3 result = new Short3();
+ result.x = (short)(a.x - b.x);
+ result.y = (short)(a.y - b.y);
+ result.z = (short)(a.z - b.z);
+
+ return result;
+ }
+
+ /** @hide
+ * Vector subtraction
+ *
+ * @param value
+ */
+ public void sub(short value) {
+ x -= value;
+ y -= value;
+ z -= value;
+ }
+
+ /** @hide
+ * Vector subtraction
+ *
+ * @param a
+ * @param b
+ * @return
+ */
+ public static Short3 sub(Short3 a, short b) {
+ Short3 result = new Short3();
+ result.x = (short)(a.x - b);
+ result.y = (short)(a.y - b);
+ result.z = (short)(a.z - b);
+
+ return result;
+ }
+
+ /** @hide
+ * Vector multiplication
+ *
+ * @param a
+ */
+ public void mul(Short3 a) {
+ this.x *= a.x;
+ this.y *= a.y;
+ this.z *= a.z;
+ }
+
+ /** @hide
+ * Vector multiplication
+ *
+ * @param a
+ * @param b
+ * @return
+ */
+ public static Short3 mul(Short3 a, Short3 b) {
+ Short3 result = new Short3();
+ result.x = (short)(a.x * b.x);
+ result.y = (short)(a.y * b.y);
+ result.z = (short)(a.z * b.z);
+
+ return result;
+ }
+
+ /** @hide
+ * Vector multiplication
+ *
+ * @param value
+ */
+ public void mul(short value) {
+ x *= value;
+ y *= value;
+ z *= value;
+ }
+
+ /** @hide
+ * Vector multiplication
+ *
+ * @param a
+ * @param b
+ * @return
+ */
+ public static Short3 mul(Short3 a, short b) {
+ Short3 result = new Short3();
+ result.x = (short)(a.x * b);
+ result.y = (short)(a.y * b);
+ result.z = (short)(a.z * b);
+ return result;
+ }
+
+ /** @hide
+ * Vector division
+ *
+ * @param a
+ */
+ public void div(Short3 a) {
+ this.x /= a.x;
+ this.y /= a.y;
+ this.z /= a.z;
+ }
+
+ /** @hide
+ * Vector division
+ *
+ * @param a
+ * @param b
+ * @return
+ */
+ public static Short3 div(Short3 a, Short3 b) {
+ Short3 result = new Short3();
+ result.x = (short)(a.x / b.x);
+ result.y = (short)(a.y / b.y);
+ result.z = (short)(a.z / b.z);
+
+ return result;
+ }
+
+ /** @hide
+ * Vector division
+ *
+ * @param value
+ */
+ public void div(short value) {
+ x /= value;
+ y /= value;
+ z /= value;
+ }
+
+ /** @hide
+ * Vector division
+ *
+ * @param a
+ * @param b
+ * @return
+ */
+ public static Short3 div(Short3 a, short b) {
+ Short3 result = new Short3();
+ result.x = (short)(a.x / b);
+ result.y = (short)(a.y / b);
+ result.z = (short)(a.z / b);
+
+ return result;
+ }
+ /** @hide
+ * Vector Modulo
+ *
+ * @param a
+ */
+ public void mod(Short3 a) {
+ this.x %= a.x;
+ this.y %= a.y;
+ this.z %= a.z;
+ }
+
+ /** @hide
+ * Vector Modulo
+ *
+ * @param a
+ * @param b
+ * @return
+ */
+ public static Short3 mod(Short3 a, Short3 b) {
+ Short3 result = new Short3();
+ result.x = (short)(a.x % b.x);
+ result.y = (short)(a.y % b.y);
+ result.z = (short)(a.z % b.z);
+
+ return result;
+ }
+
+ /** @hide
+ * Vector Modulo
+ *
+ * @param value
+ */
+ public void mod(short value) {
+ x %= value;
+ y %= value;
+ z %= value;
+ }
+ /** @hide
+ * Vector Modulo
+ *
+ * @param a
+ * @param b
+ * @return
+ */
+ public static Short3 mod(Short3 a, short b) {
+ Short3 result = new Short3();
+ result.x = (short)(a.x % b);
+ result.y = (short)(a.y % b);
+ result.z = (short)(a.z % b);
+ return result;
+ }
+
+ /** @hide
+ * get vector length
+ *
+ * @return
+ */
+ public short length() {
+ return 3;
+ }
+
+ /** @hide
+ * set vector negate
+ */
+ public void negate() {
+ this.x = (short)(-x);
+ this.y = (short)(-y);
+ this.z = (short)(-z);
+ }
+
+ /** @hide
+ * Vector dot Product
+ *
+ * @param a
+ * @return
+ */
+ public short dotProduct(Short3 a) {
+ return (short)((x * a.x) + (y * a.y) + (z * a.z));
+ }
+
+ /** @hide
+ * Vector dot Product
+ *
+ * @param a
+ * @param b
+ * @return
+ */
+ public static short dotProduct(Short3 a, Short3 b) {
+ return (short)((b.x * a.x) + (b.y * a.y) + (b.z * a.z));
+ }
+
+ /** @hide
+ * Vector add Multiple
+ *
+ * @param a
+ * @param factor
+ */
+ public void addMultiple(Short3 a, short factor) {
+ x += a.x * factor;
+ y += a.y * factor;
+ z += a.z * factor;
+ }
+
+ /** @hide
+ * set vector value by Short3
+ *
+ * @param a
+ */
+ public void set(Short3 a) {
+ this.x = a.x;
+ this.y = a.y;
+ this.z = a.z;
+ }
+
+ /** @hide
+ * set the vector field value by Short
+ *
+ * @param a
+ * @param b
+ * @param c
+ */
+ public void setValues(short a, short b, short c) {
+ this.x = a;
+ this.y = b;
+ this.z = c;
+ }
+
+ /** @hide
+ * return the element sum of vector
+ *
+ * @return
+ */
+ public short elementSum() {
+ return (short)(x + y + z);
+ }
+
+ /** @hide
+ * get the vector field value by index
+ *
+ * @param i
+ * @return
+ */
+ public short get(int i) {
+ switch (i) {
+ case 0:
+ return (short)(x);
+ case 1:
+ return (short)(y);
+ case 2:
+ return (short)(z);
+ default:
+ throw new IndexOutOfBoundsException("Index: i");
+ }
+ }
+
+ /** @hide
+ * set the vector field value by index
+ *
+ * @param i
+ * @param value
+ */
+ public void setAt(int i, short value) {
+ switch (i) {
+ case 0:
+ x = value;
+ return;
+ case 1:
+ y = value;
+ return;
+ case 2:
+ z = value;
+ return;
+ default:
+ throw new IndexOutOfBoundsException("Index: i");
+ }
+ }
+
+ /** @hide
+ * add the vector field value by index
+ *
+ * @param i
+ * @param value
+ */
+ public void addAt(int i, short value) {
+ switch (i) {
+ case 0:
+ x += value;
+ return;
+ case 1:
+ y += value;
+ return;
+ case 2:
+ z += value;
+ return;
+ default:
+ throw new IndexOutOfBoundsException("Index: i");
+ }
+ }
+
+ /** @hide
+ * copy the vector to short array
+ *
+ * @param data
+ * @param offset
+ */
+ public void copyTo(short[] data, int offset) {
+ data[offset] = (short)(x);
+ data[offset + 1] = (short)(y);
+ data[offset + 2] = (short)(z);
+ }
+}
diff --git a/graphics/java/android/renderscript/Short4.java b/graphics/java/android/renderscript/Short4.java
index a7807a4..a2d74f2 100644
--- a/graphics/java/android/renderscript/Short4.java
+++ b/graphics/java/android/renderscript/Short4.java
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2009 The Android Open Source Project
+ * Copyright (C) 2013 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -16,30 +16,499 @@
package android.renderscript;
-import java.lang.Math;
-import android.util.Log;
-
-
/**
- * Class for exposing the native RenderScript short4 type back to the Android system.
- *
- **/
+ * Vector version of the basic short type.
+ * Provides four short fields packed.
+ */
public class Short4 {
+ public short x;
+ public short y;
+ public short z;
+ public short w;
+
public Short4() {
}
- public Short4(short initX, short initY, short initZ, short initW) {
- x = initX;
- y = initY;
- z = initZ;
- w = initW;
+ /** @hide */
+ public Short4(short i) {
+ this.x = this.y = this.z = this.w = i;
}
- public short x;
- public short y;
- public short z;
- public short w;
-}
+ public Short4(short x, short y, short z, short w) {
+ this.x = x;
+ this.y = y;
+ this.z = z;
+ this.w = w;
+ }
+ /** @hide */
+ public Short4(Short4 source) {
+ this.x = source.x;
+ this.y = source.y;
+ this.z = source.z;
+ this.w = source.w;
+ }
+
+ /** @hide
+ * Vector add
+ *
+ * @param a
+ */
+ public void add(Short4 a) {
+ this.x += a.x;
+ this.y += a.y;
+ this.z += a.z;
+ this.w += a.w;
+ }
+
+ /** @hide
+ * Vector add
+ *
+ * @param a
+ * @param b
+ * @return
+ */
+ public static Short4 add(Short4 a, Short4 b) {
+ Short4 result = new Short4();
+ result.x = (short)(a.x + b.x);
+ result.y = (short)(a.y + b.y);
+ result.z = (short)(a.z + b.z);
+ result.w = (short)(a.w + b.w);
+
+ return result;
+ }
+
+ /** @hide
+ * Vector add
+ *
+ * @param value
+ */
+ public void add(short value) {
+ x += value;
+ y += value;
+ z += value;
+ w += value;
+ }
+ /** @hide
+ * Vector add
+ *
+ * @param a
+ * @param b
+ * @return
+ */
+ public static Short4 add(Short4 a, short b) {
+ Short4 result = new Short4();
+ result.x = (short)(a.x + b);
+ result.y = (short)(a.y + b);
+ result.z = (short)(a.z + b);
+ result.w = (short)(a.w + b);
+
+ return result;
+ }
+
+ /** @hide
+ * Vector subtraction
+ *
+ * @param a
+ */
+ public void sub(Short4 a) {
+ this.x -= a.x;
+ this.y -= a.y;
+ this.z -= a.z;
+ this.w -= a.w;
+ }
+
+ /** @hide
+ * Vector subtraction
+ *
+ * @param a
+ * @param b
+ * @return
+ */
+ public static Short4 sub(Short4 a, Short4 b) {
+ Short4 result = new Short4();
+ result.x = (short)(a.x - b.x);
+ result.y = (short)(a.y - b.y);
+ result.z = (short)(a.z - b.z);
+ result.w = (short)(a.w - b.w);
+
+ return result;
+ }
+
+ /** @hide
+ * Vector subtraction
+ *
+ * @param value
+ */
+ public void sub(short value) {
+ x -= value;
+ y -= value;
+ z -= value;
+ w -= value;
+ }
+
+ /** @hide
+ * Vector subtraction
+ *
+ * @param a
+ * @param b
+ * @return
+ */
+ public static Short4 sub(Short4 a, short b) {
+ Short4 result = new Short4();
+ result.x = (short)(a.x - b);
+ result.y = (short)(a.y - b);
+ result.z = (short)(a.z - b);
+ result.w = (short)(a.w - b);
+
+ return result;
+ }
+
+ /** @hide
+ * Vector multiplication
+ *
+ * @param a
+ */
+ public void mul(Short4 a) {
+ this.x *= a.x;
+ this.y *= a.y;
+ this.z *= a.z;
+ this.w *= a.w;
+ }
+
+ /** @hide
+ * Vector multiplication
+ *
+ * @param a
+ * @param b
+ * @return
+ */
+ public static Short4 mul(Short4 a, Short4 b) {
+ Short4 result = new Short4();
+ result.x = (short)(a.x * b.x);
+ result.y = (short)(a.y * b.y);
+ result.z = (short)(a.z * b.z);
+ result.w = (short)(a.w * b.w);
+
+ return result;
+ }
+
+ /** @hide
+ * Vector multiplication
+ *
+ * @param value
+ */
+ public void mul(short value) {
+ x *= value;
+ y *= value;
+ z *= value;
+ w *= value;
+ }
+
+ /** @hide
+ * Vector multiplication
+ *
+ * @param a
+ * @param b
+ * @return
+ */
+ public static Short4 mul(Short4 a, short b) {
+ Short4 result = new Short4();
+ result.x = (short)(a.x * b);
+ result.y = (short)(a.y * b);
+ result.z = (short)(a.z * b);
+ result.w = (short)(a.w * b);
+
+ return result;
+ }
+ /** @hide
+ * Vector division
+ *
+ * @param a
+ */
+ public void div(Short4 a) {
+ this.x /= a.x;
+ this.y /= a.y;
+ this.z /= a.z;
+ this.w /= a.w;
+ }
+
+ /** @hide
+ * Vector division
+ *
+ * @param a
+ * @param b
+ * @return
+ */
+ public static Short4 div(Short4 a, Short4 b) {
+ Short4 result = new Short4();
+ result.x = (short)(a.x / b.x);
+ result.y = (short)(a.y / b.y);
+ result.z = (short)(a.z / b.z);
+ result.w = (short)(a.w / b.w);
+
+ return result;
+ }
+
+ /** @hide
+ * Vector division
+ *
+ * @param value
+ */
+ public void div(short value) {
+ x /= value;
+ y /= value;
+ z /= value;
+ w /= value;
+ }
+
+ /** @hide
+ * Vector division
+ *
+ * @param a
+ * @param b
+ * @return
+ */
+ public static Short4 div(Short4 a, short b) {
+ Short4 result = new Short4();
+ result.x = (short)(a.x / b);
+ result.y = (short)(a.y / b);
+ result.z = (short)(a.z / b);
+ result.w = (short)(a.w / b);
+
+ return result;
+ }
+
+ /** @hide
+ * Vector Modulo
+ *
+ * @param a
+ */
+ public void mod(Short4 a) {
+ this.x %= a.x;
+ this.y %= a.y;
+ this.z %= a.z;
+ this.w %= a.w;
+ }
+
+ /** @hide
+ * Vector Modulo
+ *
+ * @param a
+ * @param b
+ * @return
+ */
+ public static Short4 mod(Short4 a, Short4 b) {
+ Short4 result = new Short4();
+ result.x = (short)(a.x % b.x);
+ result.y = (short)(a.y % b.y);
+ result.z = (short)(a.z % b.z);
+ result.w = (short)(a.w % b.w);
+
+ return result;
+ }
+
+ /** @hide
+ * Vector Modulo
+ *
+ * @param value
+ */
+ public void mod(short value) {
+ x %= value;
+ y %= value;
+ z %= value;
+ w %= value;
+ }
+
+ /** @hide
+ * Vector Modulo
+ *
+ * @param a
+ * @param b
+ * @return
+ */
+ public static Short4 mod(Short4 a, short b) {
+ Short4 result = new Short4();
+ result.x = (short)(a.x % b);
+ result.y = (short)(a.y % b);
+ result.z = (short)(a.z % b);
+ result.w = (short)(a.w % b);
+
+ return result;
+ }
+
+ /** @hide
+ * get vector length
+ *
+ * @return
+ */
+ public short length() {
+ return 4;
+ }
+
+ /** @hide
+ * set vector negate
+ */
+ public void negate() {
+ this.x = (short)(-x);
+ this.y = (short)(-y);
+ this.z = (short)(-z);
+ this.w = (short)(-w);
+ }
+
+ /** @hide
+ * Vector dot Product
+ *
+ * @param a
+ * @return
+ */
+ public short dotProduct(Short4 a) {
+ return (short)((x * a.x) + (y * a.y) + (z * a.z) + (w * a.w));
+ }
+
+ /** @hide
+ * Vector dot Product
+ *
+ * @param a
+ * @param b
+ * @return
+ */
+ public static short dotProduct(Short4 a, Short4 b) {
+ return (short)((b.x * a.x) + (b.y * a.y) + (b.z * a.z) + (b.w * a.w));
+ }
+
+ /** @hide
+ * Vector add Multiple
+ *
+ * @param a
+ * @param factor
+ */
+ public void addMultiple(Short4 a, short factor) {
+ x += a.x * factor;
+ y += a.y * factor;
+ z += a.z * factor;
+ w += a.w * factor;
+ }
+
+ /** @hide
+ * set vector value by Short4
+ *
+ * @param a
+ */
+ public void set(Short4 a) {
+ this.x = a.x;
+ this.y = a.y;
+ this.z = a.z;
+ this.w = a.w;
+ }
+
+ /** @hide
+ * set the vector field value by Short
+ *
+ * @param a
+ * @param b
+ * @param c
+ * @param d
+ */
+ public void setValues(short a, short b, short c, short d) {
+ this.x = a;
+ this.y = b;
+ this.z = c;
+ this.w = d;
+ }
+
+ /** @hide
+ * return the element sum of vector
+ *
+ * @return
+ */
+ public short elementSum() {
+ return (short)(x + y + z + w);
+ }
+
+ /** @hide
+ * get the vector field value by index
+ *
+ * @param i
+ * @return
+ */
+ public short get(int i) {
+ switch (i) {
+ case 0:
+ return (short)(x);
+ case 1:
+ return (short)(y);
+ case 2:
+ return (short)(z);
+ case 3:
+ return (short)(w);
+ default:
+ throw new IndexOutOfBoundsException("Index: i");
+ }
+ }
+
+ /** @hide
+ * set the vector field value by index
+ *
+ * @param i
+ * @param value
+ */
+ public void setAt(int i, short value) {
+ switch (i) {
+ case 0:
+ x = value;
+ return;
+ case 1:
+ y = value;
+ return;
+ case 2:
+ z = value;
+ return;
+ case 3:
+ w = value;
+ return;
+ default:
+ throw new IndexOutOfBoundsException("Index: i");
+ }
+ }
+
+ /** @hide
+ * add the vector field value by index
+ *
+ * @param i
+ * @param value
+ */
+ public void addAt(int i, short value) {
+ switch (i) {
+ case 0:
+ x += value;
+ return;
+ case 1:
+ y += value;
+ return;
+ case 2:
+ z += value;
+ return;
+ case 3:
+ w += value;
+ return;
+ default:
+ throw new IndexOutOfBoundsException("Index: i");
+ }
+ }
+
+ /** @hide
+ * copy the vector to short array
+ *
+ * @param data
+ * @param offset
+ */
+ public void copyTo(short[] data, int offset) {
+ data[offset] = (short)(x);
+ data[offset + 1] = (short)(y);
+ data[offset + 2] = (short)(z);
+ data[offset + 3] = (short)(w);
+ }
+}