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

Commit 709d7dec authored by Andy McFadden's avatar Andy McFadden
Browse files

Adjust for device orientation

When the device is rotated, reverse the width/height values.

Change-Id: Idc2b80b1cb96d9379cd94192997580e1ade70bf6
parent c9ed7d37
Loading
Loading
Loading
Loading
+12 −1
Original line number Diff line number Diff line
@@ -43,8 +43,19 @@ WindowSurface::WindowSurface() {
        return;
    }

    uint32_t width, height;
    if (mainDpyInfo.orientation != DISPLAY_ORIENTATION_0 &&
            mainDpyInfo.orientation != DISPLAY_ORIENTATION_180) {
        // rotated
        width = mainDpyInfo.h;
        height = mainDpyInfo.w;
    } else {
        width = mainDpyInfo.w;
        height = mainDpyInfo.h;
    }

    sp<SurfaceControl> sc = surfaceComposerClient->createSurface(
            String8("Benchmark"), mainDpyInfo.w, mainDpyInfo.h,
            String8("Benchmark"), width, height,
            PIXEL_FORMAT_RGBA_8888, ISurfaceComposerClient::eOpaque);
    if (sc == NULL || !sc->isValid()) {
        fprintf(stderr, "Failed to create SurfaceControl\n");