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

Commit 6917e655 authored by Romain Guy's avatar Romain Guy Committed by Android (Google) Code Review
Browse files

Merge "Record possible clip rejects when recording display lists"

parents 7d5bb3dd 33f6beb1
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -26,6 +26,15 @@ package android.view;
 * @hide 
 */
public abstract class DisplayList {
    /**
     * Flag used when calling
     * {@link HardwareCanvas#drawDisplayList(DisplayList, int, int, android.graphics.Rect, int)}.
     * When this flag is set, draw operations lying outside of the bounds of the
     * display list will be culled early. It is recommeneded to always set this
     * flag.
     */
    public static final int FLAG_CLIP_CHILDREN = 0x1;

    /**
     * Starts recording the display list. All operations performed on the
     * returned canvas are recorded and stored in this display list.
+5 −4
Original line number Diff line number Diff line
@@ -385,13 +385,14 @@ class GLES20Canvas extends HardwareCanvas {
    private static native void nSetDisplayListName(int displayList, String name);

    @Override
    public boolean drawDisplayList(DisplayList displayList, int width, int height, Rect dirty) {
        return nDrawDisplayList(mRenderer,
                ((GLES20DisplayList) displayList).getNativeDisplayList(), width, height, dirty);
    public boolean drawDisplayList(DisplayList displayList, int width, int height,
            Rect dirty, int flags) {
        return nDrawDisplayList(mRenderer, ((GLES20DisplayList) displayList).getNativeDisplayList(),
                width, height, dirty, flags);
    }

    private static native boolean nDrawDisplayList(int renderer, int displayList,
            int width, int height, Rect dirty);
            int width, int height, Rect dirty, int flags);

    @Override
    void outputDisplayList(DisplayList displayList) {
+2 −2
Original line number Diff line number Diff line
@@ -143,8 +143,8 @@ class GLES20RecordingCanvas extends GLES20Canvas implements Poolable<GLES20Recor
    @Override
    public void drawBitmapMesh(Bitmap bitmap, int meshWidth, int meshHeight, float[] verts,
            int vertOffset, int[] colors, int colorOffset, Paint paint) {
        super.drawBitmapMesh(bitmap, meshWidth, meshHeight, verts, vertOffset, colors, colorOffset,
                paint);
        super.drawBitmapMesh(bitmap, meshWidth, meshHeight, verts, vertOffset,
                colors, colorOffset, paint);
        mDisplayList.mBitmaps.add(bitmap);
        // Shaders in the Paint are ignored when drawing a Bitmap
    }
+4 −1
Original line number Diff line number Diff line
@@ -57,11 +57,14 @@ public abstract class HardwareCanvas extends Canvas {
     * @param height The height of the display list.
     * @param dirty The dirty region to redraw in the next pass, matters only
     *        if this method returns true, can be null.
     * @param flags Optional flags about drawing, see {@link DisplayList} for
     *              the possible flags.
     * 
     * @return True if the content of the display list requires another
     *         drawing pass (invalidate()), false otherwise
     */
    public abstract boolean drawDisplayList(DisplayList displayList, int width, int height, Rect dirty);
    public abstract boolean drawDisplayList(DisplayList displayList, int width, int height,
            Rect dirty, int flags);

    /**
     * Outputs the specified display list to the log. This method exists for use by
+2 −1
Original line number Diff line number Diff line
@@ -969,7 +969,8 @@ public abstract class HardwareRenderer {
                            }

                            boolean invalidateNeeded = canvas.drawDisplayList(displayList,
                                    view.getWidth(), view.getHeight(), mRedrawClip);
                                    view.getWidth(), view.getHeight(), mRedrawClip,
                                    DisplayList.FLAG_CLIP_CHILDREN);

                            if (mProfileEnabled) {
                                long now = System.nanoTime();
Loading