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

Commit ec4a4b13 authored by sergeyv's avatar sergeyv
Browse files

Use Bitmap in DisplayList & RecordedOps instead of SkBitmap

Test: refactoring cl.
bug:32216791

Change-Id: I1d8a9a6e772e2176b6c2409409a910478b45f8db
parent 5fd2a1cb
Loading
Loading
Loading
Loading
+1 −3
Original line number Diff line number Diff line
@@ -1205,9 +1205,7 @@ static jlong Bitmap_refPixelRef(JNIEnv* env, jobject, jlong bitmapHandle) {
static void Bitmap_prepareToDraw(JNIEnv* env, jobject, jlong bitmapPtr) {
    LocalScopedBitmap bitmapHandle(bitmapPtr);
    if (!bitmapHandle.valid()) return;
    SkBitmap bitmap;
    bitmapHandle->getSkBitmap(&bitmap);
    android::uirenderer::renderthread::RenderProxy::prepareToDraw(bitmap);
    android::uirenderer::renderthread::RenderProxy::prepareToDraw(bitmapHandle->bitmap());
}

static jint Bitmap_getAllocationByteCount(JNIEnv* env, jobject, jlong bitmapPtr) {
+1 −1
Original line number Diff line number Diff line
@@ -46,7 +46,7 @@ void BakedOpDispatcher::onMergedBitmapOps(BakedOpRenderer& renderer,
        const MergedBakedOpList& opList) {

    const BakedOpState& firstState = *(opList.states[0]);
    const SkBitmap* bitmap = (static_cast<const BitmapOp*>(opList.states[0]->op))->bitmap;
    Bitmap* bitmap = (static_cast<const BitmapOp*>(opList.states[0]->op))->bitmap;

    Texture* texture = renderer.caches().textureCache.get(bitmap);
    if (!texture) return;
+1 −1
Original line number Diff line number Diff line
@@ -181,7 +181,7 @@ void BakedOpRenderer::clearColorBuffer(const Rect& rect) {
    if (!mRenderTarget.frameBufferId) mHasDrawn = true;
}

Texture* BakedOpRenderer::getTexture(const SkBitmap* bitmap) {
Texture* BakedOpRenderer::getTexture(Bitmap* bitmap) {
    return mCaches.textureCache.get(bitmap);
}

+1 −1
Original line number Diff line number Diff line
@@ -74,7 +74,7 @@ public:
    void endLayer();
    WARN_UNUSED_RESULT OffscreenBuffer* copyToLayer(const Rect& area);

    Texture* getTexture(const SkBitmap* bitmap);
    Texture* getTexture(Bitmap* bitmap);
    const LightInfo& getLightInfo() const { return mLightInfo; }

    void renderGlop(const BakedOpState& state, const Glop& glop) {
+2 −2
Original line number Diff line number Diff line
@@ -106,9 +106,9 @@ void DisplayList::updateChildren(std::function<void(RenderNode*)> updateFn) {
bool DisplayList::prepareListAndChildren(TreeInfo& info, bool functorsNeedLayer,
        std::function<void(RenderNode*, TreeInfo&, bool)> childFn) {
    TextureCache& cache = Caches::getInstance().textureCache;
    for (auto&& bitmapResource : bitmapResources) {
    for (auto& bitmapResource : bitmapResources) {
        void* ownerToken = &info.canvasContext;
        info.prepareTextures = cache.prefetchAndMarkInUse(ownerToken, bitmapResource);
        info.prepareTextures = cache.prefetchAndMarkInUse(ownerToken, bitmapResource.get());
    }
    for (auto&& op : children) {
        RenderNode* childNode = op->renderNode;
Loading