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

Commit 66365e40 authored by Robert Carr's avatar Robert Carr
Browse files

Transaction::setGeometry: Handle invalid src rect correctly

If no source rect (INVALID_RECT) is passed in we use no crop
and a scaling factor of 1.

Bug: 123720507
Test: android.wm.cts.SurfaceControlTest
Change-Id: I92a7f951c32fb10071a7fac17bc338b433d521fd
parent dee669c2
Loading
Loading
Loading
Loading
+6 −2
Original line number Diff line number Diff line
@@ -1147,8 +1147,12 @@ SurfaceComposerClient::Transaction& SurfaceComposerClient::Transaction::setGeome

    int x = dst.left;
    int y = dst.top;
    float xScale = dst.getWidth() / static_cast<float>(source.getWidth());
    float yScale = dst.getHeight() / static_cast<float>(source.getHeight());

    float sourceWidth = source.getWidth();
    float sourceHeight = source.getHeight();

    float xScale = sourceWidth < 0 ? 1.0f : dst.getWidth() / sourceWidth;
    float yScale = sourceHeight < 0 ? 1.0f : dst.getHeight() / sourceHeight;
    float matrix[4] = {1, 0, 0, 1};

    switch (transform) {