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

Commit 1be2c0fc authored by John Reck's avatar John Reck Committed by Android Git Automerger
Browse files

am c75db826: Merge "Remove kStatusInvoke & kStatusDraw"

* commit 'c75db826':
  Remove kStatusInvoke & kStatusDraw
parents 00bd466a c75db826
Loading
Loading
Loading
Loading
+1 −23
Original line number Diff line number Diff line
@@ -1096,8 +1096,7 @@ public class GLRenderer extends HardwareRenderer {
            }

            if (checkRenderContext() != SURFACE_STATE_ERROR) {
                int status = mCanvas.invokeFunctors(mRedrawClip);
                handleFunctorStatus(attachInfo, status);
                mCanvas.invokeFunctors(mRedrawClip);
            }
        }
    }
@@ -1301,7 +1300,6 @@ public class GLRenderer extends HardwareRenderer {
            mProfileData[mProfileCurrentFrame + 1] = total;
        }

        handleFunctorStatus(attachInfo, status);
        return status;
    }

@@ -1337,26 +1335,6 @@ public class GLRenderer extends HardwareRenderer {
        }
    }

    private void handleFunctorStatus(View.AttachInfo attachInfo, int status) {
        // If the draw flag is set, functors will be invoked while executing
        // the tree of display lists
        if ((status & RenderNode.STATUS_DRAW) != 0) {
            if (mRedrawClip.isEmpty()) {
                attachInfo.mViewRootImpl.invalidate();
            } else {
                attachInfo.mViewRootImpl.invalidateChildInParent(null, mRedrawClip);
                mRedrawClip.setEmpty();
            }
        }

        if ((status & RenderNode.STATUS_INVOKE) != 0 ||
                attachInfo.mHandler.hasCallbacks(mFunctorsRunnable)) {
            attachInfo.mHandler.removeCallbacks(mFunctorsRunnable);
            mFunctorsRunnable.attachInfo = attachInfo;
            attachInfo.mHandler.postDelayed(mFunctorsRunnable, FUNCTOR_PROCESS_DELAY);
        }
    }

    @Override
    void detachFunctor(long functor) {
        if (mCanvas != null) {
+12 −16
Original line number Diff line number Diff line
@@ -70,13 +70,11 @@ public abstract class HardwareCanvas extends Canvas {
     * Draws the specified display list onto this canvas.
     *
     * @param displayList The display list to replay.
     * @param dirty The dirty region to redraw in the next pass, matters only
     *        if this method returns {@link RenderNode#STATUS_DRAW}, can be null.
     * @param dirty Ignored, can be null.
     * @param flags Optional flags about drawing, see {@link RenderNode} for
     *              the possible flags.
     *
     * @return One of {@link RenderNode#STATUS_DONE}, {@link RenderNode#STATUS_DRAW}, or
     *         {@link RenderNode#STATUS_INVOKE}, or'd with {@link RenderNode#STATUS_DREW}
     * @return One of {@link RenderNode#STATUS_DONE} or {@link RenderNode#STATUS_DREW}
     *         if anything was drawn.
     *
     * @hide
@@ -102,8 +100,7 @@ public abstract class HardwareCanvas extends Canvas {
     *
     * @param drawGLFunction A native function pointer
     *
     * @return One of {@link RenderNode#STATUS_DONE}, {@link RenderNode#STATUS_DRAW} or
     *         {@link RenderNode#STATUS_INVOKE}
     * @return {@link RenderNode#STATUS_DONE}
     *
     * @hide
     */
@@ -115,10 +112,9 @@ public abstract class HardwareCanvas extends Canvas {
    /**
     * Invoke all the functors who requested to be invoked during the previous frame.
     *
     * @param dirty The region to redraw when the functors return {@link RenderNode#STATUS_DRAW}
     * @param dirty Ignored
     *
     * @return One of {@link RenderNode#STATUS_DONE}, {@link RenderNode#STATUS_DRAW} or
     *         {@link RenderNode#STATUS_INVOKE}
     * @return Ignored
     *
     * @hide
     */
+0 −8
Original line number Diff line number Diff line
@@ -65,14 +65,6 @@ struct DrawGlInfo {
    enum Status {
        // The functor is done
        kStatusDone = 0x0,
        // The functor is requesting a redraw (the clip rect
        // used by the redraw is specified by DrawGlInfo.)
        // The rest of the UI might redraw too.
        kStatusDraw = 0x1,
        // The functor needs to be invoked again but will
        // not redraw. Only the functor is invoked again
        // (unless another functor requests a redraw.)
        kStatusInvoke = 0x2,
        // DisplayList actually issued GL drawing commands.
        // This is used to signal the HardwareRenderer that the
        // buffers should be flipped - otherwise, there were no
+2 −20
Original line number Diff line number Diff line
@@ -409,15 +409,6 @@ status_t OpenGLRenderer::invokeFunctors(Rect& dirty) {
        for (size_t i = 0; i < count; i++) {
            Functor* f = functors.itemAt(i);
            result |= (*f)(DrawGlInfo::kModeProcess, &info);

            if (result & DrawGlInfo::kStatusDraw) {
                Rect localDirty(info.dirtyLeft, info.dirtyTop, info.dirtyRight, info.dirtyBottom);
                dirty.unionWith(localDirty);
            }

            if (result & DrawGlInfo::kStatusInvoke) {
                mFunctors.add(f);
            }
        }
        resume();
    }
@@ -461,19 +452,10 @@ status_t OpenGLRenderer::callDrawGLFunction(Functor* functor, Rect& dirty) {
    interrupt();

    // call functor immediately after GL state setup
    status_t result = (*functor)(DrawGlInfo::kModeDraw, &info);

    if (result != DrawGlInfo::kStatusDone) {
        Rect localDirty(info.dirtyLeft, info.dirtyTop, info.dirtyRight, info.dirtyBottom);
        dirty.unionWith(localDirty);

        if (result & DrawGlInfo::kStatusInvoke) {
            mFunctors.add(functor);
        }
    }
    (*functor)(DrawGlInfo::kModeDraw, &info);

    resume();
    return result | DrawGlInfo::kStatusDrew;
    return DrawGlInfo::kStatusDrew;
}

///////////////////////////////////////////////////////////////////////////////
+1 −17
Original line number Diff line number Diff line
@@ -411,7 +411,6 @@ void CanvasContext::drawDisplayList(RenderNode* displayList, Rect* dirty) {

    Rect outBounds;
    status |= mCanvas->drawDisplayList(displayList, outBounds);
    handleFunctorStatus(status, outBounds);

    // TODO: Draw debug info
    // TODO: Performance tracking
@@ -448,22 +447,7 @@ void CanvasContext::invokeFunctors() {

    makeCurrent();
    Rect dirty;
    int status = mCanvas->invokeFunctors(dirty);
    handleFunctorStatus(status, dirty);
}

void CanvasContext::handleFunctorStatus(int status, const Rect& redrawClip) {
    if (status & DrawGlInfo::kStatusDraw) {
        // TODO: Invalidate the redrawClip
        // Do we need to post to ViewRootImpl like the current renderer?
        // Can we just enqueue ourselves to re-invoke the same display list?
        // Something else entirely? Does ChromiumView still want this in a
        // RenderThread world?
    }

    if (status & DrawGlInfo::kStatusInvoke) {
        queueFunctorsTask();
    }
    mCanvas->invokeFunctors(dirty);
}

void CanvasContext::removeFunctorsTask() {
Loading