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

Commit 0fe478ea authored by Romain Guy's avatar Romain Guy
Browse files

Support nested display lists.

Change-Id: I3815a2832fc0f722c668ba8f51c5f177edb77c94
parent cce1d2a6
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -421,7 +421,7 @@ static void android_view_GLES20Canvas_destroyDisplayList(JNIEnv* env,

static void android_view_GLES20Canvas_drawDisplayList(JNIEnv* env,
        jobject canvas, OpenGLRenderer* renderer, DisplayList* displayList) {
    displayList->replay(*renderer);
    renderer->drawDisplayList(displayList);
}

#endif // USE_OPENGL_RENDERER
+9 −0
Original line number Diff line number Diff line
@@ -226,6 +226,10 @@ void DisplayList::replay(OpenGLRenderer& renderer) {
                        (SkRegion::Op) getInt());
            }
            break;
            case DrawDisplayList: {
                renderer.drawDisplayList(getDisplayList());
            }
            break;
            case DrawBitmap: {
                renderer.drawBitmap(getBitmap(), getFloat(), getFloat(), getPaint());
            }
@@ -453,6 +457,11 @@ bool DisplayListRenderer::clipRect(float left, float top, float right, float bot
    return OpenGLRenderer::clipRect(left, top, right, bottom, op);
}

void DisplayListRenderer::drawDisplayList(DisplayList* displayList) {
    addOp(DisplayList::DrawDisplayList);
    addDisplayList(displayList);
}

void DisplayListRenderer::drawBitmap(SkBitmap* bitmap, float left, float top,
        SkPaint* paint) {
    addOp(DisplayList::DrawBitmap);
+21 −6
Original line number Diff line number Diff line
@@ -92,6 +92,7 @@ public:
        SetMatrix,
        ConcatMatrix,
        ClipRect,
        DrawDisplayList,
        DrawBitmap,
        DrawBitmapMatrix,
        DrawBitmapRect,
@@ -160,6 +161,10 @@ private:
        return (SkPaint*) getInt();
    }

    DisplayList* getDisplayList() {
        return (DisplayList*) getInt();
    }

    inline float getFloat() {
        return mReader.readScalar();
    }
@@ -235,6 +240,7 @@ public:

    bool clipRect(float left, float top, float right, float bottom, SkRegion::Op op);

    void drawDisplayList(DisplayList* displayList);
    void drawBitmap(SkBitmap* bitmap, float left, float top, SkPaint* paint);
    void drawBitmap(SkBitmap* bitmap, SkMatrix* matrix, SkPaint* paint);
    void drawBitmap(SkBitmap* bitmap, float srcLeft, float srcTop,
@@ -351,15 +357,24 @@ private:
            addInt((int) NULL);
            return;
        }

        SkPaint *paintCopy =  mPaintMap.valueFor(paint);
        if (paintCopy == NULL || paintCopy->getGenerationID() != paint->getGenerationID()) {
            paintCopy = new SkPaint(*paint);
            mPaintMap.add(paint, paintCopy);
            mPaints.add(paintCopy);
        }

        addInt((int) paintCopy);
    }

    inline void addDisplayList(DisplayList* displayList) {
        // TODO: To be safe, the display list should be ref-counted in the
        //       resources cache, but we rely on the caller (UI toolkit) to
        //       do the right thing for now
        addInt((int) displayList);
    }

    inline void addMatrix(SkMatrix* matrix) {
        // Copying the matrix is cheap and prevents against the user changing the original
        // matrix before the operation that uses it
+6 −0
Original line number Diff line number Diff line
@@ -48,6 +48,12 @@ int OpenGLDebugRenderer::saveLayer(float left, float top, float right, float bot
    return OpenGLRenderer::saveLayer(left, top, right, bottom, p, flags);
}

void OpenGLDebugRenderer::drawDisplayList(DisplayList* displayList) {
    mPrimitivesCount++;
    StopWatch w("drawDisplayList");
    OpenGLRenderer::drawDisplayList(displayList);
}

void OpenGLDebugRenderer::drawBitmap(SkBitmap* bitmap, float left, float top,
        SkPaint* paint) {
    mPrimitivesCount++;
+1 −0
Original line number Diff line number Diff line
@@ -40,6 +40,7 @@ public:
    int saveLayer(float left, float top, float right, float bottom,
            SkPaint* p, int flags);

    void drawDisplayList(DisplayList* displayList);
    void drawBitmap(SkBitmap* bitmap, float left, float top, SkPaint* paint);
    void drawBitmap(SkBitmap* bitmap, SkMatrix* matrix, SkPaint* paint);
    void drawBitmap(SkBitmap* bitmap, float srcLeft, float srcTop,
Loading