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

Commit 3c1b9ad9 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Automerger Merge Worker
Browse files

Merge "Render boot animation with same size as framebuffer" into rvc-dev am:...

Merge "Render boot animation with same size as framebuffer" into rvc-dev am: cbea0ab5 am: 937a25de am: 35ae2778

Original change: undetermined

Change-Id: I4422eda86b261c20a6dd33b0f897f875d004ae4c
parents 4709b924 35ae2778
Loading
Loading
Loading
Loading
+26 −4
Original line number Original line Diff line number Diff line
@@ -349,6 +349,25 @@ EGLConfig BootAnimation::getEglConfig(const EGLDisplay& display) {
    return config;
    return config;
}
}


ui::Size BootAnimation::limitSurfaceSize(int width, int height) const {
    ui::Size limited(width, height);
    bool wasLimited = false;
    const float aspectRatio = float(width) / float(height);
    if (mMaxWidth != 0 && width > mMaxWidth) {
        limited.height = mMaxWidth / aspectRatio;
        limited.width = mMaxWidth;
        wasLimited = true;
    }
    if (mMaxHeight != 0 && limited.height > mMaxHeight) {
        limited.height = mMaxHeight;
        limited.width = mMaxHeight * aspectRatio;
        wasLimited = true;
    }
    SLOGV_IF(wasLimited, "Surface size has been limited to [%dx%d] from [%dx%d]",
             limited.width, limited.height, width, height);
    return limited;
}

status_t BootAnimation::readyToRun() {
status_t BootAnimation::readyToRun() {
    mAssets.addDefaultAssets();
    mAssets.addDefaultAssets();


@@ -362,8 +381,10 @@ status_t BootAnimation::readyToRun() {
    if (error != NO_ERROR)
    if (error != NO_ERROR)
        return error;
        return error;


    const ui::Size& resolution = displayConfig.resolution;
    mMaxWidth = android::base::GetIntProperty("ro.surface_flinger.max_graphics_width", 0);

    mMaxHeight = android::base::GetIntProperty("ro.surface_flinger.max_graphics_height", 0);
    ui::Size resolution = displayConfig.resolution;
    resolution = limitSurfaceSize(resolution.width, resolution.height);
    // create the native surface
    // create the native surface
    sp<SurfaceControl> control = session()->createSurface(String8("BootAnimation"),
    sp<SurfaceControl> control = session()->createSurface(String8("BootAnimation"),
            resolution.getWidth(), resolution.getHeight(), PIXEL_FORMAT_RGB_565);
            resolution.getWidth(), resolution.getHeight(), PIXEL_FORMAT_RGB_565);
@@ -459,8 +480,9 @@ void BootAnimation::resizeSurface(int newWidth, int newHeight) {
    eglMakeCurrent(mDisplay, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
    eglMakeCurrent(mDisplay, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
    eglDestroySurface(mDisplay, mSurface);
    eglDestroySurface(mDisplay, mSurface);


    mWidth = newWidth;
    const auto limitedSize = limitSurfaceSize(newWidth, newHeight);
    mHeight = newHeight;
    mWidth = limitedSize.width;
    mHeight = limitedSize.height;


    SurfaceComposerClient::Transaction t;
    SurfaceComposerClient::Transaction t;
    t.setSize(mFlingerSurfaceControl, mWidth, mHeight);
    t.setSize(mFlingerSurfaceControl, mWidth, mHeight);
+3 −0
Original line number Original line Diff line number Diff line
@@ -170,6 +170,7 @@ private:
    bool findBootAnimationFileInternal(const std::vector<std::string>& files);
    bool findBootAnimationFileInternal(const std::vector<std::string>& files);
    bool preloadAnimation();
    bool preloadAnimation();
    EGLConfig getEglConfig(const EGLDisplay&);
    EGLConfig getEglConfig(const EGLDisplay&);
    ui::Size limitSurfaceSize(int width, int height) const;
    void resizeSurface(int newWidth, int newHeight);
    void resizeSurface(int newWidth, int newHeight);


    void checkExit();
    void checkExit();
@@ -181,6 +182,8 @@ private:
    Texture     mAndroid[2];
    Texture     mAndroid[2];
    int         mWidth;
    int         mWidth;
    int         mHeight;
    int         mHeight;
    int         mMaxWidth = 0;
    int         mMaxHeight = 0;
    int         mCurrentInset;
    int         mCurrentInset;
    int         mTargetInset;
    int         mTargetInset;
    bool        mUseNpotTextures = false;
    bool        mUseNpotTextures = false;