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

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

Add support for scripts to return an animation flag. This allows them to...

Add support for scripts to return an animation flag.  This allows them to indicate they are generating changing content and the rs thread to sleep if the content is static.
parent 9600fcce
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -87,7 +87,7 @@ typedef struct {
    void (*drawRect)(void *con, int32_t x1, int32_t x2, int32_t y1, int32_t y2);
} rsc_FunctionTable;

typedef void (*rsc_RunScript)(void *con, const rsc_FunctionTable *, uint32_t launchID);
typedef int (*rsc_RunScript)(void *con, const rsc_FunctionTable *, uint32_t launchID);


/* EnableCap */
+2 −3
Original line number Diff line number Diff line
@@ -65,7 +65,7 @@ main(con, ft, launchID) {

        if (life) {
            if (posy < (480 << 16)) {
                dstIdx = ct * 3 * 3;
                dstIdx = drawCount * 9;
                c = 0xffafcf | ((life >> lifeShift) << 24);

                storeU32(con, 1, dstIdx, c);
@@ -79,8 +79,6 @@ main(con, ft, launchID) {
                storeU32(con, 1, dstIdx + 6, c);
                storeI32(con, 1, dstIdx + 7, posx - 0x10000);
                storeI32(con, 1, dstIdx + 8, posy + dy * 4);

                vertPtr = vertPtr + 36;
                drawCount ++;
            } else {
                if (dy > 0) {
@@ -102,4 +100,5 @@ main(con, ft, launchID) {
    }

    drawTriangleArray(con, loadI32(con, 0, 5), drawCount);
    return 1;
}
+13 −20
Original line number Diff line number Diff line
@@ -64,10 +64,12 @@ void Context::initEGL()

}

void Context::runRootScript()
bool Context::runRootScript()
{
    rsAssert(mRootScript->mIsRoot);

    glColor4f(1,1,1,1);
    glEnable(GL_LIGHT0);
    glViewport(0, 0, 320, 480);
    float aspectH = 480.f / 320.f;

@@ -99,8 +101,7 @@ void Context::runRootScript()
    glClear(GL_COLOR_BUFFER_BIT);
    glClear(GL_DEPTH_BUFFER_BIT);

    mRootScript->run(this, 0);

    return mRootScript->run(this, 0);
}

void Context::setupCheck()
@@ -133,24 +134,19 @@ void * Context::threadProc(void *vrsc)
     LOGE("TP 2");

     rsc->mRunning = true;
     bool mDraw = true;
     while (!rsc->mExit) {
         gIO->playCoreCommands(rsc);
         mDraw |= gIO->playCoreCommands(rsc);

         if (!rsc->mRootScript.get()) {
         if (!mDraw || !rsc->mRootScript.get()) {
             usleep(10000);
             continue;
         }


         glColor4f(1,1,1,1);
         glEnable(GL_LIGHT0);

         if (rsc->mRootScript.get()) {
             rsc->runRootScript();
         }

             mDraw = rsc->runRootScript();
             eglSwapBuffers(rsc->mDisplay, rsc->mSurface);

         usleep(10000);
         }
     }

     LOGE("TP 6");
@@ -158,9 +154,6 @@ void * Context::threadProc(void *vrsc)
     glClear(GL_COLOR_BUFFER_BIT);
     eglSwapBuffers(rsc->mDisplay, rsc->mSurface);
     eglTerminate(rsc->mDisplay);

     LOGE("TP 7");

     return NULL;
}

+1 −1
Original line number Diff line number Diff line
@@ -108,7 +108,7 @@ private:

    void initEGL();

    void runRootScript();
    bool runRootScript();

    static void * threadProc(void *);

+1 −1
Original line number Diff line number Diff line
@@ -46,7 +46,7 @@ public:

    ObjectBaseRef<Allocation> mSlots[16];

    virtual void run(Context *, uint32_t launchID) = 0;
    virtual bool run(Context *, uint32_t launchID) = 0;
};


Loading