forked from PeterGSI/patches
46 lines
1.8 KiB
Diff
46 lines
1.8 KiB
Diff
From 30aef337016de69871d0bdd70568cd7d018540d7 Mon Sep 17 00:00:00 2001
|
|
From: Pierre-Hugues Husson <phh@phh.me>
|
|
Date: Mon, 20 Dec 2021 15:01:41 -0500
|
|
Subject: [PATCH 04/10] Dynamically resize boot animation to match screen size
|
|
|
|
Change-Id: I54e49fc6b8c670103852e212d1416e27ff976205
|
|
---
|
|
cmds/bootanimation/BootAnimation.cpp | 22 ++++++++++++++++++++++
|
|
1 file changed, 22 insertions(+)
|
|
|
|
diff --git a/cmds/bootanimation/BootAnimation.cpp b/cmds/bootanimation/BootAnimation.cpp
|
|
index 77b74e9898b8..ba14cc03fccb 100644
|
|
--- a/cmds/bootanimation/BootAnimation.cpp
|
|
+++ b/cmds/bootanimation/BootAnimation.cpp
|
|
@@ -618,6 +618,28 @@ status_t BootAnimation::readyToRun() {
|
|
mFlingerSurface = s;
|
|
mTargetInset = -1;
|
|
|
|
+ if ( mAnimation != nullptr ) {
|
|
+ SLOGE("Got screen size %d, animation size %d", mWidth, mAnimation->width);
|
|
+ int origWidth = mAnimation->width;
|
|
+ if ( mAnimation->width*2 < mWidth ) {
|
|
+ SLOGE("Making animation bigger");
|
|
+ mAnimation->width *= 2;
|
|
+ mAnimation->height *= 2;
|
|
+ } else if ( mWidth < mAnimation->width ) {
|
|
+ SLOGE("Making animation smaller");
|
|
+ mAnimation->width /= 2;
|
|
+ mAnimation->height /= 2;
|
|
+ }
|
|
+ for (Animation::Part& part : mAnimation->parts) {
|
|
+ for(auto& frame: part.frames) {
|
|
+ if(frame.trimWidth == origWidth && frame.trimX == 0 && frame.trimY == 0) {
|
|
+ frame.trimWidth = mAnimation->width;
|
|
+ frame.trimHeight = mAnimation->height;
|
|
+ }
|
|
+ }
|
|
+ }
|
|
+ }
|
|
+
|
|
// Rotate the boot animation according to the value specified in the sysprop
|
|
// ro.bootanim.set_orientation_<display_id>. Four values are supported: ORIENTATION_0,
|
|
// ORIENTATION_90, ORIENTATION_180 and ORIENTATION_270.
|
|
--
|
|
2.44.0
|
|
|