FileDocCategorySizeDatePackage
RSTestView.javaAPI DocAndroid 5.1 API2818Thu Mar 12 22:22:54 GMT 2015com.android.rs.test_v11

RSTestView

public class RSTestView extends android.renderscript.RSSurfaceView

Fields Summary
private android.content.Context
mCtx
private android.renderscript.RenderScriptGL
mRS
private RSTestCore
mRender
Constructors Summary
public RSTestView(android.content.Context context)

        super(context);
        mCtx = context;
        //setFocusable(true);
    
Methods Summary
protected voidonDetachedFromWindow()

        if(mRS != null) {
            mRender.cleanup();
            mRS = null;
            destroyRenderScriptGL();
        }
    
public booleanonKeyDown(int keyCode, android.view.KeyEvent event)

        return super.onKeyDown(keyCode, event);
    
public booleanonTouchEvent(android.view.MotionEvent ev)

        boolean ret = false;
        int act = ev.getAction();
        if (act == ev.ACTION_DOWN) {
            mRender.onActionDown((int)ev.getX(), (int)ev.getY());
            ret = true;
        }
        else if (act == ev.ACTION_MOVE) {
            mRender.onActionMove((int)ev.getX(), (int)ev.getY());
            ret = true;
        }

        return ret;
    
public voidsurfaceChanged(android.view.SurfaceHolder holder, int format, int w, int h)

        super.surfaceChanged(holder, format, w, h);
        if (mRS == null) {
            RenderScriptGL.SurfaceConfig sc = new RenderScriptGL.SurfaceConfig();
            mRS = createRenderScriptGL(sc);
            mRS.setSurface(holder, w, h);
            mRender = new RSTestCore(mCtx);
            mRender.init(mRS, getResources(), w, h);
        }