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

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

Merge "Use a status_t return type for GL functors"

parents 994c26b2 6554943a
Loading
Loading
Loading
Loading
+24 −0
Original line number Diff line number Diff line
@@ -35,6 +35,30 @@ public abstract class DisplayList {
     */
    public static final int FLAG_CLIP_CHILDREN = 0x1;

    // NOTE: The STATUS_* values *must* match the enum in DrawGlInfo.h

    /**
     * Indicates that the display list is done drawing.
     * 
     * @see HardwareCanvas#drawDisplayList(DisplayList, int, int, android.graphics.Rect, int) 
     */
    public static final int STATUS_DONE = 0x0;

    /**
     * Indicates that the display list needs another drawing pass.
     * 
     * @see HardwareCanvas#drawDisplayList(DisplayList, int, int, android.graphics.Rect, int)
     */
    public static final int STATUS_DRAW = 0x2;

    /**
     * Indicates that the display list needs to re-execute its GL functors.
     * 
     * @see HardwareCanvas#drawDisplayList(DisplayList, int, int, android.graphics.Rect, int)
     * @see HardwareCanvas#callDrawGLFunction(int) 
     */
    public static final int STATUS_INVOKE = 0x2;

    /**
     * Starts recording the display list. All operations performed on the
     * returned canvas are recorded and stored in this display list.
+4 −4
Original line number Diff line number Diff line
@@ -296,11 +296,11 @@ class GLES20Canvas extends HardwareCanvas {
    ///////////////////////////////////////////////////////////////////////////

    @Override
    public boolean callDrawGLFunction(int drawGLFunction) {
    public int callDrawGLFunction(int drawGLFunction) {
        return nCallDrawGLFunction(mRenderer, drawGLFunction);
    }

    private static native boolean nCallDrawGLFunction(int renderer, int drawGLFunction);
    private static native int nCallDrawGLFunction(int renderer, int drawGLFunction);

    ///////////////////////////////////////////////////////////////////////////
    // Memory
@@ -394,13 +394,13 @@ class GLES20Canvas extends HardwareCanvas {
    private static native void nSetDisplayListName(int displayList, String name);

    @Override
    public boolean drawDisplayList(DisplayList displayList, int width, int height,
    public int 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,
    private static native int nDrawDisplayList(int renderer, int displayList,
            int width, int height, Rect dirty, int flags);

    @Override
+9 −7
Original line number Diff line number Diff line
@@ -60,10 +60,10 @@ public abstract class HardwareCanvas extends Canvas {
     * @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
     * @return One of {@link DisplayList#STATUS_DONE}, {@link DisplayList#STATUS_DRAW} or
     *         {@link DisplayList#STATUS_INVOKE}
     */
    public abstract boolean drawDisplayList(DisplayList displayList, int width, int height,
    public abstract int drawDisplayList(DisplayList displayList, int width, int height,
            Rect dirty, int flags);

    /**
@@ -90,10 +90,12 @@ public abstract class HardwareCanvas extends Canvas {
     * This function may return true if an invalidation is needed after the call.
     *
     * @param drawGLFunction A native function pointer
     * @return true if an invalidate is needed after the call, false otherwise
     *                       
     * @return One of {@link DisplayList#STATUS_DONE}, {@link DisplayList#STATUS_DRAW} or
     *         {@link DisplayList#STATUS_INVOKE}
     */
    public boolean callDrawGLFunction(int drawGLFunction) {
    public int callDrawGLFunction(int drawGLFunction) {
        // Noop - this is done in the display list recorder subclass
        return false;
        return DisplayList.STATUS_DONE;
    }
}
+4 −6
Original line number Diff line number Diff line
@@ -966,7 +966,6 @@ public abstract class HardwareRenderer {
                                Log.d("DLProperties", "getDisplayList():\t" +
                                        mProfileData[mProfileCurrentFrame]);
                            }

                        }

                        if (displayList != null) {
@@ -975,7 +974,7 @@ public abstract class HardwareRenderer {
                                drawDisplayListStartTime = System.nanoTime();
                            }

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

@@ -986,20 +985,19 @@ public abstract class HardwareRenderer {

                                if (ViewDebug.DEBUG_LATENCY) {
                                    Log.d(ViewDebug.DEBUG_LATENCY_TAG, "- drawDisplayList() took " +
                                            total + "ms, invalidateNeeded=" +
                                            invalidateNeeded + ".");
                                            total + "ms, status=" + status);
                                }
                            }

                            if (invalidateNeeded) {
                            if (status != DisplayList.STATUS_DONE) {
                                if (mRedrawClip.isEmpty()) {
                                    attachInfo.mViewRootImpl.invalidate();
                                } else {
                                    attachInfo.mViewRootImpl.invalidateChildInParent(
                                            null, mRedrawClip);
                                }
                                    mRedrawClip.setEmpty();
                                }
                            }
                        } else {
                            // Shouldn't reach here
                            view.draw(canvas);
+13 −9
Original line number Diff line number Diff line
@@ -21,12 +21,16 @@
#include "jni.h"
#include "GraphicsJNI.h"
#include <nativehelper/JNIHelp.h>

#include <android_runtime/AndroidRuntime.h>
#include <android_runtime/android_graphics_SurfaceTexture.h>
#include <cutils/properties.h>
#include <gui/SurfaceTexture.h>

#include <androidfw/ResourceTypes.h>

#include <gui/SurfaceTexture.h>
#include <private/hwui/DrawGlInfo.h>

#include <cutils/properties.h>

#include <SkBitmap.h>
#include <SkCanvas.h>
@@ -196,7 +200,7 @@ static jint android_view_GLES20Canvas_getStencilSize(JNIEnv* env, jobject clazz)
// Functor
// ----------------------------------------------------------------------------

static bool android_view_GLES20Canvas_callDrawGLFunction(JNIEnv* env, jobject clazz,
static jint android_view_GLES20Canvas_callDrawGLFunction(JNIEnv* env, jobject clazz,
        OpenGLRenderer* renderer, Functor *functor) {
    android::uirenderer::Rect dirty;
    return renderer->callDrawGLFunction(functor, dirty);
@@ -682,16 +686,16 @@ static void android_view_GLES20Canvas_destroyDisplayList(JNIEnv* env,
    DisplayList::destroyDisplayListDeferred(displayList);
}

static bool android_view_GLES20Canvas_drawDisplayList(JNIEnv* env,
static jint android_view_GLES20Canvas_drawDisplayList(JNIEnv* env,
        jobject clazz, OpenGLRenderer* renderer, DisplayList* displayList,
        jint width, jint height, jobject dirty, jint flags) {
    android::uirenderer::Rect bounds;
    bool redraw = renderer->drawDisplayList(displayList, width, height, bounds, flags);
    if (redraw && dirty != NULL) {
    status_t status = renderer->drawDisplayList(displayList, width, height, bounds, flags);
    if (status != DrawGlInfo::kStatusDone && dirty != NULL) {
        env->CallVoidMethod(dirty, gRectClassInfo.set,
                int(bounds.left), int(bounds.top), int(bounds.right), int(bounds.bottom));
    }
    return redraw;
    return status;
}

static void android_view_GLES20Canvas_outputDisplayList(JNIEnv* env,
@@ -865,7 +869,7 @@ static JNINativeMethod gMethods[] = {

    { "nGetStencilSize",    "()I",             (void*) android_view_GLES20Canvas_getStencilSize },

    { "nCallDrawGLFunction", "(II)Z",
    { "nCallDrawGLFunction", "(II)I",
            (void*) android_view_GLES20Canvas_callDrawGLFunction },

    { "nSave",              "(II)I",           (void*) android_view_GLES20Canvas_save },
@@ -943,7 +947,7 @@ static JNINativeMethod gMethods[] = {
    { "nGetDisplayListSize",     "(I)I",       (void*) android_view_GLES20Canvas_getDisplayListSize },
    { "nSetDisplayListName",     "(ILjava/lang/String;)V",
                                               (void*) android_view_GLES20Canvas_setDisplayListName },
    { "nDrawDisplayList",        "(IIIILandroid/graphics/Rect;I)Z",
    { "nDrawDisplayList",        "(IIIILandroid/graphics/Rect;I)I",
                                               (void*) android_view_GLES20Canvas_drawDisplayList },

    { "nCreateDisplayListRenderer", "()I",     (void*) android_view_GLES20Canvas_createDisplayListRenderer },
Loading