summaryrefslogtreecommitdiffstats
path: root/graphics
diff options
context:
space:
mode:
authorJason Sams <rjsams@android.com>2010-10-13 15:33:00 -0700
committerAndroid (Google) Code Review <android-gerrit@google.com>2010-10-13 15:33:00 -0700
commit0726fd9e835579019f6b23ab50d7b45401e11dbe (patch)
tree9a17c234e4ca2b3345cf6579e33332ff9f6abef7 /graphics
parentd8404b23739b135060ab9a04317a9f8b990cf8ca (diff)
parent11c8af9ded3a319635b4e91a639a616ec97fc7e3 (diff)
downloadframeworks_base-0726fd9e835579019f6b23ab50d7b45401e11dbe.zip
frameworks_base-0726fd9e835579019f6b23ab50d7b45401e11dbe.tar.gz
frameworks_base-0726fd9e835579019f6b23ab50d7b45401e11dbe.tar.bz2
Merge "Begin hooking up SurfaceConfig."
Diffstat (limited to 'graphics')
-rw-r--r--graphics/java/android/renderscript/RenderScript.java19
-rw-r--r--graphics/java/android/renderscript/RenderScriptGL.java17
-rw-r--r--graphics/jni/android_renderscript_RenderScript.cpp26
3 files changed, 50 insertions, 12 deletions
diff --git a/graphics/java/android/renderscript/RenderScript.java b/graphics/java/android/renderscript/RenderScript.java
index 0f9ed87..97ce7dc 100644
--- a/graphics/java/android/renderscript/RenderScript.java
+++ b/graphics/java/android/renderscript/RenderScript.java
@@ -69,9 +69,22 @@ public class RenderScript {
// Methods below are wrapped to protect the non-threadsafe
// lockless fifo.
- native int rsnContextCreateGL(int dev, int ver, boolean useDepth);
- synchronized int nContextCreateGL(int dev, int ver, boolean useDepth) {
- return rsnContextCreateGL(dev, ver, useDepth);
+ native int rsnContextCreateGL(int dev, int ver,
+ int colorMin, int colorPref,
+ int alphaMin, int alphaPref,
+ int depthMin, int depthPref,
+ int stencilMin, int stencilPref,
+ int samplesMin, int samplesPref, float samplesQ);
+ synchronized int nContextCreateGL(int dev, int ver,
+ int colorMin, int colorPref,
+ int alphaMin, int alphaPref,
+ int depthMin, int depthPref,
+ int stencilMin, int stencilPref,
+ int samplesMin, int samplesPref, float samplesQ) {
+ return rsnContextCreateGL(dev, ver, colorMin, colorPref,
+ alphaMin, alphaPref, depthMin, depthPref,
+ stencilMin, stencilPref,
+ samplesMin, samplesPref, samplesQ);
}
native int rsnContextCreate(int dev, int ver);
synchronized int nContextCreate(int dev, int ver) {
diff --git a/graphics/java/android/renderscript/RenderScriptGL.java b/graphics/java/android/renderscript/RenderScriptGL.java
index b60c689..0477d75 100644
--- a/graphics/java/android/renderscript/RenderScriptGL.java
+++ b/graphics/java/android/renderscript/RenderScriptGL.java
@@ -18,6 +18,7 @@ package android.renderscript;
import java.lang.reflect.Field;
+import android.graphics.PixelFormat;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.util.Config;
@@ -103,7 +104,11 @@ public class RenderScriptGL extends RenderScript {
SurfaceConfig mSurfaceConfig;
public void configureSurface(SurfaceHolder sh) {
- //getHolder().setFormat(PixelFormat.TRANSLUCENT);
+ if (mSurfaceConfig.mAlphaMin > 1) {
+ sh.setFormat(PixelFormat.RGBA_8888);
+ } else {
+ sh.setFormat(PixelFormat.RGBX_8888);
+ }
}
public void checkSurface(SurfaceHolder sh) {
@@ -112,13 +117,17 @@ public class RenderScriptGL extends RenderScript {
public RenderScriptGL(SurfaceConfig sc) {
mSurfaceConfig = new SurfaceConfig(sc);
-
-
mSurface = null;
mWidth = 0;
mHeight = 0;
mDev = nDeviceCreate();
- mContext = nContextCreateGL(mDev, 0, mSurfaceConfig.mDepthMin > 0);
+ mContext = nContextCreateGL(mDev, 0,
+ mSurfaceConfig.mColorMin, mSurfaceConfig.mColorPref,
+ mSurfaceConfig.mAlphaMin, mSurfaceConfig.mAlphaPref,
+ mSurfaceConfig.mDepthMin, mSurfaceConfig.mDepthPref,
+ mSurfaceConfig.mStencilMin, mSurfaceConfig.mStencilPref,
+ mSurfaceConfig.mSamplesMin, mSurfaceConfig.mSamplesPref,
+ mSurfaceConfig.mSamplesQ);
mMessageThread = new MessageThread(this);
mMessageThread.start();
Element.initPredefined(this);
diff --git a/graphics/jni/android_renderscript_RenderScript.cpp b/graphics/jni/android_renderscript_RenderScript.cpp
index 014f03b..ce2a40c 100644
--- a/graphics/jni/android_renderscript_RenderScript.cpp
+++ b/graphics/jni/android_renderscript_RenderScript.cpp
@@ -158,10 +158,26 @@ nContextCreate(JNIEnv *_env, jobject _this, jint dev, jint ver)
}
static jint
-nContextCreateGL(JNIEnv *_env, jobject _this, jint dev, jint ver, jboolean useDepth)
-{
+nContextCreateGL(JNIEnv *_env, jobject _this, jint dev, jint ver,
+ int colorMin, int colorPref,
+ int alphaMin, int alphaPref,
+ int depthMin, int depthPref,
+ int stencilMin, int stencilPref,
+ int samplesMin, int samplesPref, float samplesQ)
+{
+ RsSurfaceConfig sc;
+ sc.alphaMin = alphaMin;
+ sc.alphaPref = alphaPref;
+ sc.colorMin = colorMin;
+ sc.colorPref = colorPref;
+ sc.depthMin = depthMin;
+ sc.depthPref = depthPref;
+ sc.samplesMin = samplesMin;
+ sc.samplesPref = samplesPref;
+ sc.samplesQ = samplesQ;
+
LOG_API("nContextCreateGL");
- return (jint)rsContextCreateGL((RsDevice)dev, ver, useDepth);
+ return (jint)rsContextCreateGL((RsDevice)dev, ver, sc);
}
static void
@@ -309,7 +325,7 @@ nElementGetSubElements(JNIEnv *_env, jobject _this, RsContext con, jint id, jint
rsElementGetSubElements(con, (RsElement)id, ids, names, (uint32_t)dataSize);
- for(jint i = 0; i < dataSize; i ++) {
+ for(jint i = 0; i < dataSize; i++) {
_env->SetObjectArrayElement(_names, i, _env->NewStringUTF(names[i]));
_env->SetIntArrayRegion(_IDs, i, 1, (const jint*)&ids[i]);
}
@@ -1220,7 +1236,7 @@ static JNINativeMethod methods[] = {
// All methods below are thread protected in java.
{"rsnContextCreate", "(II)I", (void*)nContextCreate },
-{"rsnContextCreateGL", "(IIZ)I", (void*)nContextCreateGL },
+{"rsnContextCreateGL", "(IIIIIIIIIIIIF)I", (void*)nContextCreateGL },
{"rsnContextFinish", "(I)V", (void*)nContextFinish },
{"rsnContextSetPriority", "(II)V", (void*)nContextSetPriority },
{"rsnContextSetSurface", "(IIILandroid/view/Surface;)V", (void*)nContextSetSurface },