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

Commit 70e7299b authored by Nader Jawad's avatar Nader Jawad
Browse files

Removed logic to handle optimized software rendering pass for opaque

Views

Change-Id: I149b8297e432a3d038ce18e8bd76022a39006a00
Fixes: 71521014
Test: Re-ran CtsWidgetTestCases and CtsGraphicsTestCases
parent ab5500c2
Loading
Loading
Loading
Loading
+0 −4
Original line number Diff line number Diff line
@@ -791,15 +791,11 @@ public final class ThreadedRenderer {
     * @param callbacks Callbacks invoked when drawing happens.
     */
    void draw(View view, AttachInfo attachInfo, DrawCallbacks callbacks) {
        attachInfo.mIgnoreDirtyState = true;

        final Choreographer choreographer = attachInfo.mViewRootImpl.mChoreographer;
        choreographer.mFrameInfo.markDrawStart();

        updateRootDisplayList(view, callbacks);

        attachInfo.mIgnoreDirtyState = false;

        // register animating rendernodes which started animating prior to renderer
        // creation, which is typical for animators started prior to first draw
        if (attachInfo.mPendingAnimatingRenderNodes != null) {
+5 −29
Original line number Diff line number Diff line
@@ -2297,19 +2297,11 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
    static final int PFLAG_DIRTY                       = 0x00200000;
    /**
     * View flag indicating whether this view was invalidated by an opaque
     * invalidate request.
     * Mask for {@link #PFLAG_DIRTY}.
     *
     * @hide
     */
    static final int PFLAG_DIRTY_OPAQUE                = 0x00400000;
    /**
     * Mask for {@link #PFLAG_DIRTY} and {@link #PFLAG_DIRTY_OPAQUE}.
     *
     * @hide
     */
    static final int PFLAG_DIRTY_MASK                  = 0x00600000;
    static final int PFLAG_DIRTY_MASK                  = 0x00200000;
    /**
     * Indicates whether the background is opaque.
@@ -3833,7 +3825,6 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
            name = "DRAWING_CACHE_INVALID", outputIf = false),
        @ViewDebug.FlagToString(mask = PFLAG_DRAWN, equals = PFLAG_DRAWN, name = "DRAWN", outputIf = true),
        @ViewDebug.FlagToString(mask = PFLAG_DRAWN, equals = PFLAG_DRAWN, name = "NOT_DRAWN", outputIf = false),
        @ViewDebug.FlagToString(mask = PFLAG_DIRTY_MASK, equals = PFLAG_DIRTY_OPAQUE, name = "DIRTY_OPAQUE"),
        @ViewDebug.FlagToString(mask = PFLAG_DIRTY_MASK, equals = PFLAG_DIRTY, name = "DIRTY")
    }, formatToHexString = true)
@@ -20173,8 +20164,6 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
    @CallSuper
    public void draw(Canvas canvas) {
        final int privateFlags = mPrivateFlags;
        final boolean dirtyOpaque = (privateFlags & PFLAG_DIRTY_MASK) == PFLAG_DIRTY_OPAQUE &&
                (mAttachInfo == null || !mAttachInfo.mIgnoreDirtyState);
        mPrivateFlags = (privateFlags & ~PFLAG_DIRTY_MASK) | PFLAG_DRAWN;
        /*
@@ -20192,9 +20181,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
        // Step 1, draw the background, if needed
        int saveCount;
        if (!dirtyOpaque) {
        drawBackground(canvas);
        }
        // skip step 2 & 5 if possible (common case)
        final int viewFlags = mViewFlags;
@@ -20202,7 +20189,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
        boolean verticalEdges = (viewFlags & FADING_EDGE_VERTICAL) != 0;
        if (!verticalEdges && !horizontalEdges) {
            // Step 3, draw the content
            if (!dirtyOpaque) onDraw(canvas);
            onDraw(canvas);
            // Step 4, draw the children
            dispatchDraw(canvas);
@@ -20316,7 +20303,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
        }
        // Step 3, draw the content
        if (!dirtyOpaque) onDraw(canvas);
        onDraw(canvas);
        // Step 4, draw the children
        dispatchDraw(canvas);
@@ -26473,17 +26460,6 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
         */
        long mDrawingTime;
        /**
         * Indicates whether or not ignoring the DIRTY_MASK flags.
         */
        boolean mIgnoreDirtyState;
        /**
         * This flag tracks when the mIgnoreDirtyState flag is set during draw(),
         * to avoid clearing that flag prematurely.
         */
        boolean mSetIgnoreDirtyState = false;
        /**
         * Indicates whether the view's window is currently in touch mode.
         */
+1 −8
Original line number Diff line number Diff line
@@ -5853,11 +5853,8 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager
            // Views being animated or transformed are not considered opaque because we may
            // be invalidating their old position and need the parent to paint behind them.
            Matrix childMatrix = child.getMatrix();
            final boolean isOpaque = child.isOpaque() && !drawAnimation &&
                    child.getAnimation() == null && childMatrix.isIdentity();
            // Mark the child as dirty, using the appropriate flag
            // Make sure we do not set both flags at the same time
            int opaqueFlag = isOpaque ? PFLAG_DIRTY_OPAQUE : PFLAG_DIRTY;

            if (child.mLayerType != LAYER_TYPE_NONE) {
                mPrivateFlags |= PFLAG_INVALIDATED;
@@ -5911,12 +5908,8 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager
                // If the parent is dirty opaque or not dirty, mark it dirty with the opaque
                // flag coming from the child that initiated the invalidate
                if (view != null) {
                    if ((view.mViewFlags & FADING_EDGE_MASK) != 0 &&
                            view.getSolidColor() == 0) {
                        opaqueFlag = PFLAG_DIRTY;
                    }
                    if ((view.mPrivateFlags & PFLAG_DIRTY_MASK) != PFLAG_DIRTY) {
                        view.mPrivateFlags = (view.mPrivateFlags & ~PFLAG_DIRTY_MASK) | opaqueFlag;
                        view.mPrivateFlags = (view.mPrivateFlags & ~PFLAG_DIRTY_MASK) | PFLAG_DIRTY;
                    }
                }

+7 −27
Original line number Diff line number Diff line
@@ -1283,10 +1283,6 @@ public final class ViewRootImpl implements ViewParent,

    private void invalidateRectOnScreen(Rect dirty) {
        final Rect localDirty = mDirty;
        if (!localDirty.isEmpty() && !localDirty.contains(dirty)) {
            mAttachInfo.mSetIgnoreDirtyState = true;
            mAttachInfo.mIgnoreDirtyState = true;
        }

        // Add the new dirty rect to the current one
        localDirty.union(dirty.left, dirty.top, dirty.right, dirty.bottom);
@@ -3178,7 +3174,6 @@ public final class ViewRootImpl implements ViewParent,
        }

        if (fullRedrawNeeded) {
            mAttachInfo.mIgnoreDirtyState = true;
            dirty.set(0, 0, (int) (mWidth * appScale + 0.5f), (int) (mHeight * appScale + 0.5f));
        }

@@ -3325,13 +3320,6 @@ public final class ViewRootImpl implements ViewParent,

            canvas = mSurface.lockCanvas(dirty);

            // The dirty rectangle can be modified by Surface.lockCanvas()
            //noinspection ConstantConditions
            if (left != dirty.left || top != dirty.top || right != dirty.right
                    || bottom != dirty.bottom) {
                attachInfo.mIgnoreDirtyState = true;
            }

            // TODO: Do this in native
            canvas.setDensity(mDensity);
        } catch (Surface.OutOfResourcesException e) {
@@ -3377,23 +3365,15 @@ public final class ViewRootImpl implements ViewParent,
                        ", metrics=" + cxt.getResources().getDisplayMetrics() +
                        ", compatibilityInfo=" + cxt.getResources().getCompatibilityInfo());
            }
            try {
            canvas.translate(-xoff, -yoff);
            if (mTranslator != null) {
                mTranslator.translateCanvas(canvas);
            }
            canvas.setScreenDensity(scalingRequired ? mNoncompatDensity : 0);
                attachInfo.mSetIgnoreDirtyState = false;

            mView.draw(canvas);

            drawAccessibilityFocusedDrawableIfNeeded(canvas);
            } finally {
                if (!attachInfo.mSetIgnoreDirtyState) {
                    // Only clear the flag if it was not set during the mView.draw() call
                    attachInfo.mIgnoreDirtyState = false;
                }
            }
        } finally {
            try {
                surface.unlockCanvasAndPost(canvas);
+0 −1
Original line number Diff line number Diff line
@@ -49,7 +49,6 @@ public class ViewInvalidateTest {
    public ActivityTestRule<Activity> mActivityRule = new ActivityTestRule<>(Activity.class);

    private static final int INVAL_TEST_FLAG_MASK = View.PFLAG_DIRTY
            | View.PFLAG_DIRTY_OPAQUE
            | View.PFLAG_DRAWN
            | View.PFLAG_DRAWING_CACHE_VALID
            | View.PFLAG_INVALIDATED