summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Android.mk166
-rw-r--r--api/current.txt6
-rw-r--r--core/java/android/content/Intent.java6
-rw-r--r--core/java/android/provider/DocumentsContract.java2
-rw-r--r--core/java/android/widget/ListView.java32
-rw-r--r--core/jni/Android.mk1
-rw-r--r--core/jni/android_view_GLES20Canvas.cpp2
-rw-r--r--core/res/res/values-am/strings.xml14
-rw-r--r--core/res/res/values-da/strings.xml28
-rw-r--r--core/res/res/values-nb/strings.xml8
-rw-r--r--core/res/res/values-pl/strings.xml4
-rw-r--r--docs/html/guide/faq/security.jd7
-rw-r--r--docs/html/training/system-ui/immersive.jd24
-rw-r--r--graphics/java/android/renderscript/Allocation.java476
-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.java369
-rw-r--r--graphics/java/android/renderscript/Double3.java403
-rw-r--r--graphics/java/android/renderscript/Double4.java439
-rw-r--r--graphics/java/android/renderscript/Float2.java369
-rw-r--r--graphics/java/android/renderscript/Float3.java403
-rw-r--r--graphics/java/android/renderscript/Float4.java438
-rw-r--r--graphics/java/android/renderscript/Int2.java423
-rw-r--r--graphics/java/android/renderscript/Int3.java462
-rw-r--r--graphics/java/android/renderscript/Int4.java502
-rw-r--r--graphics/java/android/renderscript/Long2.java422
-rw-r--r--graphics/java/android/renderscript/Long3.java461
-rw-r--r--graphics/java/android/renderscript/Long4.java501
-rw-r--r--graphics/java/android/renderscript/Short2.java420
-rw-r--r--graphics/java/android/renderscript/Short3.java462
-rw-r--r--graphics/java/android/renderscript/Short4.java502
-rw-r--r--libs/hwui/DisplayList.cpp2
-rw-r--r--libs/hwui/DisplayListOp.h9
-rw-r--r--libs/hwui/DisplayListRenderer.cpp2
-rw-r--r--libs/hwui/OpenGLRenderer.cpp119
-rw-r--r--libs/hwui/OpenGLRenderer.h36
-rw-r--r--libs/hwui/PathTessellator.cpp38
-rw-r--r--libs/hwui/PathTessellator.h2
-rw-r--r--libs/hwui/Rect.h7
-rw-r--r--packages/InputDevices/res/values-mn-rMN/strings.xml2
-rw-r--r--packages/Keyguard/res/values-nb/strings.xml2
42 files changed, 7987 insertions, 748 deletions
diff --git a/Android.mk b/Android.mk
index 82b23f1..5af0231 100644
--- a/Android.mk
+++ b/Android.mk
@@ -549,8 +549,7 @@ framework_docs_LOCAL_ADDITIONAL_JAVA_DIR:= \
framework_docs_LOCAL_ADDITIONAL_DEPENDENCIES := \
frameworks/base/docs/knowntags.txt
-sample_dir := development/samples/browseable
-new_sample_dir := developers/samples/android
+samples_dir := development/samples/browseable
# Whitelist of valid groups, used for default TOC grouping. Each sample must
# belong to one (and only one) group. Assign samples to groups by setting
@@ -565,161 +564,6 @@ sample_groups := -samplegroup Background \
-samplegroup UI \
-samplegroup Views
-# the list here should match the list of samples included in the sdk samples package
-# (see development/build/sdk.atree)
-# remove htmlified samples for now -- samples are still available through the SDK
-web_docs_sample_code_flags := \
- -hdf android.hasSamples 1 \
- -samplecode $(sample_dir)/BasicAccessibility \
- samples/BasicAccessibility "" \
- -samplecode $(sample_dir)/HorizontalPaging \
- samples/HorizontalPaging "" \
- -samplecode $(sample_dir)/ShareActionProvider \
- samples/ShareActionProvider "" \
- -samplecode $(sample_dir)/Styled \
- samples/Styled "" \
- -samplecode $(sample_dir)/BasicAndroidKeyStore \
- samples/BasicAndroidKeyStore "" \
- -samplecode $(sample_dir)/Basic \
- samples/Basic "" \
- -samplecode $(sample_dir)/ImmersiveMode \
- samples/ImmersiveMode "" \
- -samplecode $(sample_dir)/repeatingAlarm \
- samples/repeatingAlarm "" \
- -samplecode $(sample_dir)/TextLinkify \
- samples/TextLinkify "" \
- -samplecode $(sample_dir)/BasicMediaRouter \
- samples/BasicMediaRouter "" \
- -samplecode $(sample_dir)/BasicMultitouch \
- samples/BasicMultitouch "" \
- -samplecode $(sample_dir)/TextSwitcher \
- samples/TextSwitcher "" \
- -samplecode $(sample_dir)/ActivityInstrumentation \
- samples/ActivityInstrumentation "" \
- -samplecode $(sample_dir)/BorderlessButtons \
- samples/BorderlessButtons "" \
- -samplecode $(sample_dir)/BasicNotifications \
- samples/BasicNotifications "" \
- -samplecode $(sample_dir)/AdvancedImmersiveMode \
- samples/AdvancedImmersiveMode "" \
- -samplecode $(sample_dir)/BluetoothLeGatt \
- samples/BluetoothLeGatt "" \
- -samplecode $(sample_dir)/NetworkConnect \
- samples/NetworkConnect "" \
- -samplecode $(sample_dir)/BasicNetworking \
- samples/BasicNetworking "" \
- -samplecode $(sample_dir)/BasicMediaDecoder \
- samples/BasicMediaDecoder "" \
- -samplecode $(sample_dir)/BasicImmersiveMode \
- samples/BasicImmersiveMode "" \
- -samplecode $(sample_dir)/CustomChoiceList \
- samples/CustomChoiceList "" \
- -samplecode $(sample_dir)/BasicContactables \
- samples/BasicContactables "" \
- -samplecode $(sample_dir)/BasicGestureDetect \
- samples/BasicGestureDetect "" \
- -samplecode $(sample_dir)/DoneBar \
- samples/DoneBar "" \
- -samplecode $(sample_dir)/ListPopupMenu \
- samples/ListPopupMenu "" \
- -samplecode $(sample_dir)/AppRestrictions \
- samples/AppRestrictions "" \
- -samplecode $(sample_dir)/CustomNotifications \
- samples/CustomNotifications "" \
- -samplecode $(sample_dir)/BasicSyncAdapter \
- samples/BasicSyncAdapter "" \
- -samplecode $(sample_dir)/StorageClient \
- samples/StorageClient "" \
- -samplecode $(sample_dir)/StorageProvider \
- samples/StorageProvider ""
-# -samplecode $(sample_dir)/AndroidBeamDemo \
-# samples/AndroidBeamDemo "Android Beam Demo" \
-# -samplecode $(sample_dir)/ApiDemos \
-# samples/ApiDemos "API Demos" \
-# -samplecode $(sample_dir)/Support4Demos \
-# samples/Support4Demos "API 4+ Support Demos" \
-# -samplecode $(sample_dir)/Support13Demos \
-# samples/Support13Demos "API 13+ Support Demos" \
-# -samplecode $(sample_dir)/BackupRestore \
-# samples/BackupRestore "Backup and Restore" \
-# -samplecode $(sample_dir)/BluetoothChat \
-# samples/BluetoothChat "Bluetooth Chat" \
-# -samplecode $(sample_dir)/BusinessCard \
-# samples/BusinessCard "Business Card" \
-# -samplecode $(sample_dir)/ContactManager \
-# samples/ContactManager "Contact Manager" \
-# -samplecode $(sample_dir)/CubeLiveWallpaper \
-# samples/CubeLiveWallpaper "Cube Live Wallpaper" \
-# -samplecode $(sample_dir)/Home \
-# samples/Home "Home" \
-# -samplecode $(sample_dir)/HoneycombGallery \
-# samples/HoneycombGallery "Honeycomb Gallery" \
-# -samplecode $(sample_dir)/JetBoy \
-# samples/JetBoy "JetBoy" \
-# -samplecode $(sample_dir)/KeyChainDemo \
-# samples/KeyChainDemo "KeyChain Demo" \
-# -samplecode $(sample_dir)/LunarLander \
-# samples/LunarLander "Lunar Lander" \
-# -samplecode $(sample_dir)/training/ads-and-ux \
-# samples/training/ads-and-ux "Mobile Advertisement Integration" \
-# -samplecode $(sample_dir)/MultiResolution \
-# samples/MultiResolution "Multiple Resolutions" \
-# -samplecode $(sample_dir)/training/multiscreen/newsreader \
-# samples/newsreader "News Reader" \
-# -samplecode $(sample_dir)/NotePad \
-# samples/NotePad "Note Pad" \
-# -samplecode $(sample_dir)/SpellChecker/SampleSpellCheckerService \
-# samples/SpellChecker/SampleSpellCheckerService "Spell Checker Service" \
-# -samplecode $(sample_dir)/SpellChecker/HelloSpellChecker \
-# samples/SpellChecker/HelloSpellChecker "Spell Checker Client" \
-# -samplecode $(sample_dir)/SampleSyncAdapter \
-# samples/SampleSyncAdapter "Sample Sync Adapter" \
-# -samplecode $(sample_dir)/RandomMusicPlayer \
-# samples/RandomMusicPlayer "Random Music Player" \
-# -samplecode $(sample_dir)/RenderScript \
-# samples/RenderScript "RenderScript" \
-# -samplecode $(sample_dir)/SearchableDictionary \
-# samples/SearchableDictionary "Searchable Dictionary v2" \
-# -samplecode $(sample_dir)/SipDemo \
-# samples/SipDemo "SIP Demo" \
-# -samplecode $(sample_dir)/Snake \
-# samples/Snake "Snake" \
-# -samplecode $(sample_dir)/SoftKeyboard \
-# samples/SoftKeyboard "Soft Keyboard" \
-# -samplecode $(sample_dir)/Spinner \
-# samples/Spinner "Spinner" \
-# -samplecode $(sample_dir)/SpinnerTest \
-# samples/SpinnerTest "SpinnerTest" \
-# -samplecode $(sample_dir)/StackWidget \
-# samples/StackWidget "StackView Widget" \
-# -samplecode $(sample_dir)/TicTacToeLib \
-# samples/TicTacToeLib "TicTacToeLib" \
-# -samplecode $(sample_dir)/TicTacToeMain \
-# samples/TicTacToeMain "TicTacToeMain" \
-# -samplecode $(sample_dir)/ToyVpn \
-# samples/ToyVpn "Toy VPN Client" \
-# -samplecode $(sample_dir)/USB \
-# samples/USB "USB" \
-# -samplecode $(sample_dir)/WeatherListWidget \
-# samples/WeatherListWidget "Weather List Widget" \
-# -samplecode $(sample_dir)/WiFiDirectDemo \
-# samples/WiFiDirectDemo "Wi-Fi Direct Demo" \
-# -samplecode $(sample_dir)/Wiktionary \
-# samples/Wiktionary "Wiktionary" \
-# -samplecode $(sample_dir)/WiktionarySimple \
-# samples/WiktionarySimple "Wiktionary (Simplified)" \
-# -samplecode $(sample_dir)/VoiceRecognitionService \
-# samples/VoiceRecognitionService "Voice Recognition Service" \
-# -samplecode $(sample_dir)/VoicemailProviderDemo \
-# samples/VoicemailProviderDemo "Voicemail Provider Demo" \
-# -samplecode $(sample_dir)/XmlAdapters \
-# samples/XmlAdapters "XML Adapters" \
-# -samplecode $(sample_dir)/TtsEngine \
-# samples/TtsEngine "Text To Speech Engine" \
-# -samplecode $(sample_dir)/training/device-management-policy \
-# samples/training/device-management-policy "Device Management Policy"
-
-
## SDK version identifiers used in the published docs
# major[.minor] version for current SDK. (full releases only)
framework_docs_SDK_VERSION:=4.4
@@ -729,7 +573,7 @@ framework_docs_SDK_REL_ID:=1
framework_docs_LOCAL_DROIDDOC_OPTIONS += \
-hdf sdk.version $(framework_docs_SDK_VERSION) \
-hdf sdk.rel.id $(framework_docs_SDK_REL_ID) \
- -hdf sdk.preview 0 \
+ -hdf sdk.preview 0
# ==== the api stubs and current.xml ===========================
include $(CLEAR_VARS)
@@ -815,8 +659,6 @@ LOCAL_DROIDDOC_OPTIONS:=\
-todo $(OUT_DOCS)/$(LOCAL_MODULE)-docs-todo.html \
-sdkvalues $(OUT_DOCS) \
-hdf android.whichdoc offline
-# $(web_docs_sample_code_flags)
-
LOCAL_DROIDDOC_CUSTOM_TEMPLATE_DIR:=build/tools/droiddoc/templates-sdk
@@ -852,7 +694,8 @@ LOCAL_DROIDDOC_OPTIONS:= \
-toroot / \
-hdf android.whichdoc online \
$(sample_groups) \
- $(web_docs_sample_code_flags)
+ -hdf android.hasSamples true \
+ -samplesdir $(samples_dir)
LOCAL_DROIDDOC_CUSTOM_TEMPLATE_DIR:=build/tools/droiddoc/templates-sdk
@@ -880,7 +723,6 @@ LOCAL_DROIDDOC_OPTIONS:= \
-toroot / \
-hdf android.whichdoc online \
-hdf devsite true
-# $(web_docs_sample_code_flags)
LOCAL_DROIDDOC_CUSTOM_TEMPLATE_DIR:=build/tools/droiddoc/templates-sdk
diff --git a/api/current.txt b/api/current.txt
index 4d500c6..0a88f87 100644
--- a/api/current.txt
+++ b/api/current.txt
@@ -22228,15 +22228,18 @@ package android.provider {
package android.renderscript {
public class Allocation extends android.renderscript.BaseObj {
+ method public void copy1DRangeFrom(int, int, java.lang.Object);
method public void copy1DRangeFrom(int, int, int[]);
method public void copy1DRangeFrom(int, int, short[]);
method public void copy1DRangeFrom(int, int, byte[]);
method public void copy1DRangeFrom(int, int, float[]);
method public void copy1DRangeFrom(int, int, android.renderscript.Allocation, int);
+ method public void copy1DRangeFromUnchecked(int, int, java.lang.Object);
method public void copy1DRangeFromUnchecked(int, int, int[]);
method public void copy1DRangeFromUnchecked(int, int, short[]);
method public void copy1DRangeFromUnchecked(int, int, byte[]);
method public void copy1DRangeFromUnchecked(int, int, float[]);
+ method public void copy2DRangeFrom(int, int, int, int, java.lang.Object);
method public void copy2DRangeFrom(int, int, int, int, byte[]);
method public void copy2DRangeFrom(int, int, int, int, short[]);
method public void copy2DRangeFrom(int, int, int, int, int[]);
@@ -22244,17 +22247,20 @@ package android.renderscript {
method public void copy2DRangeFrom(int, int, int, int, android.renderscript.Allocation, int, int);
method public void copy2DRangeFrom(int, int, android.graphics.Bitmap);
method public void copyFrom(android.renderscript.BaseObj[]);
+ method public void copyFrom(java.lang.Object);
method public void copyFrom(int[]);
method public void copyFrom(short[]);
method public void copyFrom(byte[]);
method public void copyFrom(float[]);
method public void copyFrom(android.graphics.Bitmap);
method public void copyFrom(android.renderscript.Allocation);
+ method public void copyFromUnchecked(java.lang.Object);
method public void copyFromUnchecked(int[]);
method public void copyFromUnchecked(short[]);
method public void copyFromUnchecked(byte[]);
method public void copyFromUnchecked(float[]);
method public void copyTo(android.graphics.Bitmap);
+ method public void copyTo(java.lang.Object);
method public void copyTo(byte[]);
method public void copyTo(short[]);
method public void copyTo(int[]);
diff --git a/core/java/android/content/Intent.java b/core/java/android/content/Intent.java
index 85b3141..ba7db76 100644
--- a/core/java/android/content/Intent.java
+++ b/core/java/android/content/Intent.java
@@ -4424,7 +4424,7 @@ public class Intent implements Parcelable, Cloneable {
* Return the {@link ClipData} associated with this Intent. If there is
* none, returns null. See {@link #setClipData} for more information.
*
- * @see #setClipData;
+ * @see #setClipData
*/
public ClipData getClipData() {
return mClipData;
@@ -7179,8 +7179,8 @@ public class Intent implements Parcelable, Cloneable {
*
* @param type MIME data type to normalize
* @return normalized MIME data type, or null if the input was null
- * @see {@link #setType}
- * @see {@link #setTypeAndNormalize}
+ * @see #setType
+ * @see #setTypeAndNormalize
*/
public static String normalizeMimeType(String type) {
if (type == null) {
diff --git a/core/java/android/provider/DocumentsContract.java b/core/java/android/provider/DocumentsContract.java
index 86d3cf8..f0520b5 100644
--- a/core/java/android/provider/DocumentsContract.java
+++ b/core/java/android/provider/DocumentsContract.java
@@ -257,8 +257,6 @@ public final class DocumentsContract {
* {@link #MIME_TYPE_DIR}.
*
* @see #COLUMN_FLAGS
- * @see DocumentsContract#createDocument(ContentResolver, Uri, String,
- * String)
* @see DocumentsProvider#createDocument(String, String, String)
*/
public static final int FLAG_DIR_SUPPORTS_CREATE = 1 << 3;
diff --git a/core/java/android/widget/ListView.java b/core/java/android/widget/ListView.java
index 0cd35e8..c461723 100644
--- a/core/java/android/widget/ListView.java
+++ b/core/java/android/widget/ListView.java
@@ -266,6 +266,7 @@ public class ListView extends AbsListView {
info.data = data;
info.isSelectable = isSelectable;
mHeaderViewInfos.add(info);
+ mAreAllItemsSelectable &= isSelectable;
// Wrap the adapter if it wasn't already wrapped.
if (mAdapter != null) {
@@ -359,6 +360,7 @@ public class ListView extends AbsListView {
info.data = data;
info.isSelectable = isSelectable;
mFooterViewInfos.add(info);
+ mAreAllItemsSelectable &= isSelectable;
// Wrap the adapter if it wasn't already wrapped.
if (mAdapter != null) {
@@ -3241,14 +3243,13 @@ public class ListView extends AbsListView {
if (drawDividers && (bottom < listBottom)
&& !(drawOverscrollFooter && isLastItem)) {
final int nextIndex = (itemIndex + 1);
- // Draw dividers between enabled items, headers and/or
- // footers when enabled, and the end of the list.
- if (areAllItemsSelectable || ((adapter.isEnabled(itemIndex)
- || (headerDividers && isHeader)
- || (footerDividers && isFooter)) && (isLastItem
- || adapter.isEnabled(nextIndex)
- || (headerDividers && (nextIndex < headerCount))
- || (footerDividers && (nextIndex >= footerLimit))))) {
+ // Draw dividers between enabled items, headers
+ // and/or footers when enabled and requested, and
+ // after the last enabled item.
+ if (adapter.isEnabled(itemIndex) && (headerDividers || !isHeader
+ && (nextIndex >= headerCount)) && (isLastItem
+ || adapter.isEnabled(nextIndex) && (footerDividers || !isFooter
+ && (nextIndex < footerLimit)))) {
bounds.top = bottom;
bounds.bottom = bottom + dividerHeight;
drawDivider(canvas, bounds, i);
@@ -3290,14 +3291,13 @@ public class ListView extends AbsListView {
if (drawDividers && (top > effectivePaddingTop)) {
final boolean isFirstItem = (i == start);
final int previousIndex = (itemIndex - 1);
- // Draw dividers between enabled items, headers and/or
- // footers when enabled, and the end of the list.
- if (areAllItemsSelectable || ((adapter.isEnabled(itemIndex)
- || (headerDividers && isHeader)
- || (footerDividers && isFooter)) && (isFirstItem
- || adapter.isEnabled(previousIndex)
- || (headerDividers && (previousIndex < headerCount))
- || (footerDividers && (previousIndex >= footerLimit))))) {
+ // Draw dividers between enabled items, headers
+ // and/or footers when enabled and requested, and
+ // before the first enabled item.
+ if (adapter.isEnabled(itemIndex) && (headerDividers || !isHeader
+ && (previousIndex >= headerCount)) && (isFirstItem ||
+ adapter.isEnabled(previousIndex) && (footerDividers || !isFooter
+ && (previousIndex < footerLimit)))) {
bounds.top = top - dividerHeight;
bounds.bottom = top;
// Give the method the child ABOVE the divider,
diff --git a/core/jni/Android.mk b/core/jni/Android.mk
index 04661d7..ca519d1 100644
--- a/core/jni/Android.mk
+++ b/core/jni/Android.mk
@@ -208,7 +208,6 @@ LOCAL_SHARED_LIBRARIES := \
libicuuc \
libicui18n \
libmedia \
- libwpa_client \
libjpeg \
libusbhost \
libharfbuzz_ng \
diff --git a/core/jni/android_view_GLES20Canvas.cpp b/core/jni/android_view_GLES20Canvas.cpp
index b720e73..7a763ad 100644
--- a/core/jni/android_view_GLES20Canvas.cpp
+++ b/core/jni/android_view_GLES20Canvas.cpp
@@ -298,7 +298,7 @@ static jint android_view_GLES20Canvas_saveLayerAlphaClip(JNIEnv* env, jobject cl
static bool android_view_GLES20Canvas_quickReject(JNIEnv* env, jobject clazz,
OpenGLRenderer* renderer, jfloat left, jfloat top, jfloat right, jfloat bottom) {
- return renderer->quickRejectNoScissor(left, top, right, bottom);
+ return renderer->quickRejectConservative(left, top, right, bottom);
}
static bool android_view_GLES20Canvas_clipRectF(JNIEnv* env, jobject clazz,
diff --git a/core/res/res/values-am/strings.xml b/core/res/res/values-am/strings.xml
index 5561501..0b48252 100644
--- a/core/res/res/values-am/strings.xml
+++ b/core/res/res/values-am/strings.xml
@@ -271,10 +271,10 @@
<string name="permdesc_sendRespondViaMessageRequest" msgid="7107648548468778734">"መተግበሪያው ሌሎች የመልዕክት መላኪያ መተግበሪያዎች ለመጪ ጥሪዎች በመልዕክት-በኩል-ምላሽ-መስጠት ስራን እንዲይዙ ጥያቄዎች እንዲልክላቸው ያስችለዋል።"</string>
<string name="permlab_readSms" msgid="8745086572213270480">"የጽሑፍ መልዕክቶችዎን ያንብቡ (ኤስ.ኤም.ኤስ. ወይም ኤም.ኤም.ኤስ.)"</string>
<string name="permdesc_readSms" product="tablet" msgid="2467981548684735522">"መገለጫው በጡባዊ ቱኮህ ወይም በSIM ካርድህ የተከማቹ የኤስ.ኤም.ኤስ. መልእክቶችን እንዲያነብ ይፈቅድለታል። ይህ መተግበሪያው ይዘት ወይም ሚስጥራዊነትን ከግምት ሳያስገባ ሁሉንም የኤስ.ኤም.ኤስ. መልእክቶች እንዲያነብ ይፈቅድለታል።"</string>
- <string name="permdesc_readSms" product="default" msgid="3695967533457240550">"መገለጫው በስልክህ ወይም በSIM ካርድህ የተከማቹ የኤስ.ኤም.ኤስ. መልእክቶችን እንዲያነብ ይፈቅድለታል። ይህ መተግበሪያው ይዘት ወይም ሚስጥራዊነትን ከግምት ሳያስገባ ሁሉንም የኤስ.ኤም.ኤስ. መልእክቶች እንዲያነብ ይፈቅድለታል።"</string>
+ <string name="permdesc_readSms" product="default" msgid="3695967533457240550">"መገለጫው በስልክዎ ወይም በSIM ካርድዎ የተከማቹ የኤስ.ኤም.ኤስ. መልዕክቶችን እንዲያነብ ይፈቅድለታል። ይህ መተግበሪያው ይዘት ወይም ሚስጥራዊነትን ከግምት ሳያስገባ ሁሉንም የኤስ.ኤም.ኤስ. መልዕክቶች እንዲያነብ ይፈቅድለታል።"</string>
<string name="permlab_writeSms" msgid="3216950472636214774">"የጽሑፍ መልዕክቶችህን አርትዕ (ኤስ.ኤም.ኤስ. ወይም ኤም.ኤም.ኤስ.)"</string>
<string name="permdesc_writeSms" product="tablet" msgid="5160413947794501538">"በጡባዊ ተኮህ ወይም ሲም ካርድህ ላይ ኤስ ኤም ኤስ መልዕክቶችን ለመፃፍ ለመተግበሪያው ይፈቅዳሉ፡፡መልዕክቶችህን ተንኮል አዘል መተግበሪያዎች ሊሰርዙ ይችላሉ፡፡"</string>
- <string name="permdesc_writeSms" product="default" msgid="7268668709052328567">"በስልክህ ወይም ሲም ካርድህ ላይ ኤስ ኤም ኤስ መልዕክቶችን ለመፃፍ ለመተግበሪያው ይፈቅዳሉ፡፡መልዕክቶችህን ተንኮል አዘል መተግበሪያዎች ሊሰርዙ ይችላሉ፡፡"</string>
+ <string name="permdesc_writeSms" product="default" msgid="7268668709052328567">"በስልክዎ ወይም ሲም ካርድዎ ላይ ኤስ ኤም ኤስ መልዕክቶችን ለመፃፍ ለመተግበሪያው ይፈቅዳሉ። መልዕክቶችዎን ተንኮል አዘል መተግበሪያዎች ሊሰርዙ ይችላሉ።"</string>
<string name="permlab_receiveWapPush" msgid="5991398711936590410">"የፅሁፍ መልዕክቶችን ተቀበል (WAP)"</string>
<string name="permdesc_receiveWapPush" msgid="748232190220583385">"መተግበሪያው የWAP መልእክቶችን እንዲያነብ እና እንዲያካሂድ ይፈቅዳል። ይህ ፈቃድ የተላኩልህን መልእክቶች ላንተ ሳያሳይህ የመቆጣጠር ወይም የመሰረዝ ብቃትን ያጠቃልላል።"</string>
<string name="permlab_getTasks" msgid="6466095396623933906">"አሂድ መተግበሪያዎችን ሰርስረው ያውጡ"</string>
@@ -444,12 +444,12 @@
<string name="permlab_broadcastSticky" msgid="7919126372606881614">"ልጥፍ ዝርዝር ላክ"</string>
<string name="permdesc_broadcastSticky" product="tablet" msgid="7749760494399915651">"መተግበሪያው ስርጭቱ ከተጠናቀቀ በኋላ የሚቀሩ አጣባቂ ስርጭቶችን እንዲልክ ይፈቅድለታል። ከልክ በላይ መጠቀም ጡባዊ ተኮው ብዙ ማህደረ ትውስታን እንዲጠቀም በማድረግ ቀርፋፋ ወይም ያልተረጋጋ ሊያደርገው ይችላል።"</string>
<string name="permdesc_broadcastSticky" product="default" msgid="2825803764232445091">"መተግበሪያው ስርጭቱ ከተጠናቀቀ በኋላ የሚቀሩ አጣባቂ ስርጭቶችን እንዲልክ ይፈቅድለታል። ከልክ በላይ መጠቀም ስልኩ ብዙ ማህደረ ትውስታን እንዲጠቀም በማድረግ ቀርፋፋ ወይም ያልተረጋጋ ሊያደርገው ይችላል።"</string>
- <string name="permlab_readContacts" msgid="8348481131899886131">"እውቂያዎችህን አንብብ"</string>
+ <string name="permlab_readContacts" msgid="8348481131899886131">"እውቂያዎችዎን ያንብቡ"</string>
<string name="permdesc_readContacts" product="tablet" msgid="5294866856941149639">"መተግበሪያው በጡባዊ ተኮህ ስለተከማቹ ዕውቂያዎች ያሉትን ውሂቦች በሙሉ፤ ጥሪ ያደረግክበትን፣ ኢሜይል የላክበትን ወይም ከተወሰኑ ግለሰቦች ጋር በሌላ መንገድ የተገናኘህበትን ድግምግሞሽ ጨምሮ፣ እንዲያነብ ይፈቅድለታል። ይህ ፈቃድ መተግበሪያዎች የእውቂያ ውሂብህን እንዲያስቀምጡ የሚፈቅድላቸው ሲሆን ተንኮል አዘል መተግበሪያዎች የእውቂያህን ውሂብ ሳታውቀው ሊያጋሩት ይችላሉ።"</string>
- <string name="permdesc_readContacts" product="default" msgid="8440654152457300662">"መተግበሪያው በስልክህ ስለተከማቹ ዕውቂያዎች ያሉትን ውሂቦች በሙሉ፤ ጥሪ ያደረግክበትን፣ ኢሜይል የላክበትን ወይም ከተወሰኑ ግለሰቦች ጋር በሌላ መንገድ የተገናኘህበትን ድግምግሞሽ ጨምሮ፣ እንዲያነብ ይፈቅድለታል። ይህ ፈቃድ መተግበሪያዎች የእውቂያ ውሂብህን እንዲያስቀምጡ የሚፈቅድላቸው ሲሆን ተንኮል አዘል መተግበሪያዎች የእውቂያህን ውሂብ ሳታውቀው ሊያጋሩት ይችላሉ።"</string>
+ <string name="permdesc_readContacts" product="default" msgid="8440654152457300662">"መተግበሪያው በስልክዎ ስለተከማቹ ዕውቂያዎች ያሉትን ውሂቦች በሙሉ፤ ጥሪ ያደረጉበትን፣ ኢሜይል የላኩበትን ወይም ከተወሰኑ ግለሰቦች ጋር በሌላ መንገድ የተገናኙበትን ድግምግሞሽ ጨምሮ፣ እንዲያነብ ይፈቅድለታል። ይህ ፈቃድ መተግበሪያዎች የእውቂያ ውሂብዎን እንዲያስቀምጡ የሚፈቅድላቸው ሲሆን ተንኮል አዘል መተግበሪያዎች የእውቂያዎን ውሂብ ሳያውቁት ሊያጋሩት ይችላሉ።"</string>
<string name="permlab_writeContacts" msgid="5107492086416793544">"ዕውቂያዎችዎን ያስተካክሉ"</string>
<string name="permdesc_writeContacts" product="tablet" msgid="897243932521953602">"መተግበሪያው በጡባዊ ቱኮህ ስለተከማቹ የዕውቂያዎችህ ውሂብ በሙሉ፤ ጥሪ ያደረግክበትን፣ ኢሜይል የላክበትን ወይም ከተወሰኑ እውቂያዎች ጋር በሌላ መንገድ የተገናኘህበትን ድግምግሞሽ ጨምሮ፣ እንዲያስተካክል ይፈቅድለታል። ይህ ፈቃድ መተግበሪያዎች የእውቂያ ውሂብ እንዲሰርዙ ይፈቅድላቸዋል።"</string>
- <string name="permdesc_writeContacts" product="default" msgid="589869224625163558">"መተግበሪያው በስልክህ ስለተከማቹ የዕውቂያዎችህ ውሂብ በሙሉ፤ ጥሪ ያደረግክበትን፣ ኢሜይል የላክበትን ወይም ከተወሰኑ እውቂያዎች ጋር በሌላ መንገድ የተገናኘህበትን ድግምግሞሽ ጨምሮ፣ እንዲያስተካክል ይፈቅድለታል። ይህ ፈቃድ መተግበሪያዎች የእውቂያ ውሂብ እንዲሰርዙ ይፈቅድላቸዋል።"</string>
+ <string name="permdesc_writeContacts" product="default" msgid="589869224625163558">"መተግበሪያው በስልክዎ ስለተከማቹ የዕውቂያዎችዎ ውሂብ በሙሉ፤ ጥሪ ያደረጉበትን፣ ኢሜይል የላኩበትን ወይም ከተወሰኑ እውቂያዎች ጋር በሌላ መንገድ የተገናኙበትን ድግምግሞሽ ጨምሮ፣ እንዲያስተካክል ይፈቅድለታል። ይህ ፈቃድ መተግበሪያዎች የእውቂያ ውሂብ እንዲሰርዙ ይፈቅድላቸዋል።"</string>
<string name="permlab_readCallLog" msgid="3478133184624102739">"የጥሪ ምዝግብ ማስታወሻን አንብብ"</string>
<string name="permdesc_readCallLog" product="tablet" msgid="3700645184870760285">"መተግበሪያው ስለገቢና ወጪ ጥሪዎች ያለ ውሂብን ጨምሮ የጡባዊ ተኮህን የጥሪ ምዝግብ ማስታወሻ እንዲያነብ ይፈቅድለታል። ይህ ፈቃድ መተግበሪያው የጥሪ ምዝግብ ማስታወሻ ውሂብህን እንዲያስቀምጥ የሚፈቅድለት ሲሆን ተንኮል አዘል መተግበሪያዎች ሳታውቀው የጥሪ ምዝግብ ማስታወሻ ውሂብህን ሊያጋሩት ይችላሉ።"</string>
<string name="permdesc_readCallLog" product="default" msgid="5777725796813217244">"መተግበሪያው ስለገቢና ወጪ ጥሪዎች ያለ ውሂብን ጨምሮ የስልክህን የጥሪ ምዝግብ ማስታወሻ እንዲያነብ ይፈቅድለታል። ይህ ፈቃድ መተግበሪያው የጥሪ ምዝግብ ማስታወሻ ውሂብህን እንዲያስቀምጥ የሚፈቅድለት ሲሆን ተንኮል አዘል መተግበሪያዎች ሳታውቀው የጥሪ ምዝግብ ማስታወሻ ውሂብህን ሊያጋሩት ይችላሉ።"</string>
@@ -466,10 +466,10 @@
<string name="permdesc_writeSocialStream" product="default" msgid="3086557552204114849">"መተግበሪያው ከጓኞችህን ማህበራዊ ዝማኔዎችን እንዲያሳይ ይፈቅድለታል። መረጃ ስታጋራ ተጠንቀቅ -- ይህ መተግበሪያው ከጓደኛ የመጡ የሚመስሉ መልእክቶችን እንዲያዘጋጅ ይፈቅድለታል። ማስታወሻ፦ ይህ ፈቃድ በሁሉም ማህበራዊ አውታረ መረቦች ላይ ላይፈጸም ይችላል።"</string>
<string name="permlab_readCalendar" msgid="5972727560257612398">"የቀን መቁጠሪያ ክስተቶች ተጨማሪ ሚስጥራዊ መረጃ አንብብ"</string>
<string name="permdesc_readCalendar" product="tablet" msgid="4216462049057658723">"መተግበሪያው የጓደኞችን ወይም የስራ ባልደረቦችን ጨምሮ ሁሉንም በጡባዊ ቱኮህ ላይ የተከማቹ የቀን መቁጠሪያ ክስተቶች እንዲያነብ ይፈቅድለታል። ይህ መተግበሪያው የቀን መቁጠሪያ ውሂብህን ሚስጥራዊቱን ከግምት ሳያስገባ እንዲያጋራ ወይም እንዲያስቀምጥ ሊፈቅድለት ይችላል።"</string>
- <string name="permdesc_readCalendar" product="default" msgid="7434548682470851583">"መተግበሪያው የጓደኞችን ወይም የስራ ባልደረቦችን ጨምሮ ሁሉንም በስልክህ ላይ የተከማቹ የቀን መቁጠሪያ ክስተቶች እንዲያነብ ይፈቅድለታል። ይህ መተግበሪያው የቀን መቁጠሪያ ውሂብህን ሚስጥራዊቱን ከግምት ሳያስገባ እንዲያጋራ ወይም እንዲያስቀምጥ ሊፈቅድለት ይችላል።"</string>
+ <string name="permdesc_readCalendar" product="default" msgid="7434548682470851583">"መተግበሪያው የጓደኞችን ወይም የስራ ባልደረቦችን ጨምሮ ሁሉንም በስልክዎ ላይ የተከማቹ የቀን መቁጠሪያ ክስተቶች እንዲያነብ ይፈቅድለታል። ይህ መተግበሪያው የቀን መቁጠሪያ ውሂብዎን ሚስጥራዊነቱን ከግምት ሳያስገባ እንዲያጋራ ወይም እንዲያስቀምጥ ሊፈቅድለት ይችላል።"</string>
<string name="permlab_writeCalendar" msgid="8438874755193825647">"የቀን መቁጠሪያ ክስተቶችን ቀይር ወይም አክል እና ለእንግዶች ከባለቤቱ ዕውቅና ውጪ ላክ።"</string>
<string name="permdesc_writeCalendar" product="tablet" msgid="6679035520113668528">"መተግበሪያው የጓደኞችህን እና የስራ ባልደረቦችህን ጨምሮ በጡባዊ ተኮህ ላይ ልታስተካክላቸው የምትችላቸውን ክስተቶች እንዲያክል፣ እንዲያስወግድ፣ እንዲለውጥ ይፈቅድለታል። ይህ መተግበሪያው ከቀን መቁጠሪያ ባለቤቶች የመጡ የሚመስሉ መልእክቶችን እንዲልክ ወይም ያለባለቤቱ እውቀት ክስተቶችን እንዲያስተካክል ሊፈቅድለት ይችላል።"</string>
- <string name="permdesc_writeCalendar" product="default" msgid="2324469496327249376">"መተግበሪያው የጓደኞችህን እና የስራ ባልደረቦችህን ጨምሮ በስልክህ ላይ ልታስተካክላቸው የምትችላቸውን ክስተቶች እንዲያክል፣ እንዲያስወግድ፣ እንዲለውጥ ይፈቅድለታል። ይህ መተግበሪያው ከቀን መቁጠሪያ ባለቤቶች የመጡ የሚመስሉ መልእክቶችን እንዲልክ ወይም ያለባለቤቱ እውቀት ክስተቶችን እንዲያስተካክል ሊፈቅድለት ይችላል።"</string>
+ <string name="permdesc_writeCalendar" product="default" msgid="2324469496327249376">"መተግበሪያው የጓደኞችዎን እና የስራ ባልደረቦችዎን ጨምሮ በስልክዎ ላይ ሊያስተካክሏቸው የሚችሏቸውን ክስተቶች እንዲያክል፣ እንዲያስወግድ፣ እንዲለውጥ ይፈቅድለታል። ይህ መተግበሪያው ከቀን መቁጠሪያ ባለቤቶች የመጡ የሚመስሉ መልዕክቶችን እንዲልክ ወይም ያለባለቤቱ እውቀት ክስተቶችን እንዲያስተካክል ሊፈቅድለት ይችላል።"</string>
<string name="permlab_accessMockLocation" msgid="8688334974036823330">"ለሙከራ ጊዜያዊ ሥፍራ ፍጠር።"</string>
<string name="permdesc_accessMockLocation" msgid="5808711039482051824">"ለሙከራ የማስመሰል የመነሻ ምንጮችን ፍጠር ወይም አዲስ የአካባቢ አቅራቢ ጫን። ይህ መተግበሪያው አካባቢውን እና/ወይም እንደ GPS ወይም የአካባቢ አቅራቢዎች ባሉ ሌላ የመነሻ ምንጮች የተመለሱ ሁኔታዎችን ችላ እንዲል ይፈቅድለታል።"</string>
<string name="permlab_accessLocationExtraCommands" msgid="2836308076720553837">"ተጨማሪ ሥፍራ አቅራቢ ትዕዛዞችን ድረስ።"</string>
diff --git a/core/res/res/values-da/strings.xml b/core/res/res/values-da/strings.xml
index ab7c230..a4d1b2a 100644
--- a/core/res/res/values-da/strings.xml
+++ b/core/res/res/values-da/strings.xml
@@ -235,13 +235,13 @@
<string name="permgrouplab_storage" msgid="1971118770546336966">"Lagring"</string>
<string name="permgroupdesc_storage" product="nosdcard" msgid="7442318502446874999">"Få adgang til USB-lager."</string>
<string name="permgroupdesc_storage" product="default" msgid="9203302214915355774">"Få adgang til SD-kortet."</string>
- <string name="permgrouplab_accessibilityFeatures" msgid="7919025602283593907">"Tilgængelighedsfunktioner"</string>
+ <string name="permgrouplab_accessibilityFeatures" msgid="7919025602283593907">"Hjælpefunktioner"</string>
<string name="permgroupdesc_accessibilityFeatures" msgid="4205196881678144335">"Funktioner, som hjælpeteknologier kan anmode om."</string>
<string name="capability_title_canRetrieveWindowContent" msgid="3901717936930170320">"hente indholdet i vinduet"</string>
<string name="capability_desc_canRetrieveWindowContent" msgid="3772225008605310672">"undersøge indholdet i et vindue, du interagerer med."</string>
<string name="capability_title_canRequestTouchExploration" msgid="3108723364676667320">"aktivere Udforsk ved berøring"</string>
<string name="capability_desc_canRequestTouchExploration" msgid="5800552516779249356">"De emner, der trykkes på, læses højt, og skærmen kan udforskes ved hjælp af bevægelser."</string>
- <string name="capability_title_canRequestEnhancedWebAccessibility" msgid="1739881766522594073">"aktivere forbedret webtilgængelighed"</string>
+ <string name="capability_title_canRequestEnhancedWebAccessibility" msgid="1739881766522594073">"aktivere forbedret webhjælpefunktioner"</string>
<string name="capability_desc_canRequestEnhancedWebAccessibility" msgid="7881063961507511765">"Der installeres muligvis scripts for at gøre appindhold mere tilgængeligt."</string>
<string name="capability_title_canRequestFilterKeyEvents" msgid="2103440391902412174">"observere tekst, du skriver"</string>
<string name="capability_desc_canRequestFilterKeyEvents" msgid="7463135292204152818">"Dette omfatter personlige data såsom kreditkortnumre og adgangskoder."</string>
@@ -313,8 +313,8 @@
<string name="permdesc_dump" msgid="1778299088692290329">"Tillader, at appen kan hente systemets interne tilstand. Ondsindede apps kan hente en lang række fortrolige og beskyttede oplysninger, som de normalt aldrig ville have brug for."</string>
<string name="permlab_retrieve_window_content" msgid="8022588608994589938">"hente skærmindhold"</string>
<string name="permdesc_retrieve_window_content" msgid="3193269069469700265">"Tillader, at appen kan hente indholdet i det aktive vindue. Ondsindede apps kan hente al indholdet i vinduet og undersøge al dens tekst med undtagelse af adgangskoder."</string>
- <string name="permlab_temporary_enable_accessibility" msgid="2312612135127310254">"aktivér tilgængelighed midlertidigt"</string>
- <string name="permdesc_temporary_enable_accessibility" msgid="8079456293182975464">"Tillader, at en applikation midlertidigt kan aktivere tilgængelighed på enheden. Skadelige apps kan muligvis aktivere tilgængelighed uden brugerens samtykke."</string>
+ <string name="permlab_temporary_enable_accessibility" msgid="2312612135127310254">"aktivere hjælpefunktioner midlertidigt"</string>
+ <string name="permdesc_temporary_enable_accessibility" msgid="8079456293182975464">"Tillader, at en app midlertidigt kan aktivere hjælpefunktioner på enheden. Skadelige apps kan muligvis aktivere hjælpefunktioner uden brugerens samtykke."</string>
<string name="permlab_retrieve_window_info" msgid="8532295199112519378">"hent oplysninger om vinduer"</string>
<string name="permdesc_retrieve_window_info" msgid="4998836370424186849">"Tillader, at en applikation henter oplysninger om vinduerne i vinduesadministratoren. Skadelige apps kan muligvis hente oplysninger, der er beregnet til intern systembrug."</string>
<string name="permlab_filter_events" msgid="8675535648807427389">"filtrer begivenheder"</string>
@@ -368,8 +368,8 @@
<string name="permdesc_readInputState" msgid="8387754901688728043">"Tillader, at appen kan se de taster, som du trykker på, selv i en anden app (såsom indtastning af adgangskode). Dette bør aldrig være nødvendigt for normale apps."</string>
<string name="permlab_bindInputMethod" msgid="3360064620230515776">"forpligt til en inputmetode"</string>
<string name="permdesc_bindInputMethod" msgid="3250440322807286331">"Tillader, at brugeren kan forpligter sig til en inputmetodes grænseflade på øverste niveau. Bør aldrig være nødvendigt til almindelige apps."</string>
- <string name="permlab_bindAccessibilityService" msgid="5357733942556031593">"bind dig til en tilgængelighedstjeneste"</string>
- <string name="permdesc_bindAccessibilityService" msgid="7034615928609331368">"Tillader, at brugeren binder sig til en grænseflade for en tilgængelighedstjeneste på øverste niveau. Bør aldrig være nødvendigt til almindelige apps."</string>
+ <string name="permlab_bindAccessibilityService" msgid="5357733942556031593">"binde dig til en hjælpetjeneste"</string>
+ <string name="permdesc_bindAccessibilityService" msgid="7034615928609331368">"Tillader, at appen kan binde sig til en grænseflade for en hjælpetjeneste på øverste niveau. Bør aldrig være nødvendigt til almindelige apps."</string>
<string name="permlab_bindPrintService" msgid="8462815179572748761">"forbinde til en udskriftstjeneste"</string>
<string name="permdesc_bindPrintService" msgid="7960067623209111135">"Tillader, at brugeren forbinder til grænsefladen for en udskriftstjeneste på øverste niveau. Dette bør aldrig være nødvendigt for almindelige apps."</string>
<string name="permlab_bindPrintSpoolerService" msgid="6807762783744125954">"forbinde til en udskriftsspoolertjeneste"</string>
@@ -688,11 +688,11 @@
<string name="policylab_watchLogin" msgid="914130646942199503">"Overvåg forsøg på oplåsning af skærm"</string>
<string name="policydesc_watchLogin" product="tablet" msgid="3215729294215070072">"Overvåg antallet af forkert indtastede adgangskoder, når du låser skærmen op, og lås din tablet, eller slet alle data i den, hvis der er indtastet for mange forkerte adgangskoder."</string>
<string name="policydesc_watchLogin" product="default" msgid="5712323091846761073">"Overvåg antallet af forkerte adgangskoder ved oplåsning af skærmen, og lås telefonen eller slet alle data på telefonen, hvis der er indtastet for mange forkerte adgangskoder."</string>
- <string name="policylab_resetPassword" msgid="2620077191242688955">"Skift adgangskode til oplåsning af skærm"</string>
- <string name="policydesc_resetPassword" msgid="605963962301904458">"Skift adgangskode til oplåsning af skærmen."</string>
+ <string name="policylab_resetPassword" msgid="2620077191242688955">"Skifte adgangskode til oplåsning af skærm"</string>
+ <string name="policydesc_resetPassword" msgid="605963962301904458">"Skifter adgangskode til oplåsning af skærmen."</string>
<string name="policylab_forceLock" msgid="2274085384704248431">"Lås skærmen"</string>
- <string name="policydesc_forceLock" msgid="1141797588403827138">"Kontroller, hvordan og hvornår skærmen låses."</string>
- <string name="policylab_wipeData" msgid="3910545446758639713">"Slet alle data"</string>
+ <string name="policydesc_forceLock" msgid="1141797588403827138">"Kontrollerer, hvordan og hvornår skærmen låses."</string>
+ <string name="policylab_wipeData" msgid="3910545446758639713">"Slette alle data"</string>
<string name="policydesc_wipeData" product="tablet" msgid="4306184096067756876">"Slet din tablets data uden varsel ved at gendanne fabriksindstillingerne."</string>
<string name="policydesc_wipeData" product="default" msgid="5096895604574188391">"Slet telefonens data uden varsel ved at gendanne fabriksindstillingerne."</string>
<string name="policylab_setGlobalProxy" msgid="2784828293747791446">"Angiv enhedens globale proxy"</string>
@@ -1334,7 +1334,7 @@
<string name="permission_request_notification_with_subtitle" msgid="8530393139639560189">"Der er anmodet om tilladelse\nfor kontoen <xliff:g id="ACCOUNT">%s</xliff:g>."</string>
<string name="input_method_binding_label" msgid="1283557179944992649">"Inputmetode"</string>
<string name="sync_binding_label" msgid="3687969138375092423">"Synkroniser"</string>
- <string name="accessibility_binding_label" msgid="4148120742096474641">"Tilgængelighed"</string>
+ <string name="accessibility_binding_label" msgid="4148120742096474641">"Hjælpefunktioner"</string>
<string name="wallpaper_binding_label" msgid="1240087844304687662">"Tapet"</string>
<string name="chooser_wallpaper" msgid="7873476199295190279">"Skift tapet"</string>
<string name="notification_listener_binding_label" msgid="2014162835481906429">"Underretningslytter"</string>
@@ -1553,9 +1553,9 @@
<string name="kg_text_message_separator" product="default" msgid="4160700433287233771">" – "</string>
<string name="kg_reordering_delete_drop_target_text" msgid="7899202978204438708">"Fjern"</string>
<string name="safe_media_volume_warning" product="default" msgid="7324161939475478066">"Skal lydstyrken være over det anbefalede niveau?\nDu kan skade din hørelse ved at lytte ved høj lydstyrke i længere tid."</string>
- <string name="continue_to_enable_accessibility" msgid="1626427372316070258">"Hold fortsat to fingre nede for at aktivere tilgængelighed."</string>
- <string name="accessibility_enabled" msgid="1381972048564547685">"Tilgængelighed aktiveret."</string>
- <string name="enable_accessibility_canceled" msgid="3833923257966635673">"Tilgængelighed er annulleret."</string>
+ <string name="continue_to_enable_accessibility" msgid="1626427372316070258">"Bliv ved med at holde to fingre nede for at aktivere hjælpefunktioner."</string>
+ <string name="accessibility_enabled" msgid="1381972048564547685">"Hjælpefunktioner er aktiveret."</string>
+ <string name="enable_accessibility_canceled" msgid="3833923257966635673">"Hjælpefunktioner er annulleret."</string>
<string name="user_switched" msgid="3768006783166984410">"Nuværende bruger <xliff:g id="NAME">%1$s</xliff:g>."</string>
<string name="owner_name" msgid="2716755460376028154">"Ejer"</string>
<string name="error_message_title" msgid="4510373083082500195">"Fejl"</string>
diff --git a/core/res/res/values-nb/strings.xml b/core/res/res/values-nb/strings.xml
index d5856b0..a24bcf0 100644
--- a/core/res/res/values-nb/strings.xml
+++ b/core/res/res/values-nb/strings.xml
@@ -874,7 +874,7 @@
<string name="lockscreen_forgot_pattern_button_text" msgid="2626999449610695930">"Glemt mønsteret?"</string>
<string name="lockscreen_glogin_forgot_pattern" msgid="2588521501166032747">"Opplåsing av konto"</string>
<string name="lockscreen_glogin_too_many_attempts" msgid="2751368605287288808">"For mange forsøk på tegning av mønster"</string>
- <string name="lockscreen_glogin_instructions" msgid="3931816256100707784">"Logg deg på med Google-kontoen din for å låse opp."</string>
+ <string name="lockscreen_glogin_instructions" msgid="3931816256100707784">"Logg på med Google-kontoen din for å låse opp."</string>
<string name="lockscreen_glogin_username_hint" msgid="8846881424106484447">"Brukernavn (e-post)"</string>
<string name="lockscreen_glogin_password_hint" msgid="5958028383954738528">"Passord"</string>
<string name="lockscreen_glogin_submit_button" msgid="7130893694795786300">"Logg på"</string>
@@ -1191,7 +1191,7 @@
<item quantity="other" msgid="7915895323644292768">"Åpne trådløsnett i nærheten"</item>
</plurals>
<string name="wifi_available_sign_in" msgid="4029489716605255386">"Pålogging til Wi-Fi-nettverk"</string>
- <string name="network_available_sign_in" msgid="8495155593358054676">"Logg deg på nettverket"</string>
+ <string name="network_available_sign_in" msgid="8495155593358054676">"Logg på nettverket"</string>
<!-- no translation found for network_available_sign_in_detailed (8000081941447976118) -->
<skip />
<string name="wifi_watchdog_network_disabled" msgid="7904214231651546347">"Kan ikke koble til Wi-Fi"</string>
@@ -1227,7 +1227,7 @@
<string name="sms_short_code_confirm_never_allow" msgid="446992765774269673">"Aldri tillat"</string>
<string name="sim_removed_title" msgid="6227712319223226185">"SIM-kort er fjernet"</string>
<string name="sim_removed_message" msgid="2333164559970958645">"Det mobile nettverket forblir utilgjengelig inntil du starter på nytt med et gyldig SIM-kort."</string>
- <string name="sim_done_button" msgid="827949989369963775">"Fullført"</string>
+ <string name="sim_done_button" msgid="827949989369963775">"Ferdig"</string>
<string name="sim_added_title" msgid="3719670512889674693">"SIM-kort er lagt til"</string>
<string name="sim_added_message" msgid="6599945301141050216">"Start enheten på nytt for å få tilgang til det mobile nettverket."</string>
<string name="sim_restart_button" msgid="4722407842815232347">"Start på nytt"</string>
@@ -1534,7 +1534,7 @@
<string name="kg_invalid_puk" msgid="3638289409676051243">"Skriv inn den korrekte PUK-koden på nytt. Gjentatte forsøk kommer til å deaktivere SIM-kortet."</string>
<string name="kg_invalid_confirm_pin_hint" product="default" msgid="7003469261464593516">"PIN-kodene stemmer ikke overens"</string>
<string name="kg_login_too_many_attempts" msgid="6486842094005698475">"For mange forsøk på tegning av mønster"</string>
- <string name="kg_login_instructions" msgid="1100551261265506448">"Logg deg på med Google-kontoen din for å låse opp."</string>
+ <string name="kg_login_instructions" msgid="1100551261265506448">"Logg på med Google-kontoen din for å låse opp."</string>
<string name="kg_login_username_hint" msgid="5718534272070920364">"Brukernavn (e-postadresse)"</string>
<string name="kg_login_password_hint" msgid="9057289103827298549">"Passord"</string>
<string name="kg_login_submit_button" msgid="5355904582674054702">"Logg på"</string>
diff --git a/core/res/res/values-pl/strings.xml b/core/res/res/values-pl/strings.xml
index 3b29784..aaf1b0d 100644
--- a/core/res/res/values-pl/strings.xml
+++ b/core/res/res/values-pl/strings.xml
@@ -263,8 +263,8 @@
<string name="permdesc_receiveMms" msgid="533019437263212260">"Pozwala aplikacji na odbieranie i przetwarzanie MMS-ów. To oznacza, że aplikacja będzie mogła bez Twojej wiedzy monitorować i usuwać wiadomości wysyłane do Twojego urządzenia."</string>
<string name="permlab_receiveEmergencyBroadcast" msgid="1803477660846288089">"odbiór emisji alarmowych"</string>
<string name="permdesc_receiveEmergencyBroadcast" msgid="848524070262431974">"Pozwala aplikacji na odbieranie i przetwarzanie komunikatów transmisji alarmowych. To pozwolenie jest dostępne tylko dla aplikacji systemowych."</string>
- <string name="permlab_readCellBroadcasts" msgid="1598328843619646166">"odczyt wiadomości z sieci komórkowej"</string>
- <string name="permdesc_readCellBroadcasts" msgid="6361972776080458979">"Zezwala aplikacji na odczyt wiadomości z sieci komórkowej odebranych na urządzeniu. Alerty sieci komórkowej są dostarczane w niektórych lokalizacjach w celu ostrzeżenia Cię o sytuacjach alarmowych. Złośliwe aplikacje mogą wpływać na wydajność lub zakłócać działanie urządzenia po odebraniu wiadomości alarmowej z sieci komórkowej."</string>
+ <string name="permlab_readCellBroadcasts" msgid="1598328843619646166">"odczyt komunikatów z sieci komórkowej"</string>
+ <string name="permdesc_readCellBroadcasts" msgid="6361972776080458979">"Zezwala aplikacji na odczyt komunikatów z sieci komórkowej odebranych na urządzeniu. Komunikaty alarmowe z sieci komórkowej są dostarczane w niektórych lokalizacjach w celu ostrzeżenia Cię o sytuacjach zagrożenia. Złośliwe aplikacje mogą wpływać na wydajność lub zakłócać działanie urządzenia po odebraniu komunikatu alarmowego z sieci komórkowej."</string>
<string name="permlab_sendSms" msgid="5600830612147671529">"wysyłanie wiadomości SMS"</string>
<string name="permdesc_sendSms" msgid="7094729298204937667">"Pozwala aplikacji na wysyłanie SMS-ów. Może to skutkować nieoczekiwanymi opłatami. Złośliwe aplikacje mogą generować koszty, wysyłając wiadomości bez Twojego potwierdzenia."</string>
<string name="permlab_sendRespondViaMessageRequest" msgid="8713889105305943200">"wysyłanie zdarzeń odpowiedzi przez SMS"</string>
diff --git a/docs/html/guide/faq/security.jd b/docs/html/guide/faq/security.jd
index 784d2aa..8ccf21f 100644
--- a/docs/html/guide/faq/security.jd
+++ b/docs/html/guide/faq/security.jd
@@ -59,11 +59,12 @@ of our progress in issuing a fix. </p>
<p>Vulnerabilities specific to Android OEMs should be reported to the relevant
vendor. An incomplete list of Android vendor security contacts can be found below.
-To be added to this list, please contact security@android.com.
+To be added to this list, please contact security@android.com.</p>
<ul>
- <li><a href="http://www.htc.com/www/terms/product-security/">HTC</a><li>
- <li><a href="http://www.motorolasolutions.com/US-EN/About/Security%20Vulnerability">Motorola</a><li>
+ <li><a href="http://www.htc.com/www/terms/product-security/">HTC</a></li>
+ <li><a href="http://www.motorolasolutions.com/US-EN/About/Security%20Vulnerability">Motorola</a></li>
+ <li><a href="http://developer.samsung.com/notice/How-to-Use-the-Forum">Samsung</a> - m.security@samsung.com</li>
</ul>
<a name="informed" id="informed"></a><h2>How can I stay informed about Android security?</h2>
diff --git a/docs/html/training/system-ui/immersive.jd b/docs/html/training/system-ui/immersive.jd
index 21672c8..0a1516c 100644
--- a/docs/html/training/system-ui/immersive.jd
+++ b/docs/html/training/system-ui/immersive.jd
@@ -11,8 +11,8 @@ trainingnavtop=true
<h2>This lesson teaches you to</h2>
<ol>
<li><a href="#compare">Choose an Approach</a></li>
- <li><a href="#nonsticky">Use IMMERSIVE</a></li>
- <li><a href="#sticky">Use IMMERSIVE_STICKY</a></li>
+ <li><a href="#nonsticky">Use Non-Sticky Immersion</a></li>
+ <li><a href="#sticky">Use Sticky Immersion</a></li>
</ol>
@@ -72,14 +72,6 @@ again after a few moments, you can instead use the
shown in this mode are in a transient state.
</p>
- <p>When you use {@link android.view.View#SYSTEM_UI_FLAG_IMMERSIVE IMMERSIVE} or
- {@link android.view.View#SYSTEM_UI_FLAG_IMMERSIVE_STICKY IMMERSIVE_STICKY},
- the system UI stays hidden, even while users are interacting with your
-app or game. You can capture touch events from anywhere across the screen, even areas that
-would otherwise be occupied by the system bars. This gives you a great way to create a
-larger, richer, more <a href="{@docRoot}design/patterns/fullscreen.html">
-immersive</a> UI in your app or game and reduce visual distraction at the same time.</p>
-
<p>Figure 1 illustrates the different "immersive mode" states:</p>
<img src="{@docRoot}images/training/imm-states.png"
@@ -137,12 +129,8 @@ if you use them in conjunction with {@link android.view.View#SYSTEM_UI_FLAG_HIDE
<p>The flags {@link android.view.View#SYSTEM_UI_FLAG_IMMERSIVE} and
{@link android.view.View#SYSTEM_UI_FLAG_IMMERSIVE_STICKY} both provide an immersive
- experience. But whereas the
- {@link android.view.View#SYSTEM_UI_FLAG_IMMERSIVE_STICKY IMMERSIVE_STICKY}
- flag causes semi-transparent system bars to briefly show and then hide again in response to
- a swipe gesture, the same swipe gesture causes the system bars to reappear and remain
- visible if you instead use the {@link android.view.View#SYSTEM_UI_FLAG_IMMERSIVE IMMERSIVE}
- flag. Here are examples of when you would use one vs. the other:</p>
+ experience, but with the differences in behavior described above. Here are
+ examples of when you would use one flag vs. the other:</p>
<ul>
<li>If you're building a book reader, news reader, or a magazine, use
@@ -171,7 +159,7 @@ Android 4.0 (API Level 14). For this type of app, simply using
sufficient. Don't use the "immersive" flags in this case.</li>
</ul>
-<h2 id="nonsticky">Use IMMERSIVE</h2>
+<h2 id="nonsticky">Use Non-Sticky Immersion</h2>
<p>When you use the {@link android.view.View#SYSTEM_UI_FLAG_IMMERSIVE} flag, it hides
the system bars based on what other UI flags you have set
@@ -242,7 +230,7 @@ For more discussion of these topics, watch the video
<a class ="external-link" href="http://www.youtube.com/embed/cBi8fjv90E4">DevBytes:
Android 4.4 Immersive Mode</a>.</p>
-<h2 id="sticky">Use IMMERSIVE_STICKY</h2>
+<h2 id="sticky">Use Sticky Immersion</h2>
<p>When you use the {@link android.view.View#SYSTEM_UI_FLAG_IMMERSIVE_STICKY} flag,
an inward swipe in the system bars areas causes the bars to temporarily appear in a
diff --git a/graphics/java/android/renderscript/Allocation.java b/graphics/java/android/renderscript/Allocation.java
index f253ed8..45dd25a 100644
--- a/graphics/java/android/renderscript/Allocation.java
+++ b/graphics/java/android/renderscript/Allocation.java
@@ -77,6 +77,65 @@ public class Allocation extends BaseObj {
new HashMap<Long, Allocation>();
OnBufferAvailableListener mBufferNotifier;
+ private Element.DataType validateObjectIsPrimitiveArray(Object d, boolean checkType) {
+ final Class c = d.getClass();
+ if (!c.isArray()) {
+ throw new RSIllegalArgumentException("Object passed is not an array of primitives.");
+ }
+ final Class cmp = c.getComponentType();
+ if (!cmp.isPrimitive()) {
+ throw new RSIllegalArgumentException("Object passed is not an Array of primitives.");
+ }
+
+ if (cmp == Long.TYPE) {
+ if (checkType) {
+ validateIsInt64();
+ return mType.mElement.mType;
+ }
+ return Element.DataType.SIGNED_64;
+ }
+
+ if (cmp == Integer.TYPE) {
+ if (checkType) {
+ validateIsInt32();
+ return mType.mElement.mType;
+ }
+ return Element.DataType.SIGNED_32;
+ }
+
+ if (cmp == Short.TYPE) {
+ if (checkType) {
+ validateIsInt16();
+ return mType.mElement.mType;
+ }
+ return Element.DataType.SIGNED_16;
+ }
+
+ if (cmp == Byte.TYPE) {
+ if (checkType) {
+ validateIsInt8();
+ return mType.mElement.mType;
+ }
+ return Element.DataType.SIGNED_8;
+ }
+
+ if (cmp == Float.TYPE) {
+ if (checkType) {
+ validateIsFloat32();
+ }
+ return Element.DataType.FLOAT_32;
+ }
+
+ if (cmp == Double.TYPE) {
+ if (checkType) {
+ validateIsFloat64();
+ }
+ return Element.DataType.FLOAT_64;
+ }
+ return null;
+ }
+
+
/**
* The usage of the Allocation. These signal to RenderScript where to place
* the Allocation in memory.
@@ -285,6 +344,15 @@ public class Allocation extends BaseObj {
super.finalize();
}
+ private void validateIsInt64() {
+ if ((mType.mElement.mType == Element.DataType.SIGNED_64) ||
+ (mType.mElement.mType == Element.DataType.UNSIGNED_64)) {
+ return;
+ }
+ throw new RSIllegalArgumentException(
+ "64 bit integer source does not match allocation type " + mType.mElement.mType);
+ }
+
private void validateIsInt32() {
if ((mType.mElement.mType == Element.DataType.SIGNED_32) ||
(mType.mElement.mType == Element.DataType.UNSIGNED_32)) {
@@ -320,6 +388,14 @@ public class Allocation extends BaseObj {
"32 bit float source does not match allocation type " + mType.mElement.mType);
}
+ private void validateIsFloat64() {
+ if (mType.mElement.mType == Element.DataType.FLOAT_64) {
+ return;
+ }
+ throw new RSIllegalArgumentException(
+ "64 bit float source does not match allocation type " + mType.mElement.mType);
+ }
+
private void validateIsObject() {
if ((mType.mElement.mType == Element.DataType.RS_ELEMENT) ||
(mType.mElement.mType == Element.DataType.RS_TYPE) ||
@@ -500,23 +576,30 @@ public class Allocation extends BaseObj {
}
}
+ private void copyFromUnchecked(Object array, Element.DataType dt, int arrayLen) {
+ Trace.traceBegin(RenderScript.TRACE_TAG, "copyFromUnchecked");
+ mRS.validate();
+ if (mCurrentDimZ > 0) {
+ copy3DRangeFromUnchecked(0, 0, 0, mCurrentDimX, mCurrentDimY, mCurrentDimZ, array, dt, arrayLen);
+ } else if (mCurrentDimY > 0) {
+ copy2DRangeFromUnchecked(0, 0, mCurrentDimX, mCurrentDimY, array, dt, arrayLen);
+ } else {
+ copy1DRangeFromUnchecked(0, mCurrentCount, array, dt, arrayLen);
+ }
+ Trace.traceEnd(RenderScript.TRACE_TAG);
+ }
+
/**
* Copy into this Allocation from an array. This method does not guarantee
* that the Allocation is compatible with the input buffer; it copies memory
* without reinterpretation.
*
- * @param d the source data array
+ * @param array The source data array
*/
- public void copyFromUnchecked(int[] d) {
+ public void copyFromUnchecked(Object array) {
Trace.traceBegin(RenderScript.TRACE_TAG, "copyFromUnchecked");
- mRS.validate();
- if (mCurrentDimZ > 0) {
- copy3DRangeFromUnchecked(0, 0, 0, mCurrentDimX, mCurrentDimY, mCurrentDimZ, d);
- } else if (mCurrentDimY > 0) {
- copy2DRangeFromUnchecked(0, 0, mCurrentDimX, mCurrentDimY, d);
- } else {
- copy1DRangeFromUnchecked(0, mCurrentCount, d);
- }
+ copyFromUnchecked(array, validateObjectIsPrimitiveArray(array, false),
+ java.lang.reflect.Array.getLength(array));
Trace.traceEnd(RenderScript.TRACE_TAG);
}
@@ -527,17 +610,19 @@ public class Allocation extends BaseObj {
*
* @param d the source data array
*/
+ public void copyFromUnchecked(int[] d) {
+ copyFromUnchecked(d, Element.DataType.SIGNED_32, d.length);
+ }
+
+ /**
+ * Copy into this Allocation from an array. This method does not guarantee
+ * that the Allocation is compatible with the input buffer; it copies memory
+ * without reinterpretation.
+ *
+ * @param d the source data array
+ */
public void copyFromUnchecked(short[] d) {
- Trace.traceBegin(RenderScript.TRACE_TAG, "copyFromUnchecked");
- mRS.validate();
- if (mCurrentDimZ > 0) {
- copy3DRangeFromUnchecked(0, 0, 0, mCurrentDimX, mCurrentDimY, mCurrentDimZ, d);
- } else if (mCurrentDimY > 0) {
- copy2DRangeFromUnchecked(0, 0, mCurrentDimX, mCurrentDimY, d);
- } else {
- copy1DRangeFromUnchecked(0, mCurrentCount, d);
- }
- Trace.traceEnd(RenderScript.TRACE_TAG);
+ copyFromUnchecked(d, Element.DataType.SIGNED_16, d.length);
}
/**
@@ -548,16 +633,7 @@ public class Allocation extends BaseObj {
* @param d the source data array
*/
public void copyFromUnchecked(byte[] d) {
- Trace.traceBegin(RenderScript.TRACE_TAG, "copyFromUnchecked");
- mRS.validate();
- if (mCurrentDimZ > 0) {
- copy3DRangeFromUnchecked(0, 0, 0, mCurrentDimX, mCurrentDimY, mCurrentDimZ, d);
- } else if (mCurrentDimY > 0) {
- copy2DRangeFromUnchecked(0, 0, mCurrentDimX, mCurrentDimY, d);
- } else {
- copy1DRangeFromUnchecked(0, mCurrentCount, d);
- }
- Trace.traceEnd(RenderScript.TRACE_TAG);
+ copyFromUnchecked(d, Element.DataType.SIGNED_8, d.length);
}
/**
@@ -568,37 +644,35 @@ public class Allocation extends BaseObj {
* @param d the source data array
*/
public void copyFromUnchecked(float[] d) {
- Trace.traceBegin(RenderScript.TRACE_TAG, "copyFromUnchecked");
- mRS.validate();
- if (mCurrentDimZ > 0) {
- copy3DRangeFromUnchecked(0, 0, 0, mCurrentDimX, mCurrentDimY, mCurrentDimZ, d);
- } else if (mCurrentDimY > 0) {
- copy2DRangeFromUnchecked(0, 0, mCurrentDimX, mCurrentDimY, d);
- } else {
- copy1DRangeFromUnchecked(0, mCurrentCount, d);
- }
- Trace.traceEnd(RenderScript.TRACE_TAG);
+ copyFromUnchecked(d, Element.DataType.FLOAT_32, d.length);
}
/**
* Copy into this Allocation from an array. This variant is type checked
* and will generate exceptions if the Allocation's {@link
+ * android.renderscript.Element} does not match the array's
+ * primitive type.
+ *
+ * @param array The source data array
+ */
+ public void copyFrom(Object array) {
+ Trace.traceBegin(RenderScript.TRACE_TAG, "copyFrom");
+ copyFromUnchecked(array, validateObjectIsPrimitiveArray(array, true),
+ java.lang.reflect.Array.getLength(array));
+ Trace.traceEnd(RenderScript.TRACE_TAG);
+ }
+
+ /**
+ * Copy into this Allocation from an array. This variant is type checked
+ * and will generate exceptions if the Allocation's {@link
* android.renderscript.Element} is not a 32 bit integer type.
*
* @param d the source data array
*/
public void copyFrom(int[] d) {
- Trace.traceBegin(RenderScript.TRACE_TAG, "copyFrom");
- mRS.validate();
- if (mCurrentDimZ > 0) {
- copy3DRangeFrom(0, 0, 0, mCurrentDimX, mCurrentDimY, mCurrentDimZ, d);
- } else if (mCurrentDimY > 0) {
- copy2DRangeFrom(0, 0, mCurrentDimX, mCurrentDimY, d);
- } else {
- copy1DRangeFrom(0, mCurrentCount, d);
- }
- Trace.traceEnd(RenderScript.TRACE_TAG);
+ validateIsInt32();
+ copyFromUnchecked(d, Element.DataType.SIGNED_32, d.length);
}
/**
@@ -609,16 +683,8 @@ public class Allocation extends BaseObj {
* @param d the source data array
*/
public void copyFrom(short[] d) {
- Trace.traceBegin(RenderScript.TRACE_TAG, "copyFrom");
- mRS.validate();
- if (mCurrentDimZ > 0) {
- copy3DRangeFrom(0, 0, 0, mCurrentDimX, mCurrentDimY, mCurrentDimZ, d);
- } else if (mCurrentDimY > 0) {
- copy2DRangeFrom(0, 0, mCurrentDimX, mCurrentDimY, d);
- } else {
- copy1DRangeFrom(0, mCurrentCount, d);
- }
- Trace.traceEnd(RenderScript.TRACE_TAG);
+ validateIsInt16();
+ copyFromUnchecked(d, Element.DataType.SIGNED_16, d.length);
}
/**
@@ -629,16 +695,8 @@ public class Allocation extends BaseObj {
* @param d the source data array
*/
public void copyFrom(byte[] d) {
- Trace.traceBegin(RenderScript.TRACE_TAG, "copyFrom");
- mRS.validate();
- if (mCurrentDimZ > 0) {
- copy3DRangeFrom(0, 0, 0, mCurrentDimX, mCurrentDimY, mCurrentDimZ, d);
- } else if (mCurrentDimY > 0) {
- copy2DRangeFrom(0, 0, mCurrentDimX, mCurrentDimY, d);
- } else {
- copy1DRangeFrom(0, mCurrentCount, d);
- }
- Trace.traceEnd(RenderScript.TRACE_TAG);
+ validateIsInt8();
+ copyFromUnchecked(d, Element.DataType.SIGNED_8, d.length);
}
/**
@@ -649,16 +707,8 @@ public class Allocation extends BaseObj {
* @param d the source data array
*/
public void copyFrom(float[] d) {
- Trace.traceBegin(RenderScript.TRACE_TAG, "copyFrom");
- mRS.validate();
- if (mCurrentDimZ > 0) {
- copy3DRangeFrom(0, 0, 0, mCurrentDimX, mCurrentDimY, mCurrentDimZ, d);
- } else if (mCurrentDimY > 0) {
- copy2DRangeFrom(0, 0, mCurrentDimX, mCurrentDimY, d);
- } else {
- copy1DRangeFrom(0, mCurrentCount, d);
- }
- Trace.traceEnd(RenderScript.TRACE_TAG);
+ validateIsFloat32();
+ copyFromUnchecked(d, Element.DataType.FLOAT_32, d.length);
}
/**
@@ -787,6 +837,29 @@ public class Allocation extends BaseObj {
mRS.nAllocationGenerateMipmaps(getID(mRS));
}
+ private void copy1DRangeFromUnchecked(int off, int count, Object array,
+ Element.DataType dt, int arrayLen) {
+ Trace.traceBegin(RenderScript.TRACE_TAG, "copy1DRangeFromUnchecked");
+ final int dataSize = mType.mElement.getBytesSize() * count;
+ data1DChecks(off, count, arrayLen * dt.mSize, dataSize);
+ mRS.nAllocationData1D(getIDSafe(), off, mSelectedLOD, count, array, dataSize, dt);
+ Trace.traceEnd(RenderScript.TRACE_TAG);
+ }
+
+ /**
+ * Copy an array into part of this Allocation. This method does not
+ * guarantee that the Allocation is compatible with the input buffer.
+ *
+ * @param off The offset of the first element to be copied.
+ * @param count The number of elements to be copied.
+ * @param array The source data array
+ */
+ public void copy1DRangeFromUnchecked(int off, int count, Object array) {
+ copy1DRangeFromUnchecked(off, count, array,
+ validateObjectIsPrimitiveArray(array, false),
+ java.lang.reflect.Array.getLength(array));
+ }
+
/**
* Copy an array into part of this Allocation. This method does not
* guarantee that the Allocation is compatible with the input buffer.
@@ -796,11 +869,7 @@ public class Allocation extends BaseObj {
* @param d the source data array
*/
public void copy1DRangeFromUnchecked(int off, int count, int[] d) {
- Trace.traceBegin(RenderScript.TRACE_TAG, "copy1DRangeFromUnchecked");
- int dataSize = mType.mElement.getBytesSize() * count;
- data1DChecks(off, count, d.length * 4, dataSize);
- mRS.nAllocationData1D(getIDSafe(), off, mSelectedLOD, count, d, dataSize, Element.DataType.SIGNED_32);
- Trace.traceEnd(RenderScript.TRACE_TAG);
+ copy1DRangeFromUnchecked(off, count, (Object)d, Element.DataType.SIGNED_32, d.length);
}
/**
@@ -812,11 +881,7 @@ public class Allocation extends BaseObj {
* @param d the source data array
*/
public void copy1DRangeFromUnchecked(int off, int count, short[] d) {
- Trace.traceBegin(RenderScript.TRACE_TAG, "copy1DRangeFromUnchecked");
- int dataSize = mType.mElement.getBytesSize() * count;
- data1DChecks(off, count, d.length * 2, dataSize);
- mRS.nAllocationData1D(getIDSafe(), off, mSelectedLOD, count, d, dataSize, Element.DataType.SIGNED_16);
- Trace.traceEnd(RenderScript.TRACE_TAG);
+ copy1DRangeFromUnchecked(off, count, (Object)d, Element.DataType.SIGNED_16, d.length);
}
/**
@@ -828,11 +893,7 @@ public class Allocation extends BaseObj {
* @param d the source data array
*/
public void copy1DRangeFromUnchecked(int off, int count, byte[] d) {
- Trace.traceBegin(RenderScript.TRACE_TAG, "copy1DRangeFromUnchecked");
- int dataSize = mType.mElement.getBytesSize() * count;
- data1DChecks(off, count, d.length, dataSize);
- mRS.nAllocationData1D(getIDSafe(), off, mSelectedLOD, count, d, dataSize, Element.DataType.SIGNED_8);
- Trace.traceEnd(RenderScript.TRACE_TAG);
+ copy1DRangeFromUnchecked(off, count, (Object)d, Element.DataType.SIGNED_8, d.length);
}
/**
@@ -844,11 +905,23 @@ public class Allocation extends BaseObj {
* @param d the source data array
*/
public void copy1DRangeFromUnchecked(int off, int count, float[] d) {
- Trace.traceBegin(RenderScript.TRACE_TAG, "copy1DRangeFromUnchecked");
- int dataSize = mType.mElement.getBytesSize() * count;
- data1DChecks(off, count, d.length * 4, dataSize);
- mRS.nAllocationData1D(getIDSafe(), off, mSelectedLOD, count, d, dataSize, Element.DataType.FLOAT_32);
- Trace.traceEnd(RenderScript.TRACE_TAG);
+ copy1DRangeFromUnchecked(off, count, (Object)d, Element.DataType.FLOAT_32, d.length);
+ }
+
+
+ /**
+ * Copy an array into part of this Allocation. This variant is type checked
+ * and will generate exceptions if the Allocation type does not
+ * match the component type of the array passed in.
+ *
+ * @param off The offset of the first element to be copied.
+ * @param count The number of elements to be copied.
+ * @param array The source data array.
+ */
+ public void copy1DRangeFrom(int off, int count, Object array) {
+ copy1DRangeFromUnchecked(off, count, array,
+ validateObjectIsPrimitiveArray(array, true),
+ java.lang.reflect.Array.getLength(array));
}
/**
@@ -861,10 +934,8 @@ public class Allocation extends BaseObj {
* @param d the source data array
*/
public void copy1DRangeFrom(int off, int count, int[] d) {
- Trace.traceBegin(RenderScript.TRACE_TAG, "copy1DRangeFrom");
validateIsInt32();
- copy1DRangeFromUnchecked(off, count, d);
- Trace.traceEnd(RenderScript.TRACE_TAG);
+ copy1DRangeFromUnchecked(off, count, d, Element.DataType.SIGNED_32, d.length);
}
/**
@@ -877,10 +948,8 @@ public class Allocation extends BaseObj {
* @param d the source data array
*/
public void copy1DRangeFrom(int off, int count, short[] d) {
- Trace.traceBegin(RenderScript.TRACE_TAG, "copy1DRangeFrom");
validateIsInt16();
- copy1DRangeFromUnchecked(off, count, d);
- Trace.traceEnd(RenderScript.TRACE_TAG);
+ copy1DRangeFromUnchecked(off, count, d, Element.DataType.SIGNED_16, d.length);
}
/**
@@ -893,10 +962,8 @@ public class Allocation extends BaseObj {
* @param d the source data array
*/
public void copy1DRangeFrom(int off, int count, byte[] d) {
- Trace.traceBegin(RenderScript.TRACE_TAG, "copy1DRangeFrom");
validateIsInt8();
- copy1DRangeFromUnchecked(off, count, d);
- Trace.traceEnd(RenderScript.TRACE_TAG);
+ copy1DRangeFromUnchecked(off, count, d, Element.DataType.SIGNED_8, d.length);
}
/**
@@ -909,11 +976,10 @@ public class Allocation extends BaseObj {
* @param d the source data array.
*/
public void copy1DRangeFrom(int off, int count, float[] d) {
- Trace.traceBegin(RenderScript.TRACE_TAG, "copy1DRangeFrom");
validateIsFloat32();
- copy1DRangeFromUnchecked(off, count, d);
- Trace.traceEnd(RenderScript.TRACE_TAG);
+ copy1DRangeFromUnchecked(off, count, d, Element.DataType.FLOAT_32, d.length);
}
+
/**
* Copy part of an Allocation into this Allocation.
*
@@ -948,39 +1014,31 @@ public class Allocation extends BaseObj {
}
}
- void copy2DRangeFromUnchecked(int xoff, int yoff, int w, int h, byte[] data) {
+ void copy2DRangeFromUnchecked(int xoff, int yoff, int w, int h, Object array,
+ Element.DataType dt, int arrayLen) {
Trace.traceBegin(RenderScript.TRACE_TAG, "copy2DRangeFromUnchecked");
mRS.validate();
validate2DRange(xoff, yoff, w, h);
- mRS.nAllocationData2D(getIDSafe(), xoff, yoff, mSelectedLOD, mSelectedFace.mID,
- w, h, data, data.length, Element.DataType.SIGNED_8);
+ mRS.nAllocationData2D(getIDSafe(), xoff, yoff, mSelectedLOD, mSelectedFace.mID, w, h,
+ array, arrayLen * dt.mSize, dt);
Trace.traceEnd(RenderScript.TRACE_TAG);
}
- void copy2DRangeFromUnchecked(int xoff, int yoff, int w, int h, short[] data) {
- Trace.traceBegin(RenderScript.TRACE_TAG, "copy2DRangeFromUnchecked");
- mRS.validate();
- validate2DRange(xoff, yoff, w, h);
- mRS.nAllocationData2D(getIDSafe(), xoff, yoff, mSelectedLOD, mSelectedFace.mID,
- w, h, data, data.length * 2, Element.DataType.SIGNED_16);
- Trace.traceEnd(RenderScript.TRACE_TAG);
- }
-
- void copy2DRangeFromUnchecked(int xoff, int yoff, int w, int h, int[] data) {
- Trace.traceBegin(RenderScript.TRACE_TAG, "copy2DRangeFromUnchecked");
- mRS.validate();
- validate2DRange(xoff, yoff, w, h);
- mRS.nAllocationData2D(getIDSafe(), xoff, yoff, mSelectedLOD, mSelectedFace.mID,
- w, h, data, data.length * 4, Element.DataType.SIGNED_32);
- Trace.traceEnd(RenderScript.TRACE_TAG);
- }
-
- void copy2DRangeFromUnchecked(int xoff, int yoff, int w, int h, float[] data) {
- Trace.traceBegin(RenderScript.TRACE_TAG, "copy2DRangeFromUnchecked");
- mRS.validate();
- validate2DRange(xoff, yoff, w, h);
- mRS.nAllocationData2D(getIDSafe(), xoff, yoff, mSelectedLOD, mSelectedFace.mID,
- w, h, data, data.length * 4, Element.DataType.FLOAT_32);
+ /**
+ * Copy from an array into a rectangular region in this Allocation. The
+ * array is assumed to be tightly packed.
+ *
+ * @param xoff X offset of the region to update in this Allocation
+ * @param yoff Y offset of the region to update in this Allocation
+ * @param w Width of the region to update
+ * @param h Height of the region to update
+ * @param array Data to be placed into the Allocation
+ */
+ public void copy2DRangeFrom(int xoff, int yoff, int w, int h, Object array) {
+ Trace.traceBegin(RenderScript.TRACE_TAG, "copy2DRangeFrom");
+ copy2DRangeFromUnchecked(xoff, yoff, w, h, array,
+ validateObjectIsPrimitiveArray(array, true),
+ java.lang.reflect.Array.getLength(array));
Trace.traceEnd(RenderScript.TRACE_TAG);
}
@@ -995,10 +1053,9 @@ public class Allocation extends BaseObj {
* @param data to be placed into the Allocation
*/
public void copy2DRangeFrom(int xoff, int yoff, int w, int h, byte[] data) {
- Trace.traceBegin(RenderScript.TRACE_TAG, "copy2DRangeFrom");
validateIsInt8();
- copy2DRangeFromUnchecked(xoff, yoff, w, h, data);
- Trace.traceEnd(RenderScript.TRACE_TAG);
+ copy2DRangeFromUnchecked(xoff, yoff, w, h, data,
+ Element.DataType.SIGNED_8, data.length);
}
/**
@@ -1012,10 +1069,9 @@ public class Allocation extends BaseObj {
* @param data to be placed into the Allocation
*/
public void copy2DRangeFrom(int xoff, int yoff, int w, int h, short[] data) {
- Trace.traceBegin(RenderScript.TRACE_TAG, "copy2DRangeFrom");
validateIsInt16();
- copy2DRangeFromUnchecked(xoff, yoff, w, h, data);
- Trace.traceEnd(RenderScript.TRACE_TAG);
+ copy2DRangeFromUnchecked(xoff, yoff, w, h, data,
+ Element.DataType.SIGNED_16, data.length);
}
/**
@@ -1029,10 +1085,9 @@ public class Allocation extends BaseObj {
* @param data to be placed into the Allocation
*/
public void copy2DRangeFrom(int xoff, int yoff, int w, int h, int[] data) {
- Trace.traceBegin(RenderScript.TRACE_TAG, "copy2DRangeFrom");
validateIsInt32();
- copy2DRangeFromUnchecked(xoff, yoff, w, h, data);
- Trace.traceEnd(RenderScript.TRACE_TAG);
+ copy2DRangeFromUnchecked(xoff, yoff, w, h, data,
+ Element.DataType.SIGNED_32, data.length);
}
/**
@@ -1046,10 +1101,9 @@ public class Allocation extends BaseObj {
* @param data to be placed into the Allocation
*/
public void copy2DRangeFrom(int xoff, int yoff, int w, int h, float[] data) {
- Trace.traceBegin(RenderScript.TRACE_TAG, "copy2DRangeFrom");
validateIsFloat32();
- copy2DRangeFromUnchecked(xoff, yoff, w, h, data);
- Trace.traceEnd(RenderScript.TRACE_TAG);
+ copy2DRangeFromUnchecked(xoff, yoff, w, h, data,
+ Element.DataType.FLOAT_32, data.length);
}
/**
@@ -1122,47 +1176,16 @@ public class Allocation extends BaseObj {
* @hide
*
*/
- void copy3DRangeFromUnchecked(int xoff, int yoff, int zoff, int w, int h, int d, byte[] data) {
- mRS.validate();
- validate3DRange(xoff, yoff, zoff, w, h, d);
- mRS.nAllocationData3D(getIDSafe(), xoff, yoff, zoff, mSelectedLOD,
- w, h, d, data, data.length, Element.DataType.SIGNED_8);
- }
-
- /**
- * @hide
- *
- */
- void copy3DRangeFromUnchecked(int xoff, int yoff, int zoff, int w, int h, int d, short[] data) {
+ private void copy3DRangeFromUnchecked(int xoff, int yoff, int zoff, int w, int h, int d,
+ Object array, Element.DataType dt, int arrayLen) {
+ Trace.traceBegin(RenderScript.TRACE_TAG, "copy3DRangeFromUnchecked");
mRS.validate();
validate3DRange(xoff, yoff, zoff, w, h, d);
- mRS.nAllocationData3D(getIDSafe(), xoff, yoff, zoff, mSelectedLOD,
- w, h, d, data, data.length * 2, Element.DataType.SIGNED_16);
- }
-
- /**
- * @hide
- *
- */
- void copy3DRangeFromUnchecked(int xoff, int yoff, int zoff, int w, int h, int d, int[] data) {
- mRS.validate();
- validate3DRange(xoff, yoff, zoff, w, h, d);
- mRS.nAllocationData3D(getIDSafe(), xoff, yoff, zoff, mSelectedLOD,
- w, h, d, data, data.length * 4, Element.DataType.SIGNED_32);
- }
-
- /**
- * @hide
- *
- */
- void copy3DRangeFromUnchecked(int xoff, int yoff, int zoff, int w, int h, int d, float[] data) {
- mRS.validate();
- validate3DRange(xoff, yoff, zoff, w, h, d);
- mRS.nAllocationData3D(getIDSafe(), xoff, yoff, zoff, mSelectedLOD,
- w, h, d, data, data.length * 4, Element.DataType.FLOAT_32);
+ mRS.nAllocationData3D(getIDSafe(), xoff, yoff, zoff, mSelectedLOD, w, h, d,
+ array, arrayLen * dt.mSize, dt);
+ Trace.traceEnd(RenderScript.TRACE_TAG);
}
-
/**
* @hide
* Copy a rectangular region from the array into the allocation.
@@ -1176,36 +1199,12 @@ public class Allocation extends BaseObj {
* @param d Depth of the region to update
* @param data to be placed into the allocation
*/
- public void copy3DRangeFrom(int xoff, int yoff, int zoff, int w, int h, int d, byte[] data) {
- validateIsInt8();
- copy3DRangeFromUnchecked(xoff, yoff, zoff, w, h, d, data);
- }
-
- /**
- * @hide
- *
- */
- public void copy3DRangeFrom(int xoff, int yoff, int zoff, int w, int h, int d, short[] data) {
- validateIsInt16();
- copy3DRangeFromUnchecked(xoff, yoff, zoff, w, h, d, data);
- }
-
- /**
- * @hide
- *
- */
- public void copy3DRangeFrom(int xoff, int yoff, int zoff, int w, int h, int d, int[] data) {
- validateIsInt32();
- copy3DRangeFromUnchecked(xoff, yoff, zoff, w, h, d, data);
- }
-
- /**
- * @hide
- *
- */
- public void copy3DRangeFrom(int xoff, int yoff, int zoff, int w, int h, int d, float[] data) {
- validateIsFloat32();
- copy3DRangeFromUnchecked(xoff, yoff, zoff, w, h, d, data);
+ public void copy3DRangeFrom(int xoff, int yoff, int zoff, int w, int h, int d, Object array) {
+ Trace.traceBegin(RenderScript.TRACE_TAG, "copy3DRangeFrom");
+ copy3DRangeFromUnchecked(xoff, yoff, zoff, w, h, d, array,
+ validateObjectIsPrimitiveArray(array, true),
+ java.lang.reflect.Array.getLength(array));
+ Trace.traceEnd(RenderScript.TRACE_TAG);
}
/**
@@ -1249,6 +1248,26 @@ public class Allocation extends BaseObj {
Trace.traceEnd(RenderScript.TRACE_TAG);
}
+ private void copyTo(Object array, Element.DataType dt, int arrayLen) {
+ Trace.traceBegin(RenderScript.TRACE_TAG, "copyTo");
+ mRS.validate();
+ mRS.nAllocationRead(getID(mRS), array, dt);
+ Trace.traceEnd(RenderScript.TRACE_TAG);
+ }
+
+ /**
+ * Copy from the Allocation into an array. The array must be at
+ * least as large as the Allocation. The
+ * {@link android.renderscript.Element} must match the component
+ * type of the array passed in.
+ *
+ * @param array The array to be set from the Allocation.
+ */
+ public void copyTo(Object array) {
+ copyTo(array, validateObjectIsPrimitiveArray(array, true),
+ java.lang.reflect.Array.getLength(array));
+ }
+
/**
* Copy from the Allocation into a byte array. The array must be at least
* as large as the Allocation. The allocation must be of an 8 bit integer
@@ -1257,11 +1276,8 @@ public class Allocation extends BaseObj {
* @param d The array to be set from the Allocation.
*/
public void copyTo(byte[] d) {
- Trace.traceBegin(RenderScript.TRACE_TAG, "copyTo");
validateIsInt8();
- mRS.validate();
- mRS.nAllocationRead(getID(mRS), d, Element.DataType.SIGNED_8);
- Trace.traceEnd(RenderScript.TRACE_TAG);
+ copyTo(d, Element.DataType.SIGNED_8, d.length);
}
/**
@@ -1272,11 +1288,8 @@ public class Allocation extends BaseObj {
* @param d The array to be set from the Allocation.
*/
public void copyTo(short[] d) {
- Trace.traceBegin(RenderScript.TRACE_TAG, "copyTo");
validateIsInt16();
- mRS.validate();
- mRS.nAllocationRead(getID(mRS), d, Element.DataType.SIGNED_16);
- Trace.traceEnd(RenderScript.TRACE_TAG);
+ copyTo(d, Element.DataType.SIGNED_16, d.length);
}
/**
@@ -1287,11 +1300,8 @@ public class Allocation extends BaseObj {
* @param d The array to be set from the Allocation.
*/
public void copyTo(int[] d) {
- Trace.traceBegin(RenderScript.TRACE_TAG, "copyTo");
validateIsInt32();
- mRS.validate();
- mRS.nAllocationRead(getID(mRS), d, Element.DataType.SIGNED_32);
- Trace.traceEnd(RenderScript.TRACE_TAG);
+ copyTo(d, Element.DataType.SIGNED_32, d.length);
}
/**
@@ -1302,11 +1312,8 @@ public class Allocation extends BaseObj {
* @param d The array to be set from the Allocation.
*/
public void copyTo(float[] d) {
- Trace.traceBegin(RenderScript.TRACE_TAG, "copyTo");
validateIsFloat32();
- mRS.validate();
- mRS.nAllocationRead(getID(mRS), d, Element.DataType.FLOAT_32);
- Trace.traceEnd(RenderScript.TRACE_TAG);
+ copyTo(d, Element.DataType.FLOAT_32, d.length);
}
/**
@@ -1856,4 +1863,3 @@ public class Allocation extends BaseObj {
}
}
-
diff --git a/graphics/java/android/renderscript/Byte2.java b/graphics/java/android/renderscript/Byte2.java
index ef7c770..3ad79e4 100644
--- a/graphics/java/android/renderscript/Byte2.java
+++ b/graphics/java/android/renderscript/Byte2.java
@@ -22,6 +22,9 @@ package android.renderscript;
*
**/
public class Byte2 {
+ public byte x;
+ public byte y;
+
public Byte2() {
}
@@ -30,8 +33,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 025e8de..a138313 100644
--- a/graphics/java/android/renderscript/Byte3.java
+++ b/graphics/java/android/renderscript/Byte3.java
@@ -22,6 +22,10 @@ package android.renderscript;
*
**/
public class Byte3 {
+ public byte x;
+ public byte y;
+ public byte z;
+
public Byte3() {
}
@@ -31,9 +35,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 7df2104..fa4c13d 100644
--- a/graphics/java/android/renderscript/Byte4.java
+++ b/graphics/java/android/renderscript/Byte4.java
@@ -22,6 +22,11 @@ package android.renderscript;
*
**/
public class Byte4 {
+ public byte x;
+ public byte y;
+ public byte z;
+ public byte w;
+
public Byte4() {
}
@@ -31,11 +36,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 6e1afe6..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,25 +16,370 @@
package android.renderscript;
-
/**
- * 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 7c0979d..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,27 +16,402 @@
package android.renderscript;
-
/**
- * 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 9e82611..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,28 +16,435 @@
package android.renderscript;
-
/**
- * 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 427f038..e9f8ca7 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,24 +16,369 @@
package android.renderscript;
-
/**
- * 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 bfe143a..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,25 +16,402 @@
package android.renderscript;
-
/**
- * 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 67c7afc..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,27 +16,435 @@
package android.renderscript;
-
/**
- * 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 524e361..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,24 +16,425 @@
package android.renderscript;
-
/**
- * 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 df42e28..5431b9a 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,26 +16,462 @@
package android.renderscript;
-
/**
- * 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() {
}
- public Int3(int initX, int initY, int initZ) {
- x = initX;
- y = initY;
- z = initZ;
+ /** @hide */
+ public Int3(int i) {
+ this.x = this.y = this.z = i;
}
- public int x;
- public int y;
- public int z;
-}
+ public Int3(int x, int y, int z) {
+ this.x = x;
+ this.y = y;
+ this.z = 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 408fb0d..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,27 +16,499 @@
package android.renderscript;
-
/**
- * 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 70fc374..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,23 +16,425 @@
package android.renderscript;
-
/**
- * 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 d81826b..8e243cc 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,25 +16,462 @@
package android.renderscript;
-
/**
- * 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() {
}
- public Long3(long initX, long initY, long initZ) {
- x = initX;
- y = initY;
- z = initZ;
+ /** @hide */
+ public Long3(long i) {
+ this.x = this.y = this.z = i;
}
- public long x;
- public long y;
- public long z;
-}
+ public Long3(long x, long y, long z) {
+ this.x = x;
+ this.y = y;
+ this.z = 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 47ef437..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,26 +16,499 @@
package android.renderscript;
-
/**
- * 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/Short2.java b/graphics/java/android/renderscript/Short2.java
index 2c6c334..24809f7 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.
@@ -20,20 +20,424 @@ package android.renderscript;
/**
* 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 aafd27b..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,26 +16,462 @@
package android.renderscript;
-
/**
- * 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 176bde9..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,27 +16,499 @@
package android.renderscript;
-
/**
- * 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);
+ }
+}
diff --git a/libs/hwui/DisplayList.cpp b/libs/hwui/DisplayList.cpp
index bb6526e..a3e4bb4 100644
--- a/libs/hwui/DisplayList.cpp
+++ b/libs/hwui/DisplayList.cpp
@@ -526,7 +526,7 @@ void DisplayList::iterate(OpenGLRenderer& renderer, T& handler, const int level)
setViewProperties<T>(renderer, handler, level + 1);
- if (mClipToBounds && renderer.quickRejectNoScissor(0, 0, mWidth, mHeight)) {
+ if (mClipToBounds && renderer.quickRejectConservative(0, 0, mWidth, mHeight)) {
DISPLAY_LIST_LOGD("%*sRestoreToCount %d", (level + 1) * 2, "", restoreTo);
handler(mRestoreToCountOp->reinit(restoreTo), PROPERTY_SAVECOUNT, mClipToBounds);
renderer.restoreToCount(restoreTo);
diff --git a/libs/hwui/DisplayListOp.h b/libs/hwui/DisplayListOp.h
index 5816872..88077d4 100644
--- a/libs/hwui/DisplayListOp.h
+++ b/libs/hwui/DisplayListOp.h
@@ -182,9 +182,12 @@ public:
}
inline float strokeWidthOutset() {
- float width = mPaint->getStrokeWidth();
- if (width == 0) return 0.5f; // account for hairline
- return width * 0.5f;
+ // since anything AA stroke with less than 1.0 pixel width is drawn with an alpha-reduced
+ // 1.0 stroke, treat 1.0 as minimum.
+
+ // TODO: it would be nice if this could take scale into account, but scale isn't stable
+ // since higher levels of the view hierarchy can change scale out from underneath it.
+ return fmaxf(mPaint->getStrokeWidth(), 1) * 0.5f;
}
protected:
diff --git a/libs/hwui/DisplayListRenderer.cpp b/libs/hwui/DisplayListRenderer.cpp
index 8866029..d024923 100644
--- a/libs/hwui/DisplayListRenderer.cpp
+++ b/libs/hwui/DisplayListRenderer.cpp
@@ -506,7 +506,7 @@ void DisplayListRenderer::addStateOp(StateOp* op) {
void DisplayListRenderer::addDrawOp(DrawOp* op) {
Rect localBounds;
if (op->getLocalBounds(mDrawModifiers, localBounds)) {
- bool rejected = quickRejectNoScissor(localBounds.left, localBounds.top,
+ bool rejected = quickRejectConservative(localBounds.left, localBounds.top,
localBounds.right, localBounds.bottom);
op->setQuickRejected(rejected);
}
diff --git a/libs/hwui/OpenGLRenderer.cpp b/libs/hwui/OpenGLRenderer.cpp
index 9b82013..e256ec2 100644
--- a/libs/hwui/OpenGLRenderer.cpp
+++ b/libs/hwui/OpenGLRenderer.cpp
@@ -1032,7 +1032,8 @@ void OpenGLRenderer::composeLayer(sp<Snapshot> current, sp<Snapshot> previous) {
const bool fboLayer = current->flags & Snapshot::kFlagIsFboLayer;
bool clipRequired = false;
- quickRejectNoScissor(rect, &clipRequired); // safely ignore return, should never be rejected
+ calculateQuickRejectForScissor(rect.left, rect.top, rect.right, rect.bottom,
+ &clipRequired, false); // safely ignore return, should never be rejected
mCaches.setScissorEnabled(mScissorOptimizationDisabled || clipRequired);
if (fboLayer) {
@@ -1629,8 +1630,18 @@ const Rect& OpenGLRenderer::getClipBounds() {
return mSnapshot->getLocalClip();
}
-bool OpenGLRenderer::quickRejectNoScissor(float left, float top, float right, float bottom,
- bool snapOut, bool* clipRequired) {
+/**
+ * Calculates whether content drawn within the passed bounds would be outside of, or intersect with
+ * the clipRect. Does not modify the scissor.
+ *
+ * @param clipRequired if not null, will be set to true if element intersects clip
+ * (and wasn't rejected)
+ *
+ * @param snapOut if set, the geometry will be treated as having an AA ramp.
+ * See Rect::snapGeometryToPixelBoundaries()
+ */
+bool OpenGLRenderer::calculateQuickRejectForScissor(float left, float top,
+ float right, float bottom, bool* clipRequired, bool snapOut) const {
if (mSnapshot->isIgnored() || bottom <= top || right <= left) {
return true;
}
@@ -1644,31 +1655,65 @@ bool OpenGLRenderer::quickRejectNoScissor(float left, float top, float right, fl
if (!clipRect.intersects(r)) return true;
+ // clip is required if geometry intersects clip rect
if (clipRequired) *clipRequired = !clipRect.contains(r);
return false;
}
-bool OpenGLRenderer::quickRejectPreStroke(float left, float top, float right, float bottom,
+/**
+ * Returns false if drawing won't be clipped out.
+ *
+ * Makes the decision conservatively, by rounding out the mapped rect before comparing with the
+ * clipRect. To be used when perfect, pixel accuracy is not possible (esp. with tessellation) but
+ * rejection is still desired.
+ *
+ * This function, unlike quickRejectSetupScissor, should be used where precise geometry information
+ * isn't known (esp. when geometry adjusts based on scale). Generally, this will be first pass
+ * rejection where precise rejection isn't important, or precise information isn't available.
+ */
+bool OpenGLRenderer::quickRejectConservative(float left, float top,
+ float right, float bottom) const {
+ if (mSnapshot->isIgnored() || bottom <= top || right <= left) {
+ return true;
+ }
+
+ Rect r(left, top, right, bottom);
+ currentTransform().mapRect(r);
+ r.roundOut(); // rounded out to be conservative
+
+ Rect clipRect(*mSnapshot->clipRect);
+ clipRect.snapToPixelBoundaries();
+
+ if (!clipRect.intersects(r)) return true;
+
+ return false;
+}
+
+/**
+ * Returns false and sets scissor enable based upon bounds if drawing won't be clipped out.
+ *
+ * @param paint if not null, the bounds will be expanded to account for stroke depending on paint
+ * style, and tessellated AA ramp
+ */
+bool OpenGLRenderer::quickRejectSetupScissor(float left, float top, float right, float bottom,
SkPaint* paint) {
- // AA geometry will likely have a ramp around it (not accounted for in local bounds). Snap out
- // the final mapped rect to ensure correct clipping behavior for the ramp.
- bool snapOut = paint->isAntiAlias();
+ bool clipRequired = false;
+ bool snapOut = paint && paint->isAntiAlias();
- if (paint->getStyle() != SkPaint::kFill_Style) {
+ if (paint && paint->getStyle() != SkPaint::kFill_Style) {
float outset = paint->getStrokeWidth() * 0.5f;
- return quickReject(left - outset, top - outset, right + outset, bottom + outset, snapOut);
- } else {
- return quickReject(left, top, right, bottom, snapOut);
+ left -= outset;
+ top -= outset;
+ right += outset;
+ bottom += outset;
}
-}
-bool OpenGLRenderer::quickReject(float left, float top, float right, float bottom, bool snapOut) {
- bool clipRequired = false;
- if (quickRejectNoScissor(left, top, right, bottom, snapOut, &clipRequired)) {
+ if (calculateQuickRejectForScissor(left, top, right, bottom, &clipRequired, snapOut)) {
return true;
}
if (!isDeferred()) {
+ // not quick rejected, so enable the scissor if clipRequired
mCaches.setScissorEnabled(mScissorOptimizationDisabled || clipRequired);
}
return false;
@@ -1743,7 +1788,7 @@ Rect* OpenGLRenderer::getClipRect() {
///////////////////////////////////////////////////////////////////////////////
void OpenGLRenderer::setupDraw(bool clear) {
- // TODO: It would be best if we could do this before quickReject()
+ // TODO: It would be best if we could do this before quickRejectSetupScissor()
// changes the scissor test state
if (clear) clearLayerRegions();
// Make sure setScissor & setStencil happen at the beginning of
@@ -2123,7 +2168,7 @@ status_t OpenGLRenderer::drawBitmap(SkBitmap* bitmap, float left, float top, SkP
const float right = left + bitmap->width();
const float bottom = top + bitmap->height();
- if (quickReject(left, top, right, bottom)) {
+ if (quickRejectSetupScissor(left, top, right, bottom)) {
return DrawGlInfo::kStatusDone;
}
@@ -2146,7 +2191,7 @@ status_t OpenGLRenderer::drawBitmap(SkBitmap* bitmap, SkMatrix* matrix, SkPaint*
const mat4 transform(*matrix);
transform.mapRect(r);
- if (quickReject(r.left, r.top, r.right, r.bottom)) {
+ if (quickRejectSetupScissor(r.left, r.top, r.right, r.bottom)) {
return DrawGlInfo::kStatusDone;
}
@@ -2173,7 +2218,7 @@ status_t OpenGLRenderer::drawBitmapData(SkBitmap* bitmap, float left, float top,
const float right = left + bitmap->width();
const float bottom = top + bitmap->height();
- if (quickReject(left, top, right, bottom)) {
+ if (quickRejectSetupScissor(left, top, right, bottom)) {
return DrawGlInfo::kStatusDone;
}
@@ -2256,7 +2301,7 @@ status_t OpenGLRenderer::drawBitmapMesh(SkBitmap* bitmap, int meshWidth, int mes
}
}
- if (quickReject(left, top, right, bottom)) {
+ if (quickRejectSetupScissor(left, top, right, bottom)) {
if (cleanupColors) delete[] colors;
return DrawGlInfo::kStatusDone;
}
@@ -2312,7 +2357,7 @@ status_t OpenGLRenderer::drawBitmap(SkBitmap* bitmap,
float srcLeft, float srcTop, float srcRight, float srcBottom,
float dstLeft, float dstTop, float dstRight, float dstBottom,
SkPaint* paint) {
- if (quickReject(dstLeft, dstTop, dstRight, dstBottom)) {
+ if (quickRejectSetupScissor(dstLeft, dstTop, dstRight, dstBottom)) {
return DrawGlInfo::kStatusDone;
}
@@ -2402,7 +2447,7 @@ status_t OpenGLRenderer::drawBitmap(SkBitmap* bitmap,
status_t OpenGLRenderer::drawPatch(SkBitmap* bitmap, Res_png_9patch* patch,
float left, float top, float right, float bottom, SkPaint* paint) {
- if (quickReject(left, top, right, bottom)) {
+ if (quickRejectSetupScissor(left, top, right, bottom)) {
return DrawGlInfo::kStatusDone;
}
@@ -2415,7 +2460,7 @@ status_t OpenGLRenderer::drawPatch(SkBitmap* bitmap, Res_png_9patch* patch,
status_t OpenGLRenderer::drawPatch(SkBitmap* bitmap, const Patch* mesh, AssetAtlas::Entry* entry,
float left, float top, float right, float bottom, SkPaint* paint) {
- if (quickReject(left, top, right, bottom)) {
+ if (quickRejectSetupScissor(left, top, right, bottom)) {
return DrawGlInfo::kStatusDone;
}
@@ -2564,7 +2609,7 @@ status_t OpenGLRenderer::drawConvexPath(const SkPath& path, SkPaint* paint) {
if (hasLayer()) {
SkRect bounds = path.getBounds();
- PathTessellator::expandBoundsForStroke(bounds, paint, false);
+ PathTessellator::expandBoundsForStroke(bounds, paint);
dirtyLayer(bounds.fLeft, bounds.fTop, bounds.fRight, bounds.fBottom, currentTransform());
}
@@ -2591,7 +2636,8 @@ status_t OpenGLRenderer::drawLines(float* points, int count, SkPaint* paint) {
SkRect bounds;
PathTessellator::tessellateLines(points, count, paint, mSnapshot->transform, bounds, buffer);
- if (quickReject(bounds.fLeft, bounds.fTop, bounds.fRight, bounds.fBottom)) {
+ // can't pass paint, since style would be checked for outset. outset done by tessellation.
+ if (quickRejectSetupScissor(bounds.fLeft, bounds.fTop, bounds.fRight, bounds.fBottom)) {
return DrawGlInfo::kStatusDone;
}
@@ -2610,7 +2656,8 @@ status_t OpenGLRenderer::drawPoints(float* points, int count, SkPaint* paint) {
SkRect bounds;
PathTessellator::tessellatePoints(points, count, paint, mSnapshot->transform, bounds, buffer);
- if (quickReject(bounds.fLeft, bounds.fTop, bounds.fRight, bounds.fBottom)) {
+ // can't pass paint, since style would be checked for outset. outset done by tessellation.
+ if (quickRejectSetupScissor(bounds.fLeft, bounds.fTop, bounds.fRight, bounds.fBottom)) {
return DrawGlInfo::kStatusDone;
}
@@ -2647,7 +2694,7 @@ status_t OpenGLRenderer::drawShape(float left, float top, const PathTexture* tex
status_t OpenGLRenderer::drawRoundRect(float left, float top, float right, float bottom,
float rx, float ry, SkPaint* p) {
- if (mSnapshot->isIgnored() || quickRejectPreStroke(left, top, right, bottom, p) ||
+ if (mSnapshot->isIgnored() || quickRejectSetupScissor(left, top, right, bottom, p) ||
(p->getAlpha() == 0 && getXfermode(p->getXfermode()) != SkXfermode::kClear_Mode)) {
return DrawGlInfo::kStatusDone;
}
@@ -2672,7 +2719,7 @@ status_t OpenGLRenderer::drawRoundRect(float left, float top, float right, float
}
status_t OpenGLRenderer::drawCircle(float x, float y, float radius, SkPaint* p) {
- if (mSnapshot->isIgnored() || quickRejectPreStroke(x - radius, y - radius,
+ if (mSnapshot->isIgnored() || quickRejectSetupScissor(x - radius, y - radius,
x + radius, y + radius, p) ||
(p->getAlpha() == 0 && getXfermode(p->getXfermode()) != SkXfermode::kClear_Mode)) {
return DrawGlInfo::kStatusDone;
@@ -2694,7 +2741,7 @@ status_t OpenGLRenderer::drawCircle(float x, float y, float radius, SkPaint* p)
status_t OpenGLRenderer::drawOval(float left, float top, float right, float bottom,
SkPaint* p) {
- if (mSnapshot->isIgnored() || quickRejectPreStroke(left, top, right, bottom, p) ||
+ if (mSnapshot->isIgnored() || quickRejectSetupScissor(left, top, right, bottom, p) ||
(p->getAlpha() == 0 && getXfermode(p->getXfermode()) != SkXfermode::kClear_Mode)) {
return DrawGlInfo::kStatusDone;
}
@@ -2716,7 +2763,7 @@ status_t OpenGLRenderer::drawOval(float left, float top, float right, float bott
status_t OpenGLRenderer::drawArc(float left, float top, float right, float bottom,
float startAngle, float sweepAngle, bool useCenter, SkPaint* p) {
- if (mSnapshot->isIgnored() || quickRejectPreStroke(left, top, right, bottom, p) ||
+ if (mSnapshot->isIgnored() || quickRejectSetupScissor(left, top, right, bottom, p) ||
(p->getAlpha() == 0 && getXfermode(p->getXfermode()) != SkXfermode::kClear_Mode)) {
return DrawGlInfo::kStatusDone;
}
@@ -2753,7 +2800,7 @@ status_t OpenGLRenderer::drawArc(float left, float top, float right, float botto
#define SkPaintDefaults_MiterLimit SkIntToScalar(4)
status_t OpenGLRenderer::drawRect(float left, float top, float right, float bottom, SkPaint* p) {
- if (mSnapshot->isIgnored() || quickRejectPreStroke(left, top, right, bottom, p) ||
+ if (mSnapshot->isIgnored() || quickRejectSetupScissor(left, top, right, bottom, p) ||
(p->getAlpha() == 0 && getXfermode(p->getXfermode()) != SkXfermode::kClear_Mode)) {
return DrawGlInfo::kStatusDone;
}
@@ -2917,7 +2964,7 @@ status_t OpenGLRenderer::drawText(const char* text, int bytesCount, int count, f
// The checks for corner-case ignorable text and quick rejection is only done for immediate
// drawing as ops from DeferredDisplayList are already filtered for these
if (text == NULL || count == 0 || mSnapshot->isIgnored() || canSkipText(paint) ||
- quickReject(bounds)) {
+ quickRejectSetupScissor(bounds)) {
return DrawGlInfo::kStatusDone;
}
}
@@ -3062,8 +3109,8 @@ status_t OpenGLRenderer::drawLayer(Layer* layer, float x, float y) {
}
bool clipRequired = false;
- const bool rejected = quickRejectNoScissor(x, y,
- x + layer->layer.getWidth(), y + layer->layer.getHeight(), false, &clipRequired);
+ const bool rejected = calculateQuickRejectForScissor(x, y,
+ x + layer->layer.getWidth(), y + layer->layer.getHeight(), &clipRequired, false);
if (rejected) {
if (transform && !transform->isIdentity()) {
@@ -3235,7 +3282,7 @@ Texture* OpenGLRenderer::getTexture(SkBitmap* bitmap) {
void OpenGLRenderer::drawPathTexture(const PathTexture* texture,
float x, float y, SkPaint* paint) {
- if (quickReject(x, y, x + texture->width, y + texture->height)) {
+ if (quickRejectSetupScissor(x, y, x + texture->width, y + texture->height)) {
return;
}
@@ -3356,7 +3403,7 @@ status_t OpenGLRenderer::drawColorRects(const float* rects, int count, int color
bottom = fmaxf(bottom, b);
}
- if (clip && quickReject(left, top, right, bottom)) {
+ if (clip && quickRejectSetupScissor(left, top, right, bottom)) {
return DrawGlInfo::kStatusDone;
}
diff --git a/libs/hwui/OpenGLRenderer.h b/libs/hwui/OpenGLRenderer.h
index febf14a..cfc5931 100644
--- a/libs/hwui/OpenGLRenderer.h
+++ b/libs/hwui/OpenGLRenderer.h
@@ -268,30 +268,8 @@ public:
ANDROID_API const Rect& getClipBounds();
- /**
- * Performs a quick reject but adjust the bounds to account for stroke width if necessary,
- * and handling snapOut for AA geometry.
- */
- bool quickRejectPreStroke(float left, float top, float right, float bottom, SkPaint* paint);
-
- /**
- * Returns false and sets scissor based upon bounds if drawing won't be clipped out
- */
- bool quickReject(float left, float top, float right, float bottom, bool snapOut = false);
- bool quickReject(const Rect& bounds) {
- return quickReject(bounds.left, bounds.top, bounds.right, bounds.bottom);
- }
-
- /**
- * Same as quickReject, without the scissor, instead returning clipRequired through pointer.
- * clipRequired will be only set if not rejected
- */
- ANDROID_API bool quickRejectNoScissor(float left, float top, float right, float bottom,
- bool snapOut = false, bool* clipRequired = NULL);
- bool quickRejectNoScissor(const Rect& bounds, bool* clipRequired = NULL) {
- return quickRejectNoScissor(bounds.left, bounds.top, bounds.right, bounds.bottom,
- clipRequired);
- }
+ ANDROID_API bool quickRejectConservative(float left, float top,
+ float right, float bottom) const;
virtual bool clipRect(float left, float top, float right, float bottom, SkRegion::Op op);
virtual bool clipPath(SkPath* path, SkRegion::Op op);
@@ -495,6 +473,16 @@ protected:
*/
void attachStencilBufferToLayer(Layer* layer);
+ bool calculateQuickRejectForScissor(float left, float top, float right, float bottom,
+ bool* clipRequired, bool snapOut) const;
+
+ bool quickRejectSetupScissor(float left, float top, float right, float bottom,
+ SkPaint* paint = NULL);
+ bool quickRejectSetupScissor(const Rect& bounds, SkPaint* paint = NULL) {
+ return quickRejectSetupScissor(bounds.left, bounds.top,
+ bounds.right, bounds.bottom, paint);
+ }
+
/**
* Compose the layer defined in the current snapshot with the layer
* defined by the previous snapshot.
diff --git a/libs/hwui/PathTessellator.cpp b/libs/hwui/PathTessellator.cpp
index 03b2099..7e8a45b 100644
--- a/libs/hwui/PathTessellator.cpp
+++ b/libs/hwui/PathTessellator.cpp
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-#define LOG_TAG "PathTessellator"
+#define LOG_TAG "OpenGLRenderer"
#define LOG_NDEBUG 1
#define ATRACE_TAG ATRACE_TAG_GRAPHICS
@@ -57,9 +57,12 @@ namespace uirenderer {
#define ROUND_CAP_THRESH 0.25f
#define PI 3.1415926535897932f
-void PathTessellator::expandBoundsForStroke(SkRect& bounds, const SkPaint* paint,
- bool forceExpand) {
- if (forceExpand || paint->getStyle() != SkPaint::kFill_Style) {
+/**
+ * Note: this function doesn't account for the AA case with sub-pixel line thickness (not just 0 <
+ * width < 1.0, canvas scale factors in as well) so this can't be used for points/lines
+ */
+void PathTessellator::expandBoundsForStroke(SkRect& bounds, const SkPaint* paint) {
+ if (paint->getStyle() != SkPaint::kFill_Style) {
float outset = paint->getStrokeWidth() * 0.5f;
if (outset == 0) outset = 0.5f; // account for hairline
bounds.outset(outset, outset);
@@ -159,6 +162,17 @@ public:
}
return 0;
}
+
+ /**
+ * Outset the bounds of point data (for line endpoints or points) to account for AA stroke
+ * geometry.
+ */
+ void expandBoundsForStrokeAA(SkRect& bounds) const {
+ float outset = halfStrokeWidth;
+ if (outset == 0) outset = 0.5f;
+ bounds.outset(outset * inverseScaleX + Vertex::gGeometryFudgeFactor,
+ outset * inverseScaleY + Vertex::gGeometryFudgeFactor);
+ }
};
void getFillVerticesFromPerimeter(const Vector<Vertex>& perimeter, VertexBuffer& vertexBuffer) {
@@ -329,7 +343,7 @@ void getStrokeVerticesFromUnclosedVertices(const PaintInfo& paintInfo,
* 3 - zig zag back and forth inside the shape to fill it (using perimeter.size() vertices)
*/
void getFillVerticesFromPerimeterAA(const PaintInfo& paintInfo, const Vector<Vertex>& perimeter,
- VertexBuffer& vertexBuffer) {
+ VertexBuffer& vertexBuffer, float maxAlpha = 1.0f) {
AlphaVertex* buffer = vertexBuffer.alloc<AlphaVertex>(perimeter.size() * 3 + 2);
// generate alpha points - fill Alpha vertex gaps in between each point with
@@ -357,7 +371,7 @@ void getFillVerticesFromPerimeterAA(const PaintInfo& paintInfo, const Vector<Ver
AlphaVertex::set(&buffer[currentIndex++],
current->x - totalOffset.x,
current->y - totalOffset.y,
- 1.0f);
+ maxAlpha);
last = current;
current = next;
@@ -829,11 +843,14 @@ void PathTessellator::tessellatePoints(const float* points, int count, SkPaint*
getFillVerticesFromPerimeter(outlineVertices, tempBuffer);
instanceVertices<Vertex>(tempBuffer, vertexBuffer, points, count, bounds);
} else {
- getFillVerticesFromPerimeterAA(paintInfo, outlineVertices, tempBuffer);
+ // note: pass maxAlpha directly, since we want fill to be alpha modulated
+ getFillVerticesFromPerimeterAA(paintInfo, outlineVertices, tempBuffer, paintInfo.maxAlpha);
instanceVertices<AlphaVertex>(tempBuffer, vertexBuffer, points, count, bounds);
}
- expandBoundsForStroke(bounds, paint, true); // force-expand bounds to incorporate stroke
+ // expand bounds from vertex coords to pixel data
+ paintInfo.expandBoundsForStrokeAA(bounds);
+
}
void PathTessellator::tessellateLines(const float* points, int count, SkPaint* paint,
@@ -873,14 +890,15 @@ void PathTessellator::tessellateLines(const float* points, int count, SkPaint* p
expandRectToCoverVertex(bounds, tempVerticesData[1]);
}
- expandBoundsForStroke(bounds, paint, true); // force-expand bounds to incorporate stroke
-
// since multiple objects tessellated into buffer, separate them with degen tris
if (paintInfo.isAA) {
vertexBuffer.createDegenerateSeparators<AlphaVertex>(lineAllocSize);
} else {
vertexBuffer.createDegenerateSeparators<Vertex>(lineAllocSize);
}
+
+ // expand bounds from vertex coords to pixel data
+ paintInfo.expandBoundsForStrokeAA(bounds);
}
///////////////////////////////////////////////////////////////////////////////
diff --git a/libs/hwui/PathTessellator.h b/libs/hwui/PathTessellator.h
index 85797fc..e0044e8 100644
--- a/libs/hwui/PathTessellator.h
+++ b/libs/hwui/PathTessellator.h
@@ -102,7 +102,7 @@ private:
class PathTessellator {
public:
- static void expandBoundsForStroke(SkRect& bounds, const SkPaint* paint, bool forceExpand);
+ static void expandBoundsForStroke(SkRect& bounds, const SkPaint* paint);
static void tessellatePath(const SkPath& path, const SkPaint* paint,
const mat4 *transform, VertexBuffer& vertexBuffer);
diff --git a/libs/hwui/Rect.h b/libs/hwui/Rect.h
index dabd8d4..83b3436 100644
--- a/libs/hwui/Rect.h
+++ b/libs/hwui/Rect.h
@@ -213,6 +213,13 @@ public:
bottom = floorf(bottom + 0.5f);
}
+ void roundOut() {
+ left = floorf(left);
+ top = floorf(top);
+ right = ceilf(right);
+ bottom = ceilf(bottom);
+ }
+
void dump() const {
ALOGD("Rect[l=%f t=%f r=%f b=%f]", left, top, right, bottom);
}
diff --git a/packages/InputDevices/res/values-mn-rMN/strings.xml b/packages/InputDevices/res/values-mn-rMN/strings.xml
index 0cfb085..ec6cccb 100644
--- a/packages/InputDevices/res/values-mn-rMN/strings.xml
+++ b/packages/InputDevices/res/values-mn-rMN/strings.xml
@@ -25,7 +25,7 @@
<string name="keyboard_layout_finnish" msgid="5585659438924315466">"Финлянд"</string>
<string name="keyboard_layout_croatian" msgid="4172229471079281138">"Хорват"</string>
<string name="keyboard_layout_czech" msgid="1349256901452975343">"Чех"</string>
- <string name="keyboard_layout_estonian" msgid="8775830985185665274">"Эстони"</string>
+ <string name="keyboard_layout_estonian" msgid="8775830985185665274">"Эстон"</string>
<string name="keyboard_layout_hungarian" msgid="4154963661406035109">"Унгар"</string>
<string name="keyboard_layout_icelandic" msgid="5836645650912489642">"Исланд"</string>
<string name="keyboard_layout_brazilian" msgid="5117896443147781939">"Бразил"</string>
diff --git a/packages/Keyguard/res/values-nb/strings.xml b/packages/Keyguard/res/values-nb/strings.xml
index c25a772..71138a5 100644
--- a/packages/Keyguard/res/values-nb/strings.xml
+++ b/packages/Keyguard/res/values-nb/strings.xml
@@ -117,7 +117,7 @@
<string name="kg_invalid_puk" msgid="3638289409676051243">"Skriv inn den korrekte PUK-koden på nytt. Gjentatte forsøk kommer til å deaktivere SIM-kortet."</string>
<string name="kg_invalid_confirm_pin_hint" product="default" msgid="7003469261464593516">"PIN-kodene stemmer ikke overens"</string>
<string name="kg_login_too_many_attempts" msgid="6486842094005698475">"For mange forsøk på tegning av mønster"</string>
- <string name="kg_login_instructions" msgid="1100551261265506448">"Logg deg på med Google-kontoen din for å låse opp."</string>
+ <string name="kg_login_instructions" msgid="1100551261265506448">"Logg på med Google-kontoen din for å låse opp."</string>
<string name="kg_login_username_hint" msgid="5718534272070920364">"Brukernavn (e-postadresse)"</string>
<string name="kg_login_password_hint" msgid="9057289103827298549">"Passord"</string>
<string name="kg_login_submit_button" msgid="5355904582674054702">"Logg på"</string>