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

Commit 8be02e37 authored by Ady Abraham's avatar Ady Abraham
Browse files

SurfaceFlinger: relative size RefreshRateOverlay

Use display size to calculate the overlay size.

Test: Enable refresh rate overlay
Change-Id: I4b53c8f8137ec9b59867079d70e1016e2a57a2e6
parent 0ecfc27c
Loading
Loading
Loading
Loading
+12 −2
Original line number Diff line number Diff line
@@ -192,10 +192,20 @@ void RefreshRateOverlay::primeCache() {
}

void RefreshRateOverlay::changeRefreshRate(const RefreshRate& refreshRate) {
    const auto display = mFlinger.getDefaultDisplayDeviceLocked();
    if (!display) {
        return;
    }

    const int32_t left = display->getWidth() / 32;
    const int32_t top = display->getHeight() / 32;
    const int32_t right = left + display->getWidth() / 8;
    const int32_t buttom = top + display->getHeight() / 32;

    auto buffer = mBufferCache[refreshRate.fps];
    mLayer->setBuffer(buffer, 0, 0, {});
    mLayer->setFrame(Rect(20, 120, 20 + SevenSegmentDrawer::getWidth(),
                          120 + SevenSegmentDrawer::getHeight()));

    mLayer->setFrame(Rect(left, top, right, buttom));

    mFlinger.mTransactionFlags.fetch_or(eTransactionMask);
}