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

Commit 1bd1bad0 authored by Romain Guy's avatar Romain Guy
Browse files

Preapre region tracking in layers

Change-Id: Ied1fa0d36c99ef4e33cb8fde7e3106a793db3a4c
parent 739e34a3
Loading
Loading
Loading
Loading
+13 −13
Original line number Diff line number Diff line
@@ -697,13 +697,7 @@ void OpenGLRenderer::dirtyLayer(const float left, const float top,
    if ((mSnapshot->flags & Snapshot::kFlagFboTarget) && mSnapshot->region) {
        Rect bounds(left, top, right, bottom);
        transform.mapRect(bounds);
        if (bounds.intersect(*mSnapshot->clipRect)) {
            bounds.snapToPixelBoundaries();
            android::Rect dirty(bounds.left, bounds.top, bounds.right, bounds.bottom);
            if (!dirty.isEmpty()) {
                mSnapshot->region->orSelf(dirty);
            }
        }
        dirtyLayerUnchecked(bounds, mSnapshot->region);
    }
#endif
}
@@ -713,12 +707,18 @@ void OpenGLRenderer::dirtyLayer(const float left, const float top,
#if RENDER_LAYERS_AS_REGIONS
    if ((mSnapshot->flags & Snapshot::kFlagFboTarget) && mSnapshot->region) {
        Rect bounds(left, top, right, bottom);
        dirtyLayerUnchecked(bounds, mSnapshot->region);
    }
#endif
}

void OpenGLRenderer::dirtyLayerUnchecked(Rect& bounds, Region* region) {
#if RENDER_LAYERS_AS_REGIONS
    if (bounds.intersect(*mSnapshot->clipRect)) {
        bounds.snapToPixelBoundaries();
        android::Rect dirty(bounds.left, bounds.top, bounds.right, bounds.bottom);
        if (!dirty.isEmpty()) {
                mSnapshot->region->orSelf(dirty);
            }
            region->orSelf(dirty);
        }
    }
#endif
+2 −0
Original line number Diff line number Diff line
@@ -145,6 +145,8 @@ protected:
    virtual void dirtyLayer(const float left, const float top,
            const float right, const float bottom);

    void dirtyLayerUnchecked(Rect& bounds, Region* region);

private:
    /**
     * Saves the current state of the renderer as a new snapshot.