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

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

Merge "Snap layer bounds to pixel boundaries."

parents 885b1f21 bf434114
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -353,6 +353,8 @@ bool OpenGLRenderer::createLayer(sp<Snapshot> snapshot, float left, float top,

    // Layers only make sense if they are in the framebuffer's bounds
    bounds.intersect(*mSnapshot->clipRect);
    bounds.snapToPixelBoundaries();

    if (bounds.isEmpty() || bounds.getWidth() > mMaxTextureSize ||
            bounds.getHeight() > mMaxTextureSize) {
        return false;
+7 −0
Original line number Diff line number Diff line
@@ -148,6 +148,13 @@ struct Rect {
        return false;
    }

    void snapToPixelBoundaries() {
        left = floor(left);
        top = floor(top);
        right = ceil(right);
        bottom = ceil(bottom);
    }

    void dump() const {
        LOGD("Rect[l=%f t=%f r=%f b=%f]", left, top, right, bottom);
    }