Loading graphics/java/android/renderscript/RSSurfaceView.java +7 −9 Original line number Diff line number Diff line Loading @@ -80,10 +80,10 @@ public class RSSurfaceView extends SurfaceView implements SurfaceHolder.Callback */ public void surfaceDestroyed(SurfaceHolder holder) { // Surface will be destroyed when we return Log.v(RenderScript.LOG_TAG, "surfaceDestroyed"); if (mRS != null) { mRS.contextSetSurface(null); mRS.contextSetSurface(0, 0, null); } //Log.v(RenderScript.LOG_TAG, "surfaceDestroyed"); } /** Loading @@ -91,10 +91,10 @@ public class RSSurfaceView extends SurfaceView implements SurfaceHolder.Callback * not normally called or subclassed by clients of RSSurfaceView. */ public void surfaceChanged(SurfaceHolder holder, int format, int w, int h) { Log.v(RenderScript.LOG_TAG, "surfaceChanged"); if (mRS != null) { mRS.contextSetSurface(holder.getSurface()); mRS.contextSetSurface(w, h, holder.getSurface()); } //Log.v(RenderScript.LOG_TAG, "surfaceChanged"); } /** Loading Loading @@ -147,11 +147,8 @@ public class RSSurfaceView extends SurfaceView implements SurfaceHolder.Callback // ---------------------------------------------------------------------- public RenderScript createRenderScript(boolean useDepth, boolean forceSW) { Surface sur = null; while ((sur == null) || (mSurfaceHolder == null)) { sur = getHolder().getSurface(); } mRS = new RenderScript(sur, useDepth, forceSW); Log.v(RenderScript.LOG_TAG, "createRenderScript"); mRS = new RenderScript(useDepth, forceSW); return mRS; } Loading @@ -160,6 +157,7 @@ public class RSSurfaceView extends SurfaceView implements SurfaceHolder.Callback } public void destroyRenderScript() { Log.v(RenderScript.LOG_TAG, "destroyRenderScript"); mRS.destroy(); mRS = null; } Loading graphics/java/android/renderscript/RenderScript.java +16 −10 Original line number Diff line number Diff line Loading @@ -30,10 +30,12 @@ import android.view.Surface; * **/ public class RenderScript { static final String LOG_TAG = "libRS_jni"; static final String LOG_TAG = "RenderScript_jni"; private static final boolean DEBUG = false; @SuppressWarnings({"UnusedDeclaration", "deprecation"}) private static final boolean LOG_ENABLED = DEBUG ? Config.LOGD : Config.LOGV; int mWidth; int mHeight; Loading Loading @@ -62,9 +64,9 @@ public class RenderScript { native int nDeviceCreate(); native void nDeviceDestroy(int dev); native void nDeviceSetConfig(int dev, int param, int value); native int nContextCreate(int dev, Surface sur, int ver, boolean useDepth); native int nContextCreate(int dev, int ver, boolean useDepth); native void nContextDestroy(int con); native void nContextSetSurface(Surface sur); native void nContextSetSurface(int w, int h, Surface sur); native void nContextBindRootScript(int script); native void nContextBindSampler(int sampler, int slot); Loading Loading @@ -259,27 +261,31 @@ public class RenderScript { mRS.mMessageCallback.mID = msg; mRS.mMessageCallback.run(); } //Log.d("rs", "MessageThread msg " + msg + " v1 " + rbuf[0] + " v2 " + rbuf[1] + " v3 " +rbuf[2]); //Log.d(LOG_TAG, "MessageThread msg " + msg + " v1 " + rbuf[0] + " v2 " + rbuf[1] + " v3 " +rbuf[2]); } Log.d("rs", "MessageThread exiting."); Log.d(LOG_TAG, "MessageThread exiting."); } } public RenderScript(Surface sur, boolean useDepth, boolean forceSW) { mSurface = sur; public RenderScript(boolean useDepth, boolean forceSW) { mSurface = null; mWidth = 0; mHeight = 0; mDev = nDeviceCreate(); if(forceSW) { nDeviceSetConfig(mDev, 0, 1); } mContext = nContextCreate(mDev, mSurface, 0, useDepth); mContext = nContextCreate(mDev, 0, useDepth); Element.initPredefined(this); mMessageThread = new MessageThread(this); mMessageThread.start(); } public void contextSetSurface(Surface sur) { public void contextSetSurface(int w, int h, Surface sur) { mSurface = sur; nContextSetSurface(mSurface); mWidth = w; mHeight = h; nContextSetSurface(w, h, mSurface); } public void destroy() { Loading graphics/jni/android_renderscript_RenderScript.cpp +7 −20 Original line number Diff line number Diff line Loading @@ -151,30 +151,17 @@ nDeviceSetConfig(JNIEnv *_env, jobject _this, jint dev, jint p, jint value) } static jint nContextCreate(JNIEnv *_env, jobject _this, jint dev, jobject wnd, jint ver, jboolean useDepth) nContextCreate(JNIEnv *_env, jobject _this, jint dev, jint ver, jboolean useDepth) { LOG_API("nContextCreate"); if (wnd == NULL) { not_valid_surface: doThrow(_env, "java/lang/IllegalArgumentException", "Make sure the SurfaceView or associated SurfaceHolder has a valid Surface"); return 0; } jclass surface_class = _env->FindClass("android/view/Surface"); jfieldID surfaceFieldID = _env->GetFieldID(surface_class, "mSurface", "I"); Surface * window = (Surface*)_env->GetIntField(wnd, surfaceFieldID); if (window == NULL) goto not_valid_surface; return (jint)rsContextCreate((RsDevice)dev, window, ver, useDepth); return (jint)rsContextCreate((RsDevice)dev, ver, useDepth); } static void nContextSetSurface(JNIEnv *_env, jobject _this, jobject wnd) nContextSetSurface(JNIEnv *_env, jobject _this, jint width, jint height, jobject wnd) { RsContext con = (RsContext)(_env->GetIntField(_this, gContextId)); LOG_API("nContextSetSurface, con(%p), surface(%p)", con, (Surface *)wnd); LOG_API("nContextSetSurface, con(%p), width(%i), height(%i), surface(%p)", con, width, height, (Surface *)wnd); Surface * window = NULL; if (wnd == NULL) { Loading @@ -185,7 +172,7 @@ nContextSetSurface(JNIEnv *_env, jobject _this, jobject wnd) window = (Surface*)_env->GetIntField(wnd, surfaceFieldID); } rsContextSetSurface(con, window); rsContextSetSurface(con, width, height, window); } static void Loading Loading @@ -1345,8 +1332,8 @@ static JNINativeMethod methods[] = { {"nDeviceCreate", "()I", (void*)nDeviceCreate }, {"nDeviceDestroy", "(I)V", (void*)nDeviceDestroy }, {"nDeviceSetConfig", "(III)V", (void*)nDeviceSetConfig }, {"nContextCreate", "(ILandroid/view/Surface;IZ)I", (void*)nContextCreate }, {"nContextSetSurface", "(Landroid/view/Surface;)V", (void*)nContextSetSurface }, {"nContextCreate", "(IIZ)I", (void*)nContextCreate }, {"nContextSetSurface", "(IILandroid/view/Surface;)V", (void*)nContextSetSurface }, {"nContextDestroy", "(I)V", (void*)nContextDestroy }, {"nContextPause", "()V", (void*)nContextPause }, {"nContextResume", "()V", (void*)nContextResume }, Loading libs/rs/RenderScript.h +1 −1 Original line number Diff line number Diff line Loading @@ -55,7 +55,7 @@ RsDevice rsDeviceCreate(); void rsDeviceDestroy(RsDevice); void rsDeviceSetConfig(RsDevice, RsDeviceParam, int32_t value); RsContext rsContextCreate(RsDevice, void *, uint32_t version, bool useDepth); RsContext rsContextCreate(RsDevice, uint32_t version, bool useDepth); void rsContextDestroy(RsContext); void rsObjDestroyOOB(RsContext, void *); Loading libs/rs/java/ImageProcessing/src/com/android/rs/image/ImageProcessingActivity.java +2 −1 Original line number Diff line number Diff line Loading @@ -126,13 +126,14 @@ public class ImageProcessingActivity extends Activity implements SurfaceHolder.C } public void surfaceChanged(SurfaceHolder holder, int format, int width, int height) { mRS.contextSetSurface(width, height, holder.getSurface()); } public void surfaceDestroyed(SurfaceHolder holder) { } private Script.Invokable createScript() { mRS = new RenderScript(mSurfaceView.getHolder().getSurface(), false, false); mRS = new RenderScript(false, false); mRS.mMessageCallback = new FilterCallback(); mParamsType = Type.createFromClass(mRS, Params.class, 1, "Parameters"); Loading Loading
graphics/java/android/renderscript/RSSurfaceView.java +7 −9 Original line number Diff line number Diff line Loading @@ -80,10 +80,10 @@ public class RSSurfaceView extends SurfaceView implements SurfaceHolder.Callback */ public void surfaceDestroyed(SurfaceHolder holder) { // Surface will be destroyed when we return Log.v(RenderScript.LOG_TAG, "surfaceDestroyed"); if (mRS != null) { mRS.contextSetSurface(null); mRS.contextSetSurface(0, 0, null); } //Log.v(RenderScript.LOG_TAG, "surfaceDestroyed"); } /** Loading @@ -91,10 +91,10 @@ public class RSSurfaceView extends SurfaceView implements SurfaceHolder.Callback * not normally called or subclassed by clients of RSSurfaceView. */ public void surfaceChanged(SurfaceHolder holder, int format, int w, int h) { Log.v(RenderScript.LOG_TAG, "surfaceChanged"); if (mRS != null) { mRS.contextSetSurface(holder.getSurface()); mRS.contextSetSurface(w, h, holder.getSurface()); } //Log.v(RenderScript.LOG_TAG, "surfaceChanged"); } /** Loading Loading @@ -147,11 +147,8 @@ public class RSSurfaceView extends SurfaceView implements SurfaceHolder.Callback // ---------------------------------------------------------------------- public RenderScript createRenderScript(boolean useDepth, boolean forceSW) { Surface sur = null; while ((sur == null) || (mSurfaceHolder == null)) { sur = getHolder().getSurface(); } mRS = new RenderScript(sur, useDepth, forceSW); Log.v(RenderScript.LOG_TAG, "createRenderScript"); mRS = new RenderScript(useDepth, forceSW); return mRS; } Loading @@ -160,6 +157,7 @@ public class RSSurfaceView extends SurfaceView implements SurfaceHolder.Callback } public void destroyRenderScript() { Log.v(RenderScript.LOG_TAG, "destroyRenderScript"); mRS.destroy(); mRS = null; } Loading
graphics/java/android/renderscript/RenderScript.java +16 −10 Original line number Diff line number Diff line Loading @@ -30,10 +30,12 @@ import android.view.Surface; * **/ public class RenderScript { static final String LOG_TAG = "libRS_jni"; static final String LOG_TAG = "RenderScript_jni"; private static final boolean DEBUG = false; @SuppressWarnings({"UnusedDeclaration", "deprecation"}) private static final boolean LOG_ENABLED = DEBUG ? Config.LOGD : Config.LOGV; int mWidth; int mHeight; Loading Loading @@ -62,9 +64,9 @@ public class RenderScript { native int nDeviceCreate(); native void nDeviceDestroy(int dev); native void nDeviceSetConfig(int dev, int param, int value); native int nContextCreate(int dev, Surface sur, int ver, boolean useDepth); native int nContextCreate(int dev, int ver, boolean useDepth); native void nContextDestroy(int con); native void nContextSetSurface(Surface sur); native void nContextSetSurface(int w, int h, Surface sur); native void nContextBindRootScript(int script); native void nContextBindSampler(int sampler, int slot); Loading Loading @@ -259,27 +261,31 @@ public class RenderScript { mRS.mMessageCallback.mID = msg; mRS.mMessageCallback.run(); } //Log.d("rs", "MessageThread msg " + msg + " v1 " + rbuf[0] + " v2 " + rbuf[1] + " v3 " +rbuf[2]); //Log.d(LOG_TAG, "MessageThread msg " + msg + " v1 " + rbuf[0] + " v2 " + rbuf[1] + " v3 " +rbuf[2]); } Log.d("rs", "MessageThread exiting."); Log.d(LOG_TAG, "MessageThread exiting."); } } public RenderScript(Surface sur, boolean useDepth, boolean forceSW) { mSurface = sur; public RenderScript(boolean useDepth, boolean forceSW) { mSurface = null; mWidth = 0; mHeight = 0; mDev = nDeviceCreate(); if(forceSW) { nDeviceSetConfig(mDev, 0, 1); } mContext = nContextCreate(mDev, mSurface, 0, useDepth); mContext = nContextCreate(mDev, 0, useDepth); Element.initPredefined(this); mMessageThread = new MessageThread(this); mMessageThread.start(); } public void contextSetSurface(Surface sur) { public void contextSetSurface(int w, int h, Surface sur) { mSurface = sur; nContextSetSurface(mSurface); mWidth = w; mHeight = h; nContextSetSurface(w, h, mSurface); } public void destroy() { Loading
graphics/jni/android_renderscript_RenderScript.cpp +7 −20 Original line number Diff line number Diff line Loading @@ -151,30 +151,17 @@ nDeviceSetConfig(JNIEnv *_env, jobject _this, jint dev, jint p, jint value) } static jint nContextCreate(JNIEnv *_env, jobject _this, jint dev, jobject wnd, jint ver, jboolean useDepth) nContextCreate(JNIEnv *_env, jobject _this, jint dev, jint ver, jboolean useDepth) { LOG_API("nContextCreate"); if (wnd == NULL) { not_valid_surface: doThrow(_env, "java/lang/IllegalArgumentException", "Make sure the SurfaceView or associated SurfaceHolder has a valid Surface"); return 0; } jclass surface_class = _env->FindClass("android/view/Surface"); jfieldID surfaceFieldID = _env->GetFieldID(surface_class, "mSurface", "I"); Surface * window = (Surface*)_env->GetIntField(wnd, surfaceFieldID); if (window == NULL) goto not_valid_surface; return (jint)rsContextCreate((RsDevice)dev, window, ver, useDepth); return (jint)rsContextCreate((RsDevice)dev, ver, useDepth); } static void nContextSetSurface(JNIEnv *_env, jobject _this, jobject wnd) nContextSetSurface(JNIEnv *_env, jobject _this, jint width, jint height, jobject wnd) { RsContext con = (RsContext)(_env->GetIntField(_this, gContextId)); LOG_API("nContextSetSurface, con(%p), surface(%p)", con, (Surface *)wnd); LOG_API("nContextSetSurface, con(%p), width(%i), height(%i), surface(%p)", con, width, height, (Surface *)wnd); Surface * window = NULL; if (wnd == NULL) { Loading @@ -185,7 +172,7 @@ nContextSetSurface(JNIEnv *_env, jobject _this, jobject wnd) window = (Surface*)_env->GetIntField(wnd, surfaceFieldID); } rsContextSetSurface(con, window); rsContextSetSurface(con, width, height, window); } static void Loading Loading @@ -1345,8 +1332,8 @@ static JNINativeMethod methods[] = { {"nDeviceCreate", "()I", (void*)nDeviceCreate }, {"nDeviceDestroy", "(I)V", (void*)nDeviceDestroy }, {"nDeviceSetConfig", "(III)V", (void*)nDeviceSetConfig }, {"nContextCreate", "(ILandroid/view/Surface;IZ)I", (void*)nContextCreate }, {"nContextSetSurface", "(Landroid/view/Surface;)V", (void*)nContextSetSurface }, {"nContextCreate", "(IIZ)I", (void*)nContextCreate }, {"nContextSetSurface", "(IILandroid/view/Surface;)V", (void*)nContextSetSurface }, {"nContextDestroy", "(I)V", (void*)nContextDestroy }, {"nContextPause", "()V", (void*)nContextPause }, {"nContextResume", "()V", (void*)nContextResume }, Loading
libs/rs/RenderScript.h +1 −1 Original line number Diff line number Diff line Loading @@ -55,7 +55,7 @@ RsDevice rsDeviceCreate(); void rsDeviceDestroy(RsDevice); void rsDeviceSetConfig(RsDevice, RsDeviceParam, int32_t value); RsContext rsContextCreate(RsDevice, void *, uint32_t version, bool useDepth); RsContext rsContextCreate(RsDevice, uint32_t version, bool useDepth); void rsContextDestroy(RsContext); void rsObjDestroyOOB(RsContext, void *); Loading
libs/rs/java/ImageProcessing/src/com/android/rs/image/ImageProcessingActivity.java +2 −1 Original line number Diff line number Diff line Loading @@ -126,13 +126,14 @@ public class ImageProcessingActivity extends Activity implements SurfaceHolder.C } public void surfaceChanged(SurfaceHolder holder, int format, int width, int height) { mRS.contextSetSurface(width, height, holder.getSurface()); } public void surfaceDestroyed(SurfaceHolder holder) { } private Script.Invokable createScript() { mRS = new RenderScript(mSurfaceView.getHolder().getSurface(), false, false); mRS = new RenderScript(false, false); mRS.mMessageCallback = new FilterCallback(); mParamsType = Type.createFromClass(mRS, Params.class, 1, "Parameters"); Loading