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

Commit c66f34d8 authored by Jesse Hall's avatar Jesse Hall Committed by Android Git Automerger
Browse files

am fa32888f: Merge "Fix display projection transforms" into jb-mr1-dev

* commit 'fa32888f':
  Fix display projection transforms
parents 917321d2 fa32888f
Loading
Loading
Loading
Loading
+8 −5
Original line number Diff line number Diff line
@@ -309,7 +309,7 @@ void DisplayDevice::setProjection(int orientation,
void DisplayDevice::updateGeometryTransform() {
    int w = mDisplayWidth;
    int h = mDisplayHeight;
    Transform R, S;
    Transform T, R, S;
    if (DisplayDevice::orientationToTransfrom(
            mOrientation, w, h, &R) == NO_ERROR) {
        dirtyRegion.set(bounds());
@@ -340,20 +340,23 @@ void DisplayDevice::updateGeometryTransform() {
        float src_height = viewport.height();
        float dst_width  = frame.width();
        float dst_height = frame.height();
        if (src_width != src_height || dst_width != dst_height) {
        if (src_width != dst_width || src_height != dst_height) {
            float sx = dst_width  / src_width;
            float sy = dst_height / src_height;
            S.set(sx, 0, 0, sy);
        }

        float src_x = viewport.left;
        float src_y = viewport.top;
        float dst_x = frame.left;
        float dst_y = frame.top;
        float tx = dst_x - src_x;
        float ty = dst_y - src_y;
        S.set(tx, ty);
        T.set(tx, ty);

        // rotate first, followed by scaling
        mGlobalTransform = S * R;
        // The viewport and frame are both in the logical orientation, so the
        // translation is also in that space. So translation must be applied
        // before rotating from logical to physical orientation.
        mGlobalTransform = S * R * T;
    }
}