Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c1ea948e authored by Jason Sams's avatar Jason Sams
Browse files

More usability tweaks including turning the icons right side up.

parent 764205c1
Loading
Loading
Loading
Loading
+13 −17
Original line number Diff line number Diff line
@@ -4,14 +4,10 @@
#pragma stateFragmentStore(PFS)

// Scratch buffer layout
// 0: fadeIn
// 1: zoomFade

#define SCRATCH_FADE 0
#define SCRATCH_ZOOM 1
#define SCRATCH_ROT 2


#define STATE_POS_X             0
#define STATE_POS_Y             1
#define STATE_PRESSURE          2
@@ -21,16 +17,13 @@
#define STATE_SELECTION         6
#define STATE_FIRST_VISIBLE     7
#define STATE_COUNT             8
#define STATE_TOUCH             9

void pfClearColor(float, float, float, float);
float loadF(int, int);
void storeF(int, int, float);
void drawQuad(float x1, float y1, float z1,
                         float x2, float y2, float z2,
                          float x3, float y3, float z3,
                          float x4, float y4, float z4);
float sinf(float);
float cosf(float);
float filter(float val, float target, float str)
{
    float delta = (target - val);
    return val + delta * str;
}

int main(void* con, int ft, int launchID)
{
@@ -48,14 +41,17 @@ int main(void* con, int ft, int launchID)
        storeF(2, 0, f);
    }

    float zoom = loadF(2, SCRATCH_ZOOM);
    float touchCut = 1.f;
    if (loadI32(0, STATE_TOUCH)) {
        touchCut = 5.f;
    }

    float targetZoom = ((float)loadI32(0, STATE_ZOOM)) / 10.f;
    zoom = zoom + (targetZoom - zoom) * 0.15f;
    float zoom = filter(loadF(2, SCRATCH_ZOOM), targetZoom, 0.15 * touchCut);
    storeF(2, SCRATCH_ZOOM, zoom);

    float rot = loadF(2, SCRATCH_ROT);
    float targetRot = loadI32(0, STATE_FIRST_VISIBLE) / 180.0f * 3.14f;
    rot = rot + (targetRot - rot) * 0.15f;
    float rot = filter(loadF(2, SCRATCH_ROT), targetRot, 0.1f * touchCut);
    storeF(2, SCRATCH_ROT, rot);

    float diam = 8.f;// + curve * 2.f;
+11 −5
Original line number Diff line number Diff line
@@ -47,6 +47,7 @@ public class RolloRS {
    public static final int STATE_SELECTION = 6;
    public static final int STATE_FIRST_VISIBLE = 7;
    public static final int STATE_COUNT = 8;
    public static final int STATE_TOUCH = 9;


    public RolloRS() {
@@ -64,20 +65,25 @@ public class RolloRS {
        mAllocState.data(mAllocStateBuf);
    }

    public void setTouch(boolean touch) {
        mAllocStateBuf[STATE_TOUCH] = touch ? 1 : 0;
        mAllocState.data(mAllocStateBuf);
    }

    public void setShadow(float x, float y, float size) {
        // x and y are normalized at this point.
        mAllocStateBuf[STATE_POS_X] = (int)(x * 1000);
        mAllocStateBuf[STATE_POS_Y] = (int)(y * 1000);
        mAllocStateBuf[STATE_PRESSURE] = (int)(size * 1000);

        Log.e("rs","shadow x=" + Integer.toString(mAllocStateBuf[STATE_POS_X]) +
              "  y=" + Integer.toString(mAllocStateBuf[STATE_POS_X]) +
              "  s=" + Integer.toString(mAllocStateBuf[STATE_PRESSURE]));
        //Log.e("rs","shadow x=" + Integer.toString(mAllocStateBuf[STATE_POS_X]) +
              //"  y=" + Integer.toString(mAllocStateBuf[STATE_POS_X]) +
              //"  s=" + Integer.toString(mAllocStateBuf[STATE_PRESSURE]));
        mAllocState.data(mAllocStateBuf);
    }

    public void setZoom(float z) {
        Log.e("rs", "zoom " + Float.toString(z));
        //Log.e("rs", "zoom " + Float.toString(z));

        mAllocStateBuf[STATE_ZOOM] = (int)(z * 10.f);
        mAllocState.data(mAllocStateBuf);
@@ -253,7 +259,7 @@ public class RolloRS {
        //mRS.scriptCSetClearDepth(0);
        mScript = mRS.scriptCCreate();

        mAllocStateBuf = new int[] {0, 0, 0, 8, 0, 0, 0, 0, 38, 0};
        mAllocStateBuf = new int[] {0, 0, 0, 8, 0, 0, 0, 0, 38, 0, 0};
        mAllocState = mRS.allocationCreatePredefSized(
            RenderScript.ElementPredefined.USER_I32, mAllocStateBuf.length);
        mScript.bindAllocation(mAllocState, 0);
+3 −1
Original line number Diff line number Diff line
@@ -87,6 +87,8 @@ public class RolloView extends RSSurfaceView {
        float nx = ev.getX() / getWidth();
        float ny = ev.getY() / getHeight();

        mRender.setTouch(ret);

        if((ny > 0.85f) || mControlMode) {
            mRender.setShadow(0, 0, 0);
            mFlingMode = false;
@@ -99,7 +101,7 @@ public class RolloView extends RSSurfaceView {
                        float dx = nx - mFlingX;

                        if(ny < 0.9) {
                            zoom = 5.f - ((0.9f - ny) * 10.f);
                            zoom = 5.f - ((0.9f - ny) * 15.f);
                            if(zoom < 1) {
                                zoom = 1;
                                mControlMode = false;
+2 −13
Original line number Diff line number Diff line
@@ -326,7 +326,7 @@ static void SC_drawQuad(float x1, float y1, float z1,
    //LOGE("%4.2f, %4.2f, %4.2f", x4, y4, z4);

    float vtx[] = {x1,y1,z1, x2,y2,z2, x3,y3,z3, x4,y4,z4};
    static const float tex[] = {0,0, 0,1, 1,1, 1,0};
    static const float tex[] = {0,1, 1,1, 1,0, 0,0};


    rsc->setupCheck();
@@ -353,18 +353,6 @@ static void SC_drawQuad(float x1, float y1, float z1,
    glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
}

extern "C" float sinf(float angle)
{
    float s = (float)sin(angle);
    return s;
}

extern "C" float cosf(float angle)
{
    float s = (float)cos(angle);
    return s;
}

extern "C" void pfClearColor(float r, float g, float b, float a)
{
    //LOGE("c %f %f %f %f", r, g, b, a);
@@ -522,6 +510,7 @@ ScriptCState::SymbolTable_t ScriptCState::gSyms[] = {
    { "drawQuad", (void *)&SC_drawQuad, "void drawQuad(float x1, float y1, float z1, float x2, float y2, float z2, float x3, float y3, float z3, float x4, float y4, float z4)" },
    { "sinf", (void *)&sinf, "float sinf(float)" },
    { "cosf", (void *)&cosf, "float cosf(float)" },
    { "fabs", (void *)&fabs, "float fabs(float)" },
    { "contextBindProgramFragmentStore", (void *)&contextBindProgramFragmentStore, "void contextBindProgramFragmentStore(int)" },
    { "pfClearColor", (void *)&pfClearColor, "void pfClearColor(float, float, float, float)" },
    { "pfBindTexture", (void *)&pfBindTexture, "void pfBindTexture(int, int, int)" },