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

Commit 5e7f766e authored by Romain Guy's avatar Romain Guy
Browse files

Make nested hardware layers work again

Change-Id: I97bde694ec1b712a1e010c8137919e6d64af3148
parent 82d41a51
Loading
Loading
Loading
Loading
+6 −3
Original line number Diff line number Diff line
@@ -8087,7 +8087,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback, Accessibility
     *
     * @return A HardwareLayer ready to render, or null if an error occurred.
     */
    HardwareLayer getHardwareLayer(Canvas currentCanvas) {
    HardwareLayer getHardwareLayer() {
        if (mAttachInfo == null || mAttachInfo.mHardwareRenderer == null) {
            return null;
        }
@@ -8107,7 +8107,9 @@ public class View implements Drawable.Callback, KeyEvent.Callback, Accessibility
                mHardwareLayer.resize(width, height);
            }

            final HardwareCanvas canvas = mHardwareLayer.start(mAttachInfo.mHardwareCanvas);
            Canvas currentCanvas = mAttachInfo.mHardwareCanvas;
            final HardwareCanvas canvas = mHardwareLayer.start(currentCanvas);
            mAttachInfo.mHardwareCanvas = canvas;
            try {
                canvas.setViewport(width, height);
                // TODO: We should pass the dirty rect
@@ -8131,7 +8133,8 @@ public class View implements Drawable.Callback, KeyEvent.Callback, Accessibility
                canvas.restoreToCount(restoreCount);
            } finally {
                canvas.onPostDraw();
                mHardwareLayer.end(mAttachInfo.mHardwareCanvas);
                mHardwareLayer.end(currentCanvas);
                mAttachInfo.mHardwareCanvas = currentCanvas;
            }
        }

+1 −1
Original line number Diff line number Diff line
@@ -2475,7 +2475,7 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager
        if (hasNoCache) {
            boolean layerRendered = false;
            if (layerType == LAYER_TYPE_HARDWARE) {
                final HardwareLayer layer = child.getHardwareLayer(canvas);
                final HardwareLayer layer = child.getHardwareLayer();
                if (layer != null && layer.isValid()) {
                    ((HardwareCanvas) canvas).drawHardwareLayer(layer, 0, 0, child.mLayerPaint);
                    layerRendered = true;