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

Commit 14b56a51 authored by Doris Liu's avatar Doris Liu
Browse files

DrawVectorDrawableOp for old rendering pipeline

Bug: 27371430
Change-Id: I068d8023812173526ac98d11b903f82e0a66d9c2
parent 1e33af88
Loading
Loading
Loading
Loading
+1 −6
Original line number Original line Diff line number Diff line
@@ -415,12 +415,7 @@ void DisplayListCanvas::drawPoints(const float* points, int count, const SkPaint


void DisplayListCanvas::drawVectorDrawable(VectorDrawableRoot* tree) {
void DisplayListCanvas::drawVectorDrawable(VectorDrawableRoot* tree) {
    mDisplayList->ref(tree);
    mDisplayList->ref(tree);
    const SkBitmap& bitmap = tree->getBitmapUpdateIfDirty();
    addDrawOp(new (alloc()) DrawVectorDrawableOp(tree));
    SkPaint* paint = tree->getPaint();
    const SkRect bounds = tree->getBounds();
    addDrawOp(new (alloc()) DrawBitmapRectOp(refBitmap(bitmap),
            0, 0, bitmap.width(), bitmap.height(),
            bounds.left(), bounds.top(), bounds.right(), bounds.bottom(), refPaint(paint)));
}
}


void DisplayListCanvas::drawTextOnPath(const uint16_t* glyphs, int count,
void DisplayListCanvas::drawTextOnPath(const uint16_t* glyphs, int count,
+25 −0
Original line number Original line Diff line number Diff line
@@ -28,6 +28,7 @@
#include "UvMapper.h"
#include "UvMapper.h"
#include "utils/LinearAllocator.h"
#include "utils/LinearAllocator.h"
#include "utils/PaintUtils.h"
#include "utils/PaintUtils.h"
#include "VectorDrawable.h"


#include <algorithm>
#include <algorithm>


@@ -1107,6 +1108,30 @@ private:
    float* mRadius;
    float* mRadius;
};
};


class DrawVectorDrawableOp : public DrawOp {
public:
    DrawVectorDrawableOp(VectorDrawableRoot* tree)
            : DrawOp(nullptr), mTree(tree) {}

    virtual void applyDraw(OpenGLRenderer& renderer, Rect& dirty) override {
        const SkBitmap& bitmap = mTree->getBitmapUpdateIfDirty();
        SkPaint* paint = mTree->getPaint();
        const SkRect bounds = mTree->getBounds();
        renderer.drawBitmap(&bitmap, Rect(0, 0, bitmap.width(), bitmap.height()),
                bounds, paint);
    }

    virtual void output(int level, uint32_t logFlags) const override {
        OP_LOG("Draw Vector Drawable %p", mTree);
    }

    virtual const char* name() override { return "DrawVectorDrawable"; }

private:
    VectorDrawableRoot* mTree;

};

class DrawOvalOp : public DrawStrokableOp {
class DrawOvalOp : public DrawStrokableOp {
public:
public:
    DrawOvalOp(float left, float top, float right, float bottom, const SkPaint* paint)
    DrawOvalOp(float left, float top, float right, float bottom, const SkPaint* paint)