summaryrefslogtreecommitdiffstats
path: root/graphics/java/android/renderscript
diff options
context:
space:
mode:
Diffstat (limited to 'graphics/java/android/renderscript')
-rw-r--r--graphics/java/android/renderscript/RenderScript.java19
-rw-r--r--graphics/java/android/renderscript/RenderScriptGL.java17
2 files changed, 29 insertions, 7 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);